Skip to content

Commit

Permalink
M1: Update address (#31)
Browse files Browse the repository at this point in the history
* M1: Update address
+ update version
+ update one composer dependency
+ update one unit test

* M1-40: Fix calculation to avoid decimal rounding issue

* M1-40 : Fix rounding calculation
+ adjust unit test dataset

* M1-40 : Fix to comply CS check

---------

Co-authored-by: Vincent Boulanger <[email protected]>
  • Loading branch information
BoulangerV and Vincent Boulanger authored May 4, 2023
1 parent fba5c62 commit 707db52
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
### [1.8.3](https://github.com/ratepay/php-library/compare/1.8.2...1.8.3) (2023-01-16)

### Update
* Change Ratepay address

### [1.8.2](https://github.com/ratepay/php-library/compare/1.8.1...1.8.2) (2022-09-05)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RatePAY Integration Toolkit for PHP
| Repository | Common RatePAY PHP Library
|------------|----------
| Author | Eduardo Iriarte-Mendez
| Version | `1.8.2` [Changelog](./CHANGELOG.md)
| Version | `1.8.3` [Changelog](./CHANGELOG.md)
| Link | http://www.ratepay.com
| Mail | [email protected]

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ratepay/php-library",
"description": "Ratepay Payment-API PHP Library",
"version": "1.8.2",
"version": "1.8.3",
"license": "MIT",
"type": "library",
"homepage": "https://ratepay.gitbook.io/docs/",
Expand All @@ -28,7 +28,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17@dev",
"donatj/mock-webserver": "dev-master",
"donatj/mock-webserver": "~2.5.0",
"phpunit/phpunit": "^6.5||^7.5||^8.5||^9.0"
},
"minimum-stability": "dev",
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Request/SubModel/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Constants
/**
* Library version.
*/
const LIBRARY_VERSION = '1.8.2';
const LIBRARY_VERSION = '1.8.3';

/**
* Supported RatePAY API version.
Expand Down
6 changes: 4 additions & 2 deletions src/Service/Math.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ public static function isZero($number, $precission = 2)
*/
public static function netToGross($netPrice, $taxPercentage, $round = false)
{
$withTax = $netPrice + $netPrice * $taxPercentage / 100;
$withTax = $netPrice * (1 + $taxPercentage / 100);

if (!$round) {
return $withTax;
$localInfo = localeconv();

return floatval(number_format($withTax, 5, $localInfo['decimal_point'], $localInfo['thousands_sep']));
}

$rounded = round($withTax, 2);
Expand Down
4 changes: 2 additions & 2 deletions src/locales/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
'rp_reason_code_translation_699' => 'Die Rate ist zu hoch f&uuml;r die minimal verf&uuml;gbare Laufzeit. Die Rate wurde verringert.',
'rp_switch_payment_type_bank_transfer' => 'Ich m&ouml;chte die Ratenzahlungen selbst vornehmen und nicht per Lastschrift begleichen.',
'rp_switch_payment_type_direct_debit' => 'Ich m&ouml;chte die Ratenzahlungen bequem per Lastschrift begleichen.',
'rp_address' => 'Ratepay GmbH, Franklinstra&szlig;e 28-29, 10587 Berlin',
'wcd_address' => 'Ratepay GmbH, Franklinstra&szlig;e 28-29, 10587 Berlin',
'rp_address' => 'Ratepay GmbH, Ritterstra&szlig;e 12-14, 10969 Berlin',
'wcd_address' => 'Ratepay GmbH, Ritterstra&szlig;e 12-14, 10969 Berlin',
'rp_creditor' => 'Gl&auml;ubiger-ID',
'rp_creditor_id' => 'DE39RPY00000568463',
'wcd_creditor_id' => 'DE39RPY00000568463',
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
'rp_reason_code_translation_699' => 'The instalment is too high for the minimum available runtime. The instalment has been reduced.',
'rp_switch_payment_type_bank_transfer' => 'I would like to make the instalments myself and not pay by direct debit',
'rp_switch_payment_type_direct_debit' => 'I would like to pay the instalments conveniently by direct debit',
'rp_address' => 'RatePAY GmbH, Franklinstra&szlig;e 28-29, 10587 Berlin',
'wcd_address' => 'RatePAY GmbH, Franklinstra&szlig;e 28-29, 10587 Berlin',
'rp_address' => 'RatePAY GmbH, Ritterstra&szlig;e 12-14, 10969 Berlin',
'wcd_address' => 'RatePAY GmbH, Ritterstra&szlig;e 12-14, 10969 Berlin',
'rp_creditor' => 'Creditor ID',
'rp_creditor_id' => 'DE39RPY00000568463',
'wcd_creditor_id' => 'DE39RPY00000568463',
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/Service/MathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function provideNatPricesWithTaxRates()
[100, 19, 119],
[100, 0, 100],
[29.99, 2.5, 30.73975],
[1029.99, 2.5, 1055.73975],
[12345.99, 8.9, 13444.78311],
];
}

Expand All @@ -44,6 +46,8 @@ public function provideRoundedNatPricesWithTaxRates()
[100, 19, 119.00],
[100, 0, 100.00],
[29.99, 2.5, 30.74],
[1029.99, 2.5, 1055.74],
[12345.99, 8.9, 13444.78],
];
}

Expand Down

0 comments on commit 707db52

Please sign in to comment.