mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
payemnt
This commit is contained in:
@@ -289,20 +289,21 @@ export class PaymentService {
|
||||
providerTxnId?: string;
|
||||
paidAt?: Date;
|
||||
}): Promise<{ alreadyFinalized: boolean }> {
|
||||
const intent = await this.paymentRepo.findOneBy({ id: input.intentId });
|
||||
if (!intent) throw new NotFoundException("PaymentIntent not found");
|
||||
if (intent.status === "success") return { alreadyFinalized: true };
|
||||
// const intent = await this.paymentRepo.findOneBy({ id: input.intentId });
|
||||
// if (!intent) throw new NotFoundException("PaymentIntent not found");
|
||||
// if (intent.status === "success") return { alreadyFinalized: true };
|
||||
|
||||
const paidAt = input.paidAt ?? new Date();
|
||||
|
||||
// Every booking is a real shipment now (contracts are a separate aggregate),
|
||||
// so payment always settles the booking to PAID and enters allocation.
|
||||
await this.datasource.transaction(async (mg) => {
|
||||
await mg.update(
|
||||
PaymentEntity,
|
||||
{ id: intent.id },
|
||||
{ status: "success", paidAt, transactionId: input.providerTxnId ?? intent.transactionId },
|
||||
);
|
||||
// await mg.update(
|
||||
// PaymentEntity,
|
||||
// // { id: intent.id },
|
||||
// {id:input.intentId},
|
||||
// { status: "success", paidAt, transactionId: input.providerTxnId ?? intent.transactionId },
|
||||
// );
|
||||
await mg.update(
|
||||
Booking,
|
||||
{ id: input.bookingId },
|
||||
|
||||
Reference in New Issue
Block a user