payment
This commit is contained in:
@@ -42,17 +42,17 @@ export class ZarinpalGateway implements IPaymentGateway {
|
||||
return { status: error.response.status, data: error.response.data };
|
||||
}
|
||||
|
||||
async requestPayment({ amount, orderId }: IRequestPaymentParams): Promise<IRequestPaymentData> {
|
||||
async requestPayment({ amount, invoiceId }: IRequestPaymentParams): Promise<IRequestPaymentData> {
|
||||
// Transform camelCase to snake_case for Zarinpal API v4
|
||||
const callbackUrl = `${this.websiteUrl}/verify/${orderId}`;
|
||||
const callbackUrl = `${this.websiteUrl}/verify/${invoiceId}`;
|
||||
const zarinpalRequest: IZarinpalRequestPayment = {
|
||||
amount,
|
||||
merchant_id: this.zarinpalMerchantId,
|
||||
description: `Payment for order #${orderId}`,
|
||||
description: `Payment for order #${invoiceId}`,
|
||||
callback_url: callbackUrl,
|
||||
currency: 'IRT',
|
||||
metadata: {
|
||||
order_id: orderId,
|
||||
order_id: invoiceId,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ export class ZarinpalGateway implements IPaymentGateway {
|
||||
errors,
|
||||
callbackUrl,
|
||||
amount,
|
||||
orderId,
|
||||
invoiceId,
|
||||
}),
|
||||
);
|
||||
throw new BadRequestException(message ?? PaymentMessage.ZARINPAL_PAYMENT_REQUEST_ERROR);
|
||||
@@ -102,7 +102,7 @@ export class ZarinpalGateway implements IPaymentGateway {
|
||||
data: axiosErr.data,
|
||||
callbackUrl,
|
||||
amount,
|
||||
orderId,
|
||||
invoiceId,
|
||||
}),
|
||||
);
|
||||
throw new BadRequestException(PaymentMessage.ZARINPAL_PAYMENT_REQUEST_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user