washday-sdk 0.0.49 → 0.0.50
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/dist/api/index.js +7 -0
- package/dist/api/stripe/get.js +1 -0
- package/dist/api/stripe/post.js +65 -0
- package/dist/api/stripe/put.js +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +7 -0
- package/src/api/stripe/get.ts +0 -0
- package/src/api/stripe/post.ts +42 -0
- package/src/api/stripe/put.ts +0 -0
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,
|
|
@@ -46,4 +48,9 @@ WashdayClient.prototype.companies = {
|
|
|
46
48
|
updateCompanyTaxInfoCertificates: post_1.updateCompanyTaxInfoCertificates,
|
|
47
49
|
updateCFDIOrgLogo: post_1.updateCFDIOrgLogo
|
|
48
50
|
};
|
|
51
|
+
WashdayClient.prototype.stripe = {
|
|
52
|
+
createCreateSuscriptionCheckoutSession: post_3.createCreateSuscriptionCheckoutSession,
|
|
53
|
+
createCFDISuscrptionCheckoutSession: post_3.createCFDISuscrptionCheckoutSession,
|
|
54
|
+
createCustomerPortalSession: post_3.createCustomerPortalSession
|
|
55
|
+
};
|
|
49
56
|
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
package/src/api/index.ts
CHANGED
|
@@ -8,6 +8,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 = {
|
|
@@ -58,7 +60,12 @@ WashdayClient.prototype.companies = {
|
|
|
58
60
|
updateCompanyTaxInfoById: updateCompanyTaxInfoById,
|
|
59
61
|
updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
|
|
60
62
|
updateCFDIOrgLogo: updateCFDIOrgLogo
|
|
63
|
+
};
|
|
61
64
|
|
|
65
|
+
WashdayClient.prototype.stripe = {
|
|
66
|
+
createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
|
|
67
|
+
createCFDISuscrptionCheckoutSession: createCFDISuscrptionCheckoutSession,
|
|
68
|
+
createCustomerPortalSession: createCustomerPortalSession
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
export default WashdayClient;
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
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?: any): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-subscription-checkout-session`, data, config);
|
|
11
|
+
return response;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching createCreateSuscriptionCheckoutSession:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const createCustomerPortalSession = async function (this: WashdayClientInstance, data?: any): Promise<any> {
|
|
19
|
+
try {
|
|
20
|
+
const config = {
|
|
21
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
|
+
};
|
|
23
|
+
const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-customer-portal-session`, data, config);
|
|
24
|
+
return response;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Error fetching createCustomerPortalSession:', error);
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const createCFDISuscrptionCheckoutSession = async function (this: WashdayClientInstance, data?: any): Promise<any> {
|
|
32
|
+
try {
|
|
33
|
+
const config = {
|
|
34
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
35
|
+
};
|
|
36
|
+
const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-cfdi-subscription-checkout-session`, data, config);
|
|
37
|
+
return response;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error fetching createCFDISuscrptionCheckoutSession:', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
File without changes
|