We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit cddb1830 authored by Rik ter Beek's avatar Rik ter Beek

#58 added installments for creditcard and oneclick and minor oneclick sepa payment fix

parent 8a723268
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Block\Adminhtml\System\Config\Field;
class Cctypes extends \Magento\Framework\View\Element\Html\Select
{
/**
* All possible credit card types
*
* @var array
*/
protected $ccTypes = [];
/**
* @var \Magento\Braintree\Model\Source\CcType
*/
protected $ccTypeSource;
/**
* Cctypes constructor.
*
* @param \Magento\Framework\View\Element\Context $context
* @param \Adyen\Payment\Model\Config\Source\CcType $ccTypeSource
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Context $context,
\Adyen\Payment\Model\Config\Source\CcType $ccTypeSource,
array $data = []
) {
parent::__construct($context, $data);
$this->ccTypeSource = $ccTypeSource;
}
/**
* Render block HTML
*
* @return string
*/
public function _toHtml()
{
if (!$this->getOptions()) {
foreach ($this->_getCcTypes() as $country) {
if (isset($country['value']) && $country['value'] && isset($country['label']) && $country['label']) {
$this->addOption($country['value'], $country['label']);
}
}
}
$this->setClass('cc-type-select');
$this->setExtraParams('multiple="multiple"');
return parent::_toHtml();
}
/**
* All possible credit card types
*
* @return array
*/
protected function _getCcTypes()
{
if (!$this->ccTypes) {
$this->ccTypes = $this->ccTypeSource->toOptionArray();
}
return $this->ccTypes;
}
/**
* Sets name for input element
*
* @param string $value
* @return $this
*/
public function setInputName($value)
{
return $this->setName($value . '[]');
}
}
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Block\Adminhtml\System\Config\Field;
class Installment extends \Magento\Framework\View\Element\Html\Select
{
/**
* Options
*
* @var array
*/
protected $_options = [ '1' => '1x',
'2' => '2x',
'3' => '3x',
'4' => '4x',
'5' => '5x',
'6' => '6x',
'7' => '7x',
'8' => '8x',
'9' => '9x',
'10' => '10x',
'11' => '11x',
'12' => '12x'
];
/**
* Sets name for input element
*
* @param string $value
* @return $this
*/
public function setInputName($value)
{
return $this->setName($value);
}
}
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Block\Adminhtml\System\Config\Field;
class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
{
/**
* @var \Adyen\Payment\Block\Adminhtml\System\Config\Field\Installment
*/
protected $_installmentRenderer = null;
/**
* @var \Magento\Braintree\Block\Adminhtml\Form\Field\CcTypes
*/
protected $_ccTypesRenderer = null;
/**
* Return renderer for installments
*
* @return Installment|\Magento\Framework\View\Element\BlockInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function getNumberOfInstallmentsRenderer()
{
if (!$this->_installmentRenderer) {
$this->_installmentRenderer = $this->getLayout()->createBlock(
'\Adyen\Payment\Block\Adminhtml\System\Config\Field\Installment',
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->_installmentRenderer;
}
/**
* Returns renderer for country element
*
* @return \Magento\Braintree\Block\Adminhtml\Form\Field\Cctypes
*/
protected function getCcTypesRenderer()
{
if (!$this->_ccTypesRenderer) {
$this->_ccTypesRenderer = $this->getLayout()->createBlock(
'\Adyen\Payment\Block\Adminhtml\System\Config\Field\Cctypes',
'',
['data' => ['is_render_to_js_template' => true]]
);
}
return $this->_ccTypesRenderer;
}
/**
* Prepare to render
* @return void
*/
protected function _prepareToRender()
{
$this->addColumn(
'amount',
[
'label' => __('Amount Range (minor units)'),
'renderer' => false,
]
);
$this->addColumn(
'installments',
[
'label' => __('Max Number Of Installments'),
'renderer' => $this->getNumberOfInstallmentsRenderer(),
]
);
$this->addColumn(
'cc_types',
[
'label' => __('Allowed Credit Card Types'),
'renderer' => $this->getCcTypesRenderer(),
]
);
$this->_addAfter = false;
$this->_addButtonLabel = __('Add Rule');
}
/**
* Prepare existing row data object
*
* @param \Magento\Framework\DataObject $row
* @return void
*/
protected function _prepareArrayRow(\Magento\Framework\DataObject $row)
{
$installlments = $row->getInstallments();
$options = [];
if ($installlments) {
$options['option_' . $this->getNumberOfInstallmentsRenderer()->calcOptionHash($installlments)]
= 'selected="selected"';
$ccTypes = $row->getCcTypes();
if (!is_array($ccTypes)) {
$ccTypes = [$ccTypes];
}
foreach ($ccTypes as $cardType) {
$options['option_' . $this->getCcTypesRenderer()->calcOptionHash($cardType)]
= 'selected="selected"';
}
}
$row->setData('option_extra_attrs', $options);
return;
}
}
......@@ -87,6 +87,9 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
{
$config = parent::getConfig();
foreach ($this->_methodCodes as $code) {
if ($this->methods[$code]->isAvailable()) {
$demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode');
if ($demoMode) {
......@@ -116,6 +119,20 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
$config['payment']['adyenCc']['icons'] = $this->getIcons();
// has installments by default false
$config['payment']['adyenCc']['hasInstallments'] = false;
// get Installments
$installments = $this->_adyenHelper->getAdyenCcConfigData('installments');
if ($installments) {
$config['payment']['adyenCc']['installments'] = unserialize($installments);
$config['payment']['adyenCc']['hasInstallments'] = true;
} else {
$config['payment']['adyenCc']['installments'] = [];
}
}
}
return $config;
}
......
......@@ -179,7 +179,7 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
// is admin?
if ($this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
//retrieve storeId from quote
$store = $this->_session->getQuote()->getStore();
$store = $this->_getQuote()->getStore();
} else {
$store = $this->_storeManager->getStore();
}
......@@ -206,6 +206,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
if (in_array($recurringPaymentType, $allowedContractTypes)) {
// check if AgreementLabel is set and if contract has an recurringType
if ($billingAgreement->getAgreementLabel()) {
// for Ideal use sepadirectdebit because it is
if ($agreementData['variant'] == 'ideal') {
$agreementData['variant'] = 'sepadirectdebit';
}
$data = ['reference_id' => $billingAgreement->getReferenceId(),
'agreement_label' => $billingAgreement->getAgreementLabel(),
'agreement_data' => $agreementData
......@@ -213,10 +219,6 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
if ($this->_genericConfig->showLogos()) {
$logoName = $agreementData['variant'];
// for Ideal use sepadirectdebit because it is
if ($agreementData['variant'] == 'ideal') {
$logoName = "sepadirectdebit";
}
$asset = $this->_genericConfig->createAsset(
'Adyen_Payment::images/logos/' . $logoName . '.png'
......@@ -235,6 +237,34 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
}
$data['logo'] = $icon;
}
/**
* Check if there are installments for this creditcard type defined
*/
$data['number_of_installments'] = 0;
$ccType = $this->_adyenHelper->getMagentoCreditCartType($agreementData['variant']);
$installments = null;
$installmentsValue = $this->_adyenHelper->getAdyenCcConfigData('installments');
if ($installmentsValue) {
$installments = unserialize($installmentsValue);
}
if ($installments) {
$numberOfInstallments = null;
$grandTotal = $this->_getQuote()->getGrandTotal();
foreach ($installments as $ccTypeInstallment => $installment) {
if ($ccTypeInstallment == $ccType) {
foreach ($installment as $amount => $installments) {
if ($grandTotal <= $amount) {
$numberOfInstallments = $installments;
}
}
}
}
if ($numberOfInstallments) {
$data['number_of_installments'] = $numberOfInstallments;
}
}
$billingAgreements[] = $data;
}
}
......@@ -250,4 +280,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
{
return $this->_adyenHelper->getAdyenOneclickConfigData('recurring_payment_type');
}
/**
* @return \Magento\Quote\Model\Quote
*/
protected function _getQuote()
{
return $this->_session->getQuote();
}
}
\ No newline at end of file
......@@ -259,6 +259,11 @@ class PaymentRequest extends DataObject
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
}
// if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick
if ($payment->getCcType() == "sepadirectdebit") {
$request['selectedBrand'] = "sepadirectdebit";
}
if ($paymentMethodCode == \Adyen\Payment\Model\Method\Cc::METHOD_CODE ||
$paymentMethodCode == \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE) {
// If cse is enabled add encrypted card date into request
......@@ -291,6 +296,12 @@ class PaymentRequest extends DataObject
$request['bankAccount'] = $bankAccount;
}
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments');
}
$result = $service->authorise($request);
return $result;
}
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Config\Backend;
class Installments extends \Magento\Framework\App\Config\Value
{
/**
* @var \Magento\Framework\Math\Random
*/
protected $mathRandom;
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
* @param \Magento\Framework\Math\Random $mathRandom
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\Math\Random $mathRandom,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->mathRandom = $mathRandom;
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
}
/**
* Prepare data before save
*
* @return $this
*/
public function beforeSave()
{
$value = $this->getValue();
$result = [];
foreach ($value as $data) {
if (!$data) {
continue;
}
if (!is_array($data)) {
continue;
}
if (count($data) < 2) {
continue;
}
$amount = $data['amount'];
$installments = $data['installments'];
$ccTypes = $data['cc_types'];
foreach($ccTypes as $ccType) {
$result[$ccType][$amount] = $installments;
}
}
$this->setValue(serialize($result));
return $this;
}
/**
* Process data after load
*
* @return $this
*/
protected function _afterLoad()
{
$value = $this->getValue();
$value = unserialize($value);
if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value);
$this->setValue($value);
}
return $this;
}
/**
* Encode value to be used in \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
*
* @param array $value
* @return array
*/
protected function encodeArrayFieldValue(array $value)
{
$result = [];
// first combine the ccTypes together
$list = [];
foreach ($value as $ccType => $items) {
// sort on amount
ksort($items);
foreach ($items as $amount => $installment) {
if (!isset($list[$installment][$amount])) {
$list[$installment][$amount] = [$ccType];
} else {
$ccTypes = $list[$installment][$amount];
$ccTypes[] = $ccType;
$list[$installment][$amount] = $ccTypes;
}
}
}
// loop through combined ccTypes configuration and pre fill the items
foreach ($list as $installment => $amounts) {
foreach ($amounts as $amount => $ccTypes) {
$resultId = $this->mathRandom->getUniqueHash('_');
$result[$resultId] = ['amount' => $amount, 'cc_types' => $ccTypes, 'installments' => $installment];
}
}
return $result;
}
}
......@@ -208,6 +208,11 @@ class Cc extends \Magento\Payment\Model\Method\Cc
}
}
// set number of installements
if (isset($additionalData['number_of_installments'])) {
$infoInstance->setAdditionalInformation('number_of_installments', $additionalData['number_of_installments']);
}
// save value remember details checkbox
if (isset($additionalData['store_cc'])) {
$infoInstance->setAdditionalInformation('store_cc', $additionalData['store_cc']);
......
......@@ -92,6 +92,11 @@ class Oneclick extends \Adyen\Payment\Model\Method\Cc
$infoInstance->setAdditionalInformation('customer_interaction', $customerInteraction);
// set number of installements
if (isset($additionalData['number_of_installments'])) {
$infoInstance->setAdditionalInformation('number_of_installments', $additionalData['number_of_installments']);
}
return $this;
}
......
......@@ -72,6 +72,13 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/enable_moto</config_path>
</field>
<field id="installments" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Installments</label>
<tooltip>Configure your installment foreach creditcard type.</tooltip>
<frontend_model>Adyen\Payment\Block\Adminhtml\System\Config\Field\Installments</frontend_model>
<backend_model>Adyen\Payment\Model\Config\Backend\Installments</backend_model>
<config_path>payment/adyen_cc/installments</config_path>
</field>
</group>
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200">
......
......@@ -55,6 +55,10 @@ $_isDemoMode = $block->isDemoMode();
<?php echo __('Credit Card Number: xxxx-%1', $this->getInfo()->getCcLast4()) ?><br/>
<?php endif;?>
<?php if($_info->getAdditionalInformation('number_of_installments') != ""): ?>
<?php echo __('Number of installments: %1', $_info->getAdditionalInformation('number_of_installments')) ?><br/>
<?php endif; ?>
<?php if($_info->getAdditionalInformation('adyen_avs_result') != ""): ?>
<?php echo __('Avs result: %1', $_info->getAdditionalInformation('adyen_avs_result')) ?><br/>
......
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'ko',
],
function (ko) {
'use strict';
var installments = ko.observableArray([]);
return {
/**
* Populate the list of installments
* @param {Array} methods
*/
setInstallments: function (installmentData) {
// remove everything from the current list
installments.removeAll();
// populate installments
var i;
for (i = 1; i <= installmentData; i++) {
installments.push({
key: i,
value: i
});
}
},
/**
* Get the list of available installments.
* @returns {Array}
*/
getInstallments: function () {
return installments;
}
};
}
);
......@@ -30,9 +30,13 @@ define(
'mage/translate',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Customer/js/model/customer',
'Magento_Payment/js/model/credit-card-validation/credit-card-data',
'Magento_Checkout/js/model/quote',
'ko',
'Adyen_Payment/js/model/installments',
'adyen/encrypt'
],
function (_, $, Component, placeOrderAction, $t, additionalValidators, customer, adyenEncrypt) {
function (_, $, Component, placeOrderAction, $t, additionalValidators, customer, creditCardData, quote, ko, installments, adyenEncrypt) {
'use strict';
return Component.extend({
......@@ -40,7 +44,8 @@ define(
template: 'Adyen_Payment/payment/cc-form',
creditCardOwner: '',
encryptedData: '',
setStoreCc: true
setStoreCc: true,
installment: ''
},
initObservable: function () {
this._super()
......@@ -56,10 +61,49 @@ define(
'creditCardOwner',
'encryptedData',
'generationtime',
'setStoreCc'
'setStoreCc',
'installment'
]);
return this;
},
getInstallments: installments.getInstallments(),
initialize: function() {
var self = this;
this._super();
//Set credit card number to credit card data object
this.creditCardNumber.subscribe(function(value) {
// installments enabled ??
var allInstallments = self.getAllInstallments();
// what card is this ??
var creditcardType = creditCardData.creditCard.type;
if(creditcardType) {
if (creditcardType in allInstallments) {
// get for the creditcard the installments
var installmentCreditcard = allInstallments[creditcardType];
var grandTotal = quote.totals().grand_total;
var numberOfInstallments = 0;
$.each(installmentCreditcard, function (amount, installment) {
if(grandTotal <= amount) {
numberOfInstallments = installment;
return false;
}
});
if(numberOfInstallments > 0) {
installments.setInstallments(numberOfInstallments);
}
} else {
installments.setInstallments(0);
}
}
});
},
setPlaceOrderHandler: function(handler) {
this.placeOrderHandler = handler;
},
......@@ -76,7 +120,8 @@ define(
'cc_type': this.creditCardType(),
'encrypted_data': this.encryptedData(),
'generationtime': this.generationtime(),
'store_cc': this.setStoreCc()
'store_cc': this.setStoreCc(),
'number_of_installments': this.installment()
}
};
},
......@@ -175,6 +220,12 @@ define(
? window.checkoutConfig.payment.adyenCc.icons[type]
: false
},
hasInstallments: function() {
return window.checkoutConfig.payment.adyenCc.hasInstallments;
},
getAllInstallments: function() {
return window.checkoutConfig.payment.adyenCc.installments;
}
});
}
);
......
......@@ -66,16 +66,6 @@ define(
getCode: function() {
return 'adyen_oneclick';
},
getData: function() {
return {
'method': this.item.method,
additional_data: {
'cc_type': this.creditCardType(),
'cc_cid': this.creditCardVerificationNumber(),
'encrypted_data': this.encryptedData()
}
};
},
isActive: function() {
return true;
},
......@@ -112,7 +102,8 @@ define(
"additional_data": {
encrypted_data: encryptedData,
recurring_detail_reference: self.value,
variant: self.agreement_data.variant
variant: self.agreement_data.variant,
number_of_installments: self.installment
}
};
......@@ -153,14 +144,26 @@ define(
creditCardExpYear = value.agreement_data.card.expiryYear;
}
// pre-define installments if they are set
var i, installments = [];
if(value.number_of_installments > 0) {
for (i = 1; i <= value.number_of_installments; i++) {
installments.push({
key: i,
value: i
});
}
}
return {
'expiry': ko.observable(false),
'test': true,
'test2': true,
'label': value.agreement_label,
'value': value.reference_id,
'agreement_data': value.agreement_data,
'logo': value.logo,
'installment': '',
'number_of_installments': value.number_of_installments,
getInstallments: ko.observableArray(installments),
'method': self.item.method,
getCode: function() {
return self.item.method;
......@@ -181,7 +184,6 @@ define(
var codeValue = code + '_' + value;
var form = 'form[data-role=' + codeValue + ']';
var formObject = $(form);
var validate = $(form).validation() && $(form).validation('isValid');
......@@ -190,16 +192,17 @@ define(
// add extra validation because jqeury validation will not work on non name attributes
var expiration = Boolean($(form + ' #' + codeValue + '_expiration').valid());
var expiration_yr = Boolean($(form + ' #' + codeValue + '_expiration_yr').valid());
} else {
var expiration = true;
var expiration_yr = true;
}
// only check if recurring type is set to oneclick
var cid = true;
if(self.hasVerification()) {
var cid = Boolean($(form + ' #' + codeValue + '_cc_cid').valid());
}
} else {
var expiration = true;
var expiration_yr = true;
var cid = true;
}
if(!validate || !expiration || !expiration_yr || !cid) {
return false;
......@@ -213,14 +216,13 @@ define(
return true;
}
}
}
);
});
return paymentList;
},
selectBillingAgreement: function() {
var self = this;
// set payment method to adyen_hpp
// set payment method data
var data = {
"method": self.method,
"po_number": null,
......
......@@ -202,6 +202,32 @@
</div>
<!-- /ko -->
<!-- ko if: (hasInstallments())-->
<div class="field required" data-bind="attr: {id: getCode() + '_installments_div'}, visible: getInstallments().length > 0">
<label data-bind="attr: {for: getCode() + '_installments'}" class="label">
<span><!-- ko text: $t('Installments')--><!-- /ko --></span>
</label>
<div class="control">
<select class="select"
name="payment[number_of_installments]"
data-bind="attr: {id: getCode() + '_installments', 'data-container': getCode() + '-installments', 'data-validate': JSON.stringify({required:true})},
enable: isActive($parents),
options: getInstallments,
optionsValue: 'value',
optionsText: 'key',
optionsCaption: $t('Installments'),
value: installment"
data-validate="{required:true}">
</select>
</div>
</div>
<!-- /ko -->
<!-- ko if: (canCreateBillingAgreement())-->
<div class="field choice">
......
......@@ -196,6 +196,30 @@
<!--/ko-->
<!-- ko if: number_of_installments > 0 -->
<div class="field required" data-bind="attr: {id: getCode() + '_installments_div'}, visible: getInstallments().length > 0">
<label data-bind="attr: {for: getCode() + '_installments'}" class="label">
<span><!-- ko text: $t('Installments')--><!-- /ko --></span>
</label>
<div class="control">
<select class="select"
name="payment[number_of_installments]"
data-bind="attr: {id: getCode() + '_installments', 'data-container': getCode() + '-installments', 'data-validate': JSON.stringify({required:true})},
enable: $parent.isActive($parents),
options: getInstallments,
optionsValue: 'value',
optionsText: 'key',
optionsCaption: $t('Installments'),
value: installment"
data-validate="{required:true}">
</select>
</div>
</div>
<!-- /ko -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment