washday-sdk 1.5.8 → 1.6.1

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.
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  const GET_SET_COMPANIES = 'api/company';
11
- const REQUEST_PARAMS = {
12
- token: 'LOGGED_USER_TOKEN',
13
- };
14
11
  export const getCompanyById = function (companyId) {
15
12
  return __awaiter(this, void 0, void 0, function* () {
16
13
  try {
@@ -26,3 +23,18 @@ export const getCompanyById = function (companyId) {
26
23
  }
27
24
  });
28
25
  };
26
+ export const getCompanyOrdersMetrics = function () {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ const config = {
30
+ headers: { Authorization: `Bearer ${this.apiToken}` }
31
+ };
32
+ const response = yield this.axiosInstance.get(`${GET_SET_COMPANIES}/metrics/orders`, config);
33
+ return response;
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching getCompanyOrdersMetrics:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  const GET_SET_COMPANIES = 'api/company';
11
+ const GET_SET_BILLING = 'api/billing';
11
12
  export const updateCompanyTaxInfoCertificates = function (companyId, data) {
12
13
  return __awaiter(this, void 0, void 0, function* () {
13
14
  try {
@@ -38,3 +39,33 @@ export const updateCFDIOrgLogo = function (companyId, data) {
38
39
  }
39
40
  });
40
41
  };
42
+ export const enableBillingOverage = function (data) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ try {
45
+ const config = {
46
+ headers: { Authorization: `Bearer ${this.apiToken}` }
47
+ };
48
+ const response = yield this.axiosInstance.post(`${GET_SET_BILLING}/overage/enable`, data, config);
49
+ return response;
50
+ }
51
+ catch (error) {
52
+ console.error('Error fetching enableBillingOverage:', error);
53
+ throw error;
54
+ }
55
+ });
56
+ };
57
+ export const disableBillingOverage = function (data) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ try {
60
+ const config = {
61
+ headers: { Authorization: `Bearer ${this.apiToken}` }
62
+ };
63
+ const response = yield this.axiosInstance.post(`${GET_SET_BILLING}/overage/disable`, data, config);
64
+ return response;
65
+ }
66
+ catch (error) {
67
+ console.error('Error fetching disableBillingOverage:', error);
68
+ throw error;
69
+ }
70
+ });
71
+ };
package/dist/api/index.js CHANGED
@@ -3,7 +3,7 @@ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesBySt
3
3
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
5
5
  import { getCompanyById } from "./companies/get";
6
- import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
6
+ import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
8
8
  import { getCountries } from "./countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
@@ -235,7 +235,9 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
235
235
  updateCompanyLogoById: updateCompanyLogoById,
236
236
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
237
237
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
238
- updateCFDIOrgLogo: updateCFDIOrgLogo
238
+ updateCFDIOrgLogo: updateCFDIOrgLogo,
239
+ enableBillingOverage: enableBillingOverage,
240
+ disableBillingOverage: disableBillingOverage,
239
241
  });
240
242
  this.stripe = bindMethods(this, {
241
243
  createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.5.8",
3
+ "version": "1.6.1",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,13 +1,6 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
- import { ICustomer } from "../../interfaces/Customer";
3
- import { IOrderInfo } from "../../interfaces/Order";
4
- import axiosInstance from "../axiosInstance";
5
2
 
6
3
  const GET_SET_COMPANIES = 'api/company';
7
- const REQUEST_PARAMS = {
8
- token: 'LOGGED_USER_TOKEN',
9
- };
10
-
11
4
 
12
5
  export const getCompanyById = async function (this: WashdayClientInstance, companyId: string): Promise<any> {
13
6
  try {
@@ -21,3 +14,16 @@ export const getCompanyById = async function (this: WashdayClientInstance, compa
21
14
  throw error;
22
15
  }
23
16
  };
17
+
18
+ export const getCompanyOrdersMetrics = async function (this: WashdayClientInstance): Promise<any> {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ const response = await this.axiosInstance.get(`${GET_SET_COMPANIES}/metrics/orders`, config);
24
+ return response;
25
+ } catch (error) {
26
+ console.error('Error fetching getCompanyOrdersMetrics:', error);
27
+ throw error;
28
+ }
29
+ };
@@ -1,6 +1,7 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_COMPANIES = 'api/company';
4
+ const GET_SET_BILLING = 'api/billing';
4
5
 
5
6
  export const updateCompanyTaxInfoCertificates = async function (this: WashdayClientInstance, companyId: string, data: FormData): Promise<any> {
6
7
  try {
@@ -26,4 +27,34 @@ export const updateCFDIOrgLogo = async function (this: WashdayClientInstance, co
26
27
  console.error('Error fetching updateCFDIOrgLogo:', error);
27
28
  throw error;
28
29
  }
29
- };
30
+ };
31
+
32
+ export const enableBillingOverage = async function (this: WashdayClientInstance, data: {
33
+ companyId: string;
34
+ }) {
35
+ try {
36
+ const config = {
37
+ headers: { Authorization: `Bearer ${this.apiToken}` }
38
+ };
39
+ const response = await this.axiosInstance.post(`${GET_SET_BILLING}/overage/enable`, data, config);
40
+ return response;
41
+ } catch (error) {
42
+ console.error('Error fetching enableBillingOverage:', error);
43
+ throw error;
44
+ }
45
+ }
46
+
47
+ export const disableBillingOverage = async function (this: WashdayClientInstance, data: {
48
+ companyId: string;
49
+ }) {
50
+ try {
51
+ const config = {
52
+ headers: { Authorization: `Bearer ${this.apiToken}` }
53
+ };
54
+ const response = await this.axiosInstance.post(`${GET_SET_BILLING}/overage/disable`, data, config);
55
+ return response;
56
+ } catch (error) {
57
+ console.error('Error fetching disableBillingOverage:', error);
58
+ throw error;
59
+ }
60
+ }
package/src/api/index.ts CHANGED
@@ -4,7 +4,7 @@ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesBySt
4
4
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
5
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
6
6
  import { getCompanyById } from "./companies/get";
7
- import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
+ import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
8
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
9
9
  import { getCountries } from "./countries/get";
10
10
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
@@ -242,7 +242,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
242
242
  updateCompanyLogoById: updateCompanyLogoById,
243
243
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
244
244
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
245
- updateCFDIOrgLogo: updateCFDIOrgLogo
245
+ updateCFDIOrgLogo: updateCFDIOrgLogo,
246
+ enableBillingOverage: enableBillingOverage,
247
+ disableBillingOverage: disableBillingOverage,
246
248
  });
247
249
  this.stripe = bindMethods(this, {
248
250
  createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
@@ -3,7 +3,7 @@ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesBySt
3
3
  import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
5
5
  import { getCompanyById } from "../api/companies/get";
6
- import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
6
+ import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "../api/companies/put";
8
8
  import { getCountries } from "../api/countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
@@ -228,6 +228,8 @@ export interface WashdayClientInstance {
228
228
  updateCompanyTaxInfoById: typeof updateCompanyTaxInfoById;
229
229
  updateCompanyTaxInfoCertificates: typeof updateCompanyTaxInfoCertificates;
230
230
  updateCFDIOrgLogo: typeof updateCFDIOrgLogo;
231
+ enableBillingOverage: typeof enableBillingOverage;
232
+ disableBillingOverage: typeof disableBillingOverage;
231
233
  };
232
234
  stripe: {
233
235
  createCreateSuscriptionCheckoutSession: typeof createCreateSuscriptionCheckoutSession;