Page MenuHomePhabricator

Paypal settlement - currency conversions
Closed, ResolvedPublic

Description

We have 2 different types of 'on-the-fly' currency conversions we see in Paypal & the way that makes sense to handle one does not, seem to make sense for the other.

Type 1 - Currency Conversion is converting transaction to Settlement Currency (BRL->USD)
Type 2 - Currency Conversion is a balance transfer (moving funds to where they are needed, disassociated with the transaction it is linked to in the file)

When we get Paypal Settlement reports we get information about the balance & balance movements for 21 settlement currencies. The one currency that appears in the report that we do not get balance information for is BRL

Instead what we see for BRL is that every time there is a BRL transaction there is an immediate transaction converting it to USD and these transactions make up part of the USD batch total. The transfers are directly tied to the initial transaction and a final USD amount can be calculated for the transaction and the fee (this is also what Gravy does in their reconciliation report.)

It looks like this

Donation5050
Transfer to USD-500
Donation1010
Transfer to USD-100

By looking at the corresponsing transfers into USD we calculate the final USD amount and add them to the USD batch

HOWEVER, there is a second type of currency conversion that looks the same but it affects a currency we get settlement information for and create a settlement batch for. For example on 2025/12/01 our TWD account had been reset to 0.

AmountRunning balance
Opening Balance00
Donation156156
Fee- 19137
Chargeback-1111-974
Chargeback fee50-924
Transfer from USD Account924000
Donation312312
Fee-24288

Settled to Bank 288

In this case the transfer amount has no bearing on the Chargeback that it is tied to & it has more in common with the T0201 transfers to the USD account that happen on the last day of each month. These are considered when calculating the batch total not the payouts.

3 Options

  1. Figure out why BRL is different, make it the same as the others and treat currency conversions like balance transfers in all cases
  2. Figure out which is which when processing the file & handle appropriately - we can use the settlement currencies from the footer to tell the difference
  3. Treat BRL as if it were like the others. The issue here is that we lose information. Because Paypal converts BRL to USD we know exactly the final exchange rate - as opposed to the one from Intacct. From an amount point of view this is not material but it might make it harder to validate & validation issues can be expected to cause work (it's easier to deal with things that add up than things that nearly do)
  4. it *might* be able to differentiate between the 2 types based on the reference - checking on this

I do need to check in with Julie on this as she had expected to see BRL in Intacct. Also, if we DID make BRL like all the others ... is it really the ONLY one that is different or just the only one that has happened in the past 4-5 months? (I've been processing PayPal files back to 1 Oct to flush out the anomalies)

Transaction currently messed up https://civicrm.wikimedia.org/civicrm/contact/view/contribution?reset=1&action=view&id=133996632
Batch paypal_20251202_USD

Related Objects

Event Timeline

Change #1248657 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Add additional batch data fields to track remote journals

https://gerrit.wikimedia.org/r/1248657

Subsequent to this I discussed with Julie and she wants us to show BRL batches even though they are zero-d out at the end of the day.

This simplifies it in that all conversion transactions are treated as transfers and are excluded from the batch totals - ie BRL transactions will be in a BRL batch, not the USD batch. The TWD issue should 'go away' once we solve the BRL issue but note

  1. there is no batch total for BRL - we will have to see that there are BRL transactions in the batch & assume that debits will always === credits if no total exists. We only expect this for BRL...
  1. we need to bubble up the exchange rate used as that is the final exchange rate & in this scenario we should push it up to Intacct. Each transaction could have a different exchange rate but we can average over a batch

Change #1249433 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/SmashPig@master] Rework converstion fee handling

https://gerrit.wikimedia.org/r/1249433

Change #1249433 merged by jenkins-bot:

[wikimedia/fundraising/SmashPig@master] Rework conversion transaction handling

https://gerrit.wikimedia.org/r/1249433

Change #1248657 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Add additional batch data fields to track remote journals

https://gerrit.wikimedia.org/r/1248657

XenoRyet set Final Story Points to 2.