btrz-api-client 5.195.0 → 5.197.0
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/lib/client-standalone-min.js +1 -1
- package/lib/endpoints/accounts/dynamic-forms.js +4 -4
- package/lib/endpoints/sales/cart.js +33 -1
- package/package.json +1 -1
- package/src/endpoints/accounts/dynamic-forms.js +2 -2
- package/src/endpoints/sales/cart.js +22 -1
- package/test/endpoints/accounts/dynamic-forms.test.js +41 -0
- package/test/endpoints/sales/cart.test.js +13 -0
- package/types/client.d.ts +36 -0
- package/types/endpoints/accounts/dynamic-forms.d.ts +21 -0
- package/types/endpoints/sales/cart.d.ts +15 -0
- package/types/initializedClient.d.ts +36 -0
|
@@ -161,6 +161,37 @@ function cartFactory(_ref) {
|
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
+
var financingCosts = {
|
|
165
|
+
create: function create(_ref12) {
|
|
166
|
+
var token = _ref12.token,
|
|
167
|
+
jwtToken = _ref12.jwtToken,
|
|
168
|
+
headers = _ref12.headers,
|
|
169
|
+
cartId = _ref12.cartId,
|
|
170
|
+
financingCost = _ref12.financingCost;
|
|
171
|
+
|
|
172
|
+
return client({
|
|
173
|
+
url: "/carts/" + cartId + "/financing-costs",
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
176
|
+
data: {
|
|
177
|
+
financingcost: financingCost
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
delete: function _delete(_ref13) {
|
|
182
|
+
var token = _ref13.token,
|
|
183
|
+
jwtToken = _ref13.jwtToken,
|
|
184
|
+
headers = _ref13.headers,
|
|
185
|
+
cartId = _ref13.cartId;
|
|
186
|
+
|
|
187
|
+
return client({
|
|
188
|
+
url: "/carts/" + cartId + "/financing-costs",
|
|
189
|
+
method: "delete",
|
|
190
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
164
195
|
return {
|
|
165
196
|
get: get,
|
|
166
197
|
create: create,
|
|
@@ -170,7 +201,8 @@ function cartFactory(_ref) {
|
|
|
170
201
|
patch: patch,
|
|
171
202
|
partialDepositStatus: partialDepositStatus,
|
|
172
203
|
payments: payments,
|
|
173
|
-
taxExemptPaymentMethod: taxExemptPaymentMethod
|
|
204
|
+
taxExemptPaymentMethod: taxExemptPaymentMethod,
|
|
205
|
+
financingCosts: financingCosts
|
|
174
206
|
};
|
|
175
207
|
}
|
|
176
208
|
|
package/package.json
CHANGED
|
@@ -98,6 +98,26 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
const financingCosts = {
|
|
102
|
+
create({token, jwtToken, headers, cartId, financingCost}) {
|
|
103
|
+
return client({
|
|
104
|
+
url: `/carts/${cartId}/financing-costs`,
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
107
|
+
data: {
|
|
108
|
+
financingcost: financingCost
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
delete({token, jwtToken, headers, cartId}) {
|
|
113
|
+
return client({
|
|
114
|
+
url: `/carts/${cartId}/financing-costs`,
|
|
115
|
+
method: "delete",
|
|
116
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
101
121
|
return {
|
|
102
122
|
get,
|
|
103
123
|
create,
|
|
@@ -107,7 +127,8 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
107
127
|
patch,
|
|
108
128
|
partialDepositStatus,
|
|
109
129
|
payments,
|
|
110
|
-
taxExemptPaymentMethod
|
|
130
|
+
taxExemptPaymentMethod,
|
|
131
|
+
financingCosts
|
|
111
132
|
};
|
|
112
133
|
}
|
|
113
134
|
|
|
@@ -10,6 +10,47 @@ describe("accounts/dynamic-forms/", () => {
|
|
|
10
10
|
axiosMock.restore();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
+
it("should GET a list of dynamic forms", () => {
|
|
14
|
+
axiosMock.onGet("/dynamic-forms").reply(expectRequest({
|
|
15
|
+
statusCode: 200,
|
|
16
|
+
token
|
|
17
|
+
}));
|
|
18
|
+
return api.accounts.dynamicForms.all({
|
|
19
|
+
token
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should GET the dynamic form", () => {
|
|
24
|
+
const dynamicFormId = "123";
|
|
25
|
+
axiosMock.onGet(`/dynamic-forms/${dynamicFormId}`)
|
|
26
|
+
.reply(expectRequest({statusCode: 200, token}));
|
|
27
|
+
return api.accounts.dynamicForms.get({token, jwtToken, dynamicFormId});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should create dynamic form", () => {
|
|
31
|
+
const data = {};
|
|
32
|
+
axiosMock.onPost(`/dynamic-forms`).reply(expectRequest({statusCode: 200, token, jwtToken, body: data}));
|
|
33
|
+
return api.accounts.dynamicForms.create({
|
|
34
|
+
jwtToken,
|
|
35
|
+
userId: id,
|
|
36
|
+
token,
|
|
37
|
+
data
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should update dynamic form field", () => {
|
|
42
|
+
const dynamicFormId = "123";
|
|
43
|
+
const data = {};
|
|
44
|
+
// eslint-disable-next-line max-len
|
|
45
|
+
axiosMock.onPut(`/dynamic-forms/${dynamicFormId}`).reply(expectRequest({statusCode: 200, token, jwtToken, body: data}));
|
|
46
|
+
return api.accounts.dynamicForms.update({
|
|
47
|
+
jwtToken,
|
|
48
|
+
dynamicFormId,
|
|
49
|
+
token,
|
|
50
|
+
data
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
13
54
|
describe("accounts/dynamic-forms/fields", () => {
|
|
14
55
|
|
|
15
56
|
it("should GET a list of dynamic form fields", () => {
|
|
@@ -81,4 +81,17 @@ describe("sales/cart", () => {
|
|
|
81
81
|
axiosMock.onPost(`/carts/${cartId}/tax-exempt-payment-method`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
82
82
|
return api.sales.cart.taxExemptPaymentMethod.post({jwtToken, token, cartId});
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
it("should delete payments from a cart", () => {
|
|
86
|
+
const cartId = "someCartId";
|
|
87
|
+
axiosMock.onDelete(`/carts/${cartId}/financing-costs`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
88
|
+
return api.sales.cart.financingCosts.delete({jwtToken, token, cartId});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("should update payments from a cart", () => {
|
|
92
|
+
const cartId = "someCartId";
|
|
93
|
+
const financingCost = {_id: "123"};
|
|
94
|
+
axiosMock.onPost(`/carts/${cartId}/financing-costs`).reply(expectRequest({statusCode: 204, token, jwtToken}));
|
|
95
|
+
return api.sales.cart.financingCosts.create({jwtToken, token, cartId, financingCost});
|
|
96
|
+
});
|
|
84
97
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -1885,6 +1885,27 @@ export function createApiClient(options: {
|
|
|
1885
1885
|
}) => any;
|
|
1886
1886
|
};
|
|
1887
1887
|
dynamicForms: {
|
|
1888
|
+
get: ({ token, jwtToken, dynamicFormId, headers }?: {}) => any;
|
|
1889
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
1890
|
+
token: any;
|
|
1891
|
+
jwtToken: any;
|
|
1892
|
+
query?: {};
|
|
1893
|
+
headers: any;
|
|
1894
|
+
}) => any;
|
|
1895
|
+
create: ({ token, jwtToken, query, data, headers }: {
|
|
1896
|
+
token: any;
|
|
1897
|
+
jwtToken: any;
|
|
1898
|
+
query?: {};
|
|
1899
|
+
data: any;
|
|
1900
|
+
headers: any;
|
|
1901
|
+
}) => any;
|
|
1902
|
+
update: ({ token, jwtToken, dynamicFormId, data, headers }: {
|
|
1903
|
+
token: any;
|
|
1904
|
+
jwtToken: any;
|
|
1905
|
+
dynamicFormId: any;
|
|
1906
|
+
data: any;
|
|
1907
|
+
headers: any;
|
|
1908
|
+
}) => any;
|
|
1888
1909
|
fields: {
|
|
1889
1910
|
get({ token, jwtToken, dynamicFormFieldId, headers }?: {}): any;
|
|
1890
1911
|
all({ token, jwtToken, query, headers }: {
|
|
@@ -2783,6 +2804,21 @@ export function createApiClient(options: {
|
|
|
2783
2804
|
data?: {};
|
|
2784
2805
|
}): any;
|
|
2785
2806
|
};
|
|
2807
|
+
financingCosts: {
|
|
2808
|
+
create({ token, jwtToken, headers, cartId, financingCost }: {
|
|
2809
|
+
token: any;
|
|
2810
|
+
jwtToken: any;
|
|
2811
|
+
headers: any;
|
|
2812
|
+
cartId: any;
|
|
2813
|
+
financingCost: any;
|
|
2814
|
+
}): any;
|
|
2815
|
+
delete({ token, jwtToken, headers, cartId }: {
|
|
2816
|
+
token: any;
|
|
2817
|
+
jwtToken: any;
|
|
2818
|
+
headers: any;
|
|
2819
|
+
cartId: any;
|
|
2820
|
+
}): any;
|
|
2821
|
+
};
|
|
2786
2822
|
};
|
|
2787
2823
|
giftCertificates: {
|
|
2788
2824
|
get: ({ token, GCNumber, query, headers }: {
|
|
@@ -3,6 +3,27 @@ declare function dynamicFormsFactory({ client, internalAuthTokenProvider }: {
|
|
|
3
3
|
client: any;
|
|
4
4
|
internalAuthTokenProvider: any;
|
|
5
5
|
}): {
|
|
6
|
+
get: ({ token, jwtToken, dynamicFormId, headers }?: {}) => any;
|
|
7
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
8
|
+
token: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
query?: {};
|
|
11
|
+
headers: any;
|
|
12
|
+
}) => any;
|
|
13
|
+
create: ({ token, jwtToken, query, data, headers }: {
|
|
14
|
+
token: any;
|
|
15
|
+
jwtToken: any;
|
|
16
|
+
query?: {};
|
|
17
|
+
data: any;
|
|
18
|
+
headers: any;
|
|
19
|
+
}) => any;
|
|
20
|
+
update: ({ token, jwtToken, dynamicFormId, data, headers }: {
|
|
21
|
+
token: any;
|
|
22
|
+
jwtToken: any;
|
|
23
|
+
dynamicFormId: any;
|
|
24
|
+
data: any;
|
|
25
|
+
headers: any;
|
|
26
|
+
}) => any;
|
|
6
27
|
fields: {
|
|
7
28
|
get({ token, jwtToken, dynamicFormFieldId, headers }?: {}): any;
|
|
8
29
|
all({ token, jwtToken, query, headers }: {
|
|
@@ -77,4 +77,19 @@ declare function cartFactory({ client, internalAuthTokenProvider }: {
|
|
|
77
77
|
data?: {};
|
|
78
78
|
}): any;
|
|
79
79
|
};
|
|
80
|
+
financingCosts: {
|
|
81
|
+
create({ token, jwtToken, headers, cartId, financingCost }: {
|
|
82
|
+
token: any;
|
|
83
|
+
jwtToken: any;
|
|
84
|
+
headers: any;
|
|
85
|
+
cartId: any;
|
|
86
|
+
financingCost: any;
|
|
87
|
+
}): any;
|
|
88
|
+
delete({ token, jwtToken, headers, cartId }: {
|
|
89
|
+
token: any;
|
|
90
|
+
jwtToken: any;
|
|
91
|
+
headers: any;
|
|
92
|
+
cartId: any;
|
|
93
|
+
}): any;
|
|
94
|
+
};
|
|
80
95
|
};
|
|
@@ -1839,6 +1839,27 @@ declare const _exports: {
|
|
|
1839
1839
|
}) => any;
|
|
1840
1840
|
};
|
|
1841
1841
|
dynamicForms: {
|
|
1842
|
+
get: ({ token, jwtToken, dynamicFormId, headers }?: {}) => any;
|
|
1843
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
1844
|
+
token: any;
|
|
1845
|
+
jwtToken: any;
|
|
1846
|
+
query?: {};
|
|
1847
|
+
headers: any;
|
|
1848
|
+
}) => any;
|
|
1849
|
+
create: ({ token, jwtToken, query, data, headers }: {
|
|
1850
|
+
token: any;
|
|
1851
|
+
jwtToken: any;
|
|
1852
|
+
query?: {};
|
|
1853
|
+
data: any;
|
|
1854
|
+
headers: any;
|
|
1855
|
+
}) => any;
|
|
1856
|
+
update: ({ token, jwtToken, dynamicFormId, data, headers }: {
|
|
1857
|
+
token: any;
|
|
1858
|
+
jwtToken: any;
|
|
1859
|
+
dynamicFormId: any;
|
|
1860
|
+
data: any;
|
|
1861
|
+
headers: any;
|
|
1862
|
+
}) => any;
|
|
1842
1863
|
fields: {
|
|
1843
1864
|
get({ token, jwtToken, dynamicFormFieldId, headers }?: {}): any;
|
|
1844
1865
|
all({ token, jwtToken, query, headers }: {
|
|
@@ -2737,6 +2758,21 @@ declare const _exports: {
|
|
|
2737
2758
|
data?: {};
|
|
2738
2759
|
}): any;
|
|
2739
2760
|
};
|
|
2761
|
+
financingCosts: {
|
|
2762
|
+
create({ token, jwtToken, headers, cartId, financingCost }: {
|
|
2763
|
+
token: any;
|
|
2764
|
+
jwtToken: any;
|
|
2765
|
+
headers: any;
|
|
2766
|
+
cartId: any;
|
|
2767
|
+
financingCost: any;
|
|
2768
|
+
}): any;
|
|
2769
|
+
delete({ token, jwtToken, headers, cartId }: {
|
|
2770
|
+
token: any;
|
|
2771
|
+
jwtToken: any;
|
|
2772
|
+
headers: any;
|
|
2773
|
+
cartId: any;
|
|
2774
|
+
}): any;
|
|
2775
|
+
};
|
|
2740
2776
|
};
|
|
2741
2777
|
giftCertificates: {
|
|
2742
2778
|
get: ({ token, GCNumber, query, headers }: {
|