@konplit-services/common 1.16.1 → 1.17.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.
- package/build/events/merchants-events/interfaces/default-charge-created.interface.d.ts +2 -16
- package/build/events/merchants-events/interfaces/default-charge-updated.interface.d.ts +2 -16
- package/build/helper/charges.d.ts +19 -2
- package/build/helper/charges.js +6 -1
- package/build/repository/abstract/base-repository.js +5 -3
- package/package.json +1 -1
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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:
|
|
33
|
+
type: ChargeType;
|
|
26
34
|
value: number | Range[];
|
|
27
35
|
cap?: number | null;
|
|
28
36
|
}
|
|
29
|
-
export interface
|
|
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
|
+
}
|
package/build/helper/charges.js
CHANGED
|
@@ -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 = {}));
|
|
@@ -10,8 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BaseRepository = void 0;
|
|
13
|
-
const errors_1 = require("../../errors");
|
|
14
|
-
const helper_1 = require("../../helper");
|
|
15
13
|
class BaseRepository {
|
|
16
14
|
constructor(model) {
|
|
17
15
|
this.Model = model;
|
|
@@ -23,7 +21,11 @@ class BaseRepository {
|
|
|
23
21
|
}
|
|
24
22
|
catch (err) {
|
|
25
23
|
console.log("Error with database", err);
|
|
26
|
-
throw
|
|
24
|
+
throw err;
|
|
25
|
+
//throw new DatabaseConnectionError(
|
|
26
|
+
// "Database unavailable. Please retry.",
|
|
27
|
+
// error_codes.DATABASE_ERROR
|
|
28
|
+
// );
|
|
27
29
|
}
|
|
28
30
|
});
|
|
29
31
|
}
|