@managesome/eposmatic-toolkit 0.2.421 → 0.2.423

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.
@@ -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 convertCustomerInvoiceAmountsFromCents(customer: {
23
+ base_invoice_price: number;
24
+ base_invoice_discount_amount: number;
25
+ base_invoice_tax_amount: number;
26
+ base_invoice_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 convertCustomerInvoiceAmountsToCents(customer: {
32
+ base_invoice_price: number;
33
+ base_invoice_discount_amount: number;
34
+ base_invoice_tax_amount: number;
35
+ base_invoice_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.convertCustomerInvoiceAmountsFromCents = convertCustomerInvoiceAmountsFromCents;
6
+ exports.convertCustomerInvoiceAmountsToCents = convertCustomerInvoiceAmountsToCents;
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 convertCustomerInvoiceAmountsFromCents(customer) {
36
+ return {
37
+ ...customer,
38
+ base_invoice_price: (0, price_conversion_1.convertPriceFromCents)(customer.base_invoice_price),
39
+ base_invoice_discount_amount: (0, price_conversion_1.convertPriceFromCents)(customer.base_invoice_discount_amount),
40
+ base_invoice_tax_amount: (0, price_conversion_1.convertPriceFromCents)(customer.base_invoice_tax_amount),
41
+ base_invoice_grand_total: (0, price_conversion_1.convertPriceFromCents)(customer.base_invoice_grand_total),
42
+ };
43
+ }
44
+ /**
45
+ * Converts all subscription base amount fields on a customer from dollars to cents.
46
+ */
47
+ function convertCustomerInvoiceAmountsToCents(customer) {
48
+ return {
49
+ ...customer,
50
+ base_invoice_price: (0, price_conversion_1.convertPriceToCents)(customer.base_invoice_price),
51
+ base_invoice_discount_amount: (0, price_conversion_1.convertPriceToCents)(customer.base_invoice_discount_amount),
52
+ base_invoice_tax_amount: (0, price_conversion_1.convertPriceToCents)(customer.base_invoice_tax_amount),
53
+ base_invoice_grand_total: (0, price_conversion_1.convertPriceToCents)(customer.base_invoice_grand_total),
54
+ };
55
+ }
@@ -20,8 +20,13 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
20
20
  invoice_notes: string;
21
21
  personal_notes: string;
22
22
  payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
23
+ invoice_currency: import("../../constants").CURRENCY_CODE_ENUM;
23
24
  subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
24
25
  subscription_services: string[];
26
+ base_invoice_price: number;
27
+ base_invoice_discount_amount: number;
28
+ base_invoice_tax_amount: number;
29
+ base_invoice_grand_total: number;
25
30
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
26
31
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
27
32
  last_invoice_id: import("mongoose").Types.ObjectId;
@@ -47,8 +52,13 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
47
52
  invoice_notes: string;
48
53
  personal_notes: string;
49
54
  payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
55
+ invoice_currency: import("../../constants").CURRENCY_CODE_ENUM;
50
56
  subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
51
57
  subscription_services: string[];
58
+ base_invoice_price: number;
59
+ base_invoice_discount_amount: number;
60
+ base_invoice_tax_amount: number;
61
+ base_invoice_grand_total: number;
52
62
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
53
63
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
54
64
  last_invoice_id: import("mongoose").Types.ObjectId;
@@ -74,8 +84,13 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
74
84
  invoice_notes: string;
75
85
  personal_notes: string;
76
86
  payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
87
+ invoice_currency: import("../../constants").CURRENCY_CODE_ENUM;
77
88
  subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
78
89
  subscription_services: string[];
90
+ base_invoice_price: number;
91
+ base_invoice_discount_amount: number;
92
+ base_invoice_tax_amount: number;
93
+ base_invoice_grand_total: number;
79
94
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
80
95
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
81
96
  last_invoice_id: import("mongoose").Types.ObjectId;
@@ -55,6 +55,11 @@ exports.InternalCustomerSchema = new mongoose_1.Schema({
55
55
  enum: constants_1.ALL_INTERNAL_CUSTOMER_PAYMENT_METHOD_NAMES,
56
56
  required: true,
57
57
  },
58
+ invoice_currency: {
59
+ type: String,
60
+ enum: constants_1.ALL_CURRENCY_CODES,
61
+ required: true,
62
+ },
58
63
  // Subscription
59
64
  subscription_plan: {
60
65
  type: String,
@@ -66,6 +71,26 @@ exports.InternalCustomerSchema = new mongoose_1.Schema({
66
71
  enum: constants_1.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES,
67
72
  default: [],
68
73
  },
74
+ base_invoice_price: {
75
+ type: Number,
76
+ min: 0,
77
+ required: true,
78
+ },
79
+ base_invoice_discount_amount: {
80
+ type: Number,
81
+ min: 0,
82
+ required: true,
83
+ },
84
+ base_invoice_tax_amount: {
85
+ type: Number,
86
+ min: 0,
87
+ required: true,
88
+ },
89
+ base_invoice_grand_total: {
90
+ type: Number,
91
+ min: 0,
92
+ required: true,
93
+ },
69
94
  subscription_status: {
70
95
  type: String,
71
96
  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;
@@ -23,6 +24,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
23
24
  invoice_number: string;
24
25
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
25
26
  hardware: string[];
27
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
26
28
  subtotal: number;
27
29
  payment_terms: string;
28
30
  dqrc: string;
@@ -37,6 +39,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
37
39
  discount_amount: number;
38
40
  createdAt: NativeDate;
39
41
  updatedAt: NativeDate;
42
+ description: string;
40
43
  status: import("../../constants").INTERNAL_INVOICE_STATUS_ENUM;
41
44
  ref_id: string;
42
45
  customer_name: string;
@@ -49,6 +52,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
49
52
  invoice_number: string;
50
53
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
51
54
  hardware: string[];
55
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
52
56
  subtotal: number;
53
57
  payment_terms: string;
54
58
  dqrc: string;
@@ -63,6 +67,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
63
67
  discount_amount: number;
64
68
  createdAt: NativeDate;
65
69
  updatedAt: NativeDate;
70
+ description: string;
66
71
  status: import("../../constants").INTERNAL_INVOICE_STATUS_ENUM;
67
72
  ref_id: string;
68
73
  customer_name: string;
@@ -75,6 +80,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
75
80
  invoice_number: string;
76
81
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
77
82
  hardware: string[];
83
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
78
84
  subtotal: number;
79
85
  payment_terms: string;
80
86
  dqrc: string;
@@ -40,6 +40,11 @@ exports.InternalInvoiceSchema = new mongoose_1.Schema({
40
40
  enum: constants_1.ALL_SUBSCRIPTION_HARDWARE_NAMES,
41
41
  default: null,
42
42
  },
43
+ currency: {
44
+ type: String,
45
+ enum: constants_1.ALL_CURRENCY_CODES,
46
+ required: true,
47
+ },
43
48
  subtotal: {
44
49
  type: Number,
45
50
  min: 0,
@@ -64,6 +69,10 @@ exports.InternalInvoiceSchema = new mongoose_1.Schema({
64
69
  type: String,
65
70
  default: '',
66
71
  },
72
+ description: {
73
+ type: String,
74
+ default: '',
75
+ },
67
76
  status: {
68
77
  type: String,
69
78
  enum: constants_1.ALL_INTERNAL_INVOICE_STATUS_NAMES,
@@ -1,4 +1,4 @@
1
- import { INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM, INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM, INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM, INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM, INTERNAL_CUSTOMER_TYPE_ENUM, INTERNAL_INVOICE_STATUS_ENUM, SUBSCRIPTION_STATUS_ENUM } from '../../constants';
1
+ import { CURRENCY_CODE_ENUM, INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM, INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM, INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM, INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM, INTERNAL_CUSTOMER_TYPE_ENUM, INTERNAL_INVOICE_STATUS_ENUM, SUBSCRIPTION_STATUS_ENUM } from '../../constants';
2
2
  export interface IInternalCustomer {
3
3
  _id: string;
4
4
  ref_id: string;
@@ -12,8 +12,13 @@ export interface IInternalCustomer {
12
12
  personal_notes: string;
13
13
  active: boolean;
14
14
  payment_channel: INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
15
+ invoice_currency: CURRENCY_CODE_ENUM;
15
16
  subscription_plan: INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
16
17
  subscription_services: INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_ENUM[];
18
+ base_invoice_price: number;
19
+ base_invoice_discount_amount: number;
20
+ base_invoice_tax_amount: number;
21
+ base_invoice_grand_total: number;
17
22
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
18
23
  billing_cycle: INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM | null;
19
24
  last_invoice_id: string | null;
@@ -1,4 +1,4 @@
1
- import { INTERNAL_INVOICE_STATUS_ENUM, INTERNAL_INVOICE_TYPE_ENUM, SUBSCRIPTION_HARDWARE_ENUM } from '../../constants';
1
+ import { CURRENCY_CODE_ENUM, INTERNAL_INVOICE_STATUS_ENUM, INTERNAL_INVOICE_TYPE_ENUM, SUBSCRIPTION_HARDWARE_ENUM } from '../../constants';
2
2
  export interface IInternalInvoice {
3
3
  _id: string;
4
4
  customer_id: string;
@@ -8,11 +8,13 @@ export interface IInternalInvoice {
8
8
  invoice_number: string;
9
9
  invoice_type: INTERNAL_INVOICE_TYPE_ENUM;
10
10
  hardware: SUBSCRIPTION_HARDWARE_ENUM[] | null;
11
+ currency: CURRENCY_CODE_ENUM;
11
12
  subtotal: number;
12
13
  discount_amount: number;
13
14
  tax_amount: number;
14
15
  grand_total: number;
15
16
  notes: string;
17
+ description: string;
16
18
  status: INTERNAL_INVOICE_STATUS_ENUM;
17
19
  payment_terms: string | null;
18
20
  payment_method: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.421",
3
+ "version": "0.2.423",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",