/** * Generate payment authorization form and AUTH or CAPTURE * * @access public * @param object * @return mixed */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $objTemplate = new \Isotope\Template($this->strTemplate); $objTemplate->setData($this->arrData); $objTemplate->headline = specialchars($GLOBALS['TL_LANG']['MODEL']['tl_iso_payment.purchaseorder'][0]); return $objTemplate->parse(); }
/** * 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) { $strCountry = in_array($objOrder->getBillingAddress()->country, array('de', 'ch', 'at')) ? $objOrder->getBillingAddress()->country : 'de'; $strUrl = 'https://www.sofortueberweisung.' . $strCountry . '/payment/start'; $arrParams = array('user_id' => $this->sofortueberweisung_user_id, 'project_id' => $this->sofortueberweisung_project_id, 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_country_id' => strtoupper($objOrder->getBillingAddress()->country), 'amount' => number_format($objOrder->getTotal(), 2, '.', ''), 'currency_id' => $objOrder->currency, 'reason_1' => \Environment::get('host'), 'reason_2' => '', 'user_variable_0' => $objOrder->id, 'user_variable_1' => $this->id, 'user_variable_2' => $objOrder->uniqid, 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'project_password' => $this->sofortueberweisung_project_password); $arrParams['hash'] = sha1(implode('|', $arrParams)); $arrParams['language_id'] = $GLOBALS['TL_LANGUAGE']; $objTemplate = new \Isotope\Template('iso_payment_sofortueberweisung'); $objTemplate->setData($this->arrData); $objTemplate->action = $strUrl; $objTemplate->params = array_filter(array_diff_key($arrParams, array('project_password' => ''))); return $objTemplate->parse(); }
/** * 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(); }
/** * Return the redirect form. * @param IsotopeProductCollection The order being places * @param Module The checkout module instance * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $objTemplate = new \Isotope\Template('iso_payment_paybyway'); $objTemplate->action = 'https://www.paybyway.com/e-payments/pay'; $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]); $objTemplate->merchant_id = (int) $this->paybyway_merchant_id; $objTemplate->amount = round($objOrder->getTotal() * 100); $objTemplate->currency = 'EUR'; $objTemplate->order_number = $objOrder->id; $objTemplate->lang = $GLOBALS['TL_LANGUAGE'] == 'fi' ? 'FI' : 'EN'; $objTemplate->return_address = \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; $objTemplate->cancel_address = \Environment::get('base') . 'system/modules/isotope/postsale.php?mod=pay&id=' . $this->id; if ($this->debug) { $objTemplate->action = 'https://www.paybyway.com/e-payments/test_pay'; $this->paybyway_private_key = 'private_key'; } $objTemplate->authcode = strtoupper(md5($this->paybyway_private_key . '|' . $objTemplate->merchant_id . '|' . $objTemplate->amount . '|' . $objTemplate->currency . '|' . $objTemplate->order_number . '|' . $objTemplate->lang . '|' . $objTemplate->return_address . '|' . $objTemplate->cancel_address)); return $objTemplate->parse(); }
/** * Generates the filter */ protected function generateFilter() { $blnShowClear = false; $arrFilters = array(); foreach ($this->iso_filterFields as $strField) { $blnTrail = false; $arrItems = array(); $arrWidget = \Widget::getAttributesFromDca($GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strField], $strField); // Use the default routine to initialize options data foreach ($arrWidget['options'] as $option) { $varValue = $option['value']; // skip zero values (includeBlankOption) // @deprecated drop "-" when we only have the database table as options source if ($varValue === '' || $varValue === '-') { continue; } $strFilterKey = $strField . '=' . $varValue; $blnActive = Isotope::getRequestCache()->getFilterForModule($strFilterKey, $this->id) !== null; $blnTrail = $blnActive ? true : $blnTrail; $arrItems[] = array('href' => \Haste\Util\Url::addQueryString('cumulativefilter=' . base64_encode($this->id . ';' . ($blnActive ? 'del' : 'add') . ';' . $strField . ';' . $varValue)), 'class' => $blnActive ? 'active' : '', 'title' => specialchars($option['label']), 'link' => $option['label']); } if (!empty($arrItems) || $this->iso_iso_filterHideSingle && count($arrItems) < 2) { $objClass = RowClass::withKey('class')->addFirstLast(); if ($blnTrail) { $objClass->addCustom('sibling'); } $objClass->applyTo($arrItems); $objTemplate = new \Isotope\Template($this->navigationTpl); $objTemplate->level = 'level_2'; $objTemplate->items = $arrItems; $arrFilters[$strField] = array('label' => $arrWidget['label'], 'subitems' => $objTemplate->parse(), 'isActive' => $blnTrail); $blnShowClear = $blnTrail ? true : $blnShowClear; } } $this->Template->filters = $arrFilters; $this->Template->showClear = $blnShowClear; }
/** * Generate the checkout step * @return string */ public function generate() { $arrModules = array(); $arrOptions = array(); $arrIds = deserialize($this->objModule->iso_payment_modules); if (!empty($arrIds) && is_array($arrIds)) { $arrColumns = array('id IN (' . implode(',', $arrIds) . ')'); if (BE_USER_LOGGED_IN !== true) { $arrColumns[] = "enabled='1'"; } /** @type Payment[] $objModules */ $objModules = Payment::findBy($arrColumns, null, array('order' => \Database::getInstance()->findInSet('id', $arrIds))); if (null !== $objModules) { foreach ($objModules as $objModule) { if (!$objModule->isAvailable()) { continue; } $strLabel = $objModule->getLabel(); $fltPrice = $objModule->getPrice(); if ($fltPrice != 0) { if ($objModule->isPercentage()) { $strLabel .= ' (' . $objModule->getPercentageLabel() . ')'; } $strLabel .= ': ' . Isotope::formatPriceWithCurrency($fltPrice); } if ($objModule->note != '') { $strLabel .= '<span class="note">' . $objModule->note . '</span>'; } $arrOptions[] = array('value' => $objModule->id, 'label' => $strLabel); $arrModules[$objModule->id] = $objModule; } } } if (empty($arrModules)) { $this->blnError = true; \System::log('No payment methods available for cart ID ' . Isotope::getCart()->id, __METHOD__, TL_ERROR); $objTemplate = new \Isotope\Template('mod_message'); $objTemplate->class = 'payment_method'; $objTemplate->hl = 'h2'; $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['payment_method']; $objTemplate->type = 'error'; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['noPaymentModules']; return $objTemplate->parse(); } $strClass = $GLOBALS['TL_FFL']['radio']; /** @type \Widget $objWidget */ $objWidget = new $strClass(array('id' => $this->getStepClass(), 'name' => $this->getStepClass(), 'mandatory' => true, 'options' => $arrOptions, 'value' => Isotope::getCart()->payment_id, 'storeValues' => true, 'tableless' => true)); // If there is only one payment method, mark it as selected by default if (count($arrModules) == 1) { $objModule = reset($arrModules); $objWidget->value = $objModule->id; Isotope::getCart()->setPaymentMethod($objModule); } if (\Input::post('FORM_SUBMIT') == $this->objModule->getFormId()) { $objWidget->validate(); if (!$objWidget->hasErrors()) { Isotope::getCart()->setPaymentMethod($arrModules[$objWidget->value]); } } $objTemplate = new \Isotope\Template('iso_checkout_payment_method'); if (!Isotope::getCart()->hasPayment() || !isset($arrModules[Isotope::getCart()->payment_id])) { $this->blnError = true; } $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['payment_method']; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['payment_method_message']; $objTemplate->options = $objWidget->parse(); $objTemplate->paymentMethods = $arrModules; 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(); }
/** * 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(); $fltDiscount = 0; $i = 0; 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['item_number_' . ++$i] = $objItem->getSku(); $arrData['item_name_' . $i] = $objItem->getName() . $strOptions; $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 = $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(); }
/** * Generate the submit form for Innopay and if javascript is enabled redirect automatically * * @param IsotopeProductCollection|Order $objOrder The order being placed * @param \Module|\Isotope\Module\Checkout $objModule The checkout module instance * * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $parameters = $this->getOutboundParameters($objOrder, $objModule); $parameters['signature'] = $this->calculateSignature($parameters, $this->vads_certificate); $objTemplate = new \Isotope\Template($this->strTemplate); $objTemplate->id = $this->id; $objTemplate->params = $parameters; $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(); }
/** * HTML form for checkout * @param object * @param object * @return string */ public function checkoutForm(IsotopeProductCollection $objOrder, \Module $objModule) { $time = time(); $strSessionId = $objOrder->id . '_' . uniqid(); $objAddress = $objOrder->getBillingAddress(); $intPrice = round($objOrder->getTotal(), 2) * 100; $strDescription = sprintf($GLOBALS['TL_LANG']['MSC']['payu_order'], $objOrder->uniqid); $objTemplate = new \Isotope\Template('iso_payment_payu'); $objTemplate->setData($this->arrData); $objTemplate->id = $this->id; $objTemplate->order_id = $objOrder->uniqid; $objTemplate->ts = $time; $objTemplate->amount = $intPrice; $objTemplate->session_id = $strSessionId; $objTemplate->desc = specialchars($strDescription); $objTemplate->sig = md5($this->payu_id . ($this->debug ? 't' : '') . $strSessionId . $this->payu_authKey . $intPrice . $strDescription . $objOrder->uniqid . $objAddress->firstname . $objAddress->lastname . $objAddress->street_1 . $objAddress->city . $objAddress->postal . $objAddress->country . $objAddress->email . $objAddress->phone . $GLOBALS['TL_LANGUAGE'] . \Environment::get('ip') . $time . $this->payu_key1); $objTemplate->ip = \Environment::get('ip'); $objTemplate->language = $GLOBALS['TL_LANGUAGE']; $objTemplate->address = $objAddress; $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pay_with_payu'][0]; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['pay_with_payu'][1]; $objTemplate->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['pay_with_payu'][2]); return $objTemplate->parse(); }