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')->setMethod('POST')->setForm(null)->setInputs(array('key' => 42));
     $singleLegacyOption = array('cta_text' => 'Pay by bankwire', 'logo' => 'http://example.com/logo.png', 'action' => 'http://example.com/submit', 'method' => 'POST', 'form' => null, 'inputs' => array('key' => 42));
     $legacyOption = array($singleLegacyOption, $singleLegacyOption);
     $this->assertEquals(array($newOption, $newOption), PaymentOption::convertLegacyOption($legacyOption));
 }
 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!', 'advancedeucompliance'))));
     Media::addJsDef(array('aeuc_submit_err_str' => Tools::htmlentitiesUTF8($this->l('Something went wrong. If the problem persists, please contact us.', 'advancedeucompliance'))));
     Media::addJsDef(array('aeuc_no_pay_err_str' => Tools::htmlentitiesUTF8($this->l('Select a payment option first.', 'advancedeucompliance'))));
     Media::addJsDef(array('aeuc_virt_prod_err_str' => Tools::htmlentitiesUTF8($this->l('Please check "Revocation of virtual products" box first !', 'advancedeucompliance'))));
     if ($legacyOptions) {
         foreach ($legacyOptions as $module_name => $legacyOption) {
             if (!$legacyOption) {
                 continue;
             }
             foreach (Core_Business_Payment_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;
     }
     return null;
 }