/** * Called after an unsuccessful transaction attempt * * @since 1.0.0 * @param WC_Order $order the order * @param SV_WC_Payment_Gateway_API_Response $response the transaction response * @return boolean false */ protected function do_transaction_failed_result(WC_Order $order, SV_WC_Payment_Gateway_API_Response $response) { $order_note = ''; // build the order note with what data we have if ($response->get_status_code() && $response->get_status_message()) { /* translators: Placeholders: %1$s - status code, %2$s - status message */ $order_note = sprintf(esc_html__('Status code %1$s: %2$s', 'woocommerce-plugin-framework'), $response->get_status_code(), $response->get_status_message()); } elseif ($response->get_status_code()) { /* translators: Placeholders: %s - status code */ $order_note = sprintf(esc_html__('Status code: %s', 'woocommerce-plugin-framework'), $response->get_status_code()); } elseif ($response->get_status_message()) { /* translators: Placeholders; %s - status message */ $order_note = sprintf(esc_html__('Status message: %s', 'woocommerce-plugin-framework'), $response->get_status_message()); } // add transaction id if there is one if ($response->get_transaction_id()) { $order_note .= ' ' . sprintf(esc_html__('Transaction ID %s', 'woocommerce-plugin-framework'), $response->get_transaction_id()); } $this->mark_order_as_failed($order, $order_note, $response); return false; }
/** * Called after an unsuccessful transaction attempt * * @since 1.0.0 * @param WC_Order $order the order * @param SV_WC_Payment_Gateway_API_Response $response the transaction response * @return boolean false */ protected function do_transaction_failed_result(WC_Order $order, SV_WC_Payment_Gateway_API_Response $response) { $order_note = ''; // build the order note with what data we have if ($response->get_status_code() && $response->get_status_message()) { $order_note = sprintf('%s: "%s"', $response->get_status_code(), $response->get_status_message()); } elseif ($response->get_status_code()) { $order_note = sprintf('Status code: "%s"', $response->get_status_code()); } elseif ($response->get_status_message()) { $order_note = sprintf('Status message: "%s"', $response->get_status_message()); } // add transaction id if there is one if ($response->get_transaction_id()) { $order_note .= ' ' . sprintf(__('Transaction id %s', $this->text_domain), $response->get_transaction_id()); } $this->mark_order_as_failed($order, $order_note, $response); return false; }