Skip to content

Commit

Permalink
Correct config retrieval for Amazon Sign In
Browse files Browse the repository at this point in the history
  • Loading branch information
sgabhart22 committed May 5, 2022
1 parent 0e19c93 commit 6962ebf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Controller/Checkout/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Model/CheckoutSessionManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/web/js/action/checkout-session-config-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/amazon-login-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define([
publicKeyId: checkoutSessionConfig['public_key_id']
}
});
}.bind(this));
}.bind(this), false);
},

/**
Expand Down

0 comments on commit 6962ebf

Please sign in to comment.