UNPKG

easypay-nestjs

Version:
67 lines 3.18 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UrlService = void 0; const common_1 = require("@nestjs/common"); let UrlService = class UrlService { constructor() { this.ApiUrls = { ZARINPAL: { SANDBOX: "https://sandbox.zarinpal.com/pg/v4/payment", PRODUCTION: "https://api.zarinpal.com/pg/v4/payment", }, ZIBAL: { SANDBOX: "https://gateway.zibal.ir/v1", PRODUCTION: "https://gateway.zibal.ir/v1", }, NOVINPAL: { SANDBOX: "https://api.novinpal.ir/invoice", PRODUCTION: "https://api.novinpal.ir/invoice", }, }; this.GatewayUrls = { ZARINPAL: { SANDBOX: "https://sandbox.zarinpal.com/pg/StartPay", PRODUCTION: "https://payment.zarinpal.com/pg/StartPay", }, ZIBAL: { SANDBOX: "https://gateway.zibal.ir/start", PRODUCTION: "https://gateway.zibal.ir/start", }, NOVINPAL: { SANDBOX: "https://api.novinpal.ir/invoice/start", PRODUCTION: "https://api.novinpal.ir/invoice/start", }, }; } getRequestUrl(driver, sandbox, type) { switch (driver) { case "ZARINPAL": return sandbox ? `${this.ApiUrls.ZARINPAL.SANDBOX}/${type}.json` : `${this.ApiUrls.ZARINPAL.PRODUCTION}/${type}.json`; case "ZIBAL": return sandbox ? `${this.ApiUrls.ZIBAL.SANDBOX}/${type}` : `${this.ApiUrls.ZIBAL.PRODUCTION}/${type}`; case "NOVINPAL": return sandbox ? `${this.ApiUrls.NOVINPAL.SANDBOX}/${type}` : `${this.ApiUrls.NOVINPAL.PRODUCTION}/${type}`; } } getGatewayUrl(driver, sandbox, authority) { switch (driver) { case "ZARINPAL": return sandbox ? `${this.GatewayUrls.ZARINPAL.SANDBOX}/${authority}` : `${this.GatewayUrls.ZARINPAL.PRODUCTION}/${authority}`; case "ZIBAL": return sandbox ? `${this.GatewayUrls.ZIBAL.SANDBOX}/${authority}` : `${this.GatewayUrls.ZIBAL.PRODUCTION}/${authority}`; case "NOVINPAL": return sandbox ? `${this.GatewayUrls.NOVINPAL.SANDBOX}/${authority}` : `${this.GatewayUrls.NOVINPAL.PRODUCTION}/${authority}`; } } }; exports.UrlService = UrlService; exports.UrlService = UrlService = __decorate([ (0, common_1.Injectable)() ], UrlService); //# sourceMappingURL=url.service.js.map