-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix paypal adaptive transactions fx rate #8216
Conversation
dc0c4b0
to
ede5860
Compare
// Validate | ||
try { | ||
await models.Transaction.validate(debit, { validateOppositeTransaction: false }); | ||
await models.Transaction.validate(credit, { validateOppositeTransaction: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
@@ -1876,6 +1876,12 @@ export async function payExpense(req: express.Request, args: Record<string, unkn | |||
try { | |||
// Pay expense based on chosen payout method | |||
if (payoutMethodType === PayoutMethodTypes.PAYPAL) { | |||
if (expense.collective.currency !== host.currency) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Script ran successfully, deploying the fix to prod |
Fix opencollective/opencollective#4021
All cases left in DB where PayPal expenses paid manually.
I believe I remember a bug where we would use
USD
as the default currency somewhere in the "Mark as paid" process, which probably messed up most of these expenses. I was not able to find the relevant issue/PR.There are a few (mostly,
opencollective
inc) where I can't really explain what happens, the FX rate was wrong even though we were only usingUSD
.This PR:
1
.host.currency
!==collective.currency
. We know this can cause problems, and since we're Deprecate/Remove PayPal adaptive opencollective#5923 it doesn't seem worth working on a fix.transaction.data.isManual
flag on manually paid expenses, as it would have simplified the investigation to have an easy flag to surface that these expenses were paid manuallyChangelog
When run, the script will impact the following: