function updateBill($param) { if (!is_object($param)) { return false; } $order_info = fn_get_order_info($param->txn, false, true, true, true); $temp = ''; if (!empty($order_info['payment_method']['processor_params']['passwd']) && !empty($order_info['payment_method']['processor_params']['login'])) { $txn = fn_convert_encoding('utf-8', 'windows-1251', $param->txn); $password = fn_convert_encoding('utf-8', 'windows-1251', $order_info['payment_method']['processor_params']['passwd']); $crc = strtoupper(md5($txn . strtoupper(md5($password)))); if ($param->login == $order_info['payment_method']['processor_params']['login'] && $param->password == $crc) { $pp_response = array(); $status = 'qiwi_order_status_' . $param->status; if ($param->status == 60) { $pp_response['order_status'] = 'P'; } elseif ($param->status >= 50 && $param->status < 60) { $pp_response['order_status'] = 'O'; } else { $pp_response['order_status'] = 'F'; } $pp_response['reason_text'] = __($status); fn_finish_payment($param->txn, $pp_response); $temp = new Response(); $temp->updateBillResult = 0; } } return $temp; }
function fn_paypal_complete_checkout($token, $processor_data, $order_info) { $pp_response['order_status'] = 'F'; $reason_text = ''; $paypal_checkout_details = fn_paypal_get_express_checkout_details($processor_data, $token); if (fn_paypal_ack_success($paypal_checkout_details)) { $result = fn_paypal_do_express_checkout($processor_data, $paypal_checkout_details, $order_info); if (fn_paypal_ack_success($result)) { $status = $result['PAYMENTINFO_0_PAYMENTSTATUS']; $pp_response['transaction_id'] = $result['PAYMENTINFO_0_TRANSACTIONID']; if ($status == 'Completed' || $status == 'Processed') { $pp_response['order_status'] = 'O'; $reason_text = 'Accepted, awaiting ipn for processing '; } elseif ($status == 'Pending') { $pp_response['order_status'] = 'O'; $reason_text = 'Pending '; } else { $reason_text = 'Declined '; } $reason_text = fn_paypal_process_add_fields($result, $reason_text); if (!empty($result['L_ERRORCODE0'])) { $reason_text .= ', ' . fn_paypal_get_error($result); } } else { $reason_text = fn_paypal_get_error($result); } } else { $reason_text = fn_paypal_get_error($paypal_checkout_details); } $pp_response['reason_text'] = $reason_text; if (fn_check_payment_script($processor_data['processor_script'], $order_info['order_id'])) { unset($_SESSION['pp_express_details']); fn_finish_payment($order_info['order_id'], $pp_response); fn_order_placement_routines('route', $order_info['order_id'], false); } }
} } fn_add_breadcrumb(__('landing_header')); } elseif ($mode == 'process_payment') { if (fn_allow_place_order($cart, $auth) == true) { $order_info = $cart; $order_info['products'] = $cart['products']; $order_info = fn_array_merge($order_info, $cart['user_data']); $order_info['order_id'] = $order_id = TIME . "_" . (!empty($auth['user_id']) ? $auth['user_id'] : 0); unset($order_info['user_data']); list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id']); if ($is_processor_script) { set_time_limit(300); fn_define('IFRAME_MODE', true); include Registry::get('config.dir.payments') . $processor_data['processor_script']; fn_finish_payment($order_id, $pp_response, array()); fn_order_placement_routines('route', $order_id); } } } if (fn_cart_is_empty($cart) && !isset($force_redirection) && !in_array($mode, array('clear', 'delete', 'cart', 'update', 'apply_coupon', 'shipping_estimation', 'update_shipping', 'complete'))) { fn_set_notification('W', __('cart_is_empty'), __('cannot_proccess_checkout', 'K', 'cannot_proccess_checkout')); return array(CONTROLLER_STATUS_REDIRECT, 'checkout.cart'); } if (!empty($profile_fields)) { Tygh::$app['view']->assign('profile_fields', $profile_fields); } Tygh::$app['view']->assign('cart', $cart); Tygh::$app['view']->assign('continue_url', empty($_SESSION['continue_url']) ? '' : $_SESSION['continue_url']); Tygh::$app['view']->assign('mode', $mode); Tygh::$app['view']->assign('payment_methods', $payment_methods);
} else { $pp_response['order_status'] = 'F'; if ($_REQUEST['md5sig'] != $our_md5sig) { $pp_response['reason_text'] .= __('mb_md5_hashes_not_match'); } if (!$adjusted_order_total) { $pp_response['reason_text'] .= __('text_unsupported_currency'); } elseif ($_REQUEST['amount'] != $adjusted_order_total) { $pp_response['reason_text'] .= __('mb_amounts_not_match'); } if ($_REQUEST['currency'] != $processor_data['processor_params']['currency']) { $pp_response['reason_text'] .= __('mb_currencies_not_match'); } } if (fn_check_payment_script('skrill_ewallet.php', $_REQUEST['order_id'])) { fn_finish_payment($_REQUEST['order_id'], $pp_response); } exit; } } else { $url = 'https://www.moneybookers.com/app/payment.pl'; $suffix = AREA != 'A' && empty($order_info['repaid']) && defined('IFRAME_MODE') ? '&iframe_mode=true' : ''; $post_data = array('pay_to_email' => $processor_data['processor_params']['pay_to_email'], 'recipient_description' => $processor_data['processor_params']['recipient_description'], 'transaction_id' => $processor_data['processor_params']['order_prefix'] . (!empty($order_info['repaid']) ? $order_id . '_' . $order_info['repaid'] : $order_id), 'return_url' => fn_url("payment_notification.return?payment=skrill_ewallet&order_id={$order_id}{$suffix}", AREA, 'current'), 'return_url_text' => '', 'cancel_url' => fn_url("payment_notification.cancel?payment=skrill_ewallet&order_id={$order_id}{$suffix}", AREA, 'current'), 'status_url' => fn_url("payment_notification.status?payment=skrill_ewallet&order_id={$order_id}{$suffix}", AREA, 'current'), 'language' => $processor_data['processor_params']['language'], 'amount' => $order_info['total'], 'currency' => $processor_data['processor_params']['currency'], 'return_url_target' => '_parent', 'cancel_url_target' => '_parent', 'merchant_fields' => 'platform,mb_sess_id,inner_order_id', 'mb_sess_id' => base64_encode(Tygh::$app['session']->getID()), 'inner_order_id' => $order_id, 'platform' => '21477207'); $post_data['amount'] = fn_mb_adjust_amount($post_data['amount'], $post_data['currency']); if (!$post_data['amount']) { if (!empty($suffix)) { echo __('text_unsupported_currency'); } else { fn_set_notification('E', __('error'), __('text_unsupported_currency')); $url = fn_url("payment_notification.unsupported_currency?payment=skrill_ewallet&order_id={$order_id}", AREA, 'current'); fn_create_payment_form($url, array());
fn_finish_payment($order_id, $pp_response); exit; } } elseif (defined('PAYMENT_NOTIFICATION')) { if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($mode == 'process') { $order_id = intval($_REQUEST['ref']); fn_order_placement_routines('route', $order_id, false); } elseif ($mode == 'cancel') { $params = array(); parse_str(base64_decode($_REQUEST['divers']), $params); $pp_response['order_status'] = 'N'; $pp_response['reason_text'] = __('text_transaction_cancelled'); fn_finish_payment($params['order_id'], $pp_response, false); fn_order_placement_routines('route', $params['order_id'], false); } } else { if (!defined('BOOTSTRAP')) { die('Access denied'); } // Params $url = array('psc' => 'https://billing.paysite-cash.biz', 'ep' => 'https://secure.easy-pay.net'); $site_id = $processor_data['processor_params']['site_id']; $currency = $processor_data['processor_params']['currency']; $processor = $processor_data['processor_params']['processor']; $test = $processor_data['processor_params']['mode']; $debug = $processor_data['processor_params']['debug']; $nocurrencies = $processor_data['processor_params']['nocurrencies']; $order_id = $order_info['order_id'];
$pp_response = array(); $order_info = fn_get_order_info($_REQUEST['brq_invoicenumber']); $processor_data = fn_get_payment_method_data($order_info['payment_id']); $pp_response["transaction_id"] = $_REQUEST['brq_transactions']; $pp_response["reason_text"] = urldecode($_REQUEST['brq_statusmessage']); $_REQUEST['brq_websitekey'] = $processor_data['processor_params']['merchant_id']; $_signature = fn_buckaroo_calculate_signature($_REQUEST, $processor_data["processor_params"]["merchant_key"]); if (in_array($_REQUEST['brq_statuscode'], array('190')) && $_REQUEST['brq_signature'] == $_signature) { $pp_response['order_status'] = 'P'; } elseif (in_array($_REQUEST['brq_statuscode'], array('791', '492'))) { $pp_response['order_status'] = 'O'; // still waiting for the response } else { $pp_response['order_status'] = 'F'; } fn_finish_payment($_REQUEST['brq_invoicenumber'], $pp_response, false); $route = $order_info['repaid'] ? 'repay' : 'route'; fn_order_placement_routines($route, $_REQUEST['brq_invoicenumber']); } } else { $currency_coefficient = Registry::get('currencies.' . CART_SECONDARY_CURRENCY . '.coefficient'); $_order_total = !empty($currency_coefficient) ? $order_info['total'] / floatval($currency_coefficient) : $order_info['total']; $return_url = fn_url("payment_notification.notify?payment=ideal_xml", AREA, 'current'); $params = array('brq_websitekey' => $processor_data['processor_params']['merchant_id'], 'brq_amount' => $_order_total, 'brq_culture' => CART_LANGUAGE, 'brq_currency' => CART_SECONDARY_CURRENCY, 'brq_invoicenumber' => $order_id, 'brq_description' => $processor_data['processor_params']['description'], 'brq_return' => $return_url, 'brq_returnreject' => $return_url, 'brq_returnerror' => $return_url, 'brq_returncancel' => $return_url); $params['brq_signature'] = fn_buckaroo_calculate_signature($params, $processor_data['processor_params']['merchant_key']); $post_url = empty($processor_data['processor_params']['test']) ? "https://checkout.buckaroo.nl/html/" : "https://testcheckout.buckaroo.nl/html/"; fn_create_payment_form($post_url, $params, 'Buckaroo server', false); exit; } function fn_buckaroo_calculate_signature($params, $secret_key) {
$address->zip = preg_replace('/[^0-9]/', '', $order_info['b_zipcode']); $address->country = $order_info['b_country']; $validCardHolder = new HpsCardHolder(); $validCardHolder->firstName = $order_info['b_firstname']; $validCardHolder->lastName = $order_info['b_lastname']; $validCardHolder->address = $address; $validCardHolder->phoneNumber = preg_replace('/[^0-9]/', '', $order_info['b_phone']); $suToken = new HpsTokenData(); $suToken->tokenValue = $_REQUEST['securesubmit_token']; try { $pp_response = array('reason_text' => '', 'order_status' => 'F'); $response = $chargeService->charge($order_info['total'], 'usd', $suToken, $validCardHolder); $pp_response['order_status'] = "P"; $pp_response['reason_text'] = 'Payment processed.'; $pp_response["transaction_id"] = $response->transactionId; fn_finish_payment($merchant_order_id, $pp_response); fn_order_placement_routines('route', $merchant_order_id); } catch (HpsException $e) { fn_set_notification('E', __('error'), "Transaction Failed: " . $e->getMessage() . " With order id: " . $_REQUEST['merchant_order_id']); fn_order_placement_routines('checkout_redirect'); } } exit; } else { $url = fn_url("payment_notification.return?payment=heartland", AREA, 'current'); $checkout_url = "js/securesubmit.js"; $key = $processor_data['processor_params']['publickey']; fn_set_session_data('secretkey', $processor_data['processor_params']['secretkey']); fn_set_session_data('order_info', $order_info); $formhtml = '<form name="securesubmit-form" id="securesubmit-form" action="' . $url . '" target="_parent" method="POST"> <input type="hidden" name="securesubmit_token" id="securesubmit_token" />
exit; } $litepaid_id = $_GET['litepaid_id']; if (empty($order_info['payment_info']['transaction_id']) || $order_info['payment_info']['transaction_id'] != $litepaid_id) { echo "<p>LitePaid ID is incorrect.</p>", $redirect_timeout; exit; } $response = Http::get('https://www.litepaid.com/api?' . http_build_query(array('key' => trim($processor_data['processor_params']['api_key']), 'id' => $litepaid_id))); if (!$response || !($response = @json_decode($response, true))) { echo "<p>LitePaid API request failed. Contact support.</p>"; echo $redirect_timeout; exit; } if (!empty($response['result']) && $response['result'] == 'success') { $payment_info = array('order_status' => 'P', 'transaction_id' => $litepaid_id, 'reason_text' => isset($response['data']['error_name']) ? $response['data']['error_name'] : ''); fn_finish_payment($order_id, $payment_info, false); fn_order_placement_routines('route', $order_id); } else { fn_order_placement_routines('route', $order_id); } } else { $amount = $order_info['total']; $currencies = Registry::get('currencies'); if (!empty($currencies['EUR']['coefficient'])) { $amount /= $currencies['EUR']['coefficient']; } $data = array('key' => trim($processor_data['processor_params']['api_key']), 'value' => number_format($amount, 2, '.', ''), 'return_url' => fn_url("payment_notification.return?payment=litepaid&order_id={$order_id}", AREA, 'current'), 'description' => 'Order #' . $order_id, 'test' => !empty($processor_data['processor_params']['test_mode']) ? '1' : '0'); $response = Http::get('https://www.litepaid.com/api?' . http_build_query($data)); if (!$response || !($response = @json_decode($response, true)) || empty($response['result']) || $response['result'] != 'success' || empty($response['data']['invoice_token'])) { echo "<p>LitePaid API request failed. Choose another payment method to complete your order.</p>"; if (!empty($response['data']['error_name'])) {
/** * Order payment processing * * @param array $payment payment data * @param int $order_id order ID * @param bool $force_notification force user notification (true - notify, false - do not notify, order status properties will be skipped) * @return bool True on success, false otherwise */ function fn_start_payment($order_id, $force_notification = array(), $payment_info = array()) { $order_info = fn_get_order_info($order_id); if (!empty($order_info['payment_info']) && !empty($payment_info)) { $order_info['payment_info'] = $payment_info; } list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id']); if ($is_processor_script) { set_time_limit(300); $idata = array('order_id' => $order_id, 'type' => 'S', 'data' => TIME); db_query("REPLACE INTO ?:order_data ?e", $idata); $mode = Registry::get('runtime.mode'); Embedded::leave(); include fn_get_processor_script_path($processor_data['processor_script']); return fn_finish_payment($order_id, $pp_response, $force_notification); } return false; }
if (!empty($_REQUEST['EncryptedParameters'])) { $payment_id = db_get_field("SELECT a.payment_id FROM ?:payments as a LEFT JOIN ?:payment_processors as b ON a.processor_id = b.processor_id WHERE a.status = 'A' AND b.processor_script = 'westpac.php' LIMIT 1"); $processor_data = fn_get_payment_method_data($payment_id); $params = fn_payway_decrypt_parameters($processor_data['params']['encryption_key'], $_REQUEST['EncryptedParameters'], $_REQUEST['Signature']); if (!empty($params)) { $status = db_get_field("SELECT status FROM ?:orders WHERE order_id = ?i", $params['payment_reference']); if ($status == 'O') { if (!empty($params['bank_reference'])) { $pp_response["order_status"] = 'P'; $pp_response["reason_text"] = "Authorization code: " . $params['bank_reference']; } else { $pp_response["order_status"] = 'F'; } $pp_response['transaction_id'] = $params['payment_number']; if (fn_check_payment_script('westpac.php', $params['payment_reference'])) { fn_finish_payment($params['payment_reference'], $pp_response, false); } } fn_order_placement_routines($params['payment_reference']); } } exit; } else { $merchant_id = $processor_data['params']['mode'] == 'test' ? 'TEST' : $processor_data['params']['merchant_id']; $biller_code = $processor_data['params']['biller_code']; echo <<<EOT <html> <body onLoad="javascript: document.process.submit();"> <form method="post" action="https://www.payway.com.au/MakePayment" name="process"> \t<input type="hidden" name="merchant_id" value="{$merchant_id}"> \t<input type="hidden" name="biller_code" value="{$biller_code}">
/** * Order payment processing * * @param array $payment payment data * @param int $order_id order ID * @param bool $force_notification force user notification (true - notify, false - do not notify, order status properties will be skipped) */ function fn_start_payment($order_id, $force_notification = array()) { $order_info = fn_get_order_info($order_id); list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id'], ''); if ($is_processor_script) { set_time_limit(300); $idata = array('order_id' => $order_id, 'type' => 'S', 'data' => TIME); db_query("REPLACE INTO ?:order_data ?e", $idata); $index_script = INDEX_SCRIPT; $mode = MODE; include DIR_PAYMENT_FILES . $processor_data['processor_script']; return fn_finish_payment($order_id, $pp_response, $force_notification); } return false; }
require_once $ExternalLibPath; if (defined('PAYMENT_NOTIFICATION')) { if ($mode == 'notify') { $kaznachey = new kaznacheyLib(); $order_id = isset($_GET['OrderId']) ? $_GET['OrderId'] : false; if ($_GET['Result'] == 'success') { $kaznachey->success_page($order_id); die; } if ($_GET['Result'] == 'deferred') { $kaznachey->deferred_page($order_id); die; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input'); $hrpd = json_decode($HTTP_RAW_POST_DATA); if (isset($hrpd->MerchantInternalPaymentId)) { if ($hrpd->ErrorCode == 0) { $pp_response['order_status'] = 'P'; $pp_response["reason_text"] = ''; $pp_response["kaznachey"] = $pay_msg . $hrpd->MerchantInternalPaymentId . $test_msg; $pp_response["transaction_id"] = $hrpd->MerchantInternalPaymentId; fn_finish_payment(intval($hrpd->MerchantInternalPaymentId), $pp_response); } } } } else { $order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id; $kaznachey = new kaznacheyLib($processor_data); $kaznachey->createOrder($order_id, $order_info); exit; }
/** * Copy of the fn_start_payment - to change MODE to place_order * * @param array $payment payment data * @param int $order_id order ID * @param bool $force_notification force user notification * (true - notify, false - do not notify, order status properties will be skipped) */ function fn_twg_start_payment($order_id, $force_notification = array(), $payment_info) { $order_info = fn_get_order_info($order_id); if (!empty($order_info['payment_info']) && !empty($payment_info)) { $order_info['payment_info'] = $payment_info; } list($is_processor_script, $processor_data) = fn_check_processor_script($order_info['payment_id'], ''); if ($is_processor_script) { set_time_limit(300); $idata = array('order_id' => $order_id, 'type' => 'S', 'data' => TIME); db_query("REPLACE INTO ?:order_data ?e", $idata); $index_script = Registry::get('config.admin_index'); $mode = 'place_order'; // Change mode from 'post' to 'place_order' include Registry::get('config.dir.payments') . $processor_data['processor_script']; return fn_finish_payment($order_id, $pp_response, $force_notification); } return false; }
function fn_manageState($state, $idstate, $mode, $orderId, $payNLTransactionID, $processor_data) { switch ($state) { case 'PENDING': if ($mode == 'exchange') { echo 'TRUE| state:PENDING, orderId:' . $orderId . ', transactionId:' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true); } else { fn_order_placement_routines('route', $orderId); } die; break; case 'PAID': $payData = fn_paynl_getInfo($payNLTransactionID, $processor_data); $pp_response = array('order_status' => $idstate, 'naam' => $payData['paymentDetails']['identifierName'], 'rekening' => $payData['paymentDetails']['identifierPublic']); if ($mode == 'exchange') { echo 'TRUE| orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true); fn_finish_payment($orderId, $pp_response, true); fn_updatePayTransaction($payNLTransactionID, 'PAID'); die; } else { fn_order_placement_routines('route', $orderId); } break; case 'CANCEL': if ($mode == 'exchange') { echo 'TRUE| CANCEL orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true); fn_updatePayTransaction($payNLTransactionID, 'CANCEL'); die; } else { fn_updatePayTransaction($payNLTransactionID, 'CANCEL'); fn_change_order_status($orderId, $idstate, '', false); fn_order_placement_routines('route', $orderId); } break; case 'CHECKAMOUNT': if ($mode == 'exchange') { echo 'TRUE| CHECKAMOUNT orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true); fn_updatePayTransaction($payNLTransactionID, 'CHECKAMOUNT'); die; } else { fn_updatePayTransaction($payNLTransactionID, 'CHECKAMOUNT'); fn_change_order_status($orderId, $idstate, '', false); fn_order_placement_routines('route', $orderId, false); } break; default: $pp_response['order_status'] = $processor_data['processor_params']['statuses'][$state]; fn_updatePayTransaction($payNLTransactionID, 'PENDING'); fn_change_order_status($orderId, $pp_response['order_status'], '', false); break; } }
**************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Registry; if (!defined('BOOTSTRAP')) { require './../../../payments/init_payment.php'; } if (defined('PAYMENT_NOTIFICATION')) { if ($mode == 'cancel') { $order_info = fn_get_order_info($_REQUEST['order_id']); fn_pp_save_mode($order_info); if ($order_info['status'] == 'O' || $order_info['status'] == 'I') { $pp_response['order_status'] = 'I'; $pp_response["reason_text"] = __('text_transaction_cancelled'); fn_finish_payment($order_info['order_id'], $pp_response); } fn_order_placement_routines('route', $_REQUEST['order_id'], false); } else { $order_id = !empty($_REQUEST['order_id']) ? $_REQUEST['order_id'] : 0; $token = !empty($_REQUEST['token']) ? $_REQUEST['token'] : 0; $payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $order_id); $processor_data = fn_get_payment_method_data($payment_id); $processor_data['processor_script'] = 'paypal_express.php'; $order_info = fn_get_order_info($order_id); fn_pp_save_mode($order_info); fn_paypal_complete_checkout($token, $processor_data, $order_info); } } $mode = !empty($mode) ? $mode : (!empty($_REQUEST['mode']) ? $_REQUEST['mode'] : ''); if ($mode == 'express_return') {
/** * Ends 3DSecure transaction. * This method is called after bank ACS redirects user back to merchant site. * * @return array Payment processor response */ protected function end3DSecureTransaction() { $verifysig_response = simplexml_load_string($this->send3DSecureVerifySignatureRequest($_REQUEST['PaRes'])); $verifysig_result = (string) $verifysig_response->result; $verifysig_3dsecure_status = (string) $verifysig_response->threedsecure->status; $success_payment = false; $mpi_data = array('cavv' => (string) $verifysig_response->threedsecure->cavv, 'xid' => (string) $verifysig_response->threedsecure->xid, 'eci' => (string) $verifysig_response->threedsecure->eci); // Successful authentication if ($verifysig_result == '00' && $verifysig_3dsecure_status == 'Y') { $this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Authentication successful'; $success_payment = $this->authorizeTransaction(self::TRANSACTION_FULL_3DSECURE, $mpi_data); } elseif ($verifysig_result == '00' && $verifysig_3dsecure_status == 'A') { $this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Cardholder not Enrolled or Authentication Attempt Acknowledged'; $success_payment = $this->authorizeTransaction(self::TRANSACTION_MERCHANT_3DSECURE, $mpi_data); } elseif ($verifysig_result == '00' && $verifysig_3dsecure_status == 'U' && ($this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Authentication Unavailable') || $verifysig_result == '00' && $verifysig_3dsecure_status == 'N' && ($this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Incorrect Password') || $verifysig_result >= 500 && $verifysig_result < 600 && ($this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Invalid response from ACS')) { if (!$this->getIsLiabilityShiftRequired()) { $success_payment = $this->authorizeTransaction(self::TRANSACTION_NON_3DSECURE, $mpi_data); } } elseif ($verifysig_result == '110') { $this->response['payments.realex.3d_secure_message'] = '3DS Verifysig request: Enrolled but Invalid Response from ACS'; } fn_finish_payment($this->order_info['order_id'], $this->response); if ($success_payment) { fn_order_placement_routines('route', $this->order_info['order_id'], false); } else { fn_set_notification('E', false, "Your transaction was unsuccessful. There was a problem with your order, please try again or contact the store administrator."); fn_order_placement_routines('checkout_redirect', $this->order_info['order_id'], false); } }
$order_id = $_REQUEST['order_id']; if (!empty($_REQUEST['payment_number'])) { $pp_response['transaction_id'] = $_REQUEST['payment_number']; $conf_key = db_get_field("SELECT data FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id); if (empty($conf_key) || $conf_key != $_REQUEST['conf_key']) { $pp_response['reason_text'] .= 'Confirmation key does not match; '; } else { db_query("DELETE FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id); $pp_response['order_status'] = 'P'; } } else { $pp_response['reason_text'] .= 'Payment number is empty; '; } $pp_response['reason_text'] .= "Received from: " . $_SERVER['REMOTE_ADDR']; if (fn_check_payment_script('direct_one.php', $order_id)) { fn_finish_payment($order_id, $pp_response); } } } else { $conf_key = md5($order_id . TIME . Tygh::$app['session']['auth']['user_id']); $data = array('order_id' => $order_id, 'type' => 'E', 'data' => $conf_key); db_query("REPLACE INTO ?:order_data ?e", $data); $submit_url = 'https://vault.safepay.com.au/cgi-bin/' . ($processor_data['processor_params']['mode'] == 'live' ? 'make' : 'test') . '_payment.pl'; $return_url = fn_url("payment_notification.notify?payment=direct_one&order_id={$order_id}", AREA, 'current'); $process_url = fn_url("payment_notification.process?payment=direct_one&order_id={$order_id}&payment_number=&conf_key={$conf_key}", AREA, 'current'); $post_data = array('vendor_name' => $processor_data['processor_params']['merchant_id'], 'return_link_url' => $return_url, 'reply_link_url' => $process_url, 'Billing_name' => $order_info['b_firstname'], 'Billing_address1' => $order_info['b_address'], 'Billing_address2' => $order_info['b_address_2'], 'Billing_city' => $order_info['b_city'], 'Billing_state' => $order_info['b_state_descr'], 'Billing_zip' => $order_info['b_zipcode'], 'Billing_country' => $order_info['b_country_descr'], 'Delivery_name' => $order_info['s_firstname'], 'Delivery_address1' => $order_info['s_address'], 'Delivery_address2' => $order_info['s_address_2'], 'Delivery_city' => $order_info['s_city'], 'Delivery_state' => $order_info['s_state_descr'], 'Delivery_zip' => $order_info['s_zipcode'], 'Delivery_country' => $order_info['s_country_descr'], 'Contact_email' => $order_info['email'], 'Contact_phone' => $order_info['phone'], 'information_fields' => 'Billing_name,Billing_address1,Billing_address2,Billing_city,Billing_state,Billing_zip,Billing_country,Delivery_name,Delivery_address1,Delivery_address2,Delivery_city,Delivery_state,Delivery_zip,Delivery_country,Contact_email,Contact_phone', 'suppress_field_names' => '', 'hidden_fields' => '', 'print_zero_qty' => false); if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use'])) { // Products if (!empty($order_info['products'])) { foreach ($order_info['products'] as $k => $v) { $v['product'] = htmlspecialchars(strip_tags($v['product']));
} $extra = array('headers' => array('Content-type: application/x-www-form-urlencoded', 'Cache-Control: no-cache', 'charset="utf-8"'), 'timeout' => PAYLER_TIMEOUT); $get_status_url = $url . "GetStatus"; $result = Http::post($get_status_url, $data, $extra); $result = json_decode($result, TRUE); $order_info = fn_get_order_info($order_id); $pp_response = array(); if (!empty($result['status']) && $result['status'] == 'Charged') { // && $result['amount']/100 == $order_info['total']) { $pp_response['order_status'] = 'P'; $pp_response['reason_text'] = __('transaction_approved'); } else { $pp_response['order_status'] = 'F'; $pp_response['reason_text'] = __('transaction_declined'); } fn_finish_payment($order_id, $pp_response, FALSE); fn_order_placement_routines('route', $order_id); } } } else { if ($processor_data['processor_params']['mode'] == 'test') { $url = "https://sandbox.payler.com/gapi/"; } else { $url = "https://secure.payler.com/gapi/"; } $_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id; $product = __('text_payler_payment_for_order', array('[order_id]' => $order_id, '[store]' => Registry::get('config.current_location'))); $data = array('key' => $processor_data['processor_params']['key'], 'type' => 'Pay', 'order_id' => $_order_id . '|' . time(), 'amount' => 100 * $order_info['total'], 'product' => $product, 'vendor_id' => 1001); $extra = array('headers' => array('Content-type: application/x-www-form-urlencoded', 'Cache-Control: no-cache', 'charset="utf-8"'), 'timeout' => PAYLER_TIMEOUT); $start_url = $url . "StartSession"; $session_data = Http::post($start_url, $data, $extra);