@konplit-services/common 1.16.2 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,6 +258,7 @@ declare class AppConfigs {
258
258
  getWalletDBURI(): string;
259
259
  getAdminWebUrl(): string;
260
260
  getClientAppUrl(): string;
261
+ getMerchantAppUrl(): string;
261
262
  getNATSURI(): string;
262
263
  getWebsiteDBURI(): string;
263
264
  getSettlementDBURI(): string;
@@ -131,6 +131,12 @@ class AppConfigs {
131
131
  }
132
132
  return this.env.CLIENT_APP_URL;
133
133
  }
134
+ getMerchantAppUrl() {
135
+ if (!this.env.MERCHANT_APP_URL) {
136
+ throw new Error("MERCHANT_APP_URL is required");
137
+ }
138
+ return this.env.MERCHANT_APP_URL;
139
+ }
134
140
  getNATSURI() {
135
141
  if (!this.env.NATS_URI) {
136
142
  throw new Error("NATS_URI is required");
@@ -1,22 +1,8 @@
1
- import { PaymentMethodCharge } from "../../../helper";
1
+ import { IDefaultCharges } from "../../../helper";
2
2
  import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
3
  export interface DefaultChargeCreatedEvent {
4
4
  subject: Subjects.DefaultChargeCreated;
5
5
  streamName: StreamName.name;
6
6
  streamEvents: StreamEvent.Event;
7
- data: {
8
- id: string;
9
- merchantId: string;
10
- accountId: string;
11
- local_cards: PaymentMethodCharge;
12
- international_cards: PaymentMethodCharge;
13
- ussd: PaymentMethodCharge;
14
- qr_code: PaymentMethodCharge;
15
- mobile: PaymentMethodCharge;
16
- bank_transfer: PaymentMethodCharge;
17
- direct_debit: PaymentMethodCharge;
18
- bvn_check: PaymentMethodCharge;
19
- virtual_accounts: PaymentMethodCharge;
20
- version?: number;
21
- };
7
+ data: IDefaultCharges;
22
8
  }
@@ -1,22 +1,8 @@
1
- import { PaymentMethodCharge } from "../../../helper";
1
+ import { IDefaultCharges } from "../../../helper";
2
2
  import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
3
  export interface DefaultChargeUpdatedEvent {
4
4
  subject: Subjects.DefaultChargeUpdated;
5
5
  streamName: StreamName.name;
6
6
  streamEvents: StreamEvent.Event;
7
- data: {
8
- id: string;
9
- merchantId: string;
10
- accountId: string;
11
- local_cards: PaymentMethodCharge;
12
- international_cards: PaymentMethodCharge;
13
- ussd: PaymentMethodCharge;
14
- qr_code: PaymentMethodCharge;
15
- mobile: PaymentMethodCharge;
16
- bank_transfer: PaymentMethodCharge;
17
- direct_debit: PaymentMethodCharge;
18
- bvn_check: PaymentMethodCharge;
19
- virtual_accounts: PaymentMethodCharge;
20
- version?: number;
21
- };
7
+ data: IDefaultCharges;
22
8
  }
@@ -21,11 +21,28 @@ export interface Range {
21
21
  charge: number;
22
22
  max: number;
23
23
  }
24
+ export interface PaymentMethodCharge {
25
+ charge: Charge;
26
+ }
27
+ export declare enum ChargeTypeEnum {
28
+ PERCENT = "percent",
29
+ FLAT = "flat"
30
+ }
31
+ export type ChargeType = ChargeTypeEnum.PERCENT | ChargeTypeEnum.FLAT;
24
32
  export interface Charge {
25
- type: "percent" | "flat";
33
+ type: ChargeType;
26
34
  value: number | Range[];
27
35
  cap?: number | null;
28
36
  }
29
- export interface PaymentMethodCharge {
37
+ export interface IPaymentMethodCharge {
30
38
  charge: Charge;
31
39
  }
40
+ export type SupportedChannels = "local_transactions" | "local_cards" | "international_cards" | "ussd" | "qr_code" | "mobile" | "bank_transfer" | "direct_debit" | "bvn_check" | "virtual_accounts" | "opay";
41
+ export interface IDefaultCharges {
42
+ id: string;
43
+ merchantId: string;
44
+ accountId: string;
45
+ charges: Record<SupportedChannels, IPaymentMethodCharge>;
46
+ version?: number;
47
+ isPublic?: boolean;
48
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REVENUE_TYPE = exports.ORIGIN = exports.TRANSACTION_CHARGES_TYPE = exports.TOPUP_TRANSACTIONS = void 0;
3
+ exports.ChargeTypeEnum = exports.REVENUE_TYPE = exports.ORIGIN = exports.TRANSACTION_CHARGES_TYPE = exports.TOPUP_TRANSACTIONS = void 0;
4
4
  var TOPUP_TRANSACTIONS;
5
5
  (function (TOPUP_TRANSACTIONS) {
6
6
  TOPUP_TRANSACTIONS["FUND_WALLET"] = "FUND_WALLET";
@@ -23,3 +23,8 @@ var REVENUE_TYPE;
23
23
  REVENUE_TYPE["transfer"] = "transfer";
24
24
  REVENUE_TYPE["transaction"] = "transaction";
25
25
  })(REVENUE_TYPE || (exports.REVENUE_TYPE = REVENUE_TYPE = {}));
26
+ var ChargeTypeEnum;
27
+ (function (ChargeTypeEnum) {
28
+ ChargeTypeEnum["PERCENT"] = "percent";
29
+ ChargeTypeEnum["FLAT"] = "flat";
30
+ })(ChargeTypeEnum || (exports.ChargeTypeEnum = ChargeTypeEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.16.2",
3
+ "version": "1.18.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",