feat: ( payment ) add changing payment for booking

This commit is contained in:
Abubeker Yasin
2026-07-08 23:05:42 +03:00
parent 78bee6dbe3
commit 01e24e1aae
2 changed files with 29 additions and 3 deletions

View File

@@ -338,7 +338,14 @@ export class PaymentsService {
};
return this.prisma.paymentIntent.upsert({
where: { bookingId },
update: data,
// amountMinor/currency are refreshed on update too: a cross-currency method switch
// (e.g. Waafi/USD → Telebirr/ETB) re-initiates over the same row, and the projection
// must reflect the currency the new provider actually charges — not the first one's.
update: {
...data,
amountMinor: snapshot.amountMinor,
currency: snapshot.currency,
},
create: {
bookingId,
amountMinor: snapshot.amountMinor,