remove throttler

This commit is contained in:
SennayT
2026-07-14 10:30:22 +03:00
parent 3aa4451e00
commit 8f45d7ae1f
7 changed files with 1094 additions and 760 deletions

View File

@@ -41,7 +41,7 @@ import { PASSENGER_PERMS } from "../../seed/passenger-permissions.registry";
@ApiTags("Payment")
@Controller("payments")
@Throttle({ strict: { limit: 20, ttl: 60_000 } })
// @Throttle({ strict: { limit: 20, ttl: 60_000 } })
export class PaymentsController {
constructor(private service: PaymentsService) {}
@@ -79,7 +79,7 @@ export class PaymentsController {
}
@Post("initiate")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary: "Initiate payment with nationality-based payment methods",
description: `Initiates payment for a booking with support for multiple payment providers:\n\n**Ethiopian Payment Methods:**\n- TELEBIRR - Ethiopia's leading mobile money\n- CBE_BIRR - Commercial Bank of Ethiopia\n- EBIRR - Electronic payment gateway\n\n**Djiboutian Payment Methods:**\n- WAAFI - Djibouti's mobile money service\n\n**International Payment Methods:**\n- CARD - Visa, Mastercard\n- WALLET - Internal wallet balance\n\n**Multi-Currency:**\n- All transactions processed in ETB\n- Display amounts in ETB, DJF, or USD\n- Real-time exchange rate conversion`,
@@ -89,14 +89,14 @@ export class PaymentsController {
}
@Get("intents/:bookingId")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({ summary: "Get payment intent status for a booking" })
getIntent(@Param("bookingId") bookingId: string) {
return this.service.getIntentByBookingId(bookingId);
}
@Post(":bookingId/confirm")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary: "Confirm an OTP-debit payment (CAC Bank)",
description:
@@ -111,7 +111,7 @@ export class PaymentsController {
}
@Get("waafi/return")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary:
"DEMO ONLY — confirm a Waafi payment from the browser-return params and return JSON for the " +
@@ -142,7 +142,10 @@ export class PaymentsController {
}
@Post(":bookingId/force-confirm")
@PassengerStaff([PASSENGER_PERMS.payments.manageMethods, PASSENGER_PERMS.admin])
@PassengerStaff([
PASSENGER_PERMS.payments.manageMethods,
PASSENGER_PERMS.admin,
])
@ApiBearerAuth("IAM-auth")
@ApiOperation({
summary: "Force-confirm payment & generate ticket (back-office only)",
@@ -150,12 +153,18 @@ export class PaymentsController {
"Marks the payment as SUCCEEDED, confirms the booking, and generates the ticket. " +
"Use when a vendor payment completed but the webhook was never delivered. Idempotent.",
})
forceConfirm(@Param("bookingId") bookingId: string, @Body() dto: ForceConfirmDto) {
forceConfirm(
@Param("bookingId") bookingId: string,
@Body() dto: ForceConfirmDto,
) {
return this.service.forceConfirmPayment(bookingId, dto);
}
@Post("methods")
@PassengerStaff([PASSENGER_PERMS.payments.manageMethods, PASSENGER_PERMS.admin])
@PassengerStaff([
PASSENGER_PERMS.payments.manageMethods,
PASSENGER_PERMS.admin,
])
@ApiBearerAuth("IAM-auth")
@ApiOperation({
summary: "Add a payment system to the platform catalog (admin only)",
@@ -165,17 +174,23 @@ export class PaymentsController {
}
@Patch("methods/:id")
@PassengerStaff([PASSENGER_PERMS.payments.manageMethods, PASSENGER_PERMS.admin])
@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>) {
updateMethod(
@Param("id") id: string,
@Body() dto: Partial<AddPaymentMethodDto>,
) {
return this.service.updatePaymentMethod(id, dto);
}
@Get("methods")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary: "List payment systems supported by the platform",
description:
@@ -183,14 +198,12 @@ export class PaymentsController {
})
@ApiQuery({ name: "region", enum: PaymentRegionEnum, required: false })
@ApiOkResponse({ type: [SupportedPaymentMethodDto] })
getMethods(
@Query("region") region?: PaymentRegionEnum,
) {
getMethods(@Query("region") region?: PaymentRegionEnum) {
return this.service.getSupportedPaymentMethods(region);
}
@Get("booking-amount")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary: "Get booking amount in a specific currency",
description:
@@ -199,7 +212,12 @@ export class PaymentsController {
"Amounts are returned in major currency units (e.g. 162.50 DJF, not centimes).",
})
@ApiQuery({ name: "bookingId", required: true, description: "Booking UUID" })
@ApiQuery({ name: "currency", required: true, example: "DJF", description: "Target currency: ETB, DJF, or USD" })
@ApiQuery({
name: "currency",
required: true,
example: "DJF",
description: "Target currency: ETB, DJF, or USD",
})
@ApiOkResponse({ type: BookingAmountResponseDto })
getBookingAmount(
@Query("bookingId") bookingId: string,
@@ -209,7 +227,7 @@ export class PaymentsController {
}
@Get("checkout")
@SetMetadata('isPublic', true)
@SetMetadata("isPublic", true)
@ApiOperation({
summary: "Browser checkout redirect",
description: