mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 10:10:57 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -16,6 +16,7 @@ import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as Handlebars from "handlebars";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import { SchedulingStatus } from "@edr/types";
|
||||
import { Booking } from "../bookings/entities/booking.entity";
|
||||
|
||||
type PaymentMethod = PaymentEntity["method"];
|
||||
@@ -168,7 +169,14 @@ export class PaymentService {
|
||||
const ordersStatus = bizContent.order_status;
|
||||
if (ordersStatus == "PAY_SUCCESS") {
|
||||
await this.datasource.transaction(async (mg) => {
|
||||
await mg.update(Booking, { id: resp.refId }, { status: "PAID" });
|
||||
const now = new Date();
|
||||
const holdExpires = new Date(now.getTime() + 3 * 60 * 60 * 1000);
|
||||
await mg.update(Booking, { id: resp.refId }, {
|
||||
status: "PAID",
|
||||
schedulingStatus: SchedulingStatus.Holding,
|
||||
holdStartedAt: now,
|
||||
holdExpiresAt: holdExpires,
|
||||
});
|
||||
await mg.update(PaymentEntity, { id: resp.id }, { status: "success" });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user