Open blimpich opened 4 weeks ago
Whoops! This issue is 2 days overdue. Let's get this updated quick!
Eep! 4 days overdue now. Issues have feelings too...
Still overdue 6 days?! Let's take care of this!
10 days overdue. Is anyone even seeing these? Hello?
12 days overdue now... This issue's end is nigh!
Skimming for issues I can take... Do you still see this happening? Just from the refund that I got for testing that other thing (ha), I see the correct date:
@dangrous huh, not sure! Where did you do the refund from? Was it from supportal or the stripe dashboard? I think the date is only wrong when we refund directly via stripe, which is what the repro steps simulate. But I haven't tried repro-ing since I created this issue so maybe not.
Can you try the repro steps and see if it reproduces?
oh interesting. Yeah it was via supportal. If I have time today I'll try to go fully through the steps! It was giving me a bit of trouble on Friday but I've rebuilt since then so it's maybe better haha
eyyy finally managed to reproduce. Looking into it now.
Okay so it's this line: https://github.com/Expensify/Auth/blob/ce419dee8d3327b51569f728ce3da131b90f628b/auth/command/ProcessStripeWebhook.cpp#L198
Basically SComposeTime deals with usecs, not regular seconds, so it's not correctly parsing the date response from Stripe (i.e. it's saying 1000x less time has passed).
I just need to figure out the right function to use to parse, I'm sure we have one in there.
Technically can fix by multiplying the purchase date by (uint64_t)1000000
but i feel like there's probably a better way
ugh I would prefer not to have to create a third set of test accounts and real transactions on my real card for this.
@trjExpensify any chance you know of a way we could just double check that any real refunds we're already sending out are appropriately timestamped? Check with concierge agents maybe?
It should be all set, but I'd like to QA to confirm
Hm, any manual refund requests should get a GH created to process by Conci. Doesn't look like we've had any new ones since this was deployed: https://github.com/search?q=repo%3AExpensify%2FExpensify+refund+request&type=issues
So I think our best bet is to look for refunds in the logs probably, yeah?
Notification_RefundReceipt
here: https://github.com/Expensify/Web-Expensify/blob/37dbd9df87740a4c4afd91c4edd86862b9090113/lib/UserAPI.php#L3452-L3489Hope that helps!
Ooh great, that's helpful! But shows that we might be using the wrong date here - the date of the charge, not the date of the refund itself. So, we're close, but no cigar (might not have noticed this testing since the date of the charge and the date of the refund were the same).
@blimpich can you chime in on what we intended here? Asking because we specifically use notification["refundDate"] = originalPurchaseDate;
here. Was that intentional? Should the refund date equal the original purchase date? Or is that a separate bug that is now surfaced and needs to be fixed?
Yeah, I think it's inaccurate to say "Refunded on X date" and that date not be the date of refund. So we should change that to the date refunded, as it's in the design doc. 👍
Worth noting we're adding the card number portion to this as well, so it'll be even weirder to have "Refunded on July 1st 2024 to card ending in 1234"
@blimpich can you chime in on what we intended here? Asking because we specifically use notification["refundDate"] = originalPurchaseDate; here. Was that intentional? Should the refund date equal the original purchase date? Or is that a separate bug that is now surfaced and needs to be fixed?
Not intentional, very much a mistake 🫠
Okay cool I'll see if I can spin up a fix for this shortly! I think we can just use SComposeTime("%Y-%m-%d %H:%M:%S UTC", STimeNow())
- @blimpich would this code ever run at a different time other than immediately after the refund is processed? Trying to figure out if that would be sufficient. I can also see if there's another piece of the data returned from Stripe that I can use.
I think STimeNow()
is perfectly sufficient 👍
okay that PR is up
Once that's on prod I'll use your test steps @trjExpensify to see if we're good to go!
Dope, we're deploying auth now, so shouldn't be too long. 👍
Looks like its deployed 🎉
doesn't look like we've processed a refund yet if I'm calculating UTC correctly. I believe we're shooting for something after July 18 6:40PM UTC and the last one we have is 2024-07-18 16:20:43.
I mean hopefully we never need to refund anyone ever again and we NEVER KNOW
semi-related - I would LOVE a toggle in log search to show times in local time.
Move to the UK man.. for half the year you'll be on UTC. 😂
Problem:
Refund date is showing at Jan 1st 1970 on refund receipts.
Reproduction steps:
5
)script/clitools.sh billingrun
php script/notifyall.sh
from inside the VM in Web-Expensifyscript/bwm.sh
is running so that the subsequent BillingReceiptUploader job can completepurchases
table at the most recent purchase (should be the one you just made) and find thetransactionID
value. It'll be a hashed value, not the actualtransactionID
.YOUR_TRANSACTION_ID_HERE
with your actual transaction id that you got from thepurchases
tableProcessStripeWebhook eventType: charge.refunded signature: whsec_8V8HYuNqeMDTgMUdwdGxWygHda7tE2Sx payload: {"id":"evt_1CA23QKMVuTn5qYVgNZ14TBq","created":1522096592,"data":{"object":{"id":"YOUR_TRANSACTION_ID_HERE","amount":900,"amount_refunded":900,"created":1522096552,"currency":"usd","description":"Refund Test","refunds":{"object":"list","data":[{"id":"re_1CA23QKMVuTn5qYVUgS8I1Mr","object":"refund","amount":900,"balance_transaction":"txn_1CA23QKMVuTn5qYVQXlC0CAx","charge":"ch_1CA22mKMVuTn5qYVQitM5R1L","created":1522096592,"currency":"usd","metadata":[],"reason":"requested_by_customer","receipt_number":null,"status":"succeeded"}],"has_more":false,"total_count":1}}},"type":"charge.refunded"} countryISO: US