Enhance API documentation tags and improve checkout URL handling in WaafiProvider

This commit is contained in:
Stephanos A
2026-05-24 16:40:50 +03:00
parent 882aef7fcf
commit 80cea364c7
2 changed files with 20 additions and 15 deletions

View File

@@ -210,23 +210,30 @@ Payment providers send notifications to:
{ type: "http", scheme: "bearer", bearerFormat: "JWT", in: "header" },
"JWT-auth",
)
.addTag("Agents", "Counter booking and management")
.addTag("Auth", "Registration and login")
.addTag("Stations", "Station directory")
.addTag("Booking", "Booking lifecycle")
.addTag("Dashboard", "Home dashboard aggregate")
.addTag("Fleet", "Train services and coaches")
.addTag("Fraud Detection", "Fraud detection and monitoring")
.addTag("Live Tracking", "Real-time trip status and crowd signals")
.addTag("Loyalty", "Points, tiers, and rewards")
.addTag("Notifications", "Push and email notifications")
.addTag("Passenger", "Profiles, traveler profiles, saved routes")
.addTag("Payment", "Payment intents and refunds")
.addTag("Payment Webhooks", "Endpoints for payment provider notifications")
.addTag("Promotions", "Promo codes and campaigns")
.addTag("Reports", "Sales and operational reports")
.addTag("Routes", "Route information and management")
.addTag("Schedule", "Trips and fare rules")
.addTag("Search", "Trip search and fare quotes")
.addTag("Seat Classes", "Economy Regular, Economy Bed, VIP Bed")
.addTag("Seats", "Seat maps and holds")
.addTag("Booking", "Booking lifecycle")
.addTag("Payment", "Payment intents and refunds")
.addTag("Tickets", "QR ticket generation and validation")
.addTag("Passenger", "Profiles, traveler profiles, saved routes")
.addTag("Notifications", "Push and email notifications")
.addTag("Loyalty", "Points, tiers, and rewards")
.addTag("Wallet", "Wallet balance and ledger")
.addTag("Promotions", "Promo codes and campaigns")
.addTag("Live Tracking", "Real-time trip status and crowd signals")
.addTag("Segment-based Seats", "Seats assigned and released by trip segments")
.addTag("Stations", "Station directory")
.addTag("Support", "FAQ and chat support")
.addTag("Dashboard", "Home dashboard aggregate")
.addTag("Tickets", "QR ticket generation and validation")
.addTag("Wallet", "Wallet balance and ledger")
//.addServer('http://localhost:4000', 'Development')
// .addServer("https://api.edr-platform.com", "Production")
.build();

View File

@@ -100,7 +100,7 @@ export class WaafiProvider implements PaymentProvider {
}
const transactionId = response.params?.transactionId;
const checkoutUrl = response.params?.checkoutUrl;
const checkoutUrl = response.params?.checkoutUrl || `${this.baseUrl}/checkout?ref=${transactionId}`;
if (!transactionId) {
throw new Error(`Waafi returned no transactionId: ${JSON.stringify(response)}`);
@@ -110,9 +110,7 @@ export class WaafiProvider implements PaymentProvider {
return {
providerOrderId: transactionId,
clientAction: checkoutUrl
? { type: 'REDIRECT', url: checkoutUrl }
: { type: 'NONE' },
clientAction: { type: 'REDIRECT', url: checkoutUrl },
expiresAt,
rawInitiation: {
request: this.sanitize(requestBody),