From e18267e4fd9fb019aeccc23a45d557e08acbb85b Mon Sep 17 00:00:00 2001 From: Alexandru Lighezan Date: Thu, 14 Mar 2024 14:54:39 +0000 Subject: [PATCH 1/2] PLUG-96: Fix loss of precision of float to int conversion on payment amounts --- .github/workflows/phpstan.yml | 4 ++-- .github/workflows/setup-di-compile.yml | 6 ------ Service/Order/MakeRequest.php | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 0a39c4c..b4344de 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -6,8 +6,8 @@ jobs: strategy: matrix: include: - - PHP_VERSION: php81-fpm - MAGENTO_VERSION: 2.4.4 + - PHP_VERSION: php82-fpm + MAGENTO_VERSION: 2.4.6 runs-on: ubuntu-latest steps: diff --git a/.github/workflows/setup-di-compile.yml b/.github/workflows/setup-di-compile.yml index e489892..19fd0e5 100644 --- a/.github/workflows/setup-di-compile.yml +++ b/.github/workflows/setup-di-compile.yml @@ -7,12 +7,6 @@ jobs: fail-fast: false matrix: include: - - PHP_VERSION: php74-fpm - MAGENTO_VERSION: 2.4.3-p1 - - PHP_VERSION: php81-fpm - MAGENTO_VERSION: 2.4.4 - - PHP_VERSION: php81-fpm - MAGENTO_VERSION: 2.4.5 - PHP_VERSION: php82-fpm MAGENTO_VERSION: 2.4.6 runs-on: ubuntu-latest diff --git a/Service/Order/MakeRequest.php b/Service/Order/MakeRequest.php index 0b30a90..81741d9 100644 --- a/Service/Order/MakeRequest.php +++ b/Service/Order/MakeRequest.php @@ -202,7 +202,7 @@ private function getMerchantAccountId(ClientInterface $client, Quote $quote) /** * @param Quote $quote - * + * @param string $merchantAccountId * @return array */ private function prepareData(Quote $quote, string $merchantAccountId): array @@ -210,7 +210,7 @@ private function prepareData(Quote $quote, string $merchantAccountId): array $customerEmail = $quote->getBillingAddress()->getEmail() ?: $quote->getCustomerEmail(); $data = [ - "amount_in_minor" => (int)bcmul((string)$quote->getBaseGrandTotal(), '100'), + "amount_in_minor" => (int) round($quote->getBaseGrandTotal() * 100, 0, PHP_ROUND_HALF_UP), "currency" => $quote->getBaseCurrencyCode(), "payment_method" => [ "provider_selection" => [ From fae143921578aa5ce04fb7c2e3ea67aa6a516fb6 Mon Sep 17 00:00:00 2001 From: Alexandru Lighezan Date: Thu, 14 Mar 2024 15:09:07 +0000 Subject: [PATCH 2/2] PLUG-96: Add changelog file --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6f008f5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres +to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.7] - 2024-03-14 + +### Fixed + +- Payment totals not being rounded up, occasionally leading to a 1p difference + +## [v1.0.6] - 2023-09-13 + +### Changed: + +- Wait for payment status updates on customer checkout +- Admin panel improvements and fixes \ No newline at end of file