chore: complete the payment service

This commit is contained in:
mahyargdz
2025-02-04 16:12:33 +03:30
parent 5d91afcc6e
commit 626206c389
25 changed files with 296 additions and 82 deletions
@@ -66,11 +66,14 @@ export class ZarinpalGateway implements IPaymentGateway {
//********************************** */
async verifyPayment(verifyParams: IPaymentVerifyParams) {
try {
const verifyData = { authority: verifyParams.reference, amount: verifyParams.amount, merchant_id: this.config.merchantId };
const verifyData = {
authority: verifyParams.reference,
amount: verifyParams.amount,
merchant_id: this.config.merchantId,
};
const { data } = await firstValueFrom(
this.httpService
.post<ZarinPalPGVerifyData>(`${this.config.gatewayApiUrl}/v4/payment/verify.json`, verifyData, { headers: this.requestHeader })
.post<ZarinPalPGVerifyData>(`${this.gatewayApiUrl}/v4/payment/verify.json`, verifyData, { headers: this.requestHeader })
.pipe(
catchError((err: AxiosError) => {
this.logger.error(err);
@@ -89,6 +92,7 @@ export class ZarinpalGateway implements IPaymentGateway {
fee: data.data.fee,
};
} catch (error) {
console.error({ error });
this.logger.error(error);
throw new InternalServerErrorException(PaymentMessage.ERROR_IN_VERIFY_PAYMENT);
}