private function getSupportElement() { $control = new Customweb_Form_Control_Html('supportText', Customweb_I18n_Translation::__("If you have any issues with the module please feel free to contact us. See our <a href='https://www.sellxed.com/en/support' target='_blank'>support page</a> for more information.")); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__("Support"), $control); $element->setRequired(false); return $element; }
public function getElementGroups() { $settingHandler = $this->getSettingHandler(); $formGroups = array(); foreach ($this->getCheckouts() as $checkout) { $checkoutGroup = new Customweb_Form_ElementGroup(); $checkoutGroup->setTitle($checkout->getName()); $checkoutGroup->setMachineName($checkout->getMachineName()); // Single Checkbox // @formatter:off $element = new Customweb_Form_Element('Active', new Customweb_Form_Control_SingleCheckbox($checkout->getMachineName() . '[active]', 'yes', 'Active', $checkout->isActive()), null, false, !$settingHandler->hasCurrentStoreSetting($checkout->getMachineName() . '_active')); $element->setDescription(Customweb_I18n_Translation::__("Check to activate the external checkout.")); $checkoutGroup->addElement($element); // Input Field $element = new Customweb_Form_Element('Sort Order', new Customweb_Form_Control_TextInput($checkout->getMachineName() . '[sort_order]', $checkout->getSortOrder()), null, false, !$settingHandler->hasCurrentStoreSetting($checkout->getMachineName() . '_sort_order')); $element->setDescription(Customweb_I18n_Translation::__("Set the sort order to show the external checkouts.")); $checkoutGroup->addElement($element); // Minimal Order Total $element = new Customweb_Form_Element('Minimal Order Total', new Customweb_Form_Control_TextInput($checkout->getMachineName() . '[minimal_order_total]', $checkout->getMinimalOrderTotal()), null, false, !$settingHandler->hasCurrentStoreSetting($checkout->getMachineName() . '_minimal_order_total')); $element->setDescription(Customweb_I18n_Translation::__("Define a minimal order total for this checkout to be available.")); $checkoutGroup->addElement($element); // Maximal Order Total $element = new Customweb_Form_Element('Maximal Order Total', new Customweb_Form_Control_TextInput($checkout->getMachineName() . '[maximal_order_total]', $checkout->getMaximalOrderTotal()), null, false, !$settingHandler->hasCurrentStoreSetting($checkout->getMachineName() . '_maximal_order_total')); $element->setDescription(Customweb_I18n_Translation::__("Define a maximal order total for this checkout to be available.")); $checkoutGroup->addElement($element); // @formatter:on $formGroups[] = $checkoutGroup; } return $formGroups; }
private function getMandateElements(Customweb_Payment_Authorization_IOrderContext $orderContext) { $customer = $orderContext->getBillingAddress()->getFirstName() . ' ' . $orderContext->getBillingAddress()->getLastName(); $mandateId = Customweb_Payment_Authorization_Method_Sepa_Mandate::generateMandateId(self::$MANDATE_ID_SCHEMA); $mandateIdControl = new Customweb_Form_Control_HiddenInput('MANDATEID', $mandateId); $mandateIdElement = new Customweb_Form_HiddenElement($mandateIdControl); $mandateTextControl = new Customweb_Form_Control_Html('mandate_text', $this->getMandateText($mandateId, $customer)); $mandateTextElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('Mandate text'), $mandateTextControl); $mandateTextElement->setRequired(false); return array($mandateIdElement, $mandateTextElement); }
/** * This method creates an element to select the date of birth * @param string $fieldName The field name of the date of birth element */ public static function getDateOfBirthElement($dayFieldName, $monthFieldName, $yearFieldName, $defaultDay = '', $defaultMonth = '', $defaultYear = '') { $days = array('none' => Customweb_I18n_Translation::__('Day'), '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31'); $months = array('none' => Customweb_I18n_Translation::__('Month'), '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12'); $years = array('none' => Customweb_I18n_Translation::__('Year')); $current = intval(date('Y')); for ($i = 0; $i < 130; $i++) { $years[$current] = $current; $current--; } $dayControl = new Customweb_Form_Control_Select($dayFieldName, $days, $defaultDay); $dayControl->addValidator(new Customweb_Form_Validator_NotEmpty($dayControl, Customweb_I18n_Translation::__("Please select the day on which you were born."))); $monthControl = new Customweb_Form_Control_Select($monthFieldName, $months, $defaultMonth); $monthControl->addValidator(new Customweb_Form_Validator_NotEmpty($monthControl, Customweb_I18n_Translation::__("Please select the month in which you were born."))); $yearControl = new Customweb_Form_Control_Select($yearFieldName, $years, $defaultYear); $yearControl->addValidator(new Customweb_Form_Validator_NotEmpty($yearControl, Customweb_I18n_Translation::__("Please select the year in which you were born."))); $yearControl->addValidator(new Customweb_Saferpay_Method_ValidateDateOfBirth($yearControl, 'dob-day', 'dob-month', 'dob-year')); $control = new Customweb_Form_Control_MultiControl('dayOfBirth', array($dayControl, $monthControl, $yearControl)); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Date of birth'), $control, Customweb_I18n_Translation::__('Select your date of birth.')); $element->setElementIntention(Customweb_Form_Intention_Factory::getDateOfBirthIntention()); return $element; }
protected function buildSingleExpiryElement() { $this->createExpiryMonthControl(); $this->createExpiryYearControl(); $this->expiryMonthControl->setCssClass("hidden-control"); $this->expiryYearControl->setCssClass("hidden-control"); $month = $this->getSelectedExpiryMonth(); $year = $this->getSelectedExpiryYear(); $defaultValue = ''; if ($month !== null && $year !== null) { $defaultValue = str_replace('YY', $year, $this->getExpiryFieldFormat()); $defaultValue = str_replace('MM', $month, $defaultValue); } $this->expiryControl = new Customweb_Form_Control_TextInput($this->getExpiryFieldName(), $defaultValue); $control = new Customweb_Form_Control_MultiControl('expiration', array($this->expiryControl, $this->expiryMonthControl, $this->expiryYearControl)); $this->expiryElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('Card Expiration'), $control, Customweb_I18n_Translation::__('Enter the date on which your card expires.') . Customweb_I18n_Translation::__(" <span class='card-expiry-format-note'>The expected format is '!format' where the 'MM' means the month number and 'YY' the year number.</span>", array('!format' => $this->getExpiryFieldFormat()))); $this->expiryElement->setElementIntention(Customweb_Form_Intention_Factory::getExpirationDateIntention())->setErrorMessage($this->getExpiryElementErrorMessage()); }
public function getAliasSelect() { $payment = $this->getMethod(); $result = ''; if ($payment->getHelper()->getConfigurationValue('alias_manager') != 'inactive') { $aliasList = $payment->loadAliasForCustomer(); if (count($aliasList)) { $alias = array('new' => ''); foreach ($aliasList as $key => $value) { $alias[$key] = $value; } // The onchange even listener is added here, because there seems to be a bug with prototype's observe // on select fields. ::[License_Identifier]:: $selectControl = new Customweb_Form_Control_Select('alias', $alias, 'new'); $aliasElement = new Customweb_Form_Element($payment->getHelper()->__('Saved cards: '), $selectControl, $payment->getHelper()->__('You may choose one of the cards you paid before on this site.')); $aliasElement->setRequired(false); $result = $payment->getFormRenderer()->renderElements(array(0 => $aliasElement)); } } return $result; }
/** * This method creates a general terms and conditions element. * * @param string $fieldName The field name of the account number element * @return Customweb_Form_IElement */ protected function getGeneralTermsElement($fieldName) { $content = Customweb_I18n_Translation::__("I agree that my personal data are transmitted to\n\t\t\t<a href='https://billpay.de/endkunden' target='blank'> Billpay GmbH</a> in order to perfrom \n\t\t\tan idenity and solvency check. Billpay's <a href=\"!link\">Privacy Policy</a> applies.", array('!link' => $this->getGeneralTermsLink())); $terms = new Customweb_Form_Control_Html('generalTermsText', $content); $checkbox = new Customweb_Form_Control_SingleCheckbox($fieldName, 'accepted', Customweb_I18n_Translation::__('I agree.')); $checkbox->addValidator(new Customweb_Form_Validator_NotEmpty($checkbox, Customweb_I18n_Translation::__("You have to agree to the general terms."))); $control = new Customweb_Form_Control_MultiControl('generalTermsController', array($terms, $checkbox)); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Billpay General Terms'), $control, Customweb_I18n_Translation::__('By continuing the checkout you agree to the general terms of this agreement.')); $element->setElementIntention($this->getGeneralTermsIntention()); return $element; }
public function getAliasSelect() { $payment = $this->getMethod(); $result = ""; if ($payment->getPaymentMethodConfigurationValue('alias_manager') == 'active') { $aliasList = $payment->loadAliasForCustomer(); if (count($aliasList)) { $alias = array('new' => Mage::helper('SaferpayCw')->__('New card')); foreach ($aliasList as $key => $value) { $alias[$key] = $value; } // The onchange even listener is added here, because there seems to be a bug with prototype's observe // on select fields. $selectControl = new Customweb_SaferpayCw_Model_Select("alias_select", $alias, 'new', "cwpm_" . $payment->getCode() . ".loadAliasData(this)"); $aliasElement = new Customweb_Form_Element(Mage::helper('SaferpayCw')->__("Saved cards:"), $selectControl, Mage::helper('SaferpayCw')->__("You may choose one of the cards you paid before on this site.")); $aliasElement->setRequired(false); $renderer = new Customweb_SaferpayCw_Model_FormRenderer(); $renderer->setNameSpacePrefix($payment->getCode()); $result = $renderer->renderElements(array(0 => $aliasElement)); } } return $result; }
/** * Create an element for the bank's location. * * @param string $fieldName * @param string $errorMessage * @return Customweb_Form_Element */ public static function getBankLocationElement($fieldName, $errorMessage = null) { $control = new Customweb_Form_Control_TextInput($fieldName); $control->addValidator(new Customweb_Form_Validator_NotEmpty($control, Customweb_I18n_Translation::__("You have to enter the location of your bank."))); $control->setAutocomplete(false); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Bank Location'), $control, Customweb_I18n_Translation::__('Please enter the location of your bank.')); $element->setElementIntention(Customweb_Form_Intention_Factory::getBankLocationIntention())->setErrorMessage($errorMessage); return $element; }