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 baa8b547 authored by attilak's avatar attilak Committed by Rik ter Beek

Modifications based on code review

 - remove generation time
 - add checkout sdk live and test version
 - cvc is not required (e.g. at recurring)
parent a4794ad5
...@@ -84,8 +84,9 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -84,8 +84,9 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$request['paymentMethod']['holderName'] = $holderName; $request['paymentMethod']['holderName'] = $holderName;
} }
// The encrypted security code is required in both cc and oneclick if ($securityCode = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE)) {
$request['paymentMethod']['encryptedSecurityCode'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE); $request['paymentMethod']['encryptedSecurityCode'] = $securityCode;
}
// Remove from additional data // Remove from additional data
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER);
......
...@@ -35,7 +35,8 @@ class Data extends AbstractHelper ...@@ -35,7 +35,8 @@ class Data extends AbstractHelper
const LIVE = 'live'; const LIVE = 'live';
const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/'; const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/'; const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/';
const CHECKOUT_COMPONENT_JS = 'https://checkoutshopper-beta.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js'; const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js';
/** /**
* @var \Magento\Framework\Encryption\EncryptorInterface * @var \Magento\Framework\Encryption\EncryptorInterface
...@@ -1430,9 +1431,14 @@ class Data extends AbstractHelper ...@@ -1430,9 +1431,14 @@ class Data extends AbstractHelper
} }
/** /**
* @param int|null $storeId
* @return string * @return string
*/ */
public function getCheckoutCardComponentJs() { public function getCheckoutCardComponentJs($storeId = null) {
return self::CHECKOUT_COMPONENT_JS; if ($this->isDemoMode($storeId)) {
return self::CHECKOUT_COMPONENT_JS_TEST;
}
return self::CHECKOUT_COMPONENT_JS_LIVE;
} }
} }
...@@ -141,7 +141,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -141,7 +141,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId()); $config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId());
$config['payment']['adyenCc']['generationTime'] = date("c");
$config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$config['payment']['adyenCc']['icons'] = $this->getIcons(); $config['payment']['adyenCc']['icons'] = $this->getIcons();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model\Ui; namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface; use Magento\Checkout\Model\ConfigProviderInterface;
...@@ -33,15 +34,24 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -33,15 +34,24 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
/** /**
* AdyenGenericConfigProvider constructor. * AdyenGenericConfigProvider constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
*/ */
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper) public function __construct(
{ \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->storeManager = $storeManager;
} }
/** /**
* Define foreach payment methods the RedirectUrl * Define foreach payment methods the RedirectUrl
* *
...@@ -59,10 +69,11 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -59,10 +69,11 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
$config['payment']['adyen']['showLogo'] = false; $config['payment']['adyen']['showLogo'] = false;
} }
$config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs(); $config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs($this->storeManager->getStore()->getId());
return $config; return $config;
} }
/** /**
* Return redirect URL for method * Return redirect URL for method
* *
......
...@@ -144,9 +144,6 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -144,9 +144,6 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$canCreateBillingAgreement = true; $canCreateBillingAgreement = true;
} }
// Commented out otherwise would break the checkoutsince the getLibrarySource is removed
//$config['payment'] ['adyenOneclick']['librarySource'] = $this->_adyenHelper->getLibrarySource();
$config['payment']['adyenOneclick']['generationTime'] = date("c");
$config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$recurringContractType = $this->_getRecurringContractType(); $recurringContractType = $this->_getRecurringContractType();
......
...@@ -112,10 +112,6 @@ echo $code; ?>" ...@@ -112,10 +112,6 @@ echo $code; ?>"
<?php endforeach ?> <?php endforeach ?>
</select> </select>
<input type="hidden" id="<?php echo $code ?>_encrypted_form_expiry_generationtime"
value="<?php echo date("c"); ?>" data-encrypted-name="generationtime"/>
</div> </div>
</div> </div>
......
...@@ -72,8 +72,7 @@ define( ...@@ -72,8 +72,7 @@ define(
this._super(); this._super();
// include checkout card component javascript // include checkout card component javascript
var checkoutCardComponentScriptTag = document.getElementById('AdyenCheckoutCardComponentScript'); var checkoutCardComponentScriptTag = document.createElement('script');
checkoutCardComponentScriptTag = document.createElement('script');
checkoutCardComponentScriptTag.id = "AdyenCheckoutCardComponentScript"; checkoutCardComponentScriptTag.id = "AdyenCheckoutCardComponentScript";
checkoutCardComponentScriptTag.src = self.getCheckoutCardComponentSource(); checkoutCardComponentScriptTag.src = self.getCheckoutCardComponentSource();
checkoutCardComponentScriptTag.type = "text/javascript"; checkoutCardComponentScriptTag.type = "text/javascript";
......
...@@ -158,7 +158,7 @@ define( ...@@ -158,7 +158,7 @@ define(
/** /**
* Builds the payment details part of the payment information reqeust * Builds the payment details part of the payment information reqeust
* *
* @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, generationtime: *, store_cc: *, number_of_installments: *}}} * @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, store_cc: *, number_of_installments: *}}}
*/ */
getData: function () { getData: function () {
return { return {
...@@ -170,7 +170,6 @@ define( ...@@ -170,7 +170,6 @@ define(
'expiryMonth': this.expiryMonth(), 'expiryMonth': this.expiryMonth(),
'expiryYear': this.expiryYear(), 'expiryYear': this.expiryYear(),
'holderName': this.creditCardOwner(), 'holderName': this.creditCardOwner(),
'generationtime': this.getGenerationTime(),
'store_cc': this.setStoreCc(), 'store_cc': this.setStoreCc(),
'number_of_installments': this.installment() 'number_of_installments': this.installment()
} }
...@@ -327,9 +326,6 @@ define( ...@@ -327,9 +326,6 @@ define(
getPlaceOrderUrl: function () { getPlaceOrderUrl: function () {
return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()]; return window.checkoutConfig.payment.iframe.placeOrderUrl[this.getCode()];
}, },
getGenerationTime: function () {
return window.checkoutConfig.payment.adyenCc.generationTime;
},
canCreateBillingAgreement: function () { canCreateBillingAgreement: function () {
if (customer.isLoggedIn()) { if (customer.isLoggedIn()) {
return window.checkoutConfig.payment.adyenCc.canCreateBillingAgreement; return window.checkoutConfig.payment.adyenCc.canCreateBillingAgreement;
......
...@@ -234,7 +234,7 @@ define( ...@@ -234,7 +234,7 @@ define(
/** /**
* Builds the payment details part of the payment information reqeust * Builds the payment details part of the payment information reqeust
* *
* @returns {{method: *, additional_data: {variant: *, recurring_detail_reference: *, number_of_installments: *, cvc: (string|*), expiryMonth: *, expiryYear: *, generationtime: *}}} * @returns {{method: *, additional_data: {variant: *, recurring_detail_reference: *, number_of_installments: *, cvc: (string|*), expiryMonth: *, expiryYear: *}}}
*/ */
getData: function () { getData: function () {
var self = this; var self = this;
...@@ -247,8 +247,7 @@ define( ...@@ -247,8 +247,7 @@ define(
number_of_installments: numberOfInstallments(), number_of_installments: numberOfInstallments(),
cvc: self.encryptedCreditCardVerificationNumber, cvc: self.encryptedCreditCardVerificationNumber,
expiryMonth: self.creditCardExpMonth(), expiryMonth: self.creditCardExpMonth(),
expiryYear: self.creditCardExpYear(), expiryYear: self.creditCardExpYear()
generationtime: self.getGenerationTime()
} }
}; };
}, },
...@@ -289,9 +288,6 @@ define( ...@@ -289,9 +288,6 @@ define(
getLoadingContext: function () { getLoadingContext: function () {
return window.checkoutConfig.payment.adyenOneclick.checkoutUrl; return window.checkoutConfig.payment.adyenOneclick.checkoutUrl;
}, },
getGenerationTime: function () {
return window.checkoutConfig.payment.adyenCc.generationTime;
},
hasVerification: function () { hasVerification: function () {
return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction; return window.checkoutConfig.payment.adyenOneclick.hasCustomerInteraction;
}, },
......
...@@ -172,15 +172,6 @@ ...@@ -172,15 +172,6 @@
<!-- /ko --> <!-- /ko -->
<input type="hidden"
name="payment[generationtime]"
class="input-text"
value=""
data-encrypted-name="generationtime"
data-bind="attr: {id: getCode() + '_generationtime', 'data-container': getCode() + '-generationtime'},
value: getGenerationTime()"
/>
</fieldset> </fieldset>
</form> </form>
......
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