public function hookAdvancedPaymentOptions($param)
 {
     $legacyOptions = Hook::exec('displayPaymentEU', array(), null, true);
     $newOptions = array();
     Media::addJsDef(array('aeuc_tos_err_str' => Tools::htmlentitiesUTF8($this->l('You must agree to our Terms of Service before going any further!', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_submit_err_str' => Tools::htmlentitiesUTF8($this->l('Something went wrong. If the problem persists, please contact us.', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_no_pay_err_str' => Tools::htmlentitiesUTF8($this->l('Select a payment option first.', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_virt_prod_err_str' => Tools::htmlentitiesUTF8($this->l('Please check the "Revocation of virtual products" box first!', 'ps_legalcompliance'))));
     if ($legacyOptions) {
         foreach ($legacyOptions as $module_name => $legacyOption) {
             if (!$legacyOption) {
                 continue;
             }
             foreach (PaymentOption::convertLegacyOption($legacyOption) as $option) {
                 $option->setModuleName($module_name);
                 $to_be_cleaned = $option->getForm();
                 if ($to_be_cleaned) {
                     $cleaned = str_replace('@hiddenSubmit', '', $to_be_cleaned);
                     $option->setForm($cleaned);
                 }
                 $newOptions[] = $option;
             }
         }
     }
     return $newOptions;
 }
 public function test_convertLegacyOption_converts_two_options_specified_as_one()
 {
     $newOption = new PaymentOption();
     $newOption->setCallToActionText('Pay by bankwire')->setLogo('http://example.com/logo.png')->setAction('http://example.com/submit')->setForm(null)->setInputs(array('key' => 42));
     $singleLegacyOption = array('cta_text' => 'Pay by bankwire', 'logo' => 'http://example.com/logo.png', 'action' => 'http://example.com/submit', 'form' => null, 'inputs' => array('key' => 42));
     $legacyOption = array($singleLegacyOption, $singleLegacyOption);
     $this->assertEquals(array($newOption, $newOption), PaymentOption::convertLegacyOption($legacyOption));
 }
Example #3
0
 public function hookPaymentOptions($params)
 {
     if (!$this->active) {
         return;
     }
     if (!$this->checkCurrency($params['cart'])) {
         return;
     }
     $this->context->smarty->assign($this->getTemplateVarInfos());
     $newOption = new PaymentOption();
     $newOption->setCallToActionText($this->trans('Pay by Bank BNI', array(), 'Modules.BankBNI.Shop'))->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))->setAdditionalInformation($this->context->smarty->fetch('module:bankbni/views/templates/hook/intro.tpl'));
     $payment_options = [$newOption];
     return $payment_options;
 }
 public function hookPaymentOptions($params)
 {
     if (!$this->active) {
         return;
     }
     if (!$this->checkCurrency($params['cart'])) {
         return;
     }
     $this->smarty->assign($this->getTemplateVars());
     $newOption = new PaymentOption();
     $newOption->setCallToActionText($this->trans('Pay by Check', array(), 'Modules.CheckPayment.Admin'))->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))->setAdditionalInformation($this->fetch('module:ps_checkpayment/views/templates/front/payment_infos.tpl'));
     return [$newOption];
 }
 public function getIframePaymentOption()
 {
     $iframeOption = new PaymentOption();
     $iframeOption->setCallToActionText($this->l('Pay iframe'))->setAdditionalInformation($this->context->smarty->fetch('module:paymentexample/views/templates/front/payment_infos.tpl'))->setLogo(Media::getMediaPath(_PS_MODULE_DIR_ . $this->name . '/payment.jpg'));
     return $iframeOption;
 }