Beispiel #1
0
 public static function isPaymentValid($oplataSettings, $response)
 {
     if ($oplataSettings['MERCHANT'] != $response['merchant_id']) {
         return 'An error has occurred during payment. Merchant data is incorrect.';
     }
     //print_r ($oplataSettings); die;
     $responseSignature = $response['signature'];
     if (isset($response['response_signature_string'])) {
         unset($response['response_signature_string']);
     }
     if (isset($response['signature'])) {
         unset($response['signature']);
     }
     if (Oplata::getSignature($response, $oplataSettings['SECURE_KEY']) != $responseSignature) {
         return 'An error has occurred during payment. Signature is not valid.';
     }
     return true;
 }
Beispiel #2
0
 protected function index()
 {
     $order_id = $this->session->data['order_id'];
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $server_back = str_replace('&', '&', $this->config->get('oplata_server_back'));
     $backref = str_replace('&', '&', $this->config->get('oplata_backref'));
     $oplata_args = array('order_id' => $order_id . Oplata::ORDER_SEPARATOR . time(), 'merchant_id' => $this->config->get('oplata_merchant'), 'order_desc' => 'Order from opencart', 'amount' => Oplata::getAmount($order_info), 'currency' => $this->config->get('oplata_currency'), 'server_callback_url' => $server_back, 'response_url' => $backref, 'lang' => $this->config->get('oplata_language'), 'sender_email' => $order_info['email']);
     $oplata_args['signature'] = Oplata::getSignature($oplata_args, $this->config->get('oplata_secretkey'));
     $this->data['oplata_args'] = $oplata_args;
     $this->data['action'] = Oplata::URL;
     $this->data['button_confirm'] = $this->language->get('button_confirm');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/oplata.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/payment/oplata.tpl';
     } else {
         $this->template = 'default/template/payment/oplata.tpl';
     }
     $this->render();
 }
Beispiel #3
0
} else {
    $ORDER_ID = $_GET['ORDER_ID'];
}
#--------------------------------------------
$ORDER_ID = filter_var($ORDER_ID, FILTER_SANITIZE_NUMBER_INT);
$arOrder = CSaleOrder::GetByID($ORDER_ID);
$orderID = "Order_" . $ORDER_ID . "_" . CSaleBasket::GetBasketUserID() . "_" . md5("Order_" . time());
$shouldPay = strlen(CSalePaySystemAction::GetParamValue("SHOULD_PAY", '')) > 0 ? CSalePaySystemAction::GetParamValue("SHOULD_PAY", 0) : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"];
if (CSalePaySystemAction::GetParamValue("ONPAGE") != 'Y') {
    $amount = round($shouldPay * 100);
} else {
    $amount = $shouldPay;
}
$formFields = array('order_id' => $orderID, 'merchant_id' => CSalePaySystemAction::GetParamValue("MERCHANT"), 'order_desc' => $orderID, 'amount' => $amount, 'currency' => CSalePaySystemAction::GetParamValue("PRICE_CURRENCY"), 'server_callback_url' => CSalePaySystemAction::GetParamValue("SERVER_CALLBACK_URL"), 'response_url' => CSalePaySystemAction::GetParamValue("SERVER_CALLBACK_URL"), 'lang' => CSalePaySystemAction::GetParamValue("LANGUAGE"), 'sender_email' => $USER->GetEmail());
//print_r ($formFields); die;
$formFields['signature'] = Oplata::getSignature($formFields, CSalePaySystemAction::GetParamValue("SECURE_KEY"));
//print_r (CSalePaySystemAction::GetParamValue("ONPAGE"));die;
$oplataArgsArray = array();
foreach ($formFields as $key => $value) {
    $oplataArgsArray[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
}
if (CSalePaySystemAction::GetParamValue("ONPAGE") != 'Y') {
    $out = '	<form action="' . Oplata::URL . '" method="post" id="oplata_payment_form">
  				' . implode('', $oplataArgsArray) . '</form>' . "<div><img src='https://oplata.com/img/loader.gif' width='50px' style='margin:20px 20px;'></div>" . "<script> setTimeout(function() {\n        document.getElementById('oplata_payment_form').submit();\n     }, 100);\n    </script>";
} else {
    $out = "<script>\n\tvar checkoutStyles = {\n\t\t'html , body' : {\n\t\t\t'overflow' : 'hidden'\n\t\t\t},'.col.col-shoplogo' : {\n\t\t\t'display' : 'none'\n\t\t},\n\t\t'.col.col-language' : {\n\t\t\t'display' : 'none'\n\t\t},\n\t\t'.pages-checkout' : {\n\t\t\t'background' : 'transparent'\n\t\t},\n\t\t'.col.col-login' : {\n\t\t\t'display' : 'none'\n\t\t},\n\t\t'.pages-checkout .page-section-overview' : {\n\t\t\t'background' : '#fff',\n\t\t\t'color' : '#252525',\n\t\t\t'border-bottom' : '1px solid #dfdfdf'\n\t\t},\n\t\t'.col.col-value.order-content' : {\n\t\t\t'color' : '#252525'\n\t\t},\n\t\t'.page-section-footer' : {\n\t\t\t'display' : 'none'\n\t\t},\n\t\t'.page-section-tabs' : {\n\t\t\t'display' : 'none'\n\t\t},\n\t\t\n\t\t'.page-section-shopinfo' : {\n\t\t\t'display': 'none'\n\t\t},\n\t\t\n\t\t'.page-section-overview' : {\n\t\t\t'display': 'none'\n\t\t},\n\t}\n\t</script>";
    $out .= '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
	<script src="https://api.fondy.eu/static_common/v1/checkout/ipsp.js"></script>
	<div id="checkout">
	<div id="checkout_wrapper" style="width:600px;"></div>
	</div>