btrz-api-client 3.42.0 → 3.44.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/btrzpay/payment-methods.js +16 -1
- package/lib/endpoints/operations/manifest.js +40 -2
- package/package.json +4 -2
- package/src/endpoints/btrzpay/payment-methods.js +12 -1
- package/src/endpoints/operations/manifest.js +30 -1
- package/test/endpoints/btrzpay/payment-methods.test.js +15 -0
- package/test/endpoints/operations/manifest.test.js +35 -0
- package/types/client.d.ts +2330 -0
- package/types/constants.d.ts +1 -0
- package/types/endpoints/accounts/accounts.d.ts +11 -0
- package/types/endpoints/accounts/application-settings.d.ts +38 -0
- package/types/endpoints/accounts/application.d.ts +11 -0
- package/types/endpoints/accounts/applications.d.ts +18 -0
- package/types/endpoints/accounts/current-shifts.d.ts +12 -0
- package/types/endpoints/accounts/customers.d.ts +45 -0
- package/types/endpoints/accounts/docs.d.ts +6 -0
- package/types/endpoints/accounts/domains.d.ts +23 -0
- package/types/endpoints/accounts/email-settings.d.ts +38 -0
- package/types/endpoints/accounts/exchange-rates.d.ts +19 -0
- package/types/endpoints/accounts/interline.d.ts +68 -0
- package/types/endpoints/accounts/lexicons.d.ts +30 -0
- package/types/endpoints/accounts/print-settings.d.ts +31 -0
- package/types/endpoints/accounts/printers.d.ts +11 -0
- package/types/endpoints/accounts/shifts.d.ts +11 -0
- package/types/endpoints/accounts/travellers.d.ts +41 -0
- package/types/endpoints/accounts/trusted-machines.d.ts +12 -0
- package/types/endpoints/accounts/users.d.ts +18 -0
- package/types/endpoints/btrzpay/customerCards.d.ts +37 -0
- package/types/endpoints/btrzpay/customers.d.ts +27 -0
- package/types/endpoints/btrzpay/docs.d.ts +6 -0
- package/types/endpoints/btrzpay/payment-methods.d.ts +50 -0
- package/types/endpoints/btrzpay/payments.d.ts +18 -0
- package/types/endpoints/btrzpay/reference-numbers.d.ts +12 -0
- package/types/endpoints/btrzpay/referenced-payments.d.ts +21 -0
- package/types/endpoints/btrzpay/square.d.ts +22 -0
- package/types/endpoints/coltrane/docs.d.ts +6 -0
- package/types/endpoints/coltrane/paths.d.ts +11 -0
- package/types/endpoints/endpoints_helpers.d.ts +9 -0
- package/types/endpoints/gps/scanner-app-location.d.ts +10 -0
- package/types/endpoints/inventory/amenities.d.ts +30 -0
- package/types/endpoints/inventory/amenity-groups.d.ts +30 -0
- package/types/endpoints/inventory/bare-routes.d.ts +17 -0
- package/types/endpoints/inventory/brands.d.ts +31 -0
- package/types/endpoints/inventory/bundle-fares.d.ts +13 -0
- package/types/endpoints/inventory/bundles.d.ts +18 -0
- package/types/endpoints/inventory/companies.d.ts +12 -0
- package/types/endpoints/inventory/countries.d.ts +11 -0
- package/types/endpoints/inventory/custom-content.d.ts +35 -0
- package/types/endpoints/inventory/docs.d.ts +6 -0
- package/types/endpoints/inventory/fare-classes.d.ts +25 -0
- package/types/endpoints/inventory/fares.d.ts +16 -0
- package/types/endpoints/inventory/fees.d.ts +11 -0
- package/types/endpoints/inventory/filtered-trips-v2.d.ts +12 -0
- package/types/endpoints/inventory/filtered-trips.d.ts +12 -0
- package/types/endpoints/inventory/gift-certificate-definitions.d.ts +11 -0
- package/types/endpoints/inventory/healthcheck.d.ts +7 -0
- package/types/endpoints/inventory/insurances.d.ts +35 -0
- package/types/endpoints/inventory/insurancesCost.d.ts +13 -0
- package/types/endpoints/inventory/items.d.ts +11 -0
- package/types/endpoints/inventory/journey-prices.d.ts +25 -0
- package/types/endpoints/inventory/marketplace-modifiers.d.ts +35 -0
- package/types/endpoints/inventory/operating-companies.d.ts +31 -0
- package/types/endpoints/inventory/operation-messages.d.ts +41 -0
- package/types/endpoints/inventory/parcel-zones.d.ts +24 -0
- package/types/endpoints/inventory/payment-terminals.d.ts +35 -0
- package/types/endpoints/inventory/products.d.ts +18 -0
- package/types/endpoints/inventory/promos.d.ts +51 -0
- package/types/endpoints/inventory/routes.d.ts +53 -0
- package/types/endpoints/inventory/schedules.d.ts +11 -0
- package/types/endpoints/inventory/seatfees.d.ts +29 -0
- package/types/endpoints/inventory/seatmaps.d.ts +15 -0
- package/types/endpoints/inventory/service-numbers.d.ts +31 -0
- package/types/endpoints/inventory/service-types.d.ts +35 -0
- package/types/endpoints/inventory/ssrs.d.ts +11 -0
- package/types/endpoints/inventory/station-groups.d.ts +11 -0
- package/types/endpoints/inventory/stations-zones.d.ts +11 -0
- package/types/endpoints/inventory/stations.d.ts +16 -0
- package/types/endpoints/inventory/taxes.d.ts +30 -0
- package/types/endpoints/inventory/traveller-card-providers-types.d.ts +11 -0
- package/types/endpoints/inventory/traveller-card-providers.d.ts +31 -0
- package/types/endpoints/inventory/traveller-card-types.d.ts +37 -0
- package/types/endpoints/inventory/trips.d.ts +17 -0
- package/types/endpoints/inventory/zone-price-overages.d.ts +35 -0
- package/types/endpoints/inventory/zone-prices.d.ts +35 -0
- package/types/endpoints/invoices/docs.d.ts +6 -0
- package/types/endpoints/invoices/emails.d.ts +13 -0
- package/types/endpoints/invoices/infile.d.ts +13 -0
- package/types/endpoints/invoices/pdfs.d.ts +13 -0
- package/types/endpoints/invoices/providers.d.ts +41 -0
- package/types/endpoints/invoices/tax-ids.d.ts +12 -0
- package/types/endpoints/loyalty/movements.d.ts +31 -0
- package/types/endpoints/loyalty/programs.d.ts +25 -0
- package/types/endpoints/notifications/customers.d.ts +12 -0
- package/types/endpoints/notifications/email.d.ts +12 -0
- package/types/endpoints/notifications/manifest-notifications.d.ts +18 -0
- package/types/endpoints/notifications/printed-tickets.d.ts +15 -0
- package/types/endpoints/operations/accounting_items.d.ts +16 -0
- package/types/endpoints/operations/applied_insurance.d.ts +12 -0
- package/types/endpoints/operations/calendar_entries.d.ts +11 -0
- package/types/endpoints/operations/docs.d.ts +6 -0
- package/types/endpoints/operations/flexpasses.d.ts +13 -0
- package/types/endpoints/operations/loans.d.ts +16 -0
- package/types/endpoints/operations/manifest.d.ts +83 -0
- package/types/endpoints/operations/movements.d.ts +13 -0
- package/types/endpoints/operations/outlook-trips.d.ts +10 -0
- package/types/endpoints/operations/parcels.d.ts +26 -0
- package/types/endpoints/operations/redemption.d.ts +19 -0
- package/types/endpoints/operations/scheduled_notifications.d.ts +38 -0
- package/types/endpoints/operations/segments.d.ts +14 -0
- package/types/endpoints/operations/tickets.d.ts +26 -0
- package/types/endpoints/operations/transaction.d.ts +13 -0
- package/types/endpoints/operations/transactions.d.ts +55 -0
- package/types/endpoints/operations/trip_change_info.d.ts +13 -0
- package/types/endpoints/operations/waitlists.d.ts +30 -0
- package/types/endpoints/reports/custom-reports.d.ts +24 -0
- package/types/endpoints/reports/report-types.d.ts +18 -0
- package/types/endpoints/sales/bundles.d.ts +11 -0
- package/types/endpoints/sales/cart-promo.d.ts +20 -0
- package/types/endpoints/sales/cart.d.ts +48 -0
- package/types/endpoints/sales/custom-fields.d.ts +11 -0
- package/types/endpoints/sales/docs.d.ts +6 -0
- package/types/endpoints/sales/flexpasses.d.ts +13 -0
- package/types/endpoints/sales/gift-certificates.d.ts +12 -0
- package/types/endpoints/sales/order.d.ts +18 -0
- package/types/endpoints/sales/payment-providers.d.ts +12 -0
- package/types/endpoints/sales/redeemable-items.d.ts +18 -0
- package/types/endpoints/sales/sync-entry.d.ts +12 -0
- package/types/endpoints/sales/voucher.d.ts +11 -0
- package/types/endpoints/seatmaps/access-ticket.d.ts +11 -0
- package/types/endpoints/seatmaps/seat.d.ts +12 -0
- package/types/endpoints/uploads/files.d.ts +11 -0
- package/types/endpoints/uploads/images.d.ts +11 -0
- package/types/endpoints/webhooks/events.d.ts +13 -0
- package/types/endpoints/webhooks/subscriptions.d.ts +38 -0
- package/types/endpoints/webhooks/undelivered.d.ts +36 -0
- package/types/endpoints/webhooks/webhooks.d.ts +12 -0
- package/types/initializedClient.d.ts +2284 -0
- package/types/productionDefaults.d.ts +6 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable import/extensions */
|
|
3
4
|
var _require = require("./../endpoints_helpers"),
|
|
4
5
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
6
|
|
|
@@ -89,13 +90,27 @@ function paymentMethodsFactory(_ref) {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
function createDefaultPaymentMethods(_ref8) {
|
|
94
|
+
var token = _ref8.token,
|
|
95
|
+
jwtToken = _ref8.jwtToken,
|
|
96
|
+
accountId = _ref8.accountId;
|
|
97
|
+
|
|
98
|
+
return client({
|
|
99
|
+
url: "/default-payment-methods",
|
|
100
|
+
method: "post",
|
|
101
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
102
|
+
data: { accountId: accountId }
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
return {
|
|
93
107
|
all: all,
|
|
94
108
|
getByProviderName: getByProviderName,
|
|
95
109
|
create: create,
|
|
96
110
|
get: get,
|
|
97
111
|
setToAgency: setToAgency,
|
|
98
|
-
update: update
|
|
112
|
+
update: update,
|
|
113
|
+
createDefaultPaymentMethods: createDefaultPaymentMethods
|
|
99
114
|
};
|
|
100
115
|
}
|
|
101
116
|
|
|
@@ -142,7 +142,7 @@ function manifestFactory(_ref) {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
function
|
|
145
|
+
function addCapacityException(_ref10) {
|
|
146
146
|
var token = _ref10.token,
|
|
147
147
|
jwtToken = _ref10.jwtToken,
|
|
148
148
|
manifestId = _ref10.manifestId,
|
|
@@ -151,6 +151,42 @@ function manifestFactory(_ref) {
|
|
|
151
151
|
data = _ref10.data,
|
|
152
152
|
headers = _ref10.headers;
|
|
153
153
|
|
|
154
|
+
return client({
|
|
155
|
+
url: "/manifests/" + manifestId + "/capacity-exceptions",
|
|
156
|
+
method: "post",
|
|
157
|
+
headers: authorizationHeaders({
|
|
158
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
159
|
+
}),
|
|
160
|
+
params: query,
|
|
161
|
+
data: data
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function removeCapacityException(_ref11) {
|
|
166
|
+
var token = _ref11.token,
|
|
167
|
+
jwtToken = _ref11.jwtToken,
|
|
168
|
+
manifestId = _ref11.manifestId,
|
|
169
|
+
exceptionId = _ref11.exceptionId,
|
|
170
|
+
headers = _ref11.headers;
|
|
171
|
+
|
|
172
|
+
return client({
|
|
173
|
+
url: "/manifests/" + manifestId + "/capacity-exceptions/" + exceptionId,
|
|
174
|
+
method: "delete",
|
|
175
|
+
headers: authorizationHeaders({
|
|
176
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function updateComment(_ref12) {
|
|
182
|
+
var token = _ref12.token,
|
|
183
|
+
jwtToken = _ref12.jwtToken,
|
|
184
|
+
manifestId = _ref12.manifestId,
|
|
185
|
+
_ref12$query = _ref12.query,
|
|
186
|
+
query = _ref12$query === undefined ? {} : _ref12$query,
|
|
187
|
+
data = _ref12.data,
|
|
188
|
+
headers = _ref12.headers;
|
|
189
|
+
|
|
154
190
|
return client({
|
|
155
191
|
url: "/manifests/" + manifestId + "/comments",
|
|
156
192
|
method: "put",
|
|
@@ -171,7 +207,9 @@ function manifestFactory(_ref) {
|
|
|
171
207
|
save: save,
|
|
172
208
|
addUser: addUser,
|
|
173
209
|
removeUser: removeUser,
|
|
174
|
-
updateComment: updateComment
|
|
210
|
+
updateComment: updateComment,
|
|
211
|
+
addCapacityException: addCapacityException,
|
|
212
|
+
removeCapacityException: removeCapacityException
|
|
175
213
|
};
|
|
176
214
|
}
|
|
177
215
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btrz-api-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.44.0",
|
|
4
4
|
"description": "Api client for Betterez endpoints",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"test:integration": "mocha --recursive -r test-integration/ports.js test-integration/",
|
|
10
10
|
"browserify": "browserify lib/client.js --standalone BtrzApiClient -p tinyify -o lib/client-standalone-min.js",
|
|
11
11
|
"commit-transpile": "git add lib/ && (git diff-index --quiet HEAD || git commit -m \"transpiled src\")",
|
|
12
|
+
"commit-types": "git add types/ && (git diff-index --quiet HEAD || git commit -m \"generated types from src\")",
|
|
12
13
|
"pretranspile": "rm -rf lib/",
|
|
14
|
+
"types": "npx -p typescript tsc src/**.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
|
13
15
|
"transpile": "babel --presets es2015 -d lib/ src/",
|
|
14
|
-
"preversion": "npm test && npm run transpile && npm run browserify && npm run commit-transpile",
|
|
16
|
+
"preversion": "npm test && npm run transpile && npm run browserify && npm run types && npm run commit-transpile && npm run commit-types",
|
|
15
17
|
"postversion": "git push origin master && git push --tags",
|
|
16
18
|
"version": "git tag $1"
|
|
17
19
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable import/extensions */
|
|
1
2
|
const { authorizationHeaders } = require("./../endpoints_helpers");
|
|
2
3
|
|
|
3
4
|
function paymentMethodsFactory({ client, internalAuthTokenProvider }) {
|
|
@@ -49,13 +50,23 @@ function paymentMethodsFactory({ client, internalAuthTokenProvider }) {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
function createDefaultPaymentMethods({token, jwtToken, accountId}) {
|
|
54
|
+
return client({
|
|
55
|
+
url: "/default-payment-methods",
|
|
56
|
+
method: "post",
|
|
57
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider}),
|
|
58
|
+
data: {accountId}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
return {
|
|
53
63
|
all,
|
|
54
64
|
getByProviderName,
|
|
55
65
|
create,
|
|
56
66
|
get,
|
|
57
67
|
setToAgency,
|
|
58
|
-
update
|
|
68
|
+
update,
|
|
69
|
+
createDefaultPaymentMethods
|
|
59
70
|
};
|
|
60
71
|
}
|
|
61
72
|
|
|
@@ -102,6 +102,33 @@ function manifestFactory({
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
function addCapacityException({
|
|
106
|
+
token, jwtToken, manifestId, query = {}, data, headers
|
|
107
|
+
}) {
|
|
108
|
+
return client({
|
|
109
|
+
url: `/manifests/${manifestId}/capacity-exceptions`,
|
|
110
|
+
method: "post",
|
|
111
|
+
headers: authorizationHeaders({
|
|
112
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
113
|
+
}),
|
|
114
|
+
params: query,
|
|
115
|
+
data
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
function removeCapacityException({
|
|
121
|
+
token, jwtToken, manifestId, exceptionId, headers
|
|
122
|
+
}) {
|
|
123
|
+
return client({
|
|
124
|
+
url: `/manifests/${manifestId}/capacity-exceptions/${exceptionId}`,
|
|
125
|
+
method: "delete",
|
|
126
|
+
headers: authorizationHeaders({
|
|
127
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
105
132
|
function updateComment({
|
|
106
133
|
token, jwtToken, manifestId, query = {}, data, headers
|
|
107
134
|
}) {
|
|
@@ -125,7 +152,9 @@ function manifestFactory({
|
|
|
125
152
|
save,
|
|
126
153
|
addUser,
|
|
127
154
|
removeUser,
|
|
128
|
-
updateComment
|
|
155
|
+
updateComment,
|
|
156
|
+
addCapacityException,
|
|
157
|
+
removeCapacityException
|
|
129
158
|
};
|
|
130
159
|
}
|
|
131
160
|
|
|
@@ -80,4 +80,19 @@ describe("btrzpay/payment-methods", () => {
|
|
|
80
80
|
paymentMethodNames: ["cash", "ivr"]
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
+
|
|
84
|
+
it("should return the default payment methods", () => {
|
|
85
|
+
const data = [];
|
|
86
|
+
axiosMock.onPost("/default-payment-methods").reply(expectRequest({
|
|
87
|
+
statusCode: 200,
|
|
88
|
+
token,
|
|
89
|
+
jwtToken,
|
|
90
|
+
data
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
return api.btrzpay.paymentMethods.createDefaultPaymentMethods({
|
|
94
|
+
jwtToken,
|
|
95
|
+
token
|
|
96
|
+
});
|
|
97
|
+
});
|
|
83
98
|
});
|
|
@@ -110,6 +110,41 @@ describe("operations/manifest", () => {
|
|
|
110
110
|
return call;
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
it("should add capacity exception to the manifest", async () => {
|
|
114
|
+
const manifestId = "theId";
|
|
115
|
+
const data = {
|
|
116
|
+
capacityException: {
|
|
117
|
+
fromId: "fromId",
|
|
118
|
+
toId: "toId",
|
|
119
|
+
capacity: 22
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// optional query
|
|
124
|
+
const query = {
|
|
125
|
+
accountId: providerId,
|
|
126
|
+
routeId: "2349283409238429348",
|
|
127
|
+
scheduleId: "abc",
|
|
128
|
+
date: "2017-10-10"
|
|
129
|
+
};
|
|
130
|
+
axiosMock.onPost(`/manifests/${manifestId}/capacity-exceptions`).reply(expectRequest({statusCode: 201, token, jwtToken}));
|
|
131
|
+
const call = await api.operations.manifest.addCapacityException({token, jwtToken, manifestId, data, query});
|
|
132
|
+
expect(call.config.params).to.be.eql(query);
|
|
133
|
+
return call;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("should add capacity exception to the manifest", async () => {
|
|
137
|
+
const manifestId = "theId";
|
|
138
|
+
const exceptionId = "exceptionId";
|
|
139
|
+
|
|
140
|
+
axiosMock.onDelete(`/manifests/${manifestId}/capacity-exceptions/${exceptionId}`).reply(expectRequest({
|
|
141
|
+
statusCode: 201, token, jwtToken
|
|
142
|
+
}));
|
|
143
|
+
return api.operations.manifest.removeCapacityException({
|
|
144
|
+
token, jwtToken, manifestId, exceptionId
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
113
148
|
it("should add user to the manifest", async () => {
|
|
114
149
|
const manifestId = "theId";
|
|
115
150
|
const data = {
|