We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 0b4a91f1 authored by Aleffio's avatar Aleffio

PW-243: Code optimization

parent 326ff29d
......@@ -834,19 +834,17 @@ class Cron
$updateBillingAgreement->setStatus(
\Adyen\Payment\Model\Billing\Agreement::STATUS_CANCELED
);
$updateBillingAgreement->save();
} else {
$updateBillingAgreement->setStatus(
\Adyen\Payment\Model\Billing\Agreement::STATUS_ACTIVE
);
$updateBillingAgreement->save();
}
$updateBillingAgreement->save();
}
// Get or create billing agreement
$billingAgreement = $this->_billingAgreementFactory->create();
$billingAgreement->load($recurringDetailReference, 'reference_id');
$message = __('Updated billing agreement #%1.', $recurringDetailReference);
// check if BA exists
if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
// create new
......@@ -866,6 +864,7 @@ class Cron
else {
$this->_adyenLogger->addAdyenNotificationCronjob("Using existing Billing Agreement");
$billingAgreement->setIsObjectChanged(true);
$message = __('Updated billing agreement #%1.', $recurringDetailReference);
}
// Populate billing agreement data
......
......@@ -101,7 +101,7 @@ define(
generationtime : generationtime
};
if(updatedExpiryDate || window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction){
if(updatedExpiryDate || self.hasVerification()){
var options = { enableValidations: false};
var cse_key = this.getCSEKey();
......@@ -185,6 +185,9 @@ define(
getGenerationTime: function() {
return window.checkoutConfig.payment.adyenCc.generationTime;
},
hasVerification: function() {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
},
validate: function () {
var code = self.item.method;
......@@ -203,7 +206,7 @@ define(
// only check if recurring type is set to oneclick
var cid = true;
if(self.hasVerification()) {
if(this.hasVerification()) {
var cid = Boolean($(form + ' #' + codeValue + '_cc_cid').valid());
}
} else {
......@@ -230,6 +233,8 @@ define(
},
selectBillingAgreement: function() {
var self = this;
self.expiry(false);
updatedExpiryDate = false;
// set payment method data
var data = {
......@@ -262,9 +267,6 @@ define(
}
return null;
}),
hasVerification: function() {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
},
getPlaceOrderUrl: function() {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
}
......
......@@ -131,7 +131,7 @@
</div>
<!-- ko if: ($parent.hasVerification())-->
<!-- ko if: hasVerification()-->
<div class="field cvv required" data-bind="attr: {id: getCode() + '_' + value + '_cc_type_cvv_div'}">
<label data-bind="attr: {for: getCode() + '_' + value + '_cc_cid'}" class="label">
<span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span>
......
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