/** * Response * Create the Order, Invoice and send an email to the customer * @param $response from the Gateway Server * @return order_id or false */ public function Response($response) { $bank = self::getModule(); $bankid = $bank['bank_id']; if (!empty($response['item_number'])) { // Get the indexes of the order $orderid = trim($response['custom']); if (is_numeric($orderid) && is_numeric($bankid)) { // Replacing the comma with the dot in the amount value. $amount = str_replace(",", ".", $response['amount']); $payment = Payments::addpayment($orderid, $response['thx_id'], $bankid, 0, $amount); Orders::set_status($orderid, Statuses::id("paid", "orders")); // Paid OrdersItems::set_statuses($orderid, Statuses::id("paid", "orders")); // Paid return $orderid; } } }
/** * Response * Create the Order, Invoice and send an email to the customer * @param $response from the Gateway Server * @return order_id or false */ public function Response($response) { $bank = self::getModule(); $bankid = $bank['bank_id']; if (!empty($response['payment_status']) && $response['payment_status'] == "Completed") { if (!empty($response['item_number'])) { // Get the indexes of the order $orderid = trim($response['custom']); if (is_numeric($orderid) && is_numeric($bankid)) { // Replacing the comma with the dot in the amount value. $amount = str_replace(",", ".", $response['amount']); Shineisp_Commons_Utilities::logs("Adding the payment information: " . $response['thx_id'], "iwbank.log"); $payment = Payments::addpayment($orderid, $response['thx_id'], $bankid, 0, $amount); Shineisp_Commons_Utilities::logs("Set the order in the processing mode", "iwbank.log"); Orders::set_status($orderid, Statuses::id("paid", "orders")); // Paid OrdersItems::set_status($orderid, Statuses::id("paid", "orders")); // Paid return $orderid; } } } return false; }
/** * Response * Create the Order, Invoice and send an email to the customer * @param $response from the Gateway Server * @return order_id or false */ public function Response($response) { $bank = self::getModule(); $bankid = $bank['bank_id']; $url = $bank['test_mode'] ? $bank['url_test'] : $bank['url_official']; list($tid, $ksig) = explode(":", $bank['account']); Shineisp_Commons_Utilities::logs("-----> Callback starts!", "bnl_igfs.log"); $session = new Zend_Session_Namespace('Default'); $IgfsCgVerify = new Shineisp_Banks_BNL_Igfs_CgVerify(); $IgfsCgVerify->disableCheckSSLCert(); $IgfsCgVerify->timeout = 150000; $IgfsCgVerify->paymentID = $session->paymentid; $IgfsCgVerify->kSig = $ksig; $IgfsCgVerify->shopID = self::getOrderID(); $IgfsCgVerify->tid = $tid; $IgfsCgVerify->serverURL = $url; $requestdata = json_encode($IgfsCgVerify, true); Shineisp_Commons_Utilities::logs("---> IgfsCgVerify Request: {$requestdata}", 'bnl_igfs.log'); $result = $IgfsCgVerify->execute(); $responsedata = json_encode($IgfsCgVerify, true); Shineisp_Commons_Utilities::logs("-----> IgfsCgVerify Response: {$responsedata}", 'bnl_igfs.log'); if ($IgfsCgVerify->error) { Shineisp_Commons_Utilities::logs("-----> " . $IgfsCgVerify->rc . ": " . $IgfsCgVerify->error, 'bnl_igfs.log'); return false; } #Zend_Debug::dump($IgfsCgVerify); // Get the orderid back from the bank post variables $orderid = trim($response['custom']); $order = self::getOrder(); $amount = $order['grandtotal']; Shineisp_Commons_Utilities::logs("Adding the payment information: " . $IgfsCgVerify->tranID, "bnl_igfs.log"); $payment = Payments::addpayment($orderid, $IgfsCgVerify->tranID, $bankid, 0, $amount, date('Y-m-d H:i:s'), $order['customer_id'], $IgfsCgVerify->errorDesc); Shineisp_Commons_Utilities::logs("Set the order in the processing mode", "bnl_igfs.log"); Orders::set_status($orderid, Statuses::id("paid", "orders")); // Paid OrdersItems::set_status($orderid, Statuses::id("paid", "orders")); // Paid Shineisp_Commons_Utilities::logs("End callback", "bnl_igfs.log"); return $orderid; }