Small changes to make the code cleaner

This commit is contained in:
Dat Hoang
2020-09-02 00:14:44 +07:00
parent ec28b890fa
commit 7a2ac200d8
+10 -8
View File
@@ -225,17 +225,20 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
$is_secure = false;
$is_querydr_exists = false;
if ( 'return' == $type OR 'ipn' == $type ) {
// Verify hash for 'return' and 'ipn'
// And check vpc_DRExists value for 'querydr'
switch ( $type ) {
case 'return':
case 'ipn':
$vpc_SecureHash = $args['vpc_SecureHash'];
// Remove the parameter "vpc_SecureHash" for validating SecureHash
unset( $args['vpc_SecureHash'] );
$is_secure = $this->check_vpc_SecureHash( $args, $vpc_SecureHash );
} elseif ( 'querydr' == $type ) {
break;
case 'querydr':
$is_querydr_exists = ( 'Y' == $args['vpc_DRExists'] );
}
// Process the data
@@ -262,6 +265,9 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
);
$order->add_order_note( $order_note );
// Log data
$message_log = sprintf( 'process_onepay_response_data - Order ID: %1$s - Order Note: %2$s - http_args: %3$s', $order_id, $order_note, print_r( $args, true ) );
self::log( $message_log );
// Do action for the order based on the response code from OnePay
// This is an intentional DRY switch - refer to #DRY_vpc_TxnResponseCode below
@@ -279,10 +285,6 @@ abstract class WooViet_OnePay_Abstract extends WC_Payment_Gateway {
break;
}
// Log data
$message_log = sprintf( 'process_onepay_response_data - Order ID: %1$s - Order Note: %2$s - http_args: %3$s', $order_id, $order_note, print_r( $args, true ) );
self::log( $message_log );
// Do the last actions based on $type
switch ( $type ) {