payment refactor
This commit is contained in:
@@ -1,38 +1,67 @@
|
||||
export interface IPaymentGateway {
|
||||
processPayment(processPaymentParam: IProcessPaymentParams): Promise<IProcessPaymentData>;
|
||||
verifyPayment(verifyPaymentParam: IPaymentVerifyParams): Promise<IVerifyPayment>;
|
||||
requestPayment(requestPaymentParams: IRequestPaymentParams): Promise<IRequestPaymentData>;
|
||||
verifyPayment(verifyPaymentParam: IPaymentVerifyParams): Promise<IPaymentVerifyData>;
|
||||
getPaymentUrl(authority: string): string;
|
||||
}
|
||||
|
||||
export interface IProcessPaymentParams {
|
||||
export interface IRequestPaymentParams {
|
||||
amount: number;
|
||||
callbackUrl: string;
|
||||
merchantId: string;
|
||||
description: string;
|
||||
metadata: {
|
||||
orderId: string;
|
||||
};
|
||||
domain: string;
|
||||
orderId: string;
|
||||
}
|
||||
|
||||
export interface IProcessPaymentData {
|
||||
code: number;
|
||||
message: string;
|
||||
authority: string;
|
||||
fee_type: string;
|
||||
fee: number;
|
||||
export interface IRequestPaymentData {
|
||||
transactionId: string;
|
||||
}
|
||||
|
||||
export interface IPaymentVerifyParams {
|
||||
amount: number;
|
||||
merchantId: string;
|
||||
transactionId: string;
|
||||
}
|
||||
|
||||
export interface IPaymentVerifyData {
|
||||
success: boolean;
|
||||
referenceId?: string;
|
||||
cardPan?: string;
|
||||
raw: Record<string, any>;
|
||||
}
|
||||
////////////////////////// Zarinpal API v4 //////////////////////////
|
||||
export interface IZarinpalRequestPayment {
|
||||
amount: number;
|
||||
merchant_id: string;
|
||||
description: string;
|
||||
callback_url: string;
|
||||
metadata?: {
|
||||
order_id?: string;
|
||||
mobile?: string;
|
||||
email?: string;
|
||||
};
|
||||
referrer_id?: string;
|
||||
}
|
||||
export interface IZarinpalPaymentResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
authority: string;
|
||||
fee_type: string;
|
||||
fee: number;
|
||||
errors: [];
|
||||
}
|
||||
export interface IZarinpalVerifyRequest {
|
||||
merchant_id: string;
|
||||
amount: number;
|
||||
authority: string;
|
||||
}
|
||||
|
||||
export interface IVerifyPayment {
|
||||
code: number;
|
||||
message: string;
|
||||
refId: number;
|
||||
cardPan: string;
|
||||
cardHash: string;
|
||||
fee_type: string;
|
||||
fee: number;
|
||||
export interface IZarinpalVerifyResponse {
|
||||
data: {
|
||||
code: number;
|
||||
message: string;
|
||||
card_hash: string;
|
||||
card_pan: string;
|
||||
ref_id: number;
|
||||
fee_type: string;
|
||||
fee: number;
|
||||
};
|
||||
errors: [];
|
||||
}
|
||||
|
||||
@@ -11,3 +11,11 @@ export enum PaymentStatusEnum {
|
||||
export enum PaymentGatewayEnum {
|
||||
ZarinPal = 'zarinpal',
|
||||
}
|
||||
|
||||
export interface ICreatePayment {
|
||||
orderId: string;
|
||||
amount: number;
|
||||
method: PaymentMethodEnum;
|
||||
transactionId: string;
|
||||
gateway?: PaymentGatewayEnum | null;
|
||||
}
|
||||
Reference in New Issue
Block a user