✅ order creation logic fix, refactor & cleanup on admin end
This commit is contained in:
@@ -22,8 +22,8 @@ export class PaymentInfoRepository {
|
||||
cardholderName: data.cardDetails.cardholderName,
|
||||
expiry: data.cardDetails.expiry,
|
||||
cvv: data.cardDetails.cvv,
|
||||
flightTicketInfoId: data.flightTicketInfoId,
|
||||
|
||||
productId: data.productId,
|
||||
orderId: data.orderId,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
@@ -45,6 +45,20 @@ export class PaymentInfoRepository {
|
||||
return { data: parsed.data };
|
||||
}
|
||||
|
||||
async updatePaymentInfoOrderId(
|
||||
id: number,
|
||||
oid: number,
|
||||
): Promise<Result<number>> {
|
||||
Logger.info(`Updating payment info with id ${id} to order id ${oid}`);
|
||||
const out = await this.db
|
||||
.update(paymentInfo)
|
||||
.set({ orderId: oid })
|
||||
.where(eq(paymentInfo.id, id))
|
||||
.execute();
|
||||
Logger.debug(out);
|
||||
return { data: id };
|
||||
}
|
||||
|
||||
async deletePaymentInfo(id: number): Promise<Result<boolean>> {
|
||||
Logger.info(`Deleting payment info with id ${id}`);
|
||||
const out = await this.db
|
||||
|
||||
Reference in New Issue
Block a user