Reformat code - no major change

This commit is contained in:
Dat A8C19
2019-10-21 22:53:03 +07:00
committed by Dat Hoang
parent 9edd924c1b
commit 6250762e7b
8 changed files with 125 additions and 104 deletions
+2 -1
View File
@@ -268,7 +268,8 @@ class WooViet_Admin_Page {
<br/>
<br/>
<input name="settings[vnd_paypal_express_checkout][rate]" type="number" step="1" min="100"
<input name="settings[vnd_paypal_express_checkout][rate]" type="number" step="1"
min="100"
id="vnd_paypal_express_checkout_rate" style="width: 70px;"
value="<?php echo $settings['vnd_paypal_express_checkout']['rate'] ?>"
<label for="vnd_paypal_express_checkout_rate"><?php _e( 'Insert the exchange rate of this currency to VND', 'woo-viet' ) ?></label>
+1
View File
@@ -457,6 +457,7 @@ class WooViet_OnePay_Domestic extends WC_Payment_Gateway {
* Logging method. - Copied from the WC_Gateway_Paypal Class
*
* @since 1.3.1
*
* @param string $message Log message.
* @param string $level Optional. Default 'info'.
* emergency|alert|critical|error|warning|notice|info|debug
@@ -46,7 +46,10 @@ class WooViet_VND_PayPal_Express_Checkout {
);
// Match response currency of PayPal with local order
add_action( 'woocommerce_paypal_express_checkout_valid_ipn_request', array( $this, 'ppec_match_currency_order' ) );
add_action( 'woocommerce_paypal_express_checkout_valid_ipn_request', array(
$this,
'ppec_match_currency_order'
) );
// Add exchange rate before send request to PayPal
add_filter( 'woocommerce_paypal_express_checkout_request_body', array( $this, 'ppec_convert_prices' ) );
@@ -71,6 +74,7 @@ class WooViet_VND_PayPal_Express_Checkout {
/**
* @param $params
*
* @return mixed
*/
public function ppec_convert_prices( $params ) {
@@ -123,16 +127,25 @@ class WooViet_VND_PayPal_Express_Checkout {
// Check if "Checkout on Single Product" is enabled.
if ( 'yes' === wc_gateway_ppec()->settings->checkout_on_single_product_enabled ) {
add_action( 'woocommerce_after_add_to_cart_form', array( $this, 'add_ppec_button_exchange_rate_info' ), 30 );
add_action( 'woocommerce_after_add_to_cart_form', array(
$this,
'add_ppec_button_exchange_rate_info'
), 30 );
}
// Check if "Enable PayPal Credit" is enabled.
if ( 'yes' === wc_gateway_ppec()->settings->credit_enabled ) {
add_filter( 'woocommerce_paypal_express_checkout_settings', array( $this, 'add_paypal_credit_exchange_rate_info' ), 11 );
add_filter( 'woocommerce_paypal_express_checkout_settings', array(
$this,
'add_paypal_credit_exchange_rate_info'
), 11 );
}
// Add the exchange rate info for PPEC in Checkout page
add_filter( 'option_woocommerce_ppec_paypal_settings', array( $this, 'add_ppec_checkout_exchange_rate_info' ), 11 );
add_filter( 'option_woocommerce_ppec_paypal_settings', array(
$this,
'add_ppec_checkout_exchange_rate_info'
), 11 );
}
@@ -149,6 +162,7 @@ class WooViet_VND_PayPal_Express_Checkout {
* Display the exchange rate info of PP Credit in Checkout page
*
* @param $value
*
* @return mixed
*/
public function add_paypal_credit_exchange_rate_info( $value ) {
@@ -165,6 +179,7 @@ class WooViet_VND_PayPal_Express_Checkout {
* Display the exchange rate info of PPEC in Checkout page
*
* @param $value
*
* @return mixed
*/
public function add_ppec_checkout_exchange_rate_info( $value ) {
@@ -173,6 +188,7 @@ class WooViet_VND_PayPal_Express_Checkout {
$value['description'] .= '<br />';
$value['description'] .= $this->ppec_description;
}
return $value;
}
@@ -11,9 +11,11 @@ if ( class_exists( 'WC_Gateway_Paypal_IPN_Handler' ) ) {
class Woo_Viet_WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_IPN_Handler {
protected function validate_currency( $order, $currency ) {}
protected function validate_currency( $order, $currency ) {
}
protected function validate_amount( $order, $amount ) {}
protected function validate_amount( $order, $amount ) {
}
}
+2 -1
View File
@@ -213,7 +213,8 @@ class WooViet {
// Check if "Support VND for the PayPal Express Checkout gateway" is enabled
if ( 'yes' == $settings['vnd_paypal_express_checkout']['enabled']
AND class_exists( 'WC_Gateway_PPEC_Plugin' )
) { include( WOO_VIET_DIR . 'inc/class-wooviet-vnd-paypal-express-checkout.php' );
) {
include( WOO_VIET_DIR . 'inc/class-wooviet-vnd-paypal-express-checkout.php' );
$this->VND_PayPal_Express_Checkout = new WooViet_VND_PayPal_Express_Checkout(
$settings['vnd_paypal_express_checkout']['rate'],
$settings['vnd_paypal_express_checkout']['currency']