Skip to content

Commit

Permalink
Merge pull request #7 from TrueLayer/feature/PLUG-96
Browse files Browse the repository at this point in the history
PLUG-96: Fix loss of precision of float to int conversion on payment …
  • Loading branch information
lighe authored Mar 15, 2024
2 parents 7d1eb77 + fae1439 commit 962e824
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions Service/Order/MakeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ private function getMerchantAccountId(ClientInterface $client, Quote $quote)

/**
* @param Quote $quote
*
* @param string $merchantAccountId
* @return array
*/
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" => [
Expand Down

0 comments on commit 962e824

Please sign in to comment.