$t->assign(array('IKASSA_FORM' => $ikassa_form)); $t->parse("MAIN.IKASSAFORM"); cot_payments_updatestatus($pid, 'process'); // Изменяем статус "в процессе оплаты" } else { cot_die(); } } elseif ($m == 'success') { if ($_SERVER['REQUEST_METHOD'] == 'POST' && $cfg['plugin']['ikassabilling']['enablepost']) { $status_data = $_POST; } else { $status_data = $_GET; } if ($status_data['ik_inv_st'] == 'success' && $status_data['ik_co_id'] == $cfg['plugin']['ikassabilling']['shop_id']) { // проверка наличия номера платежки и ее статуса $pinfo = cot_payments_payinfo($status_data['ik_pm_no']); if ($pinfo['pay_status'] == 'done') { $plugin_body = $L['ikassabilling_error_done']; $redirect = $pinfo['pay_redirect']; } elseif ($pinfo['pay_status'] == 'paid') { $plugin_body = $L['ikassabilling_error_paid']; } elseif ($pinfo['pay_status'] == 'process') { $plugin_body = $L['ikassabilling_error_wait']; } else { $plugin_body = $L['roboxbilling_error_otkaz']; } } elseif ($status_data['ik_inv_st'] == 'waitAccept' || $status_data['ik_inv_st'] == 'process') { $plugin_body = $L['ikassabilling_error_wait']; } elseif ($status_data['ik_inv_st'] == 'canceled') { $plugin_body = $L['ikassabilling_error_canceled']; } elseif ($status_data['ik_inv_st'] == 'fail') {
// чтение параметров // read parameters $out_summ = $_REQUEST["OutSum"]; $inv_id = $_REQUEST["InvId"]; $shp_item = $_REQUEST["Shp_item"]; $crc = $_REQUEST["SignatureValue"]; $crc = strtoupper($crc); $my_crc = strtoupper(md5("{$out_summ}:{$inv_id}:{$mrh_pass1}:Shp_item={$shp_item}")); $plugin_body = $L['roboxbilling_error_otkaz']; // проверка корректности подписи if ($my_crc != $crc) { $plugin_body = $L['roboxbilling_error_incorrect']; } else { if (!empty($inv_id)) { // проверка наличия номера платежки и ее статуса $pinfo = cot_payments_payinfo($inv_id); if ($pinfo['pay_status'] == 'done') { $plugin_body = $L['roboxbilling_error_done']; $redirect = $pinfo['pay_redirect']; } elseif ($pinfo['pay_status'] == 'paid') { $plugin_body = $L['roboxbilling_error_paid']; } } } $t->assign(array("ROBOX_TITLE" => $L['roboxbilling_error_title'], "ROBOX_ERROR" => $plugin_body)); if ($redirect) { $t->assign(array("ROBOX_REDIRECT_TEXT" => sprintf($L['roboxbilling_redirect_text'], $redirect), "ROBOX_REDIRECT_URL" => $redirect)); } $t->parse("MAIN.ERROR"); } elseif ($m == 'fail') { $t->assign(array("ROBOX_TITLE" => $L['roboxbilling_error_title'], "ROBOX_ERROR" => $L['roboxbilling_error_fail']));
$LMI_PAYEE_PURSE = $cfg['plugin']['wmbilling']['webmoney_purse']; $RND = $rpay['pay_wmrnd']; $LMI_SIM_MODE = '0'; $LMI_HASH_METHOD = 'SIGN'; $wm_form = "<form id=wmform name=pay method=\"POST\" action=\"https://merchant.webmoney.ru/lmi/payment.asp\">\n\t\t\t<input type=\"hidden\" name=\"LMI_PAYMENT_AMOUNT\" value=\"" . $LMI_PAYMENT_AMOUNT . "\">\n\t\t\t<input type=\"hidden\" name=\"LMI_PAYMENT_DESC_BASE64\" value=\"" . $LMI_PAYMENT_DESC_BASE64 . "\">\n\t\t\t<input type=\"hidden\" name=\"LMI_PAYMENT_NO\" value=\"" . $LMI_PAYMENT_NO . "\">\n\t\t\t<input type=\"hidden\" name=\"LMI_PAYEE_PURSE\" value=\"" . $LMI_PAYEE_PURSE . "\">\n\t\t\t<input type=\"hidden\" name=\"LMI_SIM_MODE\" value=\"" . $LMI_SIM_MODE . "\">\n\t\t\t<input type=\"hidden\" name=\"RND\" value=\"" . $RND . "\">\n\t\t\t<input type=\"submit\" class=\"btn btn-success btn-large\" value=\"" . $L['wmbilling_formbuy'] . "\" />\n\t\t\t</form>"; $t->assign(array('WEBMONEY_FORM' => $wm_form)); $t->parse("MAIN.WMFORM"); cot_payments_updatestatus($pid, 'process'); // Изменяем статус "в процессе оплаты" } else { cot_die(); } } elseif ($m == 'success') { $plugin_body = $L['wmbilling_error_incorrect']; if (isset($_GET['LMI_PAYMENT_NO']) && preg_match('/^\\d+$/', $_GET['LMI_PAYMENT_NO']) == 1) { $pinfo = cot_payments_payinfo($_GET['LMI_PAYMENT_NO']); if ($pinfo['pay_status'] == 'done') { $plugin_body = $L['wmbilling_error_done']; $redirect = $pinfo['pay_redirect']; } elseif ($pinfo['pay_status'] == 'paid') { $plugin_body = $L['wmbilling_error_paid']; } } $t->assign(array("WEBMONEY_TITLE" => $L['wmbilling_error_title'], "WEBMONEY_ERROR" => $plugin_body)); if ($redirect) { $t->assign(array("WEBMONEY_REDIRECT_TEXT" => sprintf($L['wmbilling_redirect_text'], $redirect), "WEBMONEY_REDIRECT_URL" => $redirect)); } $t->parse("MAIN.ERROR"); } elseif ($m == 'fail') { $t->assign(array("WEBMONEY_TITLE" => $L['wmbilling_error_title'], "WEBMONEY_ERROR" => $L['wmbilling_error_fail'])); $t->parse("MAIN.ERROR");
$cot_billings = array(); /* === Hook === */ foreach (cot_getextplugins('payments.billing.register') as $pl) { include $pl; } /* ===== */ // Проверяем платежки на оплату пополнение счета. if ($balancepays = cot_payments_getallpays('balance', 'paid')) { foreach ($balancepays as $pay) { if (cot_payments_updatestatus($pay['pay_id'], 'done')) { $urr = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $pay['pay_userid'])->fetch(); $subject = $L['payments_balance_billing_admin_subject']; $body = sprintf($L['payments_balance_billing_admin_body'], $urr['user_name'], $pay['pay_summ'] . ' ' . $cfg['payments']['valuta'], $pay['pay_id'], cot_date('d.m.Y в H:i', $pay['pay_pdate'])); cot_mail($cfg['adminemail'], $subject, $body); if (!empty($pay['pay_code'])) { $dpay = cot_payments_payinfo($pay['pay_code']); if (!empty($dpay)) { $ubalance = cot_payments_getuserbalance($dpay['pay_userid']); if ($ubalance >= $dpay['pay_summ'] && cot_payments_updatestatus($dpay['pay_id'], 'paid')) { cot_payments_updateuserbalance($dpay['pay_userid'], -$dpay['pay_summ'], $dpay['pay_id']); } } } /* === Hook === */ foreach (cot_getextplugins('payments.balance.billing.done') as $pl) { include $pl; } /* ===== */ } } }
foreach (cot_getextplugins('payments.billing.first') as $pl) { include $pl; } /* ===== */ $t = new XTemplate(cot_tplfile('payments.billing', 'module')); /* === Hook === */ foreach (cot_getextplugins('payments.billing.main') as $pl) { include $pl; } /* ===== */ $pid = cot_import('pid', 'G', 'INT'); if (empty($pid)) { cot_redirect(cot_url('payments', 'm=error&msg=2', '', true)); } // Получаем информацию о заказе if ($pinfo = cot_payments_payinfo($pid)) { // Блокируем доступ к несобственным платежкам cot_block($usr['id'] == $pinfo['pay_userid']); // Если счета пользователей включены, то проверяем баланс if ($cfg['payments']['balance_enabled'] && $pinfo['pay_area'] != 'balance' && $usr['id'] > 0) { $ubalance = cot_payments_getuserbalance($usr['id']); if ($ubalance >= $pinfo['pay_summ']) { if (cot_payments_updatestatus($pid, 'paid')) { cot_payments_updateuserbalance($usr['id'], -$pinfo['pay_summ'], $pid); /* === Hook === */ foreach (cot_getextplugins('payments.billing.paid.done') as $pl) { include $pl; } /* ===== */ if (!empty($pinfo['pay_redirect'])) { $pinfo['pay_redirect'] = $pinfo['pay_redirect'] . '&' . cot_xg();
$pid = cot_import('pid', 'G', 'INT'); if (empty($m)) { // Получаем информацию о заказе if (!empty($pid) && ($pinfo = cot_payments_payinfo($pid))) { cot_block($usr['id'] == $pinfo['pay_userid']); cot_block($pinfo['pay_status'] == 'new' || $pinfo['pay_status'] == 'process'); cot_payments_updatestatus($pid, 'process'); // Изменяем статус "в процессе оплаты" if (cot_payments_updatestatus($pid, 'paid')) { cot_redirect(cot_url('plug', 'e=nullbilling&m=success&pid=' . $pid, '', true)); } else { cot_redirect(cot_url('plug', 'e=nullbilling&m=fail&pid=' . $pid, '', true)); } } else { cot_die(); } } elseif ($m == 'success') { if (!empty($pid) && ($pinfo = cot_payments_payinfo($pid))) { if (!empty($pinfo['pay_code']) && ($prinfo = cot_payments_payinfo($pinfo['pay_code']))) { $redirect = $prinfo['pay_redirect']; } } $t->assign(array("BILLING_TITLE" => $L['nullbilling_error_title'], "BILLING_ERROR" => $L['nullbilling_error_done'])); if ($redirect) { $t->assign(array("BILLING_REDIRECT_TEXT" => sprintf($L['nullbilling_redirect_text'], $redirect), "BILLING_REDIRECT_URL" => $redirect)); } $t->parse("MAIN.ERROR"); } elseif ($m == 'fail') { $t->assign(array("BILLING_TITLE" => $L['nullbilling_error_title'], "BILLING_ERROR" => $L['nullbilling_error_fail'])); $t->parse("MAIN.ERROR"); }
} $dataSet = array(); foreach ($status_data as $key => $value) { if (!preg_match('/ik_/', $key)) { continue; } $dataSet[$key] = $value; } $ik_sign = $dataSet['ik_sign']; unset($dataSet['ik_sign']); if ($dataSet['ik_pw_via'] == 'test_interkassa_test_xts') { $key = $cfg['plugin']['ikassabilling']['test_key']; } else { $key = $cfg['plugin']['ikassabilling']['secret_key']; } ksort($dataSet, SORT_STRING); array_push($dataSet, $key); $signString = implode(':', $dataSet); $sign = base64_encode(md5($signString, true)); if (!empty($dataSet['ik_pm_no'])) { $payinfo = cot_payments_payinfo($dataSet['ik_pm_no']); } if ($ik_sign === $sign && $dataSet['ik_inv_st'] == 'success' && $dataSet['ik_co_id'] == $cfg['plugin']['ikassabilling']['shop_id']) { if (cot_payments_updatestatus($dataSet['ik_pm_no'], 'paid')) { header('HTTP/1.1 200'); } else { header('HTTP/1.1 302'); } } else { header('HTTP/1.1 302'); }