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