/**
  * Handles the matching of transaction details with a membership.
  *
  * Expected JSON output:
  * {
  *     @var bool  `success`
  *     @var array `data` {
  *         @var string  `message`
  *     }
  * }
  *
  * @since  1.0.1.2
  */
 public function ajax_action_match()
 {
     if (!$this->is_admin_user()) {
         return;
     }
     $fields_match = array('match_with', 'source', 'source_id');
     // Save details of a single invoice.
     if ($this->verify_nonce() && self::validate_required($fields_match)) {
         $source = $_POST['source'];
         $source_id = $_POST['source_id'];
         $match_id = $_POST['match_with'];
         if (MS_Model_Import::match_with_source($match_id, $source_id, $source)) {
             wp_send_json_success(array('message' => __('Matching details saved. Future transactions are automatically processed from now on!', 'membership2')));
         }
     }
     wp_send_json_error();
     exit;
 }