btrz-api-client 8.73.0 → 8.75.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.js CHANGED
@@ -219,6 +219,7 @@ function createAccounts(_ref4) {
219
219
  return {
220
220
  accounts: require("./endpoints/accounts/accounts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
221
221
  agencies: require("./endpoints/accounts/agencies.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
222
+ agencyTypes: require("./endpoints/accounts/agency-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
222
223
  application: require("./endpoints/accounts/application.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
223
224
  applications: require("./endpoints/accounts/applications.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
224
225
  applicationSettings: require("./endpoints/accounts/application-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -610,11 +611,11 @@ function createInvoices(_ref14) {
610
611
  }
611
612
 
612
613
  /**
613
- * Creates the GPS API client (scannerAppLocation).
614
+ * Creates the BPE API client (configuration).
614
615
  * @param {CreateModuleOptions} opts - Client options
615
- * @returns {Object} Object with gps endpoint namespaces and __test.client
616
+ * @returns {Object} Object with bpes endpoint namespaces and __test.client
616
617
  */
617
- function createGPS(_ref15) {
618
+ function createBpes(_ref15) {
618
619
  var baseURL = _ref15.baseURL,
619
620
  headers = _ref15.headers,
620
621
  timeout = _ref15.timeout,
@@ -625,7 +626,7 @@ function createGPS(_ref15) {
625
626
  var client = clientFactory({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: overrideFn, agents: agents });
626
627
 
627
628
  return {
628
- scannerAppLocation: require("./endpoints/gps/scanner-app-location.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
629
+ configuration: require("./endpoints/bpes/configuration.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
629
630
  __test: {
630
631
  client: client
631
632
  }
@@ -633,17 +634,40 @@ function createGPS(_ref15) {
633
634
  }
634
635
 
635
636
  /**
636
- * Creates the Ratality API client (auth, clients, integrations). Does not use internalAuthTokenProvider.
637
- * @param {Omit<CreateModuleOptions, "internalAuthTokenProvider">} opts - Client options (no internalAuthTokenProvider)
638
- * @returns {Object} Object with ratality endpoint namespaces and __test.client
637
+ * Creates the GPS API client (scannerAppLocation).
638
+ * @param {CreateModuleOptions} opts - Client options
639
+ * @returns {Object} Object with gps endpoint namespaces and __test.client
639
640
  */
640
- function createRatality(_ref16) {
641
+ function createGPS(_ref16) {
641
642
  var baseURL = _ref16.baseURL,
642
643
  headers = _ref16.headers,
643
644
  timeout = _ref16.timeout,
644
645
  overrideFn = _ref16.overrideFn,
646
+ internalAuthTokenProvider = _ref16.internalAuthTokenProvider,
645
647
  agents = _ref16.agents;
646
648
 
649
+ var client = clientFactory({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: overrideFn, agents: agents });
650
+
651
+ return {
652
+ scannerAppLocation: require("./endpoints/gps/scanner-app-location.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
653
+ __test: {
654
+ client: client
655
+ }
656
+ };
657
+ }
658
+
659
+ /**
660
+ * Creates the Ratality API client (auth, clients, integrations). Does not use internalAuthTokenProvider.
661
+ * @param {Omit<CreateModuleOptions, "internalAuthTokenProvider">} opts - Client options (no internalAuthTokenProvider)
662
+ * @returns {Object} Object with ratality endpoint namespaces and __test.client
663
+ */
664
+ function createRatality(_ref17) {
665
+ var baseURL = _ref17.baseURL,
666
+ headers = _ref17.headers,
667
+ timeout = _ref17.timeout,
668
+ overrideFn = _ref17.overrideFn,
669
+ agents = _ref17.agents;
670
+
647
671
  var client = clientFactory({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: overrideFn, agents: agents });
648
672
  var version = "v2";
649
673
 
@@ -671,15 +695,15 @@ function createRatality(_ref16) {
671
695
  * @param {{httpAgent: import("http").Agent, httpsAgent: import("https").Agent}} options.agents - An object containg one or both http agents
672
696
  */
673
697
  function createApiClient(options) {
674
- var _ref17 = options || productionOptions,
675
- baseURL = _ref17.baseURL,
676
- _ref17$baseURLOverrid = _ref17.baseURLOverride,
677
- baseURLOverride = _ref17$baseURLOverrid === undefined ? {} : _ref17$baseURLOverrid,
678
- headers = _ref17.headers,
679
- _ref17$timeout = _ref17.timeout,
680
- timeout = _ref17$timeout === undefined ? 0 : _ref17$timeout,
681
- internalAuthTokenProvider = _ref17.internalAuthTokenProvider,
682
- agents = _ref17.agents;
698
+ var _ref18 = options || productionOptions,
699
+ baseURL = _ref18.baseURL,
700
+ _ref18$baseURLOverrid = _ref18.baseURLOverride,
701
+ baseURLOverride = _ref18$baseURLOverrid === undefined ? {} : _ref18$baseURLOverrid,
702
+ headers = _ref18.headers,
703
+ _ref18$timeout = _ref18.timeout,
704
+ timeout = _ref18$timeout === undefined ? 0 : _ref18$timeout,
705
+ internalAuthTokenProvider = _ref18.internalAuthTokenProvider,
706
+ agents = _ref18.agents;
683
707
 
684
708
  return {
685
709
  constants: require("./constants.js"),
@@ -698,6 +722,7 @@ function createApiClient(options) {
698
722
  seatmaps: createSeatmaps({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.seatmaps, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
699
723
  btrzpay: createBtrzPay({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.btrzpay, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
700
724
  invoices: createInvoices({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
725
+ bpes: createBpes({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.bpes, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
701
726
  gps: createGPS({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
702
727
  ratality: createRatality({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.ratality, agents: agents })
703
728
  };
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Query params for GET /agency-types (btrz-api-accounts).
8
+ * @typedef {Object} AgencyTypesListQuery
9
+ * @property {number} [page] - The page number to retrieve (positive integer)
10
+ */
11
+
12
+ /**
13
+ * Factory for agency-types API (btrz-api-accounts).
14
+ * @param {Object} deps
15
+ * @param {import("axios").AxiosInstance} deps.client
16
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
17
+ * @returns {{ all: function, get: function, create: function, update: function, remove: function }}
18
+ */
19
+
20
+
21
+ function agencyTypesFactory(_ref) {
22
+ var client = _ref.client,
23
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
+
25
+ /**
26
+ * GET /agency-types - list agency types for the account.
27
+ * @param {Object} opts
28
+ * @param {string} [opts.token] - API key
29
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
+ * @param {AgencyTypesListQuery} [opts.query] - Query params (page)
31
+ * @param {Object} [opts.headers] - Optional headers
32
+ * @returns {Promise<import("axios").AxiosResponse>}
33
+ */
34
+ function all(_ref2) {
35
+ var token = _ref2.token,
36
+ jwtToken = _ref2.jwtToken,
37
+ _ref2$query = _ref2.query,
38
+ query = _ref2$query === undefined ? {} : _ref2$query,
39
+ headers = _ref2.headers;
40
+
41
+ return client.get("/agency-types", {
42
+ params: query,
43
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
44
+ });
45
+ }
46
+
47
+ /**
48
+ * GET /agency-types/:agencyTypeId - get an agency type by id.
49
+ * @param {Object} opts
50
+ * @param {string} [opts.token] - API key
51
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
+ * @param {string} opts.agencyTypeId - Agency type id (ObjectId)
53
+ * @param {Object} [opts.headers] - Optional headers
54
+ * @returns {Promise<import("axios").AxiosResponse>}
55
+ */
56
+ function get(_ref3) {
57
+ var token = _ref3.token,
58
+ jwtToken = _ref3.jwtToken,
59
+ agencyTypeId = _ref3.agencyTypeId,
60
+ headers = _ref3.headers;
61
+
62
+ return client({
63
+ url: "/agency-types/" + agencyTypeId,
64
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
65
+ });
66
+ }
67
+
68
+ /**
69
+ * POST /agency-types - create an agency type.
70
+ * @param {Object} opts
71
+ * @param {string} [opts.token] - API key
72
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
+ * @param {Object} opts.agencyType - Agency type payload (name required)
74
+ * @param {Object} [opts.headers] - Optional headers
75
+ * @returns {Promise<import("axios").AxiosResponse>}
76
+ */
77
+ function create(_ref4) {
78
+ var token = _ref4.token,
79
+ jwtToken = _ref4.jwtToken,
80
+ agencyType = _ref4.agencyType,
81
+ headers = _ref4.headers;
82
+
83
+ return client({
84
+ url: "/agency-types",
85
+ method: "post",
86
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
87
+ data: {
88
+ agencyType: agencyType
89
+ }
90
+ });
91
+ }
92
+
93
+ /**
94
+ * PUT /agency-types/:agencyTypeId - update an agency type.
95
+ * @param {Object} opts
96
+ * @param {string} [opts.token] - API key
97
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
98
+ * @param {string} opts.agencyTypeId - Agency type id (24-char hex ObjectId)
99
+ * @param {Object} opts.agencyType - Agency type payload (name required)
100
+ * @param {Object} [opts.headers] - Optional headers
101
+ * @returns {Promise<import("axios").AxiosResponse>}
102
+ */
103
+ function update(_ref5) {
104
+ var token = _ref5.token,
105
+ jwtToken = _ref5.jwtToken,
106
+ agencyTypeId = _ref5.agencyTypeId,
107
+ agencyType = _ref5.agencyType,
108
+ headers = _ref5.headers;
109
+
110
+ return client({
111
+ url: "/agency-types/" + agencyTypeId,
112
+ method: "put",
113
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
114
+ data: {
115
+ agencyType: agencyType
116
+ }
117
+ });
118
+ }
119
+
120
+ /**
121
+ * DELETE /agency-types/:agencyTypeId - delete an agency type.
122
+ * @param {Object} opts
123
+ * @param {string} [opts.token] - API key
124
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
125
+ * @param {string} opts.agencyTypeId - Agency type id (24-char hex ObjectId)
126
+ * @param {Object} [opts.headers] - Optional headers
127
+ * @returns {Promise<import("axios").AxiosResponse>}
128
+ */
129
+ function remove(_ref6) {
130
+ var token = _ref6.token,
131
+ jwtToken = _ref6.jwtToken,
132
+ agencyTypeId = _ref6.agencyTypeId,
133
+ headers = _ref6.headers;
134
+
135
+ return client({
136
+ url: "/agency-types/" + agencyTypeId,
137
+ method: "delete",
138
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
139
+ });
140
+ }
141
+
142
+ return {
143
+ all: all,
144
+ get: get,
145
+ create: create,
146
+ update: update,
147
+ remove: remove
148
+ };
149
+ }
150
+
151
+ module.exports = agencyTypesFactory;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Factory for BPE configuration API (btrz-api-bpes).
8
+ * @param {Object} deps
9
+ * @param {import("axios").AxiosInstance} deps.client
10
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
+ * @returns {{ get: function, create: function, update: function }}
12
+ */
13
+
14
+
15
+ function configurationFactory(_ref) {
16
+ var client = _ref.client,
17
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
+
19
+ /**
20
+ * GET /bpe-configurations - returns the BPE configuration for the authenticated account.
21
+ * @param {Object} opts
22
+ * @param {string} [opts.token] - API key
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
+ * @param {Object} [opts.headers] - Optional headers
25
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
26
+ */
27
+ function get(_ref2) {
28
+ var token = _ref2.token,
29
+ jwtToken = _ref2.jwtToken,
30
+ headers = _ref2.headers;
31
+
32
+ return client({
33
+ url: "/bpe-configurations",
34
+ method: "get",
35
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
36
+ });
37
+ }
38
+
39
+ /**
40
+ * POST /bpe-configurations - creates the BPE configuration for the authenticated account.
41
+ * @param {Object} opts
42
+ * @param {string} [opts.token] - API key
43
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
44
+ * @param {Object} opts.bpeConfiguration - Configuration payload
45
+ * @param {Object} [opts.headers] - Optional headers
46
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
47
+ */
48
+ function create(_ref3) {
49
+ var token = _ref3.token,
50
+ jwtToken = _ref3.jwtToken,
51
+ bpeConfiguration = _ref3.bpeConfiguration,
52
+ headers = _ref3.headers;
53
+
54
+ return client({
55
+ url: "/bpe-configurations",
56
+ method: "post",
57
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
58
+ data: { bpeConfiguration: bpeConfiguration }
59
+ });
60
+ }
61
+
62
+ /**
63
+ * PUT /bpe-configurations - updates the BPE configuration for the authenticated account.
64
+ * @param {Object} opts
65
+ * @param {string} [opts.token] - API key
66
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
67
+ * @param {Object} opts.bpeConfiguration - Configuration payload
68
+ * @param {Object} [opts.headers] - Optional headers
69
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
70
+ */
71
+ function update(_ref4) {
72
+ var token = _ref4.token,
73
+ jwtToken = _ref4.jwtToken,
74
+ bpeConfiguration = _ref4.bpeConfiguration,
75
+ headers = _ref4.headers;
76
+
77
+ return client({
78
+ url: "/bpe-configurations",
79
+ method: "put",
80
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
81
+ data: { bpeConfiguration: bpeConfiguration }
82
+ });
83
+ }
84
+
85
+ return {
86
+ get: get,
87
+ create: create,
88
+ update: update
89
+ };
90
+ }
91
+
92
+ module.exports = configurationFactory;
@@ -15,6 +15,8 @@ var _require = require("../endpoints_helpers.js"),
15
15
  * @property {string} [latestPurchaseDate] - ISO 8601 datetime (purchase on or before)
16
16
  * @property {string} [earliestTravelDate] - ISO 8601 datetime (trip depart on or after)
17
17
  * @property {string} [latestTravelDate] - ISO 8601 datetime (trip depart on or before)
18
+ * @property {string} [currency] - Currency ISO code (e.g. "USD"). Modifiers without a currency apply to all currencies and are always returned
19
+ * @property {string} [excludeExpired] - When "true", modifiers whose sellEndDate and/or tripEndDate is in the past are not returned
18
20
  */
19
21
 
20
22
  /**
@@ -13,6 +13,9 @@ module.exports = {
13
13
  },
14
14
  trips: function trips(url) {
15
15
  return url + "/inventory";
16
+ },
17
+ bpes: function bpes(url) {
18
+ return url + "/bpes";
16
19
  }
17
20
  }
18
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.73.0",
3
+ "version": "8.75.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -185,6 +185,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
185
185
  return {
186
186
  accounts: require("./endpoints/accounts/accounts.js")({client, internalAuthTokenProvider}),
187
187
  agencies: require("./endpoints/accounts/agencies.js")({client, internalAuthTokenProvider}),
188
+ agencyTypes: require("./endpoints/accounts/agency-types.js")({client, internalAuthTokenProvider}),
188
189
  application: require("./endpoints/accounts/application.js")({client, internalAuthTokenProvider}),
189
190
  applications: require("./endpoints/accounts/applications.js")({client, internalAuthTokenProvider}),
190
191
  applicationSettings: require("./endpoints/accounts/application-settings.js")({client, internalAuthTokenProvider}),
@@ -505,6 +506,22 @@ function createInvoices({baseURL, headers, timeout, overrideFn, internalAuthToke
505
506
  };
506
507
  }
507
508
 
509
+ /**
510
+ * Creates the BPE API client (configuration).
511
+ * @param {CreateModuleOptions} opts - Client options
512
+ * @returns {Object} Object with bpes endpoint namespaces and __test.client
513
+ */
514
+ function createBpes({baseURL, headers, timeout, overrideFn, internalAuthTokenProvider, agents}) {
515
+ const client = clientFactory({baseURL, headers, timeout, overrideFn, agents});
516
+
517
+ return {
518
+ configuration: require("./endpoints/bpes/configuration.js")({client, internalAuthTokenProvider}),
519
+ __test: {
520
+ client
521
+ }
522
+ };
523
+ }
524
+
508
525
  /**
509
526
  * Creates the GPS API client (scannerAppLocation).
510
527
  * @param {CreateModuleOptions} opts - Client options
@@ -576,6 +593,7 @@ function createApiClient(options) {
576
593
  seatmaps: createSeatmaps({baseURL, headers, timeout, overrideFn: baseURLOverride.seatmaps, internalAuthTokenProvider, agents}),
577
594
  btrzpay: createBtrzPay({baseURL, headers, timeout, overrideFn: baseURLOverride.btrzpay, internalAuthTokenProvider, agents}),
578
595
  invoices: createInvoices({baseURL, headers, timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider, agents}),
596
+ bpes: createBpes({baseURL, headers, timeout, overrideFn: baseURLOverride.bpes, internalAuthTokenProvider, agents}),
579
597
  gps: createGPS({baseURL, headers, timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider, agents}),
580
598
  ratality: createRatality({baseURL, headers, timeout, overrideFn: baseURLOverride.ratality, agents})
581
599
  };
@@ -0,0 +1,118 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Query params for GET /agency-types (btrz-api-accounts).
7
+ * @typedef {Object} AgencyTypesListQuery
8
+ * @property {number} [page] - The page number to retrieve (positive integer)
9
+ */
10
+
11
+ /**
12
+ * Factory for agency-types API (btrz-api-accounts).
13
+ * @param {Object} deps
14
+ * @param {import("axios").AxiosInstance} deps.client
15
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
16
+ * @returns {{ all: function, get: function, create: function, update: function, remove: function }}
17
+ */
18
+ function agencyTypesFactory({client, internalAuthTokenProvider}) {
19
+ /**
20
+ * GET /agency-types - list agency types for the account.
21
+ * @param {Object} opts
22
+ * @param {string} [opts.token] - API key
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
+ * @param {AgencyTypesListQuery} [opts.query] - Query params (page)
25
+ * @param {Object} [opts.headers] - Optional headers
26
+ * @returns {Promise<import("axios").AxiosResponse>}
27
+ */
28
+ function all({token, jwtToken, query = {}, headers}) {
29
+ return client.get("/agency-types", {
30
+ params: query,
31
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
32
+ });
33
+ }
34
+
35
+ /**
36
+ * GET /agency-types/:agencyTypeId - get an agency type by id.
37
+ * @param {Object} opts
38
+ * @param {string} [opts.token] - API key
39
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
+ * @param {string} opts.agencyTypeId - Agency type id (ObjectId)
41
+ * @param {Object} [opts.headers] - Optional headers
42
+ * @returns {Promise<import("axios").AxiosResponse>}
43
+ */
44
+ function get({token, jwtToken, agencyTypeId, headers}) {
45
+ return client({
46
+ url: `/agency-types/${agencyTypeId}`,
47
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
48
+ });
49
+ }
50
+
51
+ /**
52
+ * POST /agency-types - create an agency type.
53
+ * @param {Object} opts
54
+ * @param {string} [opts.token] - API key
55
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
56
+ * @param {Object} opts.agencyType - Agency type payload (name required)
57
+ * @param {Object} [opts.headers] - Optional headers
58
+ * @returns {Promise<import("axios").AxiosResponse>}
59
+ */
60
+ function create({token, jwtToken, agencyType, headers}) {
61
+ return client({
62
+ url: "/agency-types",
63
+ method: "post",
64
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
65
+ data: {
66
+ agencyType
67
+ }
68
+ });
69
+ }
70
+
71
+ /**
72
+ * PUT /agency-types/:agencyTypeId - update an agency type.
73
+ * @param {Object} opts
74
+ * @param {string} [opts.token] - API key
75
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
76
+ * @param {string} opts.agencyTypeId - Agency type id (24-char hex ObjectId)
77
+ * @param {Object} opts.agencyType - Agency type payload (name required)
78
+ * @param {Object} [opts.headers] - Optional headers
79
+ * @returns {Promise<import("axios").AxiosResponse>}
80
+ */
81
+ function update({token, jwtToken, agencyTypeId, agencyType, headers}) {
82
+ return client({
83
+ url: `/agency-types/${agencyTypeId}`,
84
+ method: "put",
85
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
86
+ data: {
87
+ agencyType
88
+ }
89
+ });
90
+ }
91
+
92
+ /**
93
+ * DELETE /agency-types/:agencyTypeId - delete an agency type.
94
+ * @param {Object} opts
95
+ * @param {string} [opts.token] - API key
96
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
97
+ * @param {string} opts.agencyTypeId - Agency type id (24-char hex ObjectId)
98
+ * @param {Object} [opts.headers] - Optional headers
99
+ * @returns {Promise<import("axios").AxiosResponse>}
100
+ */
101
+ function remove({token, jwtToken, agencyTypeId, headers}) {
102
+ return client({
103
+ url: `/agency-types/${agencyTypeId}`,
104
+ method: "delete",
105
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
106
+ });
107
+ }
108
+
109
+ return {
110
+ all,
111
+ get,
112
+ create,
113
+ update,
114
+ remove
115
+ };
116
+ }
117
+
118
+ module.exports = agencyTypesFactory;
@@ -0,0 +1,70 @@
1
+ const {authorizationHeaders} = require("../endpoints_helpers.js");
2
+
3
+ /**
4
+ * Factory for BPE configuration API (btrz-api-bpes).
5
+ * @param {Object} deps
6
+ * @param {import("axios").AxiosInstance} deps.client
7
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
8
+ * @returns {{ get: function, create: function, update: function }}
9
+ */
10
+ function configurationFactory({client, internalAuthTokenProvider}) {
11
+ /**
12
+ * GET /bpe-configurations - returns the BPE configuration for the authenticated account.
13
+ * @param {Object} opts
14
+ * @param {string} [opts.token] - API key
15
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
16
+ * @param {Object} [opts.headers] - Optional headers
17
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
18
+ */
19
+ function get({token, jwtToken, headers}) {
20
+ return client({
21
+ url: "/bpe-configurations",
22
+ method: "get",
23
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
24
+ });
25
+ }
26
+
27
+ /**
28
+ * POST /bpe-configurations - creates the BPE configuration for the authenticated account.
29
+ * @param {Object} opts
30
+ * @param {string} [opts.token] - API key
31
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
+ * @param {Object} opts.bpeConfiguration - Configuration payload
33
+ * @param {Object} [opts.headers] - Optional headers
34
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
35
+ */
36
+ function create({token, jwtToken, bpeConfiguration, headers}) {
37
+ return client({
38
+ url: "/bpe-configurations",
39
+ method: "post",
40
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
41
+ data: {bpeConfiguration}
42
+ });
43
+ }
44
+
45
+ /**
46
+ * PUT /bpe-configurations - updates the BPE configuration for the authenticated account.
47
+ * @param {Object} opts
48
+ * @param {string} [opts.token] - API key
49
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
50
+ * @param {Object} opts.bpeConfiguration - Configuration payload
51
+ * @param {Object} [opts.headers] - Optional headers
52
+ * @returns {Promise<import("axios").AxiosResponse<{ bpeConfiguration: Object }>>}
53
+ */
54
+ function update({token, jwtToken, bpeConfiguration, headers}) {
55
+ return client({
56
+ url: "/bpe-configurations",
57
+ method: "put",
58
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
59
+ data: {bpeConfiguration}
60
+ });
61
+ }
62
+
63
+ return {
64
+ get,
65
+ create,
66
+ update
67
+ };
68
+ }
69
+
70
+ module.exports = configurationFactory;
@@ -14,6 +14,8 @@ const {
14
14
  * @property {string} [latestPurchaseDate] - ISO 8601 datetime (purchase on or before)
15
15
  * @property {string} [earliestTravelDate] - ISO 8601 datetime (trip depart on or after)
16
16
  * @property {string} [latestTravelDate] - ISO 8601 datetime (trip depart on or before)
17
+ * @property {string} [currency] - Currency ISO code (e.g. "USD"). Modifiers without a currency apply to all currencies and are always returned
18
+ * @property {string} [excludeExpired] - When "true", modifiers whose sellEndDate and/or tripEndDate is in the past are not returned
17
19
  */
18
20
 
19
21
  /**
@@ -11,6 +11,9 @@ module.exports = {
11
11
  },
12
12
  trips: (url) => {
13
13
  return `${url}/inventory`;
14
+ },
15
+ bpes: (url) => {
16
+ return `${url}/bpes`;
14
17
  }
15
18
  }
16
19
  };
package/test/all.test.js CHANGED
@@ -3,6 +3,7 @@
3
3
  require("./client.test.js");
4
4
  require("./endpoints/accounts/accounts.js");
5
5
  require("./endpoints/accounts/agencies.test.js");
6
+ require("./endpoints/accounts/agency-types.test.js");
6
7
  require("./endpoints/accounts/application-settings.test.js");
7
8
  require("./endpoints/accounts/applications.test.js");
8
9
  require("./endpoints/accounts/current-shifts.test.js");
@@ -149,6 +150,7 @@ require("./endpoints/invoices/invoices.test.js");
149
150
  require("./endpoints/invoices/providers.test.js");
150
151
  require("./endpoints/invoices/providersSequences.test.js");
151
152
  require("./endpoints/invoices/system.test.js");
153
+ require("./endpoints/bpes/configuration.test.js");
152
154
  require("./endpoints/loyalty/movements.test.js");
153
155
  require("./endpoints/loyalty/programs.test.js");
154
156
  require("./endpoints/notifications/customers.test.js");