btrz-api-client 8.68.1 → 8.68.2
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.
|
@@ -16,7 +16,7 @@ var _require = require("../endpoints_helpers.js"),
|
|
|
16
16
|
* @param {Object} deps
|
|
17
17
|
* @param {import("axios").AxiosInstance} deps.client
|
|
18
18
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
19
|
-
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function } }}
|
|
19
|
+
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function, banks: function } }}
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
|
|
@@ -186,6 +186,30 @@ function networkFactory(_ref) {
|
|
|
186
186
|
fareId: fareId
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* GET /network/agencies/banks - provider banks available to the authenticated agency.
|
|
193
|
+
* Filtered by network.bankAccountNumbers for (sellerId, providerId).
|
|
194
|
+
* @param {Object} opts
|
|
195
|
+
* @param {string} [opts.token] - API key
|
|
196
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
197
|
+
* @param {string} opts.providerId - Provider account id (ObjectId), required query param
|
|
198
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
199
|
+
* @returns {Promise<import("axios").AxiosResponse<{ banks: Array }>>}
|
|
200
|
+
* Errors: 400 (MISSING_PROVIDER_ID, INVALID_PROVIDER_ID), 401, 404 (NETWORK_NOT_FOUND), 500
|
|
201
|
+
*/
|
|
202
|
+
banks: function banks(_ref8) {
|
|
203
|
+
var token = _ref8.token,
|
|
204
|
+
jwtToken = _ref8.jwtToken,
|
|
205
|
+
providerId = _ref8.providerId,
|
|
206
|
+
headers = _ref8.headers;
|
|
207
|
+
|
|
208
|
+
return client({
|
|
209
|
+
url: "/network/agencies/banks",
|
|
210
|
+
params: { providerId: providerId },
|
|
211
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
212
|
+
});
|
|
189
213
|
}
|
|
190
214
|
};
|
|
191
215
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btrz-api-client",
|
|
3
|
-
"version": "8.68.
|
|
3
|
+
"version": "8.68.2",
|
|
4
4
|
"description": "Api client for Betterez endpoints",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"test:only": "node --require ./test/node-test-globals.js --test test/all.test.js --test-only",
|
|
10
10
|
"test:integration": "node --require ./test/node-test-globals.js --require ./test-integration/ports.js --test test-integration/all.test.js",
|
|
11
11
|
"browserify": "browserify lib/client.js --standalone BtrzApiClient -p tinyify -o lib/client-standalone-min.js",
|
|
12
|
+
"prepare": "npm run browserify",
|
|
12
13
|
"commit-transpile": "git add lib/ && (git diff-index --quiet HEAD || git commit -m \"transpiled src\")",
|
|
13
14
|
"pretranspile": "rm -rf lib/",
|
|
14
15
|
"transpile": "babel --presets es2015 -d lib/ src/",
|
|
@@ -15,7 +15,7 @@ const {
|
|
|
15
15
|
* @param {Object} deps
|
|
16
16
|
* @param {import("axios").AxiosInstance} deps.client
|
|
17
17
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
18
|
-
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function } }}
|
|
18
|
+
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function, banks: function } }}
|
|
19
19
|
*/
|
|
20
20
|
function networkFactory({client, internalAuthTokenProvider}) {
|
|
21
21
|
const agencies = {
|
|
@@ -141,6 +141,24 @@ function networkFactory({client, internalAuthTokenProvider}) {
|
|
|
141
141
|
fareId
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* GET /network/agencies/banks - provider banks available to the authenticated agency.
|
|
147
|
+
* Filtered by network.bankAccountNumbers for (sellerId, providerId).
|
|
148
|
+
* @param {Object} opts
|
|
149
|
+
* @param {string} [opts.token] - API key
|
|
150
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
151
|
+
* @param {string} opts.providerId - Provider account id (ObjectId), required query param
|
|
152
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
153
|
+
* @returns {Promise<import("axios").AxiosResponse<{ banks: Array }>>}
|
|
154
|
+
* Errors: 400 (MISSING_PROVIDER_ID, INVALID_PROVIDER_ID), 401, 404 (NETWORK_NOT_FOUND), 500
|
|
155
|
+
*/
|
|
156
|
+
banks({token, jwtToken, providerId, headers}) {
|
|
157
|
+
return client({
|
|
158
|
+
url: "/network/agencies/banks",
|
|
159
|
+
params: {providerId},
|
|
160
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
161
|
+
});
|
|
144
162
|
}
|
|
145
163
|
};
|
|
146
164
|
|
|
@@ -101,4 +101,20 @@ describe("accounts/interline", () => {
|
|
|
101
101
|
token, jwtToken, fareId
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
|
+
|
|
105
|
+
it("should GET banks for agency by providerId", () => {
|
|
106
|
+
const providerId = "6410ad00d02bf9068d7345e5";
|
|
107
|
+
axiosMock.onGet("/network/agencies/banks").reply((config) => {
|
|
108
|
+
assert.strictEqual(config.params.providerId, providerId);
|
|
109
|
+
return [200, {banks: []}];
|
|
110
|
+
});
|
|
111
|
+
return api.accounts.network.agencies.banks({
|
|
112
|
+
token,
|
|
113
|
+
jwtToken,
|
|
114
|
+
providerId
|
|
115
|
+
}).then((httpResponse) => {
|
|
116
|
+
assert.deepStrictEqual(httpResponse.status, 200);
|
|
117
|
+
assert.deepStrictEqual(httpResponse.data.banks, []);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
104
120
|
});
|
|
@@ -4,7 +4,7 @@ export = networkFactory;
|
|
|
4
4
|
* @param {Object} deps
|
|
5
5
|
* @param {import("axios").AxiosInstance} deps.client
|
|
6
6
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
7
|
-
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function } }}
|
|
7
|
+
* @returns {{ agencies: { all: function, get: function, update: function, create: function, removeProduct: function, removeFare: function, banks: function } }}
|
|
8
8
|
*/
|
|
9
9
|
declare function networkFactory({ client, internalAuthTokenProvider }: {
|
|
10
10
|
client: import("axios").AxiosInstance;
|
|
@@ -19,5 +19,6 @@ declare function networkFactory({ client, internalAuthTokenProvider }: {
|
|
|
19
19
|
create: Function;
|
|
20
20
|
removeProduct: Function;
|
|
21
21
|
removeFare: Function;
|
|
22
|
+
banks: Function;
|
|
22
23
|
};
|
|
23
24
|
};
|