This commit is contained in:
2026-02-22 11:15:16 +03:30
parent 396c50cc52
commit bfa152fdd8
5 changed files with 255 additions and 251 deletions
@@ -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);