Repository navigation
Perfect-AuthNet 1.0.1 fixes how amounts with more than two decimal places are sent. Before, they were handled differently on macOS and Linux. This release makes no API changes.
.package(url: "https://github.com/PerfectlySoft/Perfect-AuthNet.git", from: "1.0.1"),Fixed
- Amounts are rounded to the cent the same way on every platform. 1.0.0 formatted amounts with
NumberFormatter, and Linux's Foundation ignores its two-decimal limit. On Linux,49.995was sent to the gateway unchanged, as"49.995", while macOS sent"50.00". Amounts are now rounded to two places, half-to-even, on both platforms. This is what macOS already did, so macOS output is unchanged. For example,49.995is sent as50.00,49.985as49.98and0.015as0.02. Amounts with two or fewer decimal places are sent exactly as before (40becomes"40.00"). If your prices can have fractions of a cent and you want a different rounding rule, round them yourself before passing them in. (#2)
Verified
All 16 offline tests pass on macOS and on Linux with Swift 6.2 and 6.4, built with warnings as errors. Those tests include 10 new rounding cases and a locale check. Against the 1.0.0 code, 9 of the 10 rounding cases fail on Linux. CI on main (fb52c26) is green across all 8 jobs. As with 1.0.0, the live sandbox tests weren't run for this release.