diff --git a/Controller/Checkout/Config.php b/Controller/Checkout/Config.php index 429e09f6..fc6294b1 100644 --- a/Controller/Checkout/Config.php +++ b/Controller/Checkout/Config.php @@ -46,7 +46,7 @@ public function __construct( */ public function execute() { - $omitPayloads = isset($this->getRequest()->getParams()['omit_payloads']); + $omitPayloads = filter_var($this->getRequest()->getParams()['omit_payloads'], FILTER_VALIDATE_BOOLEAN); $data = $this->amazonCheckoutSession->getConfig($omitPayloads); return $this->resultJsonFactory->create()->setData($data); } diff --git a/Model/CheckoutSessionManagement.php b/Model/CheckoutSessionManagement.php index 49de814f..005d9646 100755 --- a/Model/CheckoutSessionManagement.php +++ b/Model/CheckoutSessionManagement.php @@ -413,7 +413,7 @@ protected function convertToMagentoAddress(array $address, $isShippingAddress = /** * {@inheritdoc} */ - public function getConfig($cartId = null, $omitPayloads = false) + public function getConfig($cartId = null, $omitPayloads = true) { $result = []; $quote = $this->session->getQuoteFromIdOrSession($cartId); diff --git a/view/frontend/web/js/action/checkout-session-config-load.js b/view/frontend/web/js/action/checkout-session-config-load.js index 6510ae6b..2561af37 100644 --- a/view/frontend/web/js/action/checkout-session-config-load.js +++ b/view/frontend/web/js/action/checkout-session-config-load.js @@ -29,11 +29,11 @@ define([ } return localStorage; }; - return function (callback) { + return function (callback, omitPayloads = true) { var cartId = customerData.get('cart')()['data_id'] || window.checkout.storeId; var config = getLocalStorage().get('config') || false; if (!config) { - remoteStorage.get(url.build('amazon_pay/checkout/config?omit_payloads=true')).done(function (config) { + remoteStorage.get(url.build(`amazon_pay/checkout/config?omit_payloads=${omitPayloads}`)).done(function (config) { getLocalStorage().set('cart_id', cartId); getLocalStorage().set('config', config); diff --git a/view/frontend/web/js/amazon-login-button.js b/view/frontend/web/js/amazon-login-button.js index 8025bfce..3ce15061 100755 --- a/view/frontend/web/js/amazon-login-button.js +++ b/view/frontend/web/js/amazon-login-button.js @@ -46,7 +46,7 @@ define([ publicKeyId: checkoutSessionConfig['public_key_id'] } }); - }.bind(this)); + }.bind(this), false); }, /**