mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-02 04:33:40 +00:00
add test payment event
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import { ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsEnum,
|
||||
IsIn,
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsPositive,
|
||||
IsString,
|
||||
} from "class-validator";
|
||||
import {
|
||||
PaymentEventType,
|
||||
PaymentReferenceType,
|
||||
PaymentService,
|
||||
ProviderMethod,
|
||||
} from "@edr/types";
|
||||
|
||||
/**
|
||||
* Body for the dev-only POST /test/payment-event endpoint. Every field is optional — the
|
||||
* controller fills sensible defaults so an empty `{}` publishes a `payment.succeeded` to the
|
||||
* passenger queue. Set `referenceId` to a real bookingId to exercise the consumer's side effects
|
||||
* (seat confirm / ticket issue); leave it blank to only prove RabbitMQ delivery.
|
||||
*/
|
||||
export class TestPaymentEventDto {
|
||||
@ApiPropertyOptional({
|
||||
enum: ["payment.succeeded", "payment.failed"],
|
||||
default: "payment.succeeded",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsIn(["payment.succeeded", "payment.failed"])
|
||||
eventType?: PaymentEventType;
|
||||
|
||||
@ApiPropertyOptional({ enum: PaymentService, default: PaymentService.PASSENGER })
|
||||
@IsOptional()
|
||||
@IsEnum(PaymentService)
|
||||
service?: PaymentService;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
enum: PaymentReferenceType,
|
||||
default: PaymentReferenceType.BOOKING,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEnum(PaymentReferenceType)
|
||||
referenceType?: PaymentReferenceType;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "Domain order id (e.g. bookingId). Defaults to a random uuid.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
referenceId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Defaults to a random uuid." })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
intentId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Defaults to test-<random>." })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
merchantOrderId?: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: ProviderMethod, default: ProviderMethod.WAAFI })
|
||||
@IsOptional()
|
||||
@IsEnum(ProviderMethod)
|
||||
provider?: ProviderMethod;
|
||||
|
||||
@ApiPropertyOptional({ default: 10000, description: "Amount in minor units." })
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
amountMinor?: number;
|
||||
|
||||
@ApiPropertyOptional({ default: "ETB" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
currency?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Only used for payment.succeeded." })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
providerTxnId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Only used for payment.failed." })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
failureCode?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "Only used for payment.failed." })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
failureMessage?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user