washday-sdk 1.6.72 → 1.6.74
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/companies/get.js +20 -0
- package/dist/api/index.js +3 -1
- package/dist/api/reports/get.js +19 -0
- package/dist/api/stripe/post.js +2 -2
- package/package.json +1 -1
- package/src/api/companies/get.ts +25 -0
- package/src/api/index.ts +3 -1
- package/src/api/outsourcedOrders/post.ts +10 -4
- package/src/api/outsourcedOrders/put.ts +9 -4
- package/src/api/partners/post.ts +4 -2
- package/src/api/partners/put.ts +5 -3
- package/src/api/reports/get.ts +21 -0
- package/src/api/stripe/post.ts +4 -3
- package/src/interfaces/Api.ts +3 -1
- package/src/interfaces/Company.ts +28 -0
- package/test/companies.subscriptionPlanChange.test.ts +19 -1
- package/test/stripe.domainReturnUrls.test.ts +5 -3
|
@@ -89,3 +89,23 @@ export const getAvailableSubscriptionPlans = function () {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
|
+
export const getAvailableBillingExtraPackages = function () {
|
|
93
|
+
return __awaiter(this, arguments, void 0, function* (data = {}) {
|
|
94
|
+
try {
|
|
95
|
+
const config = {
|
|
96
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
97
|
+
};
|
|
98
|
+
const params = new URLSearchParams();
|
|
99
|
+
if (data.companyId) {
|
|
100
|
+
params.set("companyId", data.companyId);
|
|
101
|
+
}
|
|
102
|
+
const query = params.toString();
|
|
103
|
+
const response = yield this.axiosInstance.get(`${GET_SET_BILLING}/extra-packages${query ? `?${query}` : ""}`, config);
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('Error fetching getAvailableBillingExtraPackages:', error);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
|
|
|
2
2
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
|
|
3
3
|
import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
|
|
4
4
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
|
|
5
|
-
import { getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
5
|
+
import { getAvailableBillingExtraPackages, getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
6
6
|
import { changeSubscriptionPlan, disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, previewSubscriptionPlanChange, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
7
7
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
|
|
8
8
|
import { getCountries } from "./countries/get";
|
|
@@ -290,6 +290,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
290
290
|
disableCFDIAddon: disableCFDIAddon,
|
|
291
291
|
getCFDIAddonStatus: getCFDIAddonStatus,
|
|
292
292
|
getAvailableSubscriptionPlans: getAvailableSubscriptionPlans,
|
|
293
|
+
getAvailableBillingExtraPackages: getAvailableBillingExtraPackages,
|
|
293
294
|
previewSubscriptionPlanChange: previewSubscriptionPlanChange,
|
|
294
295
|
changeSubscriptionPlan: changeSubscriptionPlan,
|
|
295
296
|
});
|
|
@@ -356,6 +357,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
356
357
|
getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
|
|
357
358
|
getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
|
|
358
359
|
getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
|
|
360
|
+
getStaffActivityDetails: reportsExportEndpoints.getModule.getStaffActivityDetails,
|
|
359
361
|
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
360
362
|
getProductSalesDrillDown: reportsExportEndpoints.getModule.getProductSalesDrillDown,
|
|
361
363
|
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
package/dist/api/reports/get.js
CHANGED
|
@@ -145,6 +145,25 @@ export const getStaffReport = function (storeId, params) {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
|
+
export const getStaffActivityDetails = function (storeId, params) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
try {
|
|
151
|
+
const config = {
|
|
152
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
153
|
+
};
|
|
154
|
+
const queryParams = generateQueryParamsStr([
|
|
155
|
+
'fromDate',
|
|
156
|
+
'toDate',
|
|
157
|
+
'employeeId',
|
|
158
|
+
], params);
|
|
159
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/details?${queryParams}`, config);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error('Error fetching getStaffActivityDetails:', error);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
148
167
|
export const getProductSalesReport = function (storeId, params) {
|
|
149
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
169
|
try {
|
package/dist/api/stripe/post.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
const GET_SET_STRIPE = 'api/stripe';
|
|
11
|
-
const
|
|
11
|
+
const GENERATE_EXTRA_PACKAGE_CHECKOUT_SESSION = 'api/billing/extra-packages/checkout';
|
|
12
12
|
export const createCreateSuscriptionCheckoutSession = function (data) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
try {
|
|
@@ -61,7 +61,7 @@ export const createGetMoreCheckoutSession = function (data) {
|
|
|
61
61
|
const config = {
|
|
62
62
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
63
63
|
};
|
|
64
|
-
return yield this.axiosInstance.post(`${
|
|
64
|
+
return yield this.axiosInstance.post(`${GENERATE_EXTRA_PACKAGE_CHECKOUT_SESSION}`, data, config);
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
console.error('Error fetching createGetMoreCheckoutSession:', error);
|
package/package.json
CHANGED
package/src/api/companies/get.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import {
|
|
3
|
+
GetAvailableBillingExtraPackagesRequest,
|
|
3
4
|
GetAvailableSubscriptionPlansRequest,
|
|
4
5
|
GetCFDIAddonStatusRequest,
|
|
5
6
|
} from "../../interfaces/Company";
|
|
@@ -85,3 +86,27 @@ export const getAvailableSubscriptionPlans = async function (
|
|
|
85
86
|
throw error;
|
|
86
87
|
}
|
|
87
88
|
};
|
|
89
|
+
|
|
90
|
+
export const getAvailableBillingExtraPackages = async function (
|
|
91
|
+
this: WashdayClientInstance,
|
|
92
|
+
data: GetAvailableBillingExtraPackagesRequest = {},
|
|
93
|
+
): Promise<any> {
|
|
94
|
+
try {
|
|
95
|
+
const config = {
|
|
96
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
97
|
+
};
|
|
98
|
+
const params = new URLSearchParams();
|
|
99
|
+
if (data.companyId) {
|
|
100
|
+
params.set("companyId", data.companyId);
|
|
101
|
+
}
|
|
102
|
+
const query = params.toString();
|
|
103
|
+
const response = await this.axiosInstance.get(
|
|
104
|
+
`${GET_SET_BILLING}/extra-packages${query ? `?${query}` : ""}`,
|
|
105
|
+
config,
|
|
106
|
+
);
|
|
107
|
+
return response;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error('Error fetching getAvailableBillingExtraPackages:', error);
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
|
|
|
3
3
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
|
|
4
4
|
import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
|
|
5
5
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
|
|
6
|
-
import { getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
6
|
+
import { getAvailableBillingExtraPackages, getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
|
|
7
7
|
import { changeSubscriptionPlan, disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, previewSubscriptionPlanChange, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
|
|
8
8
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
|
|
9
9
|
import { getCountries } from "./countries/get";
|
|
@@ -297,6 +297,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
297
297
|
disableCFDIAddon: disableCFDIAddon,
|
|
298
298
|
getCFDIAddonStatus: getCFDIAddonStatus,
|
|
299
299
|
getAvailableSubscriptionPlans: getAvailableSubscriptionPlans,
|
|
300
|
+
getAvailableBillingExtraPackages: getAvailableBillingExtraPackages,
|
|
300
301
|
previewSubscriptionPlanChange: previewSubscriptionPlanChange,
|
|
301
302
|
changeSubscriptionPlan: changeSubscriptionPlan,
|
|
302
303
|
});
|
|
@@ -363,6 +364,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
363
364
|
getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
|
|
364
365
|
getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
|
|
365
366
|
getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
|
|
367
|
+
getStaffActivityDetails: reportsExportEndpoints.getModule.getStaffActivityDetails,
|
|
366
368
|
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
367
369
|
getProductSalesDrillDown: reportsExportEndpoints.getModule.getProductSalesDrillDown,
|
|
368
370
|
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
|
@@ -2,16 +2,22 @@ import { WashdayClientInstance } from "../../interfaces/Api";
|
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
3
|
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type OutsourcedOrderDateInput = Date | string;
|
|
6
|
+
|
|
7
|
+
export type CreateOutsourcedOrderPayload = {
|
|
6
8
|
partner?: string;
|
|
7
9
|
outsourcedStatus?: "pending" | "in_process" | "returned";
|
|
8
|
-
sentDate?:
|
|
9
|
-
receivedDate?:
|
|
10
|
+
sentDate?: OutsourcedOrderDateInput;
|
|
11
|
+
receivedDate?: OutsourcedOrderDateInput;
|
|
10
12
|
externalOrderId?: string;
|
|
11
13
|
order: string;
|
|
12
14
|
orderProduct?: string;
|
|
13
15
|
store: string;
|
|
14
|
-
|
|
16
|
+
partnerNotes?: string;
|
|
17
|
+
internalNotes?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const createOutsourcedOrder = async function (this: WashdayClientInstance, data: CreateOutsourcedOrderPayload): Promise<any> {
|
|
15
21
|
try {
|
|
16
22
|
const config = {
|
|
17
23
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
|
+
import { OutsourcedOrderDateInput } from "./post";
|
|
3
4
|
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
+
export type UpdateOutsourcedOrderPayload = {
|
|
6
7
|
partner?: string,
|
|
7
8
|
outsourcedStatus?: "pending" | "in_process" | "returned",
|
|
8
|
-
sentDate?:
|
|
9
|
-
receivedDate?:
|
|
9
|
+
sentDate?: OutsourcedOrderDateInput,
|
|
10
|
+
receivedDate?: OutsourcedOrderDateInput,
|
|
10
11
|
externalOrderId?: string,
|
|
11
|
-
|
|
12
|
+
partnerNotes?: string,
|
|
13
|
+
internalNotes?: string,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const updateOutsourcedOrderById = async function (this: WashdayClientInstance, id: string, data: UpdateOutsourcedOrderPayload): Promise<any> {
|
|
12
17
|
try {
|
|
13
18
|
const config = {
|
|
14
19
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
package/src/api/partners/post.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { IAddress } from "../../interfaces/Customer";
|
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
const GET_SET_PARTNERS = 'api/partners';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export type CreatePartnerPayload = {
|
|
7
7
|
name: string,
|
|
8
8
|
contactEmail?: string,
|
|
9
9
|
contactPhone?: string,
|
|
10
10
|
address?: IAddress
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const createPartner = async function (this: WashdayClientInstance, data: CreatePartnerPayload): Promise<any> {
|
|
12
14
|
try {
|
|
13
15
|
const config = {
|
|
14
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
package/src/api/partners/put.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { IAddress } from "../../interfaces/Customer";
|
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
const GET_SET_PARTNERS = 'api/partners';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
name
|
|
6
|
+
export type UpdatePartnerPayload = {
|
|
7
|
+
name?: string,
|
|
8
8
|
contactEmail?: string,
|
|
9
9
|
contactPhone?: string,
|
|
10
10
|
address?: IAddress
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const updatePartnerById = async function (this: WashdayClientInstance, id: string, data: UpdatePartnerPayload): Promise<any> {
|
|
12
14
|
try {
|
|
13
15
|
const config = {
|
|
14
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
package/src/api/reports/get.ts
CHANGED
|
@@ -154,6 +154,27 @@ export const getStaffReport = async function (this: WashdayClientInstance, store
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
export const getStaffActivityDetails = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
158
|
+
fromDate?: string
|
|
159
|
+
toDate?: string
|
|
160
|
+
employeeId?: string
|
|
161
|
+
}): Promise<any> {
|
|
162
|
+
try {
|
|
163
|
+
const config = {
|
|
164
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
165
|
+
};
|
|
166
|
+
const queryParams = generateQueryParamsStr([
|
|
167
|
+
'fromDate',
|
|
168
|
+
'toDate',
|
|
169
|
+
'employeeId',
|
|
170
|
+
], params);
|
|
171
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/details?${queryParams}`, config);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error('Error fetching getStaffActivityDetails:', error);
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
157
178
|
export const getProductSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
158
179
|
fromDate?: string
|
|
159
180
|
toDate?: string
|
package/src/api/stripe/post.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import { StripeReturnUrlOptions } from "../../interfaces/DomainUrls";
|
|
3
3
|
const GET_SET_STRIPE = 'api/stripe';
|
|
4
|
-
const
|
|
4
|
+
const GENERATE_EXTRA_PACKAGE_CHECKOUT_SESSION = 'api/billing/extra-packages/checkout';
|
|
5
5
|
|
|
6
6
|
export interface CreateSubscriptionCheckoutSessionRequest extends StripeReturnUrlOptions {
|
|
7
7
|
priceId: string;
|
|
@@ -9,7 +9,8 @@ export interface CreateSubscriptionCheckoutSessionRequest extends StripeReturnUr
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface CreateGetMoreCheckoutSessionRequest extends StripeReturnUrlOptions {
|
|
12
|
-
|
|
12
|
+
companyId: string;
|
|
13
|
+
packageKey: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface CreateCFDISubscriptionCheckoutSessionRequest extends StripeReturnUrlOptions {}
|
|
@@ -73,7 +74,7 @@ export const createGetMoreCheckoutSession = async function (
|
|
|
73
74
|
const config = {
|
|
74
75
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
75
76
|
};
|
|
76
|
-
return await this.axiosInstance.post(`${
|
|
77
|
+
return await this.axiosInstance.post(`${GENERATE_EXTRA_PACKAGE_CHECKOUT_SESSION}`, data, config);
|
|
77
78
|
} catch (error) {
|
|
78
79
|
console.error('Error fetching createGetMoreCheckoutSession:', error);
|
|
79
80
|
throw error;
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "../api/cashi
|
|
|
2
2
|
import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "../api/cashierbox/get";
|
|
3
3
|
import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
|
|
4
4
|
import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
|
|
5
|
-
import { getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "../api/companies/get";
|
|
5
|
+
import { getAvailableBillingExtraPackages, getAvailableSubscriptionPlans, getCFDIAddonStatus, getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "../api/companies/get";
|
|
6
6
|
import { changeSubscriptionPlan, disableBillingOverage, disableCFDIAddon, enableBillingOverage, enableCFDIAddon, previewSubscriptionPlanChange, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
|
|
7
7
|
import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "../api/companies/put";
|
|
8
8
|
import { getCountries } from "../api/countries/get";
|
|
@@ -282,6 +282,7 @@ export interface WashdayClientInstance {
|
|
|
282
282
|
disableCFDIAddon: typeof disableCFDIAddon;
|
|
283
283
|
getCFDIAddonStatus: typeof getCFDIAddonStatus;
|
|
284
284
|
getAvailableSubscriptionPlans: typeof getAvailableSubscriptionPlans;
|
|
285
|
+
getAvailableBillingExtraPackages: typeof getAvailableBillingExtraPackages;
|
|
285
286
|
previewSubscriptionPlanChange: typeof previewSubscriptionPlanChange;
|
|
286
287
|
changeSubscriptionPlan: typeof changeSubscriptionPlan;
|
|
287
288
|
};
|
|
@@ -348,6 +349,7 @@ export interface WashdayClientInstance {
|
|
|
348
349
|
getSuppliesReport: typeof reportsExportEndpoints.getModule.getSuppliesReport;
|
|
349
350
|
getDiscountCodesReport: typeof reportsExportEndpoints.getModule.getDiscountCodesReport;
|
|
350
351
|
getStaffReport: typeof reportsExportEndpoints.getModule.getStaffReport;
|
|
352
|
+
getStaffActivityDetails: typeof reportsExportEndpoints.getModule.getStaffActivityDetails;
|
|
351
353
|
getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
|
|
352
354
|
getProductSalesDrillDown: typeof reportsExportEndpoints.getModule.getProductSalesDrillDown;
|
|
353
355
|
getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
|
|
@@ -83,6 +83,34 @@ export interface AvailableSubscriptionPlansResponse {
|
|
|
83
83
|
plans: AvailableSubscriptionPlan[];
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
export type BillingExtraPackageKey =
|
|
87
|
+
| "extra_orders_100"
|
|
88
|
+
| "extra_orders_150"
|
|
89
|
+
| "extra_orders_200"
|
|
90
|
+
| "extra_orders_400"
|
|
91
|
+
| "sms_credits_300"
|
|
92
|
+
| "sms_credits_600"
|
|
93
|
+
| "sms_credits_1500";
|
|
94
|
+
|
|
95
|
+
export interface GetAvailableBillingExtraPackagesRequest {
|
|
96
|
+
companyId?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface BillingExtraPackage {
|
|
100
|
+
key: BillingExtraPackageKey;
|
|
101
|
+
quantity: number;
|
|
102
|
+
amountMinor: number;
|
|
103
|
+
displayPrice: string;
|
|
104
|
+
description: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface AvailableBillingExtraPackagesResponse {
|
|
108
|
+
country: string;
|
|
109
|
+
currency: string;
|
|
110
|
+
orders: BillingExtraPackage[];
|
|
111
|
+
sms: BillingExtraPackage[];
|
|
112
|
+
}
|
|
113
|
+
|
|
86
114
|
export interface PreviewSubscriptionPlanChangeRequest {
|
|
87
115
|
companyId?: string;
|
|
88
116
|
targetPlan: SubscriptionPlanChangePlan;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getAvailableBillingExtraPackages,
|
|
3
|
+
getAvailableSubscriptionPlans,
|
|
4
|
+
} from "../src/api/companies/get";
|
|
2
5
|
import {
|
|
3
6
|
changeSubscriptionPlan,
|
|
4
7
|
previewSubscriptionPlanChange,
|
|
@@ -39,6 +42,21 @@ describe("subscription plan change company endpoints", () => {
|
|
|
39
42
|
);
|
|
40
43
|
});
|
|
41
44
|
|
|
45
|
+
it("fetches extra billing packages through the billing endpoint", async () => {
|
|
46
|
+
const get = jest.fn().mockResolvedValue({ data: { data: { orders: [], sms: [] } } });
|
|
47
|
+
const client = {
|
|
48
|
+
apiToken: "token-1",
|
|
49
|
+
axiosInstance: { get },
|
|
50
|
+
} as any;
|
|
51
|
+
|
|
52
|
+
await getAvailableBillingExtraPackages.call(client, { companyId: "company-1" });
|
|
53
|
+
|
|
54
|
+
expect(get).toHaveBeenCalledWith(
|
|
55
|
+
"api/billing/extra-packages?companyId=company-1",
|
|
56
|
+
{ headers: { Authorization: "Bearer token-1" } },
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
42
60
|
it("previews a subscription plan change through the billing endpoint", async () => {
|
|
43
61
|
const post = jest.fn().mockResolvedValue({
|
|
44
62
|
data: {
|
|
@@ -38,14 +38,16 @@ describe("stripe checkout return URL options", () => {
|
|
|
38
38
|
} as any;
|
|
39
39
|
|
|
40
40
|
await createGetMoreCheckoutSession.call(client, {
|
|
41
|
-
|
|
41
|
+
companyId: "company-1",
|
|
42
|
+
packageKey: "extra_orders_100",
|
|
42
43
|
returnToOrigin: "https://app.washday.mx",
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
expect(post).toHaveBeenCalledWith(
|
|
46
|
-
"api/
|
|
47
|
+
"api/billing/extra-packages/checkout",
|
|
47
48
|
{
|
|
48
|
-
|
|
49
|
+
companyId: "company-1",
|
|
50
|
+
packageKey: "extra_orders_100",
|
|
49
51
|
returnToOrigin: "https://app.washday.mx",
|
|
50
52
|
},
|
|
51
53
|
{
|