washday-sdk 0.0.49 → 0.0.52

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.
@@ -12,14 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.updateCompanyTaxInfoById = exports.updateCompanyById = void 0;
15
+ exports.updateCompanyTaxInfoById = exports.updateCompanyLogoById = exports.updateCompanyById = void 0;
16
16
  const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
17
  const GET_SET_COMPANIES = 'api/company';
18
18
  const updateCompanyById = function (companyId, data) {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
20
  try {
21
21
  const config = {
22
- headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
23
  };
24
24
  const response = yield axiosInstance_1.default.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
25
25
  return response;
@@ -31,6 +31,23 @@ const updateCompanyById = function (companyId, data) {
31
31
  });
32
32
  };
33
33
  exports.updateCompanyById = updateCompanyById;
34
+ const updateCompanyLogoById = function (companyId, data) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ //TODO: company logo requires to have content-type false?
38
+ const config = {
39
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
40
+ };
41
+ const response = yield axiosInstance_1.default.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
42
+ return response;
43
+ }
44
+ catch (error) {
45
+ console.error('Error fetching updateCompanyLogoById:', error);
46
+ throw error;
47
+ }
48
+ });
49
+ };
50
+ exports.updateCompanyLogoById = updateCompanyLogoById;
34
51
  const updateCompanyTaxInfoById = function (companyId, data) {
35
52
  return __awaiter(this, void 0, void 0, function* () {
36
53
  try {
package/dist/api/index.js CHANGED
@@ -9,6 +9,7 @@ const put_2 = require("./products/put");
9
9
  const get_4 = require("./stores/get");
10
10
  const post_2 = require("./stores/post");
11
11
  const put_3 = require("./stores/put");
12
+ const post_3 = require("./stripe/post");
12
13
  const put_4 = require("./users/put");
13
14
  const WashdayClient = function WashdayClient(apiToken) {
14
15
  this.apiToken = apiToken;
@@ -18,6 +19,7 @@ const WashdayClient = function WashdayClient(apiToken) {
18
19
  WashdayClient.prototype.users.apiToken = apiToken;
19
20
  WashdayClient.prototype.countries.apiToken = apiToken;
20
21
  WashdayClient.prototype.companies.apiToken = apiToken;
22
+ WashdayClient.prototype.stripe.apiToken = apiToken;
21
23
  };
22
24
  WashdayClient.prototype.customers = {
23
25
  getCustomerById: get_3.getCustomerById,
@@ -42,8 +44,14 @@ WashdayClient.prototype.countries = {
42
44
  WashdayClient.prototype.companies = {
43
45
  getCompanyById: get_1.getCompanyById,
44
46
  updateCompanyById: put_1.updateCompanyById,
47
+ updateCompanyLogoById: put_1.updateCompanyLogoById,
45
48
  updateCompanyTaxInfoById: put_1.updateCompanyTaxInfoById,
46
49
  updateCompanyTaxInfoCertificates: post_1.updateCompanyTaxInfoCertificates,
47
50
  updateCFDIOrgLogo: post_1.updateCFDIOrgLogo
48
51
  };
52
+ WashdayClient.prototype.stripe = {
53
+ createCreateSuscriptionCheckoutSession: post_3.createCreateSuscriptionCheckoutSession,
54
+ createCFDISuscrptionCheckoutSession: post_3.createCFDISuscrptionCheckoutSession,
55
+ createCustomerPortalSession: post_3.createCustomerPortalSession
56
+ };
49
57
  exports.default = WashdayClient;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.createCFDISuscrptionCheckoutSession = exports.createCustomerPortalSession = exports.createCreateSuscriptionCheckoutSession = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_STRIPE = 'api/stripe';
18
+ const createCreateSuscriptionCheckoutSession = function (data) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ const response = yield axiosInstance_1.default.post(`${GET_SET_STRIPE}/create-subscription-checkout-session`, data, config);
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ console.error('Error fetching createCreateSuscriptionCheckoutSession:', error);
29
+ throw error;
30
+ }
31
+ });
32
+ };
33
+ exports.createCreateSuscriptionCheckoutSession = createCreateSuscriptionCheckoutSession;
34
+ const createCustomerPortalSession = function (data) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ const config = {
38
+ headers: { Authorization: `Bearer ${this.apiToken}` }
39
+ };
40
+ const response = yield axiosInstance_1.default.post(`${GET_SET_STRIPE}/create-customer-portal-session`, data, config);
41
+ return response;
42
+ }
43
+ catch (error) {
44
+ console.error('Error fetching createCustomerPortalSession:', error);
45
+ throw error;
46
+ }
47
+ });
48
+ };
49
+ exports.createCustomerPortalSession = createCustomerPortalSession;
50
+ const createCFDISuscrptionCheckoutSession = function (data) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ try {
53
+ const config = {
54
+ headers: { Authorization: `Bearer ${this.apiToken}` }
55
+ };
56
+ const response = yield axiosInstance_1.default.post(`${GET_SET_STRIPE}/create-cfdi-subscription-checkout-session`, data, config);
57
+ return response;
58
+ }
59
+ catch (error) {
60
+ console.error('Error fetching createCFDISuscrptionCheckoutSession:', error);
61
+ throw error;
62
+ }
63
+ });
64
+ };
65
+ exports.createCFDISuscrptionCheckoutSession = createCFDISuscrptionCheckoutSession;
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.49",
3
+ "version": "0.0.52",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -5,7 +5,7 @@ const GET_SET_COMPANIES = 'api/company';
5
5
  export const updateCompanyById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
6
6
  try {
7
7
  const config = {
8
- headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
10
  const response = await axiosInstance.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
11
11
  return response;
@@ -15,6 +15,20 @@ export const updateCompanyById = async function (this: WashdayClientInstance, co
15
15
  }
16
16
  };
17
17
 
18
+ export const updateCompanyLogoById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
19
+ try {
20
+ //TODO: company logo requires to have content-type false?
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
23
+ };
24
+ const response = await axiosInstance.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
25
+ return response;
26
+ } catch (error) {
27
+ console.error('Error fetching updateCompanyLogoById:', error);
28
+ throw error;
29
+ }
30
+ };
31
+
18
32
  export const updateCompanyTaxInfoById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
19
33
  try {
20
34
  const config = {
package/src/api/index.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
2
  import { getCompanyById } from "./companies/get";
3
3
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
4
- import { updateCompanyById, updateCompanyTaxInfoById } from "./companies/put";
4
+ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
5
5
  import { getCountries } from "./countries/get";
6
6
  import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
7
7
  import { bulkUpdate } from "./products/put";
8
8
  import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
9
9
  import { createStoreImage } from "./stores/post";
10
10
  import { updateStoreById } from "./stores/put";
11
+ import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession } from "./stripe/post";
11
12
  import { updateUserById } from "./users/put";
12
13
 
13
14
  type WashdayClientConstructor = {
@@ -24,6 +25,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
24
25
  WashdayClient.prototype.users.apiToken = apiToken;
25
26
  WashdayClient.prototype.countries.apiToken = apiToken;
26
27
  WashdayClient.prototype.companies.apiToken = apiToken;
28
+ WashdayClient.prototype.stripe.apiToken = apiToken;
27
29
  } as any;
28
30
 
29
31
  WashdayClient.prototype.customers = {
@@ -55,10 +57,16 @@ WashdayClient.prototype.countries = {
55
57
  WashdayClient.prototype.companies = {
56
58
  getCompanyById: getCompanyById,
57
59
  updateCompanyById: updateCompanyById,
60
+ updateCompanyLogoById: updateCompanyLogoById,
58
61
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
59
62
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
60
63
  updateCFDIOrgLogo: updateCFDIOrgLogo
64
+ };
61
65
 
66
+ WashdayClient.prototype.stripe = {
67
+ createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
68
+ createCFDISuscrptionCheckoutSession: createCFDISuscrptionCheckoutSession,
69
+ createCustomerPortalSession: createCustomerPortalSession
62
70
  };
63
71
 
64
72
  export default WashdayClient;
File without changes
@@ -0,0 +1,44 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_STRIPE = 'api/stripe';
4
+
5
+ export const createCreateSuscriptionCheckoutSession = async function (this: WashdayClientInstance, data: {
6
+ priceId: string
7
+ }): Promise<any> {
8
+ try {
9
+ const config = {
10
+ headers: { Authorization: `Bearer ${this.apiToken}` }
11
+ };
12
+ const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-subscription-checkout-session`, data, config);
13
+ return response;
14
+ } catch (error) {
15
+ console.error('Error fetching createCreateSuscriptionCheckoutSession:', error);
16
+ throw error;
17
+ }
18
+ };
19
+
20
+ export const createCustomerPortalSession = async function (this: WashdayClientInstance, data?: any): Promise<any> {
21
+ try {
22
+ const config = {
23
+ headers: { Authorization: `Bearer ${this.apiToken}` }
24
+ };
25
+ const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-customer-portal-session`, data, config);
26
+ return response;
27
+ } catch (error) {
28
+ console.error('Error fetching createCustomerPortalSession:', error);
29
+ throw error;
30
+ }
31
+ };
32
+
33
+ export const createCFDISuscrptionCheckoutSession = async function (this: WashdayClientInstance, data?: any): Promise<any> {
34
+ try {
35
+ const config = {
36
+ headers: { Authorization: `Bearer ${this.apiToken}` }
37
+ };
38
+ const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-cfdi-subscription-checkout-session`, data, config);
39
+ return response;
40
+ } catch (error) {
41
+ console.error('Error fetching createCFDISuscrptionCheckoutSession:', error);
42
+ throw error;
43
+ }
44
+ };
File without changes