From 8489c51b2416102ed3f4687e9e32e89ecd243880 Mon Sep 17 00:00:00 2001 From: mahdisarani <37251741+mahdisarani@users.noreply.github.com> Date: Sun, 4 Apr 2021 11:20:59 +0430 Subject: [PATCH] fix refid bug --- inc/gateway.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/gateway.php b/inc/gateway.php index d0af2b2..75f0291 100644 --- a/inc/gateway.php +++ b/inc/gateway.php @@ -530,6 +530,7 @@ function CF7_PayPing_result_payment_func( $atts ){ global $wpdb; $Status = ''; + $refId = $_POST['refid']; $clientrefid = $_POST['clientrefid']; $Theme_Message = get_option('cf7pp_theme_message', ''); @@ -582,6 +583,12 @@ function CF7_PayPing_result_payment_func( $atts ){ $Message = json_decode( $verify_response['body'], true ); if( array_key_exists( '15', $Message) ){ $Status = 'success'; + }elseif( array_key_exists( 'RefId', $Message) ){ + $Status = 'error'; + $txterror = 'RefId نمی تواند خالی باشد'; + }elseif( array_key_exists( '1', $Message) ){ + $Status = 'error'; + $txterror = 'تراکنش توسط شما لغو شد'; }else{ $Status = 'error'; } @@ -598,7 +605,12 @@ function CF7_PayPing_result_payment_func( $atts ){ $wpdb->update( $wpdb->prefix . 'cf7_payping_transaction', array( 'status' => 'error', 'transid' => $refId ), array( 'id' => $clientrefid ), array( '%s', '%s' ), array( '%d' ) ); //Dispaly - $body = ''.$theme_error_message.''; + if( isset($txterror) ){ + $body = ''.$theme_error_message.'
دلیل: '.$txterror; + }else{ + $body = ''.$theme_error_message.''; + } + return CF7_PayPing_CreateMessage("پرداخت ناموفق!", $body, "" ); } } \ No newline at end of file