minor update

This commit is contained in:
Tria
2026-06-06 08:13:38 +03:00
parent ebe59f491a
commit 828f93d160
5 changed files with 28 additions and 39 deletions

View File

@@ -28,7 +28,7 @@ export class PaymentService {
])
}
async pay(redirectBaseURL: string, amount: number, currency: CurrencyType, method: PaymentMethod, reason: string, cb: (qr: QueryRunner) => Promise<{ id: string, type: PaymentEntity["type"] }>, payform: PaymentPlatform = "web"): Promise<{
async pay(amount: number, currency: CurrencyType, method: PaymentMethod, reason: string, type: PaymentEntity["type"], cb: (qr: QueryRunner) => Promise<{ id: string, type: PaymentEntity["type"] }>, payform: PaymentPlatform = "web"): Promise<{
refId: string,
clientAction: ClientAction,
status: PaymentEntity["status"],
@@ -43,9 +43,16 @@ export class PaymentService {
throw new NotFoundException("strategy not found")
}
const orderId = `freigh${Date.now()}${crypto.randomBytes(4).toString('hex')}` //todo: make it dynamic
const orderId = `${Date.now()}${crypto.randomBytes(4).toString('hex')}` //todo: make it dynamic
let redirectUrl: string;
switch (type) {
case "booking":
redirectUrl = `http://localhost:3001/api/payments/receipts/${orderId}/html`
break;
}
const paymentResp = await strategy.pay({
redirectBaseURL,
redirectUrl,
amountMinor: amount,
currency: currency,
merchantOrderId: orderId,
@@ -104,7 +111,7 @@ export class PaymentService {
throw new BadRequestException()
}
const filePath = path.join(__dirname, "templates", "ceiepts.hbs");
const filePath = path.join(__dirname, "templates", "receipt.hbs");
if (!fs.existsSync(filePath)) {
throw new InternalServerErrorException()
}