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