Skip to content

Commit

Permalink
refactor settings set internal driver
Browse files Browse the repository at this point in the history
  • Loading branch information
rrez2002 committed Nov 2, 2023
1 parent c611cda commit 2925a0e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 43 deletions.
1 change: 0 additions & 1 deletion src/config/index.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/config/payment.config.ts

This file was deleted.

10 changes: 8 additions & 2 deletions src/drivers/idpay/idpay.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ import {
VerifyDataType,
VerifyResponseType,
} from "./idpay.type";
import { driverApis } from "../../config";

export class Idpay extends Driver {
constructor(
protected invoice: Invoice = new Invoice(),
public settings: IdpaySetting = driverApis["idpay"],
public settings: IdpaySetting = {
apiPaymentUrl: "https://api.idpay.ir/v1.1/payment/",
apiPurchaseUrl: "https://api.idpay.ir/v1.1/payment",
apiVerificationUrl: "https://api.idpay.ir/v1.1/payment/verify",
callbackUrl: "http://yoursite.com/path/to",
merchantId: "7c9c2457-2798-4d42-b2e2-d8db9ff5b298",
sandbox: false,
},
public detail: Detail = {},
) {
super();
Expand Down
9 changes: 7 additions & 2 deletions src/drivers/payir/payir.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ import {
VerifyDataType,
VerifyResponseType,
} from "./payir.type";
import { driverApis } from "../../config";

export class PayIR extends Driver {
constructor(
protected invoice: Invoice = new Invoice(),
public settings: Setting = driverApis["payir"],
public settings: Setting = {
apiPaymentUrl: "https://pay.ir/pg/",
apiPurchaseUrl: "https://pay.ir/pg/send",
apiVerificationUrl: "https://pay.ir/pg/verify",
callbackUrl: "http://yoursite.com/path/to",
merchantId: "test",
},
public detail: PayIRDetail = {},
) {
super();
Expand Down
9 changes: 7 additions & 2 deletions src/drivers/zarinpal/zarinpal.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ import {
VerifyResponseType,
ZarinpalDetail,
} from "./zarinpal.type";
import { driverApis } from "../../config";

export class Zarinpal extends Driver {
constructor(
protected invoice: Invoice = new Invoice(),
public settings: Setting = driverApis["zarinpal"],
public settings: Setting = {
apiPaymentUrl: "https://www.zarinpal.com/pg/StartPay/",
apiPurchaseUrl: "https://api.zarinpal.com/pg/v4/payment/request.json",
apiVerificationUrl: "https://api.zarinpal.com/pg/v4/payment/verify.json",
callbackUrl: "http://yoursite.com/path/to",
merchantId: "",
},
public detail: ZarinpalDetail = {},
) {
super();
Expand Down
9 changes: 7 additions & 2 deletions src/drivers/zibal/zibal.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import {
VerifyDataType,
VerifyResponseType,
} from "./zibal.type";
import { driverApis } from "../../config";

export class Zibal extends Driver {
constructor(
protected invoice: Invoice = new Invoice(),
public settings: Setting = driverApis["zibal"],
public settings: Setting = {
apiPaymentUrl: "https://gateway.zibal.ir/start/",
apiPurchaseUrl: "https://gateway.zibal.ir/v1/request",
apiVerificationUrl: "https://gateway.zibal.ir/v1/verify",
callbackUrl: "http://yoursite.com/path/to",
merchantId: "zibal",
},
public detail: Detail = {},
) {
super();
Expand Down

0 comments on commit 2925a0e

Please sign in to comment.