From 500c46fac1a6a7ee2c7e7d67df5e0303ff59bda6 Mon Sep 17 00:00:00 2001 From: Mario Lorenz Date: Fri, 17 Jan 2025 15:18:27 +0100 Subject: [PATCH 1/4] Prevent the shop from breaking on misconfiguration or if the amazon service is down --- src/Core/ViewConfig.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Core/ViewConfig.php b/src/Core/ViewConfig.php index 9dde1fe..f93476b 100644 --- a/src/Core/ViewConfig.php +++ b/src/Core/ViewConfig.php @@ -366,8 +366,13 @@ public function getPayloadSignIn(): string */ public function getSignature(string $payload): string { - $amazonClient = OxidServiceProvider::getAmazonClient(); - return $amazonClient->generateButtonSignature($payload); + try { + return OxidServiceProvider::getAmazonClient()->generateButtonSignature($payload); + } catch (Exception $exception) { + $logger = new Logger(); + $logger->log('ERROR', $exception->getMessage(), [$exception]); + return ''; + } } /** From ad69984f36c92a76a9aa44fac55c73cd17fa38c0 Mon Sep 17 00:00:00 2001 From: Mario Lorenz Date: Fri, 17 Jan 2025 15:20:16 +0100 Subject: [PATCH 2/4] CHANGELOG --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df1da72..44191e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [3.1.6] - 2024-??-?? +## [3.1.6] - 2025-??-?? - [0007654](https://bugs.oxid-esales.com/view.php?id=7654): Fix Capture type is incorrectly evaluated - [0007636](https://bugs.oxid-esales.com/view.php?id=7636): Fix Refund value can only be entered with a point, semicolon is not possible - [0007685](https://bugs.oxid-esales.com/view.php?id=7685): Smarty-Template Improvements +- Prevent the shop from breaking on misconfiguration or if the amazon service is down. Thanks to https://github.com/GM-Alex ## [3.1.5] - 2024-03-22 From 6edb11a232e2370b79e035016916aa0482db7a22 Mon Sep 17 00:00:00 2001 From: Mario Lorenz Date: Fri, 17 Jan 2025 15:21:44 +0100 Subject: [PATCH 3/4] version Number --- .gitignore | 3 ++- metadata.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5db0622..5e0e70c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ /tests/Codeception/_output/* !tests/Codeception/_output/.gitkeep /tests/reports/* -!tests/reports/.gitkeep \ No newline at end of file +!tests/reports/.gitkeep +/tests/privatekey.pem \ No newline at end of file diff --git a/metadata.php b/metadata.php index 0aaf7f3..feeb2a2 100644 --- a/metadata.php +++ b/metadata.php @@ -60,7 +60,7 @@ 'en' => 'Use of the online payment service from amazon.com' ], 'thumbnail' => 'img/amazon-pay-logo.png', - 'version' => '3.1.6-rc.1', + 'version' => '3.1.6-rc.2', 'author' => 'OXID eSales AG', 'url' => 'https://www.oxid-esales.com', 'email' => 'info@oxid-esales.com', From 9bdd9bb77b3419fd4b646f3f7f21a665a84b850a Mon Sep 17 00:00:00 2001 From: Mario Lorenz Date: Fri, 17 Jan 2025 15:22:05 +0100 Subject: [PATCH 4/4] Response code can possibly be 202 https://developer.amazon.com/docs/amazon-pay-api-v2/checkout-session.html#response-4 --- src/Core/AmazonService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/AmazonService.php b/src/Core/AmazonService.php index bcd1fea..a116c57 100644 --- a/src/Core/AmazonService.php +++ b/src/Core/AmazonService.php @@ -346,7 +346,7 @@ protected function checkAmazonResult(array $result, Basket $basket, LoggerInterf $response = PhpHelper::jsonToArray($result['response']); // in case of error, the resulting structure is different... - if (!isset($result['response'], $result['status']) || $result['status'] !== 200) { + if (!isset($result['response'], $result['status']) || ($result['status'] !== 200 && $result['status'] !== 202)) { $this->showErrorOnRedirect($logger, $result, (string)$basket->getOrderId()); }