mirror of
https://github.com/10h30/woo-viet.git
synced 2026-06-05 15:09:49 +09:00
Handle different payment and queryDR links
This commit is contained in:
@@ -20,12 +20,18 @@ class WooViet_OnePay_Domestic extends WooViet_OnePay_Abstract {
|
||||
$this->method_description = __( 'OnePay supports all major bank ATMs in Vietnam.', 'woo-viet' );
|
||||
}
|
||||
|
||||
public function get_onepay_payment_link( $testmode ) {
|
||||
return $testmode ? 'https://mtf.onepay.vn/onecomm-pay/vpc.op' : 'https://onepay.vn/onecomm-pay/vpc.op';
|
||||
}
|
||||
|
||||
public function get_onepay_querydr_link( $testmode ) {
|
||||
return $testmode ? 'https://mtf.onepay.vn/onecomm-pay/Vpcdps.op' : 'https://onepay.vn/onecomm-pay/Vpcdps.op';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields.
|
||||
*/
|
||||
public function init_form_fields() {
|
||||
$this->form_fields = include( 'onepay/domestic-settings.php' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,10 +14,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
require_once('onepay/abstract-payment.php');
|
||||
class WooViet_OnePay_International extends WooViet_OnePay_Abstract {
|
||||
|
||||
public function configure_payment() {
|
||||
$this->method_title = __( 'OnePay International Gateway (by Woo Viet)', 'woo-viet' );
|
||||
$this->method_description = __( 'OnePay supports all major international cards Visa, Master, JCB, Amex, etc.', 'woo-viet' );
|
||||
}
|
||||
|
||||
public function get_onepay_payment_link( $testmode ) {
|
||||
return $testmode ? 'https://mtf.onepay.vn/vpcpay/vpcpay.op' : 'https://onepay.vn/vpcpay/vpcpay.op';
|
||||
}
|
||||
|
||||
public function get_onepay_querydr_link( $testmode ) {
|
||||
return $testmode ? 'https://mtf.onepay.vn/vpcpay/Vpcdps.op' : 'https://onepay.vn/vpcpay/Vpcdps.op';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,17 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
|
||||
* Configure $method_title and $method_description
|
||||
*/
|
||||
abstract public function configure_payment();
|
||||
|
||||
/**
|
||||
* @param bool $testmode
|
||||
*/
|
||||
abstract public function get_onepay_payment_link( $testmode );
|
||||
|
||||
/**
|
||||
* @param bool $testmode
|
||||
*/
|
||||
abstract public function get_onepay_querydr_link( $testmode );
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*/
|
||||
@@ -64,11 +75,6 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields.
|
||||
*/
|
||||
// abstract public function init_form_fields()
|
||||
|
||||
/**
|
||||
* Get the IPN URL for OnePay
|
||||
* Format: http://my-site.com/wc-api/WooViet_OnePay_Domestic/
|
||||
@@ -135,12 +141,7 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
|
||||
$message_log = sprintf( 'get_pay_url - Order ID: %1$s - http_args: %2$s', $order->get_id(), print_r( $args, true ) );
|
||||
self::log( $message_log );
|
||||
|
||||
// TODO - need to fix this issue for intl and domestic
|
||||
if ( $this->testmode ) {
|
||||
return 'https://mtf.onepay.vn/onecomm-pay/vpc.op?' . $http_args;
|
||||
} else {
|
||||
return 'https://onepay.vn/onecomm-pay/vpc.op?' . $http_args;
|
||||
}
|
||||
return $this->get_onepay_payment_link( $this->testmode ) . '?' . $http_args;
|
||||
|
||||
}
|
||||
|
||||
@@ -437,12 +438,7 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
|
||||
|
||||
$http_args = http_build_query( $args, '', '&' );
|
||||
|
||||
// TODO - need to fix this issue for intl and domestic
|
||||
if ( $this->testmode ) {
|
||||
$http_link = 'https://mtf.onepay.vn/onecomm-pay/Vpcdps.op?' . $http_args;
|
||||
} else {
|
||||
$http_link = 'https://onepay.vn/onecomm-pay/Vpcdps.op?' . $http_args;
|
||||
}
|
||||
$http_link = $this->get_onepay_querydr_link( $this->testmode ) . '?' . $http_args;
|
||||
|
||||
// Log data
|
||||
$message_log = sprintf( 'handle_onepay_querydr - http_link: %1$s - http_args: %2$s', $http_link, print_r( $args, true ) );
|
||||
|
||||
Reference in New Issue
Block a user