Boarding, payment methods, journey direction on seat hold, and more updates

This commit is contained in:
Stephanos A
2026-06-29 08:44:38 +03:00
parent 81ae99cee3
commit c6e56d1c4f
65 changed files with 6437 additions and 1425 deletions

View File

@@ -4,6 +4,7 @@ import {
Get,
HttpStatus,
Param,
Patch,
Post,
Query,
Res,
@@ -123,6 +124,16 @@ export class PaymentsController {
return this.service.addPaymentMethod(dto);
}
@Patch("methods/:id")
@PassengerStaff([PASSENGER_PERMS.payments.manageMethods, PASSENGER_PERMS.admin])
@ApiBearerAuth("IAM-auth")
@ApiOperation({
summary: "Update a payment method configuration (admin only)",
})
updateMethod(@Param("id") id: string, @Body() dto: Partial<AddPaymentMethodDto>) {
return this.service.updatePaymentMethod(id, dto);
}
@Get("methods")
@SetMetadata('isPublic', true)
@ApiOperation({

View File

@@ -473,6 +473,24 @@ export class PaymentsService {
});
}
async updatePaymentMethod(id: string, dto: Partial<AddPaymentMethodDto>) {
const existing = await this.prisma.paymentMethod.findUnique({ where: { id } });
if (!existing) throw new NotFoundException('Payment method not found');
const updateData: any = {};
if (dto.displayName !== undefined) updateData.displayName = dto.displayName;
if (dto.region !== undefined) updateData.region = dto.region as unknown as PaymentRegion;
if (dto.currency !== undefined) updateData.currency = dto.currency;
if (dto.providerId !== undefined) updateData.providerId = dto.providerId;
if (dto.enabled !== undefined) updateData.enabled = dto.enabled;
if (dto.sortOrder !== undefined) updateData.sortOrder = dto.sortOrder;
return this.prisma.paymentMethod.update({
where: { id },
data: updateData,
});
}
getSupportedPaymentMethods(region?: PaymentRegionEnum, currency?: string) {
return this.prisma.paymentMethod.findMany({
where: {