コード例 #1
0
 /**
  * Run the payment process
  * @return mixed
  */
 public function run()
 {
     if ($this->config['live'] == 'live') {
         $worldpay_url = "https://secure.wp3.rbsworldpay.com/wcc/purchase";
     } else {
         $worldpay_url = "https://select-test.wp3.rbsworldpay.com/wcc/purchase";
     }
     $str = sprintf('<FORM name="worldpayform" action="%s" method="POST">', $worldpay_url);
     if ($this->config['live'] == 'test') {
         $str .= _xls_make_hidden('testMode', '100');
     }
     $str .= _xls_make_hidden('address1', $this->CheckoutForm->billingAddress1);
     $str .= _xls_make_hidden('address2', $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('town', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('region', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('postcode', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('name', $this->CheckoutForm->contactFirstName . " " . $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('tel', $this->CheckoutForm->contactPhone);
     $str .= _xls_make_hidden('instId', $this->config['login']);
     $str .= _xls_make_hidden('currency', _xls_get_conf('CURRENCY_DEFAULT', 'USD'));
     $str .= _xls_make_hidden('cartId', $this->objCart->id_str);
     $str .= _xls_make_hidden('desc', _xls_get_conf('STORE_NAME', "Online") . " Order");
     $str .= _xls_make_hidden('M_cartlink', Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $this->objCart->linkid)));
     $str .= _xls_make_hidden('MC_callback', Yii::app()->controller->createAbsoluteUrl('cart/payment', array('id' => $this->modulename)));
     $str .= _xls_make_hidden('amount', round($this->objCart->total, 2));
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s\nRequest %s", __CLASS__, $this->objCart->id_str, $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
コード例 #2
0
 /**
  * Run the payment process
  * @return mixed
  */
 public function run()
 {
     $auth_net_login_id = $this->config['login'];
     $auth_net_tran_key = $this->config['trans_key'];
     /**
      * This option, and the commented $ret['live']->AddItem('dev' , 'dev') above, are only for API development work.
      * Regular Authorize.net customers will only use "live" and "test" modes through their account, which can be
      * chosen through the Web Admin panel.
      *
      */
     if ($this->config['live'] == 'test') {
         $auth_net_url = "https://test.authorize.net/gateway/transact.dll";
     } else {
         $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
     }
     $str = "";
     $str .= sprintf('<FORM action="%s" method="POST">', $auth_net_url);
     $str .= $this->InsertFP($auth_net_login_id, $auth_net_tran_key, round($this->objCart->Total, 2), $this->objCart->currency);
     $str .= _xls_make_hidden('x_invoice_num', $this->objCart->id_str);
     $str .= _xls_make_hidden('x_first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('x_last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('x_company', $this->CheckoutForm->contactCompany);
     $str .= _xls_make_hidden('x_address', $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('x_city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('x_state', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('x_zip', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('x_country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('x_phone', _xls_number_only($this->CheckoutForm->contactPhone));
     $str .= _xls_make_hidden('x_email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('x_cust_id', "WC-" . $this->objCart->customer_id);
     $str .= _xls_make_hidden('x_ship_to_first_name', $this->CheckoutForm->shippingFirstName);
     $str .= _xls_make_hidden('x_ship_to_last_name', $this->CheckoutForm->shippingLastName);
     $str .= _xls_make_hidden('x_ship_to_company', $this->CheckoutForm->shippingCompany);
     $str .= _xls_make_hidden('x_ship_to_address', $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2);
     $str .= _xls_make_hidden('x_ship_to_city', $this->CheckoutForm->shippingCity);
     $str .= _xls_make_hidden('x_ship_to_state', $this->CheckoutForm->shippingStateCode);
     $str .= _xls_make_hidden('x_ship_to_zip', $this->CheckoutForm->shippingPostal);
     $str .= _xls_make_hidden('x_ship_to_country', $this->CheckoutForm->shippingCountryCode);
     $str .= _xls_make_hidden('x_description', _xls_get_conf('STORE_NAME', "Online") . " Order");
     $str .= _xls_make_hidden('x_login', $auth_net_login_id);
     $str .= _xls_make_hidden('x_solution_id', 'A1000010');
     $str .= _xls_make_hidden('x_type', 'AUTH_CAPTURE');
     $str .= _xls_make_hidden('x_currency_code', $this->objCart->currency);
     //trying to get currency code to submit
     $str .= _xls_make_hidden('x_amount', round($this->objCart->Total, 2));
     $str .= _xls_make_hidden('x_show_form', 'PAYMENT_FORM');
     $str .= _xls_make_hidden('x_relay_response', 'TRUE');
     $str .= _xls_make_hidden('x_relay_url', Yii::app()->controller->createAbsoluteUrl('cart/payment', array(), 'http') . '/' . $this->modulename);
     $str .= _xls_make_hidden('x_cancel_url', Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $this->objCart->linkid), 'http'));
     if (Yii::app()->params['LIGHTSPEED_MT'] > 0) {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image("https:" . Yii::app()->params['HEADER_IMAGE'], Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     } else {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image(Yii::app()->controller->createAbsoluteUrl(Yii::app()->params['HEADER_IMAGE'], array(), 'https'), Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     }
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->id_str, $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
コード例 #3
0
ファイル: paypal.php プロジェクト: uiDeveloper116/webstore
 /**
  * The run() function is called from Web Store to run the process.
  * The return array should have two elements: the first is the processor's api version
  * that we force so that the form is received and processed as expected on the other
  * end; the second is the form formatted as an html string.
  *
  * @return array
  */
 public function run()
 {
     $paypal_email = $this->config['login'];
     if ($this->config['live'] == 'live') {
         $paypal_url = "https://www.paypal.com/cgi-bin/webscr";
     } else {
         $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     }
     $str = "";
     $str .= sprintf('<FORM name="_xclick" action="%s" method="POST">', $paypal_url);
     $str .= _xls_make_hidden('cmd', '_xclick');
     $str .= _xls_make_hidden('business', $paypal_email);
     $str .= _xls_make_hidden('currency_code', _xls_get_conf('CURRENCY_DEFAULT', 'USD'));
     $str .= _xls_make_hidden('item_name', $this->objCart->id_str);
     $str .= _xls_make_hidden('first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('address1', $this->CheckoutForm->billingAddress1);
     $str .= _xls_make_hidden('address2', $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('state', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('zip', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('cartId', $this->objCart->id_str);
     $str .= _xls_make_hidden('phone1', $this->CheckoutForm->contactPhone);
     $str .= _xls_make_hidden('rm', '2');
     $str .= _xls_make_hidden('no_shipping', isset($this->config['address']) ? $this->config['address'] : 1);
     $str .= _xls_make_hidden('no_note', '1');
     $str .= _xls_make_hidden('notify_url', Yii::app()->controller->createAbsoluteUrl('cart/payment/') . '/' . $this->modulename);
     $str .= _xls_make_hidden('return', Yii::app()->controller->createAbsoluteUrl('cart/receipt', array('getuid' => $this->objCart->linkid), 'http'));
     $str .= _xls_make_hidden('cancel_return', Yii::app()->controller->createAbsoluteUrl('cart/restoredeclined', array('getuid' => $this->objCart->linkid, 'reason' => 'Cancelled')));
     $str .= _xls_make_hidden('amount', round($this->objCart->total, 2));
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nString: %s", __CLASS__, $this->objCart->id_str, $this->config['live'], $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
コード例 #4
0
 public function run()
 {
     $ps_store_id = $this->config['ps_store_id'];
     $hpp_key = $this->config['hpp_key'];
     if ($this->config['live'] == 'live') {
         $moneris_url = "https://www3.moneris.com/HPPDP/index.php";
     } else {
         $moneris_url = "https://esqa.moneris.com/HPPDP/index.php";
     }
     $str = "";
     $str .= sprintf('<FORM method="POST" action="%s">', $moneris_url);
     $str .= _xls_make_hidden('ps_store_id', $ps_store_id);
     $str .= _xls_make_hidden('hpp_key', $hpp_key);
     $str .= _xls_make_hidden('order_id', $this->objCart->id_str . '-' . date("YmdHis"));
     foreach ($this->objCart->cartItems as $id => $item) {
         $str .= _xls_make_hidden('description' . $id, $item->description);
         $str .= _xls_make_hidden('id' . $id, $item->code);
         $str .= _xls_make_hidden('quantity' . $id, $item->qty);
         $str .= _xls_make_hidden('price' . $id, self::formatCurrencyValue($item->sell_total));
     }
     foreach ($this->objCart->Taxes as $tax => $taxvalue) {
         switch (strtolower($tax)) {
             case 'gst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('gst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
             case 'pst':
             case 'qst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('pst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
             case 'hst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('hst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
                 // todo - account for electronics tax
         }
     }
     $str .= _xls_make_hidden('shipping_cost', self::formatCurrencyValue($this->objCart->shippingCharge));
     $str .= _xls_make_hidden('note', $this->CheckoutForm->orderNotes);
     $str .= _xls_make_hidden('bill_first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('bill_last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('bill_company_name', $this->CheckoutForm->contactCompany);
     $str .= _xls_make_hidden('bill_address_one', $this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1);
     $str .= _xls_make_hidden('bill_city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('bill_state_or_province', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('bill_postal_code', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('bill_country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('bill_phone', _xls_number_only($this->CheckoutForm->contactPhone));
     $str .= _xls_make_hidden('email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('cust_id', "WC-" . $this->objCart->customer_id);
     $str .= _xls_make_hidden('ship_first_name', $this->CheckoutForm->shippingFirstName);
     $str .= _xls_make_hidden('ship_last_name', $this->CheckoutForm->shippingLastName);
     $str .= _xls_make_hidden('ship_company_name', $this->CheckoutForm->shippingCompany);
     $str .= _xls_make_hidden('ship_address_one', $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2);
     $str .= _xls_make_hidden('ship_city', $this->CheckoutForm->shippingCity);
     $str .= _xls_make_hidden('ship_state_or_province', $this->CheckoutForm->shippingStateCode);
     $str .= _xls_make_hidden('ship_postal_code', $this->CheckoutForm->shippingPostal);
     $str .= _xls_make_hidden('ship_country', $this->CheckoutForm->shippingCountryCode);
     $str .= _xls_make_hidden('charge_total', self::formatCurrencyValue($this->objCart->total));
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nRequest %s", __CLASS__, $this->objCart->id_str, $this->config['live'], $str), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }