mirror of
https://github.com/10h30/woo-viet.git
synced 2026-07-20 07:04:13 +09:00
Update correct texts and change to `WooViet_1Pay_Bank1
This commit is contained in:
@@ -13,18 +13,18 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*/
|
||||
|
||||
|
||||
class WooViet_1Pay extends WC_Payment_Gateway {
|
||||
class WooViet_1Pay_Bank extends WC_Payment_Gateway {
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'wooviet_1pay';
|
||||
$this->id = 'wooviet_1pay_bank';
|
||||
$this->has_fields = false;
|
||||
$this->order_button_text = __( 'Proceed to 1Pay', 'woo-viet' );
|
||||
$this->method_title = __( '1Pay supported by Woo Viet', 'woo-viet' );
|
||||
$this->method_title = __( '1Pay Bank (by Woo Viet)', 'woo-viet' );
|
||||
|
||||
// @todo - check the method description
|
||||
$this->method_description = __( '1Pay supported many ways for the payment in Vietnam - need to check!.', 'woo-viet' );
|
||||
$this->method_description = __( '1Pay Bank supports all banks of Vietnam.', 'woo-viet' );
|
||||
$this->supports = array(
|
||||
'products',
|
||||
'refunds'
|
||||
@@ -53,25 +53,26 @@ class WooViet_1Pay extends WC_Payment_Gateway {
|
||||
/**
|
||||
* Process the payment.
|
||||
*/
|
||||
function process_payment( $order_id ) {
|
||||
global $woocommerce;
|
||||
$order = new WC_Order( $order_id );
|
||||
public function process_payment( $order_id ) {
|
||||
|
||||
// Mark as on-hold (we're awaiting the cheque)
|
||||
$order->update_status('on-hold', __( 'Awaiting your payment', 'woo-viet' ));
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Reduce stock levels
|
||||
$order->reduce_order_stock();
|
||||
|
||||
// Remove cart
|
||||
$woocommerce->cart->empty_cart();
|
||||
|
||||
// Return thankyou redirect
|
||||
return array(
|
||||
'result' => 'success',
|
||||
'redirect' => $this->get_return_url( $order )
|
||||
'result' => 'success',
|
||||
'redirect' => $this->get_request_url( $order )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the 1Pay request URL for an order.
|
||||
* @param WC_Order $order
|
||||
* @return string
|
||||
*/
|
||||
public function get_request_url ( $order ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ return array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woo-viet' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( '1Pay supported by Woo Viet', 'woo-viet' ),
|
||||
'label' => __( '1Pay Bank (by Woo Viet)', 'woo-viet' ),
|
||||
'default' => 'yes'
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woo-viet' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woo-viet' ),
|
||||
'default' => __( '1Pay supported by Woo Viet', 'woo-viet' ),
|
||||
'default' => __( '1Pay Bank', 'woo-viet' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'description' => array(
|
||||
@@ -27,14 +27,38 @@ return array(
|
||||
'type' => 'text',
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woo-viet' ),
|
||||
'default' => __( 'Pay via 1Pay; you can have many options to choose from.', 'woo-viet' )
|
||||
'default' => __( 'With 1Pay Bank, you can make payment by using any local Vietnam ATM card.', 'woo-viet' )
|
||||
),
|
||||
'email' => array(
|
||||
'title' => __( 'PayPal Email', 'woo-viet' ),
|
||||
'type' => 'email',
|
||||
'description' => __( 'Please enter your PayPal email address; this is needed in order to take payment.', 'woocommerce' ),
|
||||
'default' => get_option( 'admin_email' ),
|
||||
'api_details' => array(
|
||||
'title' => __( 'API Credentials', 'woo-viet' ),
|
||||
'type' => 'title',
|
||||
'description' => sprintf( __( 'Enter your 1Pay API credentials. Contact 1Pay to have your credentials %shere%s.', 'woo-viet' ), '<a href="https://1pay.vn/home/contact.html">', '</a>' ),
|
||||
),
|
||||
'access_key' => array(
|
||||
'title' => __( 'Access key', 'woo-viet' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your access key from 1Pay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => 'you@youremail.com'
|
||||
'placeholder' => __( 'Required', 'woocommerce' )
|
||||
),
|
||||
'secret' => array(
|
||||
'title' => __( 'Secret', 'woocommerce' ),
|
||||
'type' => 'password',
|
||||
'description' => __( 'Get your 1Pay Secret info.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required', 'woo-viet' )
|
||||
),
|
||||
|
||||
/*
|
||||
// @todo: Add more help info later
|
||||
|
||||
'help_title' => array(
|
||||
'title' => __( 'More info about 1Pay', 'woo-viet' ),
|
||||
'type' => 'title',
|
||||
'description' => __( 'You can see more info at this link.', 'woo-viet' )
|
||||
),
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
+2
-2
@@ -121,7 +121,7 @@ class WooViet {
|
||||
|
||||
|
||||
public function add_gateway_class( $methods ) {
|
||||
$methods[] = 'WooViet_1Pay';
|
||||
$methods[] = 'WooViet_1Pay_Bank';
|
||||
return $methods;
|
||||
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class WooViet {
|
||||
// @todo: ver 1.3 check this
|
||||
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) );
|
||||
|
||||
include( 'inc/class-wooviet-1pay.php');
|
||||
include( 'inc/class-wooviet-1pay-bank.php');
|
||||
|
||||
|
||||
if ( is_admin() ) {
|
||||
|
||||
Reference in New Issue
Block a user