本文整理汇总了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);
}
}