@managesome/eposmatic-toolkit 0.2.422 → 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.
@@ -19,18 +19,18 @@ export declare function convertInvoiceAmountsToCents(invoice: {
19
19
  /**
20
20
  * Converts all subscription base amount fields on a customer from cents to dollars.
21
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;
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
27
  }): typeof customer;
28
28
  /**
29
29
  * Converts all subscription base amount fields on a customer from dollars to cents.
30
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;
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
36
  }): typeof customer;
@@ -2,8 +2,8 @@
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
+ exports.convertCustomerInvoiceAmountsFromCents = convertCustomerInvoiceAmountsFromCents;
6
+ exports.convertCustomerInvoiceAmountsToCents = convertCustomerInvoiceAmountsToCents;
7
7
  const price_conversion_1 = require("./price-conversion");
8
8
  /**
9
9
  * Converts all monetary fields on an invoice from cents to dollars.
@@ -32,24 +32,24 @@ function convertInvoiceAmountsToCents(invoice) {
32
32
  /**
33
33
  * Converts all subscription base amount fields on a customer from cents to dollars.
34
34
  */
35
- function convertCustomerSubscriptionAmountsFromCents(customer) {
35
+ function convertCustomerInvoiceAmountsFromCents(customer) {
36
36
  return {
37
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),
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
42
  };
43
43
  }
44
44
  /**
45
45
  * Converts all subscription base amount fields on a customer from dollars to cents.
46
46
  */
47
- function convertCustomerSubscriptionAmountsToCents(customer) {
47
+ function convertCustomerInvoiceAmountsToCents(customer) {
48
48
  return {
49
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),
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
54
  };
55
55
  }
@@ -20,12 +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[];
25
- base_subscription_price: number;
26
- base_subscription_discount_amount: number;
27
- base_subscription_tax_amount: number;
28
- base_subscription_grand_total: number;
26
+ base_invoice_price: number;
27
+ base_invoice_discount_amount: number;
28
+ base_invoice_tax_amount: number;
29
+ base_invoice_grand_total: number;
29
30
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
30
31
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
31
32
  last_invoice_id: import("mongoose").Types.ObjectId;
@@ -51,12 +52,13 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
51
52
  invoice_notes: string;
52
53
  personal_notes: string;
53
54
  payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
55
+ invoice_currency: import("../../constants").CURRENCY_CODE_ENUM;
54
56
  subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
55
57
  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;
58
+ base_invoice_price: number;
59
+ base_invoice_discount_amount: number;
60
+ base_invoice_tax_amount: number;
61
+ base_invoice_grand_total: number;
60
62
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
61
63
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
62
64
  last_invoice_id: import("mongoose").Types.ObjectId;
@@ -82,12 +84,13 @@ export declare const InternalCustomerSchema: Schema<any, import("mongoose").Mode
82
84
  invoice_notes: string;
83
85
  personal_notes: string;
84
86
  payment_channel: import("../../constants").INTERNAL_CUSTOMER_PAYMENT_METHOD_ENUM;
87
+ invoice_currency: import("../../constants").CURRENCY_CODE_ENUM;
85
88
  subscription_plan: import("../../constants").INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_ENUM;
86
89
  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;
90
+ base_invoice_price: number;
91
+ base_invoice_discount_amount: number;
92
+ base_invoice_tax_amount: number;
93
+ base_invoice_grand_total: number;
91
94
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
92
95
  billing_cycle: import("../../constants").INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM;
93
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,22 +71,22 @@ exports.InternalCustomerSchema = new mongoose_1.Schema({
66
71
  enum: constants_1.ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES,
67
72
  default: [],
68
73
  },
69
- base_subscription_price: {
74
+ base_invoice_price: {
70
75
  type: Number,
71
76
  min: 0,
72
77
  required: true,
73
78
  },
74
- base_subscription_discount_amount: {
79
+ base_invoice_discount_amount: {
75
80
  type: Number,
76
81
  min: 0,
77
82
  required: true,
78
83
  },
79
- base_subscription_tax_amount: {
84
+ base_invoice_tax_amount: {
80
85
  type: Number,
81
86
  min: 0,
82
87
  required: true,
83
88
  },
84
- base_subscription_grand_total: {
89
+ base_invoice_grand_total: {
85
90
  type: Number,
86
91
  min: 0,
87
92
  required: true,
@@ -24,6 +24,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
24
24
  invoice_number: string;
25
25
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
26
26
  hardware: string[];
27
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
27
28
  subtotal: number;
28
29
  payment_terms: string;
29
30
  dqrc: string;
@@ -51,6 +52,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
51
52
  invoice_number: string;
52
53
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
53
54
  hardware: string[];
55
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
54
56
  subtotal: number;
55
57
  payment_terms: string;
56
58
  dqrc: string;
@@ -78,6 +80,7 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
78
80
  invoice_number: string;
79
81
  invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
80
82
  hardware: string[];
83
+ currency: import("../../constants").CURRENCY_CODE_ENUM;
81
84
  subtotal: number;
82
85
  payment_terms: string;
83
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,
@@ -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,12 +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[];
17
- base_subscription_price: number;
18
- base_subscription_discount_amount: number;
19
- base_subscription_tax_amount: number;
20
- base_subscription_grand_total: number;
18
+ base_invoice_price: number;
19
+ base_invoice_discount_amount: number;
20
+ base_invoice_tax_amount: number;
21
+ base_invoice_grand_total: number;
21
22
  subscription_status: SUBSCRIPTION_STATUS_ENUM;
22
23
  billing_cycle: INTERNAL_CUSTOMER_BILLING_CYCLE_ENUM | null;
23
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,6 +8,7 @@ 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.422",
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",