/** * Return the payment form * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { // get current host and $strDescription = \Environment::get('host'); $objContact = \PageModel::findWithDetails($this->wirecard_contact); $arrParams = array('customerId' => $this->wirecard_customer_id, 'language' => $GLOBALS['TL_LANGUAGE'], 'paymentType' => 'SELECT', 'amount' => number_format($objOrder->getTotal(), 2, '.', ''), 'currency' => $objOrder->currency, 'orderDescription' => $strDescription, 'successUrl' => \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder), 'cancelUrl' => \Environment::get('base') . $objModule->generateUrlForStep('process'), 'failureUrl' => \Environment::get('base') . $objModule->generateUrlForStep('failed'), 'serviceUrl' => \Environment::get('base') . \Controller::generateFrontendUrl($objContact->row()), 'confirmUrl' => \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id, 'customerStatement' => $strDescription, 'order_id' => $objOrder->id, 'order_uniqid' => $objOrder->uniqid, 'secret' => $this->wirecard_secret, 'REQUEST_TOKEN' => REQUEST_TOKEN); $arrParams['requestFingerprintOrder'] = implode(',', array_keys($arrParams)) . ',requestFingerprintOrder'; $arrParams['requestFingerprint'] = $this->calcHashArray($arrParams); $objTemplate = new \Isotope\Template('iso_payment_wirecard'); $objTemplate->setData($this->arrData); $objTemplate->action = 'https://checkout.wirecard.com/page/init.php'; $objTemplate->params = array_filter(array_diff_key($arrParams, array('secret' => ''))); return $objTemplate->parse(); }
/** * Generate the submit form for datatrans and if javascript is enabled redirect automaticly * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $objAddress = $objOrder->getBillingAddress(); $arrParams = array('merchantId' => $this->datatrans_id, 'amount' => round($objOrder->getTotal() * 100), 'currency' => $objOrder->currency, 'refno' => $objOrder->id, 'language' => $objOrder->language, 'reqtype' => $this->trans_type == 'auth' ? 'NOA' : 'CAA', 'uppCustomerDetails' => 'yes', 'uppCustomerTitle' => $objAddress->salutation, 'uppCustomerFirstName' => $objAddress->firstname, 'uppCustomerLastName' => $objAddress->lastname, 'uppCustomerStreet' => $objAddress->street_1, 'uppCustomerStreet2' => $objAddress->street_2, 'uppCustomerCity' => $objAddress->city, 'uppCustomerCountry' => $objAddress->country, 'uppCustomerZipCode' => $objAddress->postal, 'uppCustomerPhone' => $objAddress->phone, 'uppCustomerEmail' => $objAddress->email, 'successUrl' => ampersand(\Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder)), 'errorUrl' => ampersand(\Environment::get('base') . $objModule->generateUrlForStep('failed')), 'cancelUrl' => ampersand(\Environment::get('base') . $objModule->generateUrlForStep('failed')), 'mod' => 'pay', 'id' => $this->id); // Security signature (see Security Level 2) $arrParams['sign'] = hash_hmac('md5', $arrParams['merchantId'] . $arrParams['amount'] . $arrParams['currency'] . $arrParams['refno'], $this->datatrans_sign); $objTemplate = new \Isotope\Template('iso_payment_datatrans'); $objTemplate->id = $this->id; $objTemplate->action = 'https://' . ($this->debug ? 'pilot' : 'payment') . '.datatrans.biz/upp/jsp/upStart.jsp'; $objTemplate->params = $arrParams; $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][0]; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][1]; $objTemplate->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][2]); return $objTemplate->parse(); }
/** * Return the payment form * * @param IsotopeProductCollection|Order $objOrder * @param \Module|\Isotope\Module\Checkout $objModule * * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $objTemplate = new \Isotope\Template('iso_payment_quickpay'); $objTemplate->setData($this->arrData); $params = array('version' => 'v10', 'merchant_id' => $this->quickpay_merchantId, 'agreement_id' => $this->quickpay_agreementId, 'order_id' => str_pad($objOrder->id, 4, '0', STR_PAD_LEFT), 'language' => substr($GLOBALS['TL_LANGUAGE'], 0, 2), 'amount' => Currency::getAmountInMinorUnits($objOrder->getTotal(), $objOrder->currency), 'currency' => $objOrder->currency, 'continueurl' => \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder), 'cancelurl' => \Environment::get('base') . $objModule->generateUrlForStep('failed'), 'callbackurl' => \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id, 'autocapture' => $this->trans_type == 'capture' ? '1' : '0'); if ('' !== $this->quickpay_paymentMethods) { $params['payment_methods'] = $this->quickpay_paymentMethods; } $apiKey = $this->quickpay_apiKey; $objTemplate->params = $params; $objTemplate->calculateHash = function ($params) use($apiKey) { ksort($params); return hash_hmac("sha256", implode(" ", $params), $apiKey); }; return $objTemplate->parse(); }
/** * HTML form for checkout * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return mixed */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $i = 0; $arrData = array('aid' => $this->payone_aid, 'portalid' => $this->payone_portalid, 'mode' => $this->debug ? 'test' : 'live', 'request' => $this->trans_type == 'auth' ? 'preauthorization' : 'authorization', 'encoding' => 'UTF-8', 'clearingtype' => $this->payone_clearingtype, 'reference' => $objOrder->id, 'display_name' => 'no', 'display_address' => 'no', 'successurl' => \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder), 'backurl' => \Environment::get('base') . $objModule->generateUrlForStep('failed'), 'amount' => $objOrder->getTotal() * 100, 'currency' => $objOrder->currency, 'param' => 'paymentMethodPayone' . $this->id); foreach ($objOrder->getItems() as $objItem) { // Set the active product for insert tags replacement if ($objItem->hasProduct()) { Product::setActive($objItem->getProduct()); } $strOptions = ''; $arrOptions = Isotope::formatOptions($objItem->getOptions()); Product::unsetActive(); if (!empty($arrOptions)) { array_walk($arrOptions, function (&$option) { $option = $option['label'] . ': ' . $option['value']; }); $strOptions = ' (' . implode(', ', $arrOptions) . ')'; } $arrData['id[' . ++$i . ']'] = $objItem->getSku(); $arrData['pr[' . $i . ']'] = round($objItem->getPrice(), 2) * 100; $arrData['no[' . $i . ']'] = $objItem->quantity; $arrData['de[' . $i . ']'] = specialchars($objItem->getName() . $strOptions); } foreach ($objOrder->getSurcharges() as $k => $objSurcharge) { if (!$objSurcharge->addToTotal) { continue; } $arrData['id[' . ++$i . ']'] = 'surcharge' . $k; $arrData['pr[' . $i . ']'] = $objSurcharge->total_price * 100; $arrData['no[' . $i . ']'] = '1'; $arrData['de[' . $i . ']'] = $objSurcharge->label; } ksort($arrData); // Do not urlencode values because Payone does not properly decode POST values (whatever...) $strHash = md5(implode('', $arrData) . $this->payone_key); $objTemplate = new \Isotope\Template('iso_payment_payone'); $objTemplate->id = $this->id; $objTemplate->data = $arrData; $objTemplate->hash = $strHash; $objTemplate->billing_address = $objOrder->getBillingAddress()->row(); $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][0]; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][1]; $objTemplate->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][2]); return $objTemplate->parse(); }
/** * Return the PayPal form. * * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $arrData = array('popupId' => $this->expercash_popupId, 'jobId' => microtime(), 'functionId' => $objOrder->member ?: $objOrder->uniqid, 'transactionId' => $objOrder->id, 'amount' => round($objOrder->getTotal(), 2) * 100, 'currency' => $objOrder->currency, 'paymentMethod' => $this->expercash_paymentMethod, 'returnUrl' => \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder), 'errorUrl' => \Environment::get('base') . $objModule->generateUrlForStep('failed'), 'notifyUrl' => \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id, 'profile' => $this->expercash_profile); $strKey = ''; $strUrl = 'https://epi.expercash.net/epi_popup2.php?'; foreach ($arrData as $k => $v) { $strKey .= $v; $strUrl .= $k . '=' . urlencode($v) . '&'; } if (is_file(TL_ROOT . '/' . $this->expercash_css)) { $strUrl .= 'cssUrl=' . urlencode(\Environment::get('base') . $this->expercash_css) . '&'; } $strUrl .= 'language=' . strtoupper($GLOBALS['TL_LANGUAGE']) . '&popupKey=' . md5($strKey . $this->expercash_popupKey); $strBuffer = ' <h2>' . $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][0] . '</h2> <p class="message">' . $GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][1] . '</p> <iframe src="' . $strUrl . '" width="100%" height="500"> <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen: Sie können die eingebettete Seite über den folgenden Verweis aufrufen: <a href="' . $strUrl . '">ExperCash</a></p> </iframe>'; return $strBuffer; }
/** * Return the PayPal form. * * @param IsotopeProductCollection|Order $objOrder The order being places * @param \Module|Checkout $objModule The checkout module instance * * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $arrData = array(); $fltDiscount = 0; $i = 0; foreach ($objOrder->getItems() as $objItem) { // Set the active product for insert tags replacement if ($objItem->hasProduct()) { Product::setActive($objItem->getProduct()); } $strConfig = ''; $arrConfig = $objItem->getConfiguration(); if (!empty($arrConfig)) { array_walk($arrConfig, function (&$option) { $option = $option['label'] . ': ' . (string) $option; }); $strConfig = ' (' . implode(', ', $arrConfig) . ')'; } $arrData['item_number_' . ++$i] = $objItem->getSku(); $arrData['item_name_' . $i] = \StringUtil::restoreBasicEntities($objItem->getName() . $strConfig); $arrData['amount_' . $i] = $objItem->getPrice(); $arrData['quantity_' . $i] = $objItem->quantity; } foreach ($objOrder->getSurcharges() as $objSurcharge) { if (!$objSurcharge->addToTotal) { continue; } // PayPal does only support one single discount item if ($objSurcharge->total_price < 0) { $fltDiscount -= $objSurcharge->total_price; continue; } $arrData['item_name_' . ++$i] = $objSurcharge->label; $arrData['amount_' . $i] = $objSurcharge->total_price; } $objTemplate = new \Isotope\Template('iso_payment_paypal'); $objTemplate->setData($this->arrData); $objTemplate->id = $this->id; $objTemplate->action = 'https://www.' . ($this->debug ? 'sandbox.' : '') . 'paypal.com/cgi-bin/webscr'; $objTemplate->invoice = $objOrder->id; $objTemplate->data = array_map('specialchars', $arrData); $objTemplate->discount = $fltDiscount; $objTemplate->address = $objOrder->getBillingAddress(); $objTemplate->currency = $objOrder->currency; $objTemplate->return = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $objTemplate->cancel_return = \Environment::get('base') . $objModule->generateUrlForStep('failed'); $objTemplate->notify_url = \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; $objTemplate->headline = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][0]); $objTemplate->message = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][1]); $objTemplate->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][2]); $objTemplate->noscript = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_redirect'][3]); return $objTemplate->parse(); }
/** * Return the ePay form * * @param IsotopeProductCollection|Order $objOrder * @param \Module|\Isotope\Module\Checkout $objModule * * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $objTemplate = new \Isotope\Template('iso_payment_epay'); $objTemplate->setData($this->arrData); $objTemplate->currency = $objOrder->currency; $objTemplate->amount = Currency::getAmountInMinorUnits($objOrder->getTotal(), $objOrder->currency); $objTemplate->orderid = $objOrder->id; $objTemplate->instantcapture = $this->trans_type == 'capture' ? '1' : '0'; $objTemplate->callbackurl = \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; $objTemplate->accepturl = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $objTemplate->cancelurl = \Environment::get('base') . $objModule->generateUrlForStep('failed'); $objTemplate->language = (int) static::$arrLanguages[substr($GLOBALS['TL_LANGUAGE'], 0, 2)]; return $objTemplate->parse(); }
/** * @param IsotopeProductCollection|Order $objOrder * @param \Module|\Isotope\Module\Checkout $objModule * * @return array */ protected function getOutboundParameters(IsotopeProductCollection $objOrder, \Module $objModule = null) { $objAddress = $objOrder->getBillingAddress(); $successUrl = ''; $failureUrl = ''; $transDate = new DateTime(); $transDate->setTimezone(new \DateTimeZone('UTC')); if (null !== $objModule) { $successUrl = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $failureUrl = \Environment::get('base') . $objModule->generateUrlForStep('failed'); } return array('vads_action_mode' => 'INTERACTIVE', 'vads_amount' => Currency::getAmountInMinorUnits($objOrder->getTotal(), $objOrder->currency), 'vads_contrib' => 'Isotope eCommerce ' . Isotope::VERSION, 'vads_ctx_mode' => $this->debug ? 'TEST' : 'PRODUCTION', 'vads_currency' => Currency::getIsoNumber($objOrder->currency), 'vads_cust_address' => $objAddress->street_1, 'vads_cust_city' => $objAddress->city, 'vads_cust_country' => $objAddress->country, 'vads_cust_email' => $objAddress->email, 'vads_cust_id' => $objOrder->member ?: '', 'vads_cust_name' => $objAddress->firstname . ' ' . $objAddress->lastname, 'vads_cust_phone' => $objAddress->phone, 'vads_cust_title' => $objAddress->salutation, 'vads_cust_zip' => $objAddress->postal, 'vads_language' => $objOrder->language, 'vads_order_id' => $objOrder->id, 'vads_page_action' => 'PAYMENT', 'vads_payment_config' => 'SINGLE', 'vads_return_mode' => 'NONE', 'vads_site_id' => $this->vads_site_id, 'vads_trans_date' => $transDate->format('YmdHis'), 'vads_trans_id' => str_pad($objOrder->id, 6, '0', STR_PAD_LEFT), 'vads_url_cancel' => $failureUrl, 'vads_url_check' => \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id, 'vads_url_error' => $failureUrl, 'vads_url_referral' => $failureUrl, 'vads_url_refused' => $failureUrl, 'vads_url_success' => $successUrl, 'vads_url_return' => $failureUrl, 'vads_version' => 'V2'); }
/** * Generate POST data to initialize payment * * @param IsotopeProductCollection $objOrder * @param \Module $objModule * * @return array */ protected function generatePaymentPostData(IsotopeProductCollection $objOrder, \Module $objModule) { $arrData = array(); $arrData['ACCOUNTID'] = $this->saferpay_accountid; $arrData['AMOUNT'] = round($objOrder->getTotal() * 100, 0); $arrData['CURRENCY'] = $objOrder->currency; $arrData['SUCCESSLINK'] = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $arrData['FAILLINK'] = \Environment::get('base') . $objModule->generateUrlForStep('failed'); $arrData['BACKLINK'] = $arrData['FAILLINK']; $arrData['NOTIFYURL'] = \Environment::get('base') . '/system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; $arrData['DESCRIPTION'] = $this->saferpay_description; $arrData['ORDERID'] = $objOrder->id; // order id // Additional attributes if ($this->saferpay_vtconfig) { $arrData['VTCONFIG'] = $this->saferpay_vtconfig; } if ($this->saferpay_paymentmethods != '') { $arrData['PAYMENTMETHODS'] = $this->saferpay_paymentmethods; } return $arrData; }
/** * Create payment URI * @return string */ private function createPaymentURI(IsotopeProductCollection $objOrder, \Module $objModule) { $strComplete = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $strFailed = \Environment::get('base') . $objModule->generateUrlForStep('failed'); $strUrl = static::createPayInitURI; $strUrl .= "?ACCOUNTID=" . $this->saferpay_accountid; $strUrl .= "&AMOUNT=" . round($objOrder->getTotal() * 100, 0); $strUrl .= "&CURRENCY=" . $objOrder->currency; $strUrl .= "&SUCCESSLINK=" . urlencode($strComplete); $strUrl .= "&FAILLINK=" . urlencode($strFailed); $strUrl .= "&BACKLINK=" . urlencode($strFailed); $strUrl .= "&NOTIFYURL=" . urlencode(\Environment::get('base') . '/system/modules/isotope/postsale.php?mod=pay&id=' . $this->id); $strUrl .= "&DESCRIPTION=" . urlencode($this->saferpay_description); $strUrl .= "&ORDERID=" . $objOrder->id; // order id // Additional attributes if ($this->saferpay_vtconfig) { $strUrl .= '&VTCONFIG=' . urlencode($this->saferpay_vtconfig); } return $strUrl; }
/** * HTML form for checkout * @param object * @param object * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $strPrice = number_format(round($objOrder->getTotal(), 2), 2, '.', ''); $objTemplate = new \Isotope\Template('iso_payment_transferujpl'); $objTemplate->setData($this->arrData); $objTemplate->id = $this->id; $objTemplate->order_id = $objOrder->id; $objTemplate->amount = $strPrice; $objTemplate->products = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['transferujpl_order'], $objOrder->uniqid)); $objTemplate->hash = md5($this->transferujpl_id . $strPrice . $objOrder->id . $this->transferujpl_code); $objTemplate->postsaleUrl = \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; $objTemplate->successUrl = \Environment::get('base') . $objModule->generateUrlForStep('complete', $objOrder); $objTemplate->errorUrl = \Environment::get('base') . $objModule->generateUrlForStep('failed'); $objTemplate->language = $GLOBALS['TL_LANGUAGE']; $objTemplate->address = $objOrder->getBillingAddress(); $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pay_with_transferujpl'][0]; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['pay_with_transferujpl'][1]; $objTemplate->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_transferujpl'][2]); return $objTemplate->parse(); }