/** * Retries to process a single error-state transaction. * * Expected JSON output: * { * @var bool `success` * @var array `data` { * @var string `desc` * @var string `status` * } * } * * @since 1.0.1.2 */ public function ajax_action_retry() { if (!$this->is_admin_user()) { return; } $fields_retry = array('id'); // Save details of a single invoice. if ($this->verify_nonce() && self::validate_required($fields_retry)) { $log_id = intval($_POST['id']); MS_Model_Import::retry_to_process($log_id); $log = MS_Factory::load('MS_Model_Transactionlog', $log_id); wp_send_json_success(array('desc' => $log->description, 'state' => $log->state)); } wp_send_json_error(array('desc' => '', 'status' => '')); exit; }
/** * Retries to process a single error-state transaction. * * Expected output: * OK * ERR * * @since 1.0.1.2 */ public function ajax_action_retry() { $res = 'ERR'; if (!$this->is_admin_user()) { return; } $fields_retry = array('id'); // Save details of a single invoice. if ($this->verify_nonce() && self::validate_required($fields_retry)) { $log_id = intval($_POST['id']); if (MS_Model_Import::retry_to_process($log_id)) { $res = 'OK'; } $log = MS_Factory::load('MS_Model_Transactionlog', $log_id); $res .= ':' . $log->description; } echo $res; exit; }