diff --git a/src/modules/payment/controllers/payment.controller.ts b/src/modules/payment/controllers/payment.controller.ts index 8a098ae..a3b816e 100644 --- a/src/modules/payment/controllers/payment.controller.ts +++ b/src/modules/payment/controllers/payment.controller.ts @@ -36,10 +36,9 @@ export class PaymentController { return this.paymentService.payInvoice(invoiceId, dto); } - @Post('public/payments/online/:token/verify') - @UseGuards(AuthGuard) + @Get('public/payments/online/:token/verify') @ApiOperation({ summary: 'Verify online payment' }) - verifyOnlinePayment(@Param('paymentId') token: string) { + verifyOnlinePayment(@Param('token') token: string) { return this.paymentService.verifyOnlinePayment(token); } diff --git a/src/modules/payment/gateways/zarinpal.gateway.ts b/src/modules/payment/gateways/zarinpal.gateway.ts index 132c8bc..690e324 100755 --- a/src/modules/payment/gateways/zarinpal.gateway.ts +++ b/src/modules/payment/gateways/zarinpal.gateway.ts @@ -21,7 +21,7 @@ export class ZarinpalGateway implements IPaymentGateway { private readonly zarinpalVerifyUrl: string; private readonly zarinpalPaymentBaseUrl: string; private readonly zarinpalMerchantId: string; - private readonly websiteUrl: string = 'https://negareh.ir' + private readonly apiUrl: string = 'https://negareh-api.dev.danakcorp.com/' private readonly axiosConfig = { timeout: 10_000, headers: { @@ -31,10 +31,10 @@ export class ZarinpalGateway implements IPaymentGateway { constructor(private readonly configService: ConfigService) { const zarinpalBaseUrl = this.configService.get('ZARINPAL_BASE_URL') || 'https://sandbox.zarinpal.com'; - this.zarinpalPaymentBaseUrl = zarinpalBaseUrl; this.zarinpalRequestUrl = `${zarinpalBaseUrl}/pg/v4/payment/request.json`; this.zarinpalVerifyUrl = `${zarinpalBaseUrl}/pg/v4/payment/verify.json`; this.zarinpalMerchantId = this.configService.getOrThrow('ZARINPAL_BASE_MERCHANT') + this.apiUrl = this.configService.getOrThrow('API_URL') || 'https://negareh-api.dev.danakcorp.com/' } private getAxiosErrorData(error: unknown): { status?: number; data?: unknown } | null { @@ -44,7 +44,7 @@ export class ZarinpalGateway implements IPaymentGateway { async requestPayment({ amount, invoiceId }: IRequestPaymentParams): Promise { // Transform camelCase to snake_case for Zarinpal API v4 - const callbackUrl = `${this.websiteUrl}/verify/${invoiceId}`; + const callbackUrl = `${this.apiUrl}/verify/${invoiceId}`; const zarinpalRequest: IZarinpalRequestPayment = { amount, merchant_id: this.zarinpalMerchantId,