@managesome/eposmatic-toolkit 0.2.420 → 0.2.422
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/lib/helpers/utils/internal-amount-helpers.d.ts +18 -2
- package/lib/helpers/utils/internal-amount-helpers.js +26 -2
- package/lib/schemas/models/internal_customers.d.ts +12 -0
- package/lib/schemas/models/internal_customers.js +20 -0
- package/lib/schemas/models/internal_invoices.d.ts +6 -0
- package/lib/schemas/models/internal_invoices.js +8 -0
- package/lib/schemas/types/internal_customers.d.ts +4 -0
- package/lib/schemas/types/internal_invoices.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts all monetary fields on an invoice from cents to dollars.
|
|
3
|
-
* Mutates and returns the same object.
|
|
4
3
|
*/
|
|
5
4
|
export declare function convertInvoiceAmountsFromCents(invoice: {
|
|
6
5
|
subtotal: number;
|
|
@@ -10,7 +9,6 @@ export declare function convertInvoiceAmountsFromCents(invoice: {
|
|
|
10
9
|
}): typeof invoice;
|
|
11
10
|
/**
|
|
12
11
|
* Converts all monetary fields on an invoice from dollars to cents.
|
|
13
|
-
* Mutates and returns the same object.
|
|
14
12
|
*/
|
|
15
13
|
export declare function convertInvoiceAmountsToCents(invoice: {
|
|
16
14
|
subtotal: number;
|
|
@@ -18,3 +16,21 @@ export declare function convertInvoiceAmountsToCents(invoice: {
|
|
|
18
16
|
tax_amount: number;
|
|
19
17
|
grand_total: number;
|
|
20
18
|
}): typeof invoice;
|
|
19
|
+
/**
|
|
20
|
+
* Converts all subscription base amount fields on a customer from cents to dollars.
|
|
21
|
+
*/
|
|
22
|
+
export declare function convertCustomerSubscriptionAmountsFromCents(customer: {
|
|
23
|
+
base_subscription_price: number;
|
|
24
|
+
base_subscription_discount_amount: number;
|
|
25
|
+
base_subscription_tax_amount: number;
|
|
26
|
+
base_subscription_grand_total: number;
|
|
27
|
+
}): typeof customer;
|
|
28
|
+
/**
|
|
29
|
+
* Converts all subscription base amount fields on a customer from dollars to cents.
|
|
30
|
+
*/
|
|
31
|
+
export declare function convertCustomerSubscriptionAmountsToCents(customer: {
|
|
32
|
+
base_subscription_price: number;
|
|
33
|
+
base_subscription_discount_amount: number;
|
|
34
|
+
base_subscription_tax_amount: number;
|
|
35
|
+
base_subscription_grand_total: number;
|
|
36
|
+
}): typeof customer;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertInvoiceAmountsFromCents = convertInvoiceAmountsFromCents;
|
|
4
4
|
exports.convertInvoiceAmountsToCents = convertInvoiceAmountsToCents;
|
|
5
|
+
exports.convertCustomerSubscriptionAmountsFromCents = convertCustomerSubscriptionAmountsFromCents;
|
|
6
|
+
exports.convertCustomerSubscriptionAmountsToCents = convertCustomerSubscriptionAmountsToCents;
|
|
5
7
|
const price_conversion_1 = require("./price-conversion");
|
|
6
8
|
/**
|
|
7
9
|
* Converts all monetary fields on an invoice from cents to dollars.
|
|
8
|
-
* Mutates and returns the same object.
|
|
9
10
|
*/
|
|
10
11
|
function convertInvoiceAmountsFromCents(invoice) {
|
|
11
12
|
return {
|
|
@@ -18,7 +19,6 @@ function convertInvoiceAmountsFromCents(invoice) {
|
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Converts all monetary fields on an invoice from dollars to cents.
|
|
21
|
-
* Mutates and returns the same object.
|
|
22
22
|
*/
|
|
23
23
|
function convertInvoiceAmountsToCents(invoice) {
|
|
24
24
|
return {
|
|
@@ -29,3 +29,27 @@ function convertInvoiceAmountsToCents(invoice) {
|
|
|
29
29
|
grand_total: (0, price_conversion_1.convertPriceToCents)(invoice.grand_total),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Converts all subscription base amount fields on a customer from cents to dollars.
|
|
34
|
+
*/
|
|
35
|
+
function convertCustomerSubscriptionAmountsFromCents(customer) {
|
|
36
|
+
return {
|
|
37
|
+
...customer,
|
|
38
|
+
base_subscription_price: (0, price_conversion_1.convertPriceFromCents)(customer.base_subscription_price),
|
|
39
|
+
base_subscription_discount_amount: (0, price_conversion_1.convertPriceFromCents)(customer.base_subscription_discount_amount),
|
|
40
|
+
base_subscription_tax_amount: (0, price_conversion_1.convertPriceFromCents)(customer.base_subscription_tax_amount),
|
|
41
|
+
base_subscription_grand_total: (0, price_conversion_1.convertPriceFromCents)(customer.base_subscription_grand_total),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts all subscription base amount fields on a customer from dollars to cents.
|
|
46
|
+
*/
|
|
47
|
+
function convertCustomerSubscriptionAmountsToCents(customer) {
|
|
48
|
+
return {
|
|
49
|
+
...customer,
|
|
50
|
+
base_subscription_price: (0, price_conversion_1.convertPriceToCents)(customer.base_subscription_price),
|
|
51
|
+
base_subscription_discount_amount: (0, price_conversion_1.convertPriceToCents)(customer.base_subscription_discount_amount),
|
|
52
|
+
base_subscription_tax_amount: (0, price_conversion_1.convertPriceToCents)(customer.base_subscription_tax_amount),
|
|
53
|
+
base_subscription_grand_total: (0, price_conversion_1.convertPriceToCents)(customer.base_subscription_grand_total),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -22,6 +22,10 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
|
|
|
22
22
|
payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
|
|
23
23
|
subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
|
|
24
24
|
subscription_services: string[];
|
|
25
|
+
base_subscription_price: number;
|
|
26
|
+
base_subscription_discount_amount: number;
|
|
27
|
+
base_subscription_tax_amount: number;
|
|
28
|
+
base_subscription_grand_total: number;
|
|
25
29
|
subscription_status: SUBSCRIPTION_STATUS_ENUM;
|
|
26
30
|
billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
|
|
27
31
|
last_invoice_id: import("mongoose").Types.ObjectId;
|
|
@@ -49,6 +53,10 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
|
|
|
49
53
|
payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
|
|
50
54
|
subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
|
|
51
55
|
subscription_services: string[];
|
|
56
|
+
base_subscription_price: number;
|
|
57
|
+
base_subscription_discount_amount: number;
|
|
58
|
+
base_subscription_tax_amount: number;
|
|
59
|
+
base_subscription_grand_total: number;
|
|
52
60
|
subscription_status: SUBSCRIPTION_STATUS_ENUM;
|
|
53
61
|
billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
|
|
54
62
|
last_invoice_id: import("mongoose").Types.ObjectId;
|
|
@@ -76,6 +84,10 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
|
|
|
76
84
|
payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
|
|
77
85
|
subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
|
|
78
86
|
subscription_services: string[];
|
|
87
|
+
base_subscription_price: number;
|
|
88
|
+
base_subscription_discount_amount: number;
|
|
89
|
+
base_subscription_tax_amount: number;
|
|
90
|
+
base_subscription_grand_total: number;
|
|
79
91
|
subscription_status: SUBSCRIPTION_STATUS_ENUM;
|
|
80
92
|
billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
|
|
81
93
|
last_invoice_id: import("mongoose").Types.ObjectId;
|
|
@@ -66,6 +66,26 @@ exports.InternalCustomerSchema = new mongoose_1.Schema({
|
|
|
66
66
|
enum: constants_1.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES,
|
|
67
67
|
default: [],
|
|
68
68
|
},
|
|
69
|
+
base_subscription_price: {
|
|
70
|
+
type: Number,
|
|
71
|
+
min: 0,
|
|
72
|
+
required: true,
|
|
73
|
+
},
|
|
74
|
+
base_subscription_discount_amount: {
|
|
75
|
+
type: Number,
|
|
76
|
+
min: 0,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
base_subscription_tax_amount: {
|
|
80
|
+
type: Number,
|
|
81
|
+
min: 0,
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
base_subscription_grand_total: {
|
|
85
|
+
type: Number,
|
|
86
|
+
min: 0,
|
|
87
|
+
required: true,
|
|
88
|
+
},
|
|
69
89
|
subscription_status: {
|
|
70
90
|
type: String,
|
|
71
91
|
enum: constants_1.ALL_SUBSCRIPTION_STATUS,
|
|
@@ -11,6 +11,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
11
11
|
discount_amount: number;
|
|
12
12
|
createdAt: NativeDate;
|
|
13
13
|
updatedAt: NativeDate;
|
|
14
|
+
description: string;
|
|
14
15
|
status: import("../../constants").INTERNAL_INVOICE_STATUS_ENUM;
|
|
15
16
|
ref_id: string;
|
|
16
17
|
customer_name: string;
|
|
@@ -25,6 +26,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
25
26
|
hardware: string[];
|
|
26
27
|
subtotal: number;
|
|
27
28
|
payment_terms: string;
|
|
29
|
+
dqrc: string;
|
|
28
30
|
issue_date: NativeDate;
|
|
29
31
|
due_date: NativeDate;
|
|
30
32
|
paid_at: NativeDate;
|
|
@@ -36,6 +38,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
36
38
|
discount_amount: number;
|
|
37
39
|
createdAt: NativeDate;
|
|
38
40
|
updatedAt: NativeDate;
|
|
41
|
+
description: string;
|
|
39
42
|
status: import("../../constants").INTERNAL_INVOICE_STATUS_ENUM;
|
|
40
43
|
ref_id: string;
|
|
41
44
|
customer_name: string;
|
|
@@ -50,6 +53,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
50
53
|
hardware: string[];
|
|
51
54
|
subtotal: number;
|
|
52
55
|
payment_terms: string;
|
|
56
|
+
dqrc: string;
|
|
53
57
|
issue_date: NativeDate;
|
|
54
58
|
due_date: NativeDate;
|
|
55
59
|
paid_at: NativeDate;
|
|
@@ -61,6 +65,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
61
65
|
discount_amount: number;
|
|
62
66
|
createdAt: NativeDate;
|
|
63
67
|
updatedAt: NativeDate;
|
|
68
|
+
description: string;
|
|
64
69
|
status: import("../../constants").INTERNAL_INVOICE_STATUS_ENUM;
|
|
65
70
|
ref_id: string;
|
|
66
71
|
customer_name: string;
|
|
@@ -75,6 +80,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
|
|
|
75
80
|
hardware: string[];
|
|
76
81
|
subtotal: number;
|
|
77
82
|
payment_terms: string;
|
|
83
|
+
dqrc: string;
|
|
78
84
|
issue_date: NativeDate;
|
|
79
85
|
due_date: NativeDate;
|
|
80
86
|
paid_at: NativeDate;
|
|
@@ -64,6 +64,10 @@ exports.InternalInvoiceSchema = new mongoose_1.Schema({
|
|
|
64
64
|
type: String,
|
|
65
65
|
default: '',
|
|
66
66
|
},
|
|
67
|
+
description: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: '',
|
|
70
|
+
},
|
|
67
71
|
status: {
|
|
68
72
|
type: String,
|
|
69
73
|
enum: constants_1.ALL_INTERNAL_INVOICE_STATUS_NAMES,
|
|
@@ -77,6 +81,10 @@ exports.InternalInvoiceSchema = new mongoose_1.Schema({
|
|
|
77
81
|
type: String,
|
|
78
82
|
default: null,
|
|
79
83
|
},
|
|
84
|
+
dqrc: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: null,
|
|
87
|
+
},
|
|
80
88
|
issue_date: {
|
|
81
89
|
type: mongoose_1.Schema.Types.Date,
|
|
82
90
|
required: true,
|
|
@@ -14,6 +14,10 @@ export interface IInternalCustomer {
|
|
|
14
14
|
payment_channel: INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
|
|
15
15
|
subscription_plan: INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
|
|
16
16
|
subscription_services: INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM[];
|
|
17
|
+
base_subscription_price: number;
|
|
18
|
+
base_subscription_discount_amount: number;
|
|
19
|
+
base_subscription_tax_amount: number;
|
|
20
|
+
base_subscription_grand_total: number;
|
|
17
21
|
subscription_status: SUBSCRIPTION_STATUS_ENUM;
|
|
18
22
|
billing_cycle: INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM | null;
|
|
19
23
|
last_invoice_id: string | null;
|
|
@@ -13,9 +13,11 @@ export interface IInternalInvoice {
|
|
|
13
13
|
tax_amount: number;
|
|
14
14
|
grand_total: number;
|
|
15
15
|
notes: string;
|
|
16
|
+
description: string;
|
|
16
17
|
status: INTERNAL_INVOICE_STATUS_ENUM;
|
|
17
18
|
payment_terms: string | null;
|
|
18
19
|
payment_method: string | null;
|
|
20
|
+
dqrc: string | null;
|
|
19
21
|
issue_date: Date;
|
|
20
22
|
due_date: Date | null;
|
|
21
23
|
paid_at: Date | null;
|