Проблема заключается в том, что результат платежа перенаправляется обратно на сайт со страницы оплаты barclaycard. Подскажите, пожалуйста, что мне нужно сделать, чтобы результат платежа был передан правильно и покупатель был перенаправлен на страницу подтверждения заказа woocommerce по умолчанию?
Вот код, который я использую:
Код: Выделить всё
if (!defined('ABSPATH')) {
exit;
}
class RapidDive_WC_Gateway_Barclay extends WC_Payment_Gateway
{
const TEST_URL = 'https://mdepayments.epdq.co.uk/ncol/test/orderstandard.asp';
const LIVE_URL = 'https://payments.epdq.co.uk/ncol/prod/orderstandard.asp';
public static $log_enabled = false;
public static $log = false;
protected $access_key;
public function __construct()
{
$this->id = 'barclay';
$this->method_title = __('Barclay ePDQ', 'woocommerce');
$this->order_button_text = __('Proceed to Barcalay ePDQ', 'woocommerce');
$this->method_description = __('Barclay ePDQ redirects customers to Barclay to enter their payment information.',
'woocommerce');
$this->supports = array(
'products',
// 'refunds',
);
$this->icon = plugin_dir_url(__FILE__) . '../assets/barclaycard_logo.png';
// Load the settings.
$this->init_form_fields();
$this->init_settings();
$this->title = $this->get_option('title');
$this->title = ($this->title !== null && $this->title !== '') ? $this->title : __('Barclay ePDQ', 'woocommerce');
$this->description = $this->get_option('description');
$this->access_key = $this->get_option('access_key');
$this->showLogo = $this->get_option('show_logo');
$this->status = $this->get_option('status');
$this->error_notice = $this->get_option('error_notice');
$this->sha_in = $this->get_option('sha_in');
$this->sha_out = $this->get_option('sha_out');
$this->sha_method = $this->get_option('sha_method');
$this->sha_method = ($this->sha_method != '') ? $this->sha_method : 0;
$this->cat_url = woocommerce_get_page_id('shop');
$this->aavscheck = $this->get_option('aavcheck');
$this->cvccheck = $this->get_option('cvccheck');
$this->payment_method = is_array($this->get_option('payment_method')) ? implode(';',
$this->get_option('payment_method')) : '';
$this->brand_cards = is_array($this->get_option('brand_cards')) ? implode(';',
$this->get_option('brand_cards')) : '';
$this->secure_3d = $this->get_option('secure_3d');
// $this->method_list = $this->get_option('method_list');
$this->method_list = is_array($this->get_option('method_list')) ? implode(';',
$this->get_option('method_list')) : '';
$this->com_plus = $this->get_option('com_plus');
$this->param_plus = $this->get_option('param_plus');
$this->param_var = $this->get_option('param_var');
//Recommended for Direct Payments and Advanced Payments
$this->operation = $this->get_option('operation');
$this->api_user_id = $this->get_option('api_user_id');
$this->api_user_pswd = $this->get_option('api_user_pswd');
//Recommended for Direct Payments and Advanced Payments
$this->operation = $this->get_option('operation');
$this->api_user_id = $this->get_option('api_user_id');
$this->api_user_pswd = $this->get_option('api_user_pswd');
$this->notify_url = 'https://www.example.com/custom-page-url/';
// templating
$this->pp_format = $this->get_option('pp_format ');
$this->TITLE = $this->get_option('TITLE');
$this->BGCOLOR = $this->get_option('BGCOLOR');
$this->TXTCOLOR = $this->get_option('TXTCOLOR');
$this->TBLBGCOLOR = $this->get_option('TBLBGCOLOR');
$this->TBLTXTCOLOR = $this->get_option('TBLTXTCOLOR');
$this->BUTTONBGCOLOR = $this->get_option('BUTTONBGCOLOR');
$this->BUTTONTXTCOLOR = $this->get_option('BUTTONTXTCOLOR');
$this->FONTTYPE = $this->get_option('FONTTYPE');
$this->LOGO = $this->get_option('LOGO');
$this->add_payment_hooks();
}
/**
* Initialise Gateway Settings Form Fields.
*/
public function init_form_fields()
{
$this->form_fields = include('includes/settings-barclay.php');
}
/**
*
*/
private function add_payment_hooks()
{
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
add_action('woocommerce_receipt_barclay', array($this, 'receipt_page'));
add_action('woocommerce_api_rapiddive_wc_gateway_barclay', array($this, 'check_barclay_response'));
}
/**
* @param $message
* @param string $level
*/
public static function log($message, $level = 'info')
{
if (self::$log_enabled) {
if (self::$log === null) {
self::$log = wc_get_logger();
}
self::$log->log($level, $message, array('source' => 'barclay'));
}
}
/**
*
*/
public function admin_options()
{
?>
Подробнее здесь: [url]https://stackoverflow.com/questions/61458468/woocommerce-wordpress-barclaycard-payment-gateway[/url]