chore: complete the payment service
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsEnum, IsInt, IsNotEmpty, IsUUID, IsUrl, Min } from "class-validator";
|
||||
|
||||
import { WalletMessage } from "../../../common/enums/message.enum";
|
||||
import { GatewayEnum } from "../enums/gateway.enum";
|
||||
|
||||
export class DepositDto {
|
||||
@IsNotEmpty({ message: WalletMessage.AMOUNT_REQUIRED })
|
||||
@IsInt({ message: WalletMessage.AMOUNT_MUST_BE_INTEGER })
|
||||
@Min(100_000, { message: WalletMessage.AMOUNT_MINIMUM })
|
||||
@ApiProperty({ description: "Amount to charge", example: 100_000 })
|
||||
amount: number;
|
||||
}
|
||||
|
||||
export class GatewayDepositDto extends DepositDto {
|
||||
@IsNotEmpty({ message: WalletMessage.GATEWAY_REQUIRED })
|
||||
@IsEnum(GatewayEnum)
|
||||
@ApiProperty({ description: "Gateway to use", example: "zarinpal" })
|
||||
gateway: GatewayEnum;
|
||||
}
|
||||
|
||||
export class CardToCardDepositDto extends DepositDto {
|
||||
@IsNotEmpty({ message: WalletMessage.RECEIPT_URL_REQUIRED })
|
||||
@IsUrl({ protocols: ["http", "https"], require_protocol: true }, { message: WalletMessage.RECEIPT_URL_SHOULD_BE_URL })
|
||||
@ApiProperty({ description: "the " })
|
||||
transferReceiptUrl: string;
|
||||
|
||||
@IsNotEmpty({ message: WalletMessage.BANK_ACCOUNT_ID_REQUIRED })
|
||||
@IsUUID("4", { message: WalletMessage.BANK_ACCOUNT_ID_SHOULD_BE_UUID })
|
||||
bankAccountId: string;
|
||||
}
|
||||
|
||||
// @IsNotEmpty({ message: WalletMessage.DEPOSIT_TYPE_REQUIRED })
|
||||
// @IsEnum(DepositType)
|
||||
// @ApiProperty({ description: "Deposit type", example: DepositType.GATEWAY })
|
||||
// depositType: DepositType;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { IsEnum, IsNotEmpty } from "class-validator";
|
||||
|
||||
import { GatewayEnum } from "../enums/gateway.enum";
|
||||
import { GatewayType } from "../types/gateway.type";
|
||||
import { GatewayPaymentStatus } from "../types/payment-status.type";
|
||||
|
||||
export class VerifyParamDto {
|
||||
@IsNotEmpty()
|
||||
@IsEnum(GatewayEnum)
|
||||
gateway: GatewayType;
|
||||
}
|
||||
|
||||
export class VerifyQueryDto {
|
||||
@IsNotEmpty()
|
||||
Authority: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
Status: GatewayPaymentStatus;
|
||||
}
|
||||
Reference in New Issue
Block a user