Skip to content

Commit

Permalink
Merge pull request #1132 from BearGroup/release/5.13.1
Browse files Browse the repository at this point in the history
Release/5.13.1
  • Loading branch information
Christian Zichichi committed Jun 6, 2022
2 parents af9abfd + c0c09af commit 2f2051f
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 5.13.1
* Fixed issue with invalid array reference if a transaction doesn’t have a charge permission
* Fixed issue with GraphQL config query supporting omitPayloads
* Fixed issue with switching stores to refresh the Amazon Pay button config

## 5.13.0
* Added Graphql support
* Added endpoints to fetch individual config types
Expand Down
19 changes: 13 additions & 6 deletions Model/AsyncManagement/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,19 @@ public function decline($order, $chargeId, $detail)
}
if ($order->canHold() || $order->isPaymentReview()) {
$this->closeLastTransaction($order);
$this->amazonAdapter->closeChargePermission(
$order->getStoreId(),
$order->getPayment()->getAdditionalInformation()['charge_permission_id'],
'Canceled due to capture declined.',
true
);
$chargePermissionId = $order->getPayment()->getAdditionalInformation()['charge_permission_id'] ?? '';
if (!empty($chargePermissionId)) {
$this->amazonAdapter->closeChargePermission(
$order->getStoreId(),
$chargePermissionId,
'Canceled due to capture declined.',
true
);
} else {
$this->asyncLogger->info('Unable to close charge permission for order #' . $order->getIncrementId()
. '; no charge permission ID associated with order');
}

$this->setOrderState($order, 'canceled');
$payment = $order->getPayment();
$transaction = $this->transactionBuilder->setPayment($payment)
Expand Down
3 changes: 2 additions & 1 deletion Model/Resolver/CheckoutSessionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public function __construct(
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
$cartId = $args['cartId'] ?? null;
$omitPayloads = $args['omitPayloads'] ?? false;

$response = $this->checkoutSessionManagement->getConfig($cartId);
$response = $this->checkoutSessionManagement->getConfig($cartId, $omitPayloads);
return array_shift($response);
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh
Magento Version | Github Branch | Latest release
---|---|---
2.2.6 - 2.2.11 (EOL) | [V2checkout-1.2.x](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/V2checkout-1.2.x) | 1.20.0 (EOL)
2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.13.0
2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.13.1

## Release Notes
See [CHANGELOG.md](/CHANGELOG.md)
6 changes: 3 additions & 3 deletions Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="orderNumber" />
<magentoCLI command="amazon:payment:sales:verify-charge-permission" arguments="--orderId {$orderNumber}" stepKey="command" />
<assertEquals stepKey="refIdAssert">
<assertStringContainsString stepKey="seeMerchantReferenceIdMatchesOrderNumber">
<expectedResult type="string">true</expectedResult>
<actualResult type="string">${command}</actualResult>
<expectedResult type="string">true\n</expectedResult>
</assertEquals>
</assertStringContainsString>
</test>
</tests>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amzn/amazon-pay-magento-2-module",
"description": "Official Magento2 Plugin to integrate with Amazon Pay",
"type": "magento2-module",
"version": "5.13.0",
"version": "5.13.1",
"license": [
"Apache-2.0"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type Query {
checkoutSessionConfig(cartId: String): CheckoutSessionConfigOutput
checkoutSessionConfig(cartId: String, omitPayloads: Boolean): CheckoutSessionConfigOutput
@resolver(class:"Amazon\\Pay\\Model\\Resolver\\CheckoutSessionConfig")

checkoutSessionDetails(amazonSessionId: String!, queryTypes: [String!]): CheckoutSessionDetailsOutput
Expand Down
7 changes: 6 additions & 1 deletion view/frontend/web/js/action/checkout-session-config-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ define([
], function ($, _, remoteStorage, url, customerData) {
'use strict';

const storageKey = 'amzn-checkout-session-config';
$('.switcher-option').on('click', function () {
$.localStorage.remove(storageKey);
});

var localStorage = null;
var getLocalStorage = function () {
if (localStorage === null) {
localStorage = $.initNamespaceStorage('amzn-checkout-session-config').localStorage;
localStorage = $.initNamespaceStorage(storageKey).localStorage;
}
return localStorage;
};
Expand Down

0 comments on commit 2f2051f

Please sign in to comment.