當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PaymentModule::transactionResultHandler方法代碼示例

本文整理匯總了PHP中PaymentModule::transactionResultHandler方法的典型用法代碼示例。如果您正苦於以下問題:PHP PaymentModule::transactionResultHandler方法的具體用法?PHP PaymentModule::transactionResultHandler怎麽用?PHP PaymentModule::transactionResultHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PaymentModule的用法示例。


在下文中一共展示了PaymentModule::transactionResultHandler方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: transactionResultHandler

 function transactionResultHandler($transaction_result = '', $message = '', $source = 'frontend')
 {
     $log = '';
     if ($source == 'handler') {
         $ID = $_POST['ID'];
         $FUNCTION = $_POST['FUNCTION'];
         $RRN = $_POST['RRN'];
         $PAYER = $_POST['PAYER'];
         $AMOUNT = $_POST['AMOUNT'];
         $ACCOUNT = $_POST['ACCOUNT'];
         $STATUS = $_POST['STATUS'];
         $DATETIME = $_POST['DATETIME'];
         $MERCH_TYPE = $_POST['MERCH_TYPE'];
         $AMOUNT_FULL = $_POST['AMOUNT_FULL'];
         $KEY = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_MK_SHARED_SECRET');
         if (isset($_POST['SIGN']) && $_POST['SIGN'] == md5(md5($ID) . md5($FUNCTION) . md5($RRN) . md5($PAYER) . md5($AMOUNT) . md5($ACCOUNT) . md5($STATUS) . md5($KEY))) {
             $function = isset($_POST['FUNCTION']) ? $_POST['FUNCTION'] : 0;
             if ($function && $function == 'check') {
                 $orderID = isset($_POST['ACCOUNT']) ? $_POST['ACCOUNT'] : 0;
                 if ($orderID && ($order = _getOrderById($orderID))) {
                     $order_amount = $order['order_amount'];
                     if ($MERCH_NAME == 0 && $order_amount == $AMOUNT) {
                         $log = "Order with id {$orderID} check";
                         $transaction_result = 'YES';
                     } elseif ($MERCH_NAME == 1 && $order_amount >= $AMOUNT && $order_amount == $AMOUNT_FULL) {
                         $log = "Order with id {$orderID} and amount {$AMOUNT} check";
                         $transaction_result = 'YES';
                     } else {
                         $log = "Order  {$orderID} amount mismatch with callback. {$AMOUNT}  in callback vs {$order_amount} in db";
                         $orderID = false;
                         $transaction_result = 'NO';
                     }
                 } else {
                     $log = "Order with id {$orderID} not exists";
                     $orderID = false;
                     $transaction_result = 'NO';
                 }
             } elseif ($function && $function == 'payment') {
                 $orderID = isset($_POST['ACCOUNT']) ? $_POST['ACCOUNT'] : 0;
                 if ($orderID && ($order = _getOrderById($orderID))) {
                     $order_amount = $order['order_amount'];
                     if ($MERCH_NAME == 0 && $order_amount == $AMOUNT) {
                         $log = "Order with id {$orderID} PAYMENT recieved";
                         $transaction_result = 'OK';
                         $statusID = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_MK_ORDERSTATUS');
                         if ($statusID != -1) {
                             $comment = $sys_invs_no ? sprintf("Заказ оплачен по ArsenalPay%s. Номер счета — %s, номер платежа — %s.", $mode ? ' (тестовый режим)' : '', $sys_invs_no, $sys_trans_no) : 'Заказ оплачен по ArsenalPay';
                             ostSetOrderStatusToOrder($orderID, $statusID, $comment, 0, true);
                         }
                     } elseif ($MERCH_NAME == 1 && $order_amount >= $AMOUNT && $order_amount == $AMOUNT_FULL) {
                         $log = "Order with id {$orderID} and amount {$AMOUNT} PAYMENT recieved";
                         $transaction_result = 'OK';
                         $statusID = $this->_getSettingValue('CONF_PAYMENTMODULE_ARSENALPAY_MK_ORDERSTATUS');
                         if ($statusID != -1) {
                             $comment = $sys_invs_no ? sprintf("Заказ оплачен по ArsenalPay%s. Номер счета — %s, номер платежа — %s, сумма заказа — %s.", $mode ? ' (тестовый режим)' : '', $sys_invs_no, $sys_trans_no, $AMOUNT) : 'Заказ оплачен по ArsenalPay';
                             ostSetOrderStatusToOrder($orderID, $statusID, $comment, 0, true);
                         }
                     } else {
                         $log = "Order  {$orderID} amount mismatch with callback. {$AMOUNT}  in callback vs {$order_amount} in db";
                         $orderID = false;
                         $transaction_result = 'ERR';
                     }
                 } else {
                     $log = "Order with id {$orderID} not exists";
                     $orderID = false;
                     $transaction_result = 'ERR';
                 }
             } else {
                 $log = "Failed ARSENAL PAY callback call";
                 $orderID = false;
                 $transaction_result = 'ERR';
             }
         } else {
             $log = "ARSENAL PAY sign fail";
             $orderID = false;
             $transaction_result = 'ERR';
         }
         $responce = $transaction_result;
         echo $responce;
         return parent::transactionResultHandler($transaction_result, $message . $log, $source);
     }
 }
開發者ID:ArsenalPay,項目名稱:WebAsyst-Shop-Script-ArsenalPay-CMS,代碼行數:82,代碼來源:class.arsenalpay_mk.php


注:本文中的PaymentModule::transactionResultHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。