Plugin Directory

Changeset 3153110


Ignore:
Timestamp:
09/17/2024 08:31:25 AM (19 months ago)
Author:
payping
Message:

fixed v3 problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • payping-donate/trunk/payping-donate.php

    r3151743 r3153110  
    9999        wp_send_json_error('مبلغ به درستی وارد نشده است');
    100100    }
    101 
     101    if ($Name == '') {
     102        wp_send_json_error('فیلد نام نمیتواند خالی باشد!');
     103    }
    102104    if ($payPingDonate_Unit == 'ریال') {
    103105        $SendAmount = $Amount / 10;
     
    184186    ////////////////////////////////////////////////////
    185187    ///             RESPONSE
    186     if (isset($_REQUEST['Status'])) {
    187         $id = $_REQUEST['ClientRefId'];
    188         $status = $_REQUEST['Status'];
    189        
    190         if ($status == -1) {
     188    if (isset($_REQUEST['status'])) {
     189        $data = stripslashes($_REQUEST['data']);
     190        $newData = json_decode($data, true);
     191        $id = $newData['clientRefId'];
     192        $status = $_REQUEST['status'];
     193       
     194        if ($status == 0) {
    191195            payPingDonate_ChangeStatus($id, 'ERROR');
    192196            $error .= esc_html(get_option('payPingDonate_IsError')) . "<br>\r\n";
     
    194198            payPingDonate_SetAuthority($id, $status);
    195199        } else {
    196             $refid = $_REQUEST['PaymentRefId'];
     200            $refid = $newData['paymentRefId'];
    197201            $Record = payPingDonate_GetDonate($id);
     202            $amount = $newData['amount'];
    198203            if ($Record === false) {
    199204                $error .= 'چنین تراکنشی در سایت ثبت نشده است' . "<br>\r\n";
    200205            } else {
    201                 $data = array('PaymentRefId' => $refid, 'Amount' => $_REQUEST['Amount']);
     206                $data = array('paymentRefId' => $refid, 'amount' => $amount);
    202207                try {
    203208                    $response = wp_remote_post('https://api.payping.ir/v3/pay/verify', array(
     
    225230                        if ($status_code == 200) {
    226231                            $response_data = json_decode($response_body, true);
    227                             if (!empty($_REQUEST["PaymentRefId"])) {
     232                            if (!empty($refid)) {
    228233                                payPingDonate_ChangeStatus($id, 'OK');
    229234                                payPingDonate_SetAuthority($id, $refid);
     
    231236                                $message .= 'کد پیگیری تراکنش: ' . esc_html($refid) . "<br>\r\n";
    232237                                $payPingDonate_TotalAmount = get_option("payPingDonate_TotalAmount");
    233                                 update_option("payPingDonate_TotalAmount", $payPingDonate_TotalAmount + $_REQUEST['Amount']);
     238                                update_option("payPingDonate_TotalAmount", $payPingDonate_TotalAmount + $amount);
    234239                            } else {
    235240                                payPingDonate_ChangeStatus($id, 'ERROR');
Note: See TracChangeset for help on using the changeset viewer.