Repository navigation
feat(mollie): charge an invoice in its billing currency (optional) - #182
Conversation
…ecord it in the shop currency and refund it in the currency paid
…refunds, and nothing changed when it is off
Panelica
left a comment
There was a problem hiding this comment.
Thank you, @ertugrulkeyvan. Off by default, with the payment carrying its own rate in the metadata, this is a careful port of the Stripe option, and the webhook and refund paths read it back the right way.
Two cases need handling before it can go in:
- A billing currency Mollie does not take blocks the payment. Mollie's multicurrency list has 34 currencies and Turkish lira is not one of them. With the option on, a lira-billed invoice is sent in TRY, a currency Mollie does not support, so the customer cannot pay that invoice with Mollie; today it is charged in the shop currency. The option should fall back to the shop currency for a billing currency Mollie does not list.
- Currencies without minor units. Mollie lists JPY and ISK with zero decimals, while
amount.valueis always written with two (1625.00for a yen invoice). Its documentation does not say what it does with that, and neither of us can try it without a live account, so the value should follow the currency's own decimals (or fall back as in 1).
Neither changes anything while the option is off. Could you add both, with a test each?
…e shop currency; amounts follow the currency's decimals
…written without decimals
|
Thank you, both handled:
There is a test for each. Both fail on the previous version of the branch. |
|
Thank you, @ertugrulkeyvan, merged. Mollie can now charge an invoice in its billing currency, off by default; a billing currency Mollie does not take falls back to the shop currency, and amounts are written with the currency's own decimals. Checked before merging: your currency list and the two zero-decimal currencies match Mollie's multicurrency page, the requests with the option off are the ones sent before, your tests fail on |
What
The Stripe option from #172, for Mollie: charge an invoice in the currency the customer is billed in.
With customers billed in their own currency (Setup → Currencies, the invoice's billing stamp), Mollie still charged in the shop currency.
Take a shop that prices in euros and bills a Polish customer in zloty. A €10.00 invoice raised at 4.30 shows zł43.00, but the customer was charged €10.00. Their bank then converted it at its own rate, often with a fee, and the statement matched nothing they had seen.
A new Mollie setting, Charge in the invoice's billing currency, off by default:
1625, not1625.00).One small fix on the way: the pay button said "Pay ", formatted in the shop currency. It now names what is still due, in the currency that will be charged, the same as the Stripe button since #166.
How
MollieModule::billingCharge(),recordedAmount(),billedAmount()andbilledInAnotherCurrency()follow the Stripe module's methods of the same names. They are adapted to Mollie's decimalamount.valueand its payment metadata.capture(),processWebhook(),refund()andgetPaymentForm()use them.descriptionadded in feat(stripe): charge an invoice in its billing currency (optional) #172.docs/guides/payment-gateways.md, with the option.The work is split into five commits: module, docs and tests, then the currency list and decimals from review and their tests.
Tests
tests/Feature/MollieBillingCurrencyTest.php, 12 tests, all against faked API responses. We have no live Mollie account, so this has not been run against Mollie itself.1625.Eight of them fail on
mainor on the first version of this branch. All gateway and payment tests pass (106).Full suite: 4098 passed. The one failure is the
CurrencyAndBackupTestdb backup test, which fails onmaintoo in my local setup.