mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 01:18:18 +00:00
Merge branch 'alpha' of https://github.com/Tria-plc/edr-platform into alpha
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Post, Patch, UseGuards, Query, Req, BadRequestException, SetMetadata } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Post, Patch, UseGuards, Query, Req, SetMetadata, BadRequestException, UnauthorizedException } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiResponse, ApiQuery, ApiBody } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiBearerAuth, ApiResponse, ApiQuery, ApiBody } from '@nestjs/swagger';
|
||||||
|
import { IsPublic } from '@tria-plc/api-common/modules/auth/decorators/public.decorator';
|
||||||
import { Throttle } from '@nestjs/throttler';
|
import { Throttle } from '@nestjs/throttler';
|
||||||
import { BookingsService } from './bookings.service';
|
import { BookingsService } from './bookings.service';
|
||||||
import { GuestBookingService } from './guest-booking.service';
|
import { GuestBookingService } from './guest-booking.service';
|
||||||
@@ -35,13 +36,13 @@ export class BookingsController {
|
|||||||
@Query('page') page?: string,
|
@Query('page') page?: string,
|
||||||
@Query('pageSize') pageSize?: string,
|
@Query('pageSize') pageSize?: string,
|
||||||
) {
|
) {
|
||||||
const passengerId = req.user?.passengerId;
|
const iamUserId = req.user?.id;
|
||||||
if (!passengerId) throw new Error('Passenger ID not found in token');
|
if (!iamUserId) throw new UnauthorizedException();
|
||||||
return this.service.findByPassengerId(passengerId, {
|
return this.service.findByIamUserId(iamUserId, {
|
||||||
search,
|
search,
|
||||||
status,
|
status,
|
||||||
page: page ? parseInt(page) : 1,
|
page: page ? parseInt(page) : 1,
|
||||||
pageSize: pageSize ? parseInt(pageSize) : 20
|
pageSize: pageSize ? parseInt(pageSize) : 20
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ export class BookingsService {
|
|||||||
private readonly fareEngine: FareEngineService,
|
private readonly fareEngine: FareEngineService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
async findByIamUserId(iamUserId: string, filters: BookingFilters = {}) {
|
||||||
|
const passenger = await this.prisma.passenger.findUniqueOrThrow({ where: { iamUserId }, select: { id: true } });
|
||||||
|
return this.findByPassengerId(passenger.id, filters);
|
||||||
|
}
|
||||||
|
|
||||||
async findByPassengerId(passengerId: string, filters: BookingFilters = {}) {
|
async findByPassengerId(passengerId: string, filters: BookingFilters = {}) {
|
||||||
const { search, status, page = 1, pageSize = 20 } = filters;
|
const { search, status, page = 1, pageSize = 20 } = filters;
|
||||||
const skip = (page - 1) * pageSize;
|
const skip = (page - 1) * pageSize;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default registerAs("dmoney", () => ({
|
|||||||
returnUrl: process.env.DMONEY_RETURN_URL ?? "",
|
returnUrl: process.env.DMONEY_RETURN_URL ?? "",
|
||||||
timeoutExpress: process.env.DMONEY_TIMEOUT_EXPRESS ?? "120m",
|
timeoutExpress: process.env.DMONEY_TIMEOUT_EXPRESS ?? "120m",
|
||||||
language: process.env.DMONEY_LANGUAGE ?? "en",
|
language: process.env.DMONEY_LANGUAGE ?? "en",
|
||||||
currency: process.env.DMONEY_CURRENCY ?? "FDJ",
|
currency: process.env.DMONEY_CURRENCY ?? "DJF",
|
||||||
privateKey: process.env.DMONEY_PRIVATE_KEY ?? "",
|
privateKey: process.env.DMONEY_PRIVATE_KEY ?? "",
|
||||||
publicKey: process.env.DMONEY_PUBLIC_KEY ?? "",
|
publicKey: process.env.DMONEY_PUBLIC_KEY ?? "",
|
||||||
insecureTls: process.env.DMONEY_INSECURE_TLS === "true",
|
insecureTls: process.env.DMONEY_INSECURE_TLS === "true",
|
||||||
|
|||||||
@@ -206,18 +206,16 @@ export class DMoneyProvider implements PaymentProvider {
|
|||||||
appid: this.merchantAppId,
|
appid: this.merchantAppId,
|
||||||
merch_code: this.merchantCode,
|
merch_code: this.merchantCode,
|
||||||
merch_order_id: input.merchantOrderId,
|
merch_order_id: input.merchantOrderId,
|
||||||
trade_type: "Checkout" as const,
|
trade_type: "WebCheckout" as const,
|
||||||
|
business_type: "OnlineMerchant" as const,
|
||||||
title: `${input.orderRef}`,
|
title: `${input.orderRef}`,
|
||||||
total_amount: totalAmount,
|
total_amount: totalAmount,
|
||||||
trans_currency: 1 == 1 ? "DJF": this.currency,
|
trans_currency: this.currency,
|
||||||
timeout_express: this.timeoutExpress,
|
timeout_express: this.timeoutExpress,
|
||||||
...(redirectUrl ? { redirect_url: redirectUrl } : {}),
|
...(redirectUrl ? { redirect_url: redirectUrl } : {}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("\n\n\n")
|
|
||||||
console.log(req)
|
|
||||||
console.log("\n\n\n")
|
|
||||||
const sign = signRequestObject(
|
const sign = signRequestObject(
|
||||||
req as unknown as Record<string, unknown>,
|
req as unknown as Record<string, unknown>,
|
||||||
this.privateKey,
|
this.privateKey,
|
||||||
@@ -265,7 +263,7 @@ export class DMoneyProvider implements PaymentProvider {
|
|||||||
`sign=${sign}`,
|
`sign=${sign}`,
|
||||||
"sign_type=SHA256WithRSA",
|
"sign_type=SHA256WithRSA",
|
||||||
"version=1.0",
|
"version=1.0",
|
||||||
"trade_type=Checkout",
|
"trade_type=WebCheckout",
|
||||||
`language=${this.language}`,
|
`language=${this.language}`,
|
||||||
].join("&");
|
].join("&");
|
||||||
return `${this.webBaseUrl}/payment/web/paygate?${query}`;
|
return `${this.webBaseUrl}/payment/web/paygate?${query}`;
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ export interface DMoneyPreOrderBizContent {
|
|||||||
appid: string;
|
appid: string;
|
||||||
merch_code: string;
|
merch_code: string;
|
||||||
merch_order_id: string;
|
merch_order_id: string;
|
||||||
trade_type: 'Checkout';
|
trade_type: 'WebCheckout';
|
||||||
|
business_type: 'OnlineMerchant';
|
||||||
title: string;
|
title: string;
|
||||||
total_amount: string;
|
total_amount: string;
|
||||||
trans_currency: string;
|
trans_currency: string;
|
||||||
timeout_express: string;
|
timeout_express: string;
|
||||||
business_type?: string;
|
|
||||||
redirect_url?: string;
|
redirect_url?: string;
|
||||||
callback_info?: string;
|
callback_info?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user