コード例 #1
0
ファイル: worldpay.php プロジェクト: AppChecker/onxshop
 /**
  * prepare data for payment gateway
  */
 function paymentPrepare($order_id)
 {
     require_once 'models/common/common_node.php';
     $node_conf = common_node::initConfiguration();
     //$this->tpl->assign('NODE_CONF', $node_conf);
     $order_data = $this->Transaction->getOrderDetail($order_id);
     /**
      * process payment method only if status = 0 unpaid or 5 failed payment
      * 
      */
     if (!$this->checkOrderStatusValidForPayment($order_data['status'])) {
         return false;
     }
     if ($_SERVER['HTTPS']) {
         $protocol = 'https';
     } else {
         $protocol = 'http';
     }
     $server_url = "{$protocol}://{$_SERVER['HTTP_HOST']}";
     require_once 'models/ecommerce/ecommerce_order.php';
     $Order = new ecommerce_order();
     $worldpay_amount = $Order->calculatePayableAmount($order_data);
     $worldpay = array('URL' => ECOMMERCE_TRANSACTION_WORLDPAY_URL, 'instId' => ECOMMERCE_TRANSACTION_WORLDPAY_INSID, 'cartId' => $order_data['id'], 'amount' => $worldpay_amount, 'currency' => GLOBAL_DEFAULT_CURRENCY, 'desc' => ECOMMERCE_TRANSACTION_WORLDPAY_DESCRIPTION, 'testMode' => ECOMMERCE_TRANSACTION_WORLDPAY_TESTMODE, 'name' => $order_data['client']['customer']['title_before'] . ' ' . $order_data['client']['customer']['first_name'] . ' ' . $order_data['client']['customer']['last_name'], 'address' => $order_data['address']['invoices']['line_1'], 'postcode' => $order_data['address']['invoices']['post_code'], 'country' => $order_data['address']['invoices']['country']['iso_code2'], 'tel' => $order_data['address']['invoices']['telephone'], 'email' => $order_data['client']['customer']['email'], 'MC_callback' => "{$server_url}/page/" . $node_conf['id_map-payment_worldpay_callback'] . "?order_id={$order_data['id']}");
     return $worldpay;
 }
コード例 #2
0
ファイル: protx.php プロジェクト: AppChecker/onxshop
 /**
  * prepare data for payment gateway
  */
 function paymentPrepare($order_id)
 {
     require_once 'models/common/common_node.php';
     $node_conf = common_node::initConfiguration();
     $order_data = $this->Transaction->getOrderDetail($order_id);
     if ($_SERVER['HTTPS']) {
         $protocol = 'https';
     } else {
         $protocol = 'http';
     }
     $server_url = "{$protocol}://{$_SERVER['HTTP_HOST']}";
     $protx = array('URL' => ECOMMERCE_TRANSACTION_PROTX_URL, 'VPSProtocol' => ECOMMERCE_TRANSACTION_PROTX_VPSPROTOCOL, 'Vendor' => ECOMMERCE_TRANSACTION_PROTX_VENDOR, 'TxType' => ECOMMERCE_TRANSACTION_PROTX_TXTYPE, 'Crypt' => '', 'VendorEmail' => ECOMMERCE_TRANSACTION_PROTX_VENDOR_EMAIL);
     require_once 'models/ecommerce/ecommerce_order.php';
     $Order = new ecommerce_order();
     $protx_amount = $Order->calculatePayableAmount($order_data);
     $protx['Crypt']['VendorTxCode'] = $order_data['id'] . '_' . time();
     $protx['Crypt']['Amount'] = $protx_amount;
     $protx['Crypt']['Currency'] = GLOBAL_DEFAULT_CURRENCY;
     $protx['Crypt']['Description'] = "Payment for Basket created {$order_data['basket']['created']}";
     $protx['Crypt']['SuccessURL'] = "{$server_url}/page/" . $node_conf['id_map-payment_protx_success'] . "?order_id={$order_data['id']}";
     $protx['Crypt']['FailureURL'] = "{$server_url}/page/" . $node_conf['id_map-payment_protx_success'] . "?order_id={$order_data['id']}";
     $protx['Crypt']['CustomerEMail'] = $order_data['client']['customer']['email'];
     $protx['Crypt']['VendorEMail'] = $protx['VendorEmail'];
     $protx['Crypt']['eMailMessage'] = ECOMMERCE_TRANSACTION_PROTX_MAIL_MESSAGE;
     $protx['Crypt']['BillingSurname'] = $order_data['client']['customer']['last_name'];
     $protx['Crypt']['BillingFirstNames'] = $order_data['client']['customer']['first_name'];
     $protx['Crypt']['BillingAddress1'] = $order_data['address']['invoices']['line_1'];
     $protx['Crypt']['BillingCity'] = $order_data['address']['invoices']['city'];
     $protx['Crypt']['BillingPostCode'] = $order_data['address']['invoices']['post_code'];
     $protx['Crypt']['BillingCountry'] = $order_data['address']['invoices']['country']['iso_code2'];
     $protx['Crypt']['DeliverySurname'] = $order_data['client']['customer']['last_name'];
     $protx['Crypt']['DeliveryFirstNames'] = $order_data['client']['customer']['first_name'];
     $delivery_name = explode(" ", trim($order_data['address']['delivery']['name']));
     foreach ($delivery_name as $i => $item) {
         if ($i == 0) {
             $protx['Crypt']['DeliveryFirstNames'] = trim($item);
         }
         if ($i == count($delivery_name) - 1) {
             $protx['Crypt']['DeliverySurname'] = trim($item);
         }
     }
     $protx['Crypt']['DeliveryAddress1'] = $order_data['address']['delivery']['line_1'];
     $protx['Crypt']['DeliveryCity'] = $order_data['address']['delivery']['city'];
     $protx['Crypt']['DeliveryPostCode'] = $order_data['address']['delivery']['post_code'];
     $protx['Crypt']['DeliveryCountry'] = $order_data['address']['delivery']['country']['iso_code2'];
     $protx['Crypt']['Basket'] = '';
     $basket = count($order_data['basket']['items']);
     //Number of items in basket:Item 1 Description:Quantity of item 1:Unit cost item 1 minus tax:Tax of item 1:Cost of Item 1 inc tax:Total cost of item 1 (Quantity x cost inc tax):Item 2 Description:Quantity of item 2: .... :Cost of Item n inc tax:Total cost of item n
     foreach ($order_data['basket']['items'] as $item) {
         $basket = $basket . ':' . $item['product']['variety']['sku'] . ' - ' . $item['product']['name'] . ':' . $item['quantity'] . ':' . $item['product']['variety']['price'][GLOBAL_DEFAULT_CURRENCY]['price']['common']['value'] . ':' . $item['product']['variety']['price'][GLOBAL_DEFAULT_CURRENCY]['vat'] . ':' . $item['product']['variety']['price'][GLOBAL_DEFAULT_CURRENCY]['price']['common']['value_vat'] . ':' . $item['total_inc_vat'];
     }
     $protx['Crypt']['Basket'] = $basket;
     foreach ($protx['Crypt'] as $key => $val) {
         $crypt = $crypt . '&' . $key . '=' . $val;
     }
     $crypt = ltrim($crypt, '&');
     $protx['Crypt'] = self::encryptAes($crypt, ECOMMERCE_TRANSACTION_PROTX_PASSWORD);
     return $protx;
 }
コード例 #3
0
ファイル: paypal.php プロジェクト: AppChecker/onxshop
 /**
  * prepare data for payment gateway
  */
 function paymentPrepare($order_id)
 {
     if (!is_numeric($order_id)) {
         return false;
     }
     require_once 'models/common/common_node.php';
     $node_conf = common_node::initConfiguration();
     //$this->tpl->assign('NODE_CONF', $node_conf);
     $order_data = $this->Transaction->getOrderDetail($order_id);
     /**
      * process payment method only if status = 0 unpaid or 5 failed payment
      * 
      */
     if (!$this->checkOrderStatusValidForPayment($order_data['status'])) {
         return false;
     }
     /**
      * check if SSL is enabled
      */
     if ($_SERVER['HTTPS']) {
         $protocol = 'https';
     } else {
         $protocol = 'http';
     }
     $server_url = "{$protocol}://{$_SERVER['HTTP_HOST']}";
     /**
      * prepare data
      */
     require_once 'models/ecommerce/ecommerce_order.php';
     $Order = new ecommerce_order();
     $total_amount = $Order->calculatePayableAmount($order_data);
     $payment_gateway_data = array();
     $payment_gateway_data['order_data'] = $order_data;
     $payment_gateway_data['total_amount'] = $total_amount;
     $payment_gateway_data['server_url'] = $server_url;
     return $payment_gateway_data;
 }