btrz-api-client 9.9.0 → 9.10.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.
@@ -20,7 +20,7 @@ function marketPricingSettingsFactory({
20
20
  * @param {string} [opts.token] - API key
21
21
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
22
  * @param {Object} [opts.headers] - Optional headers
23
- * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean } }>>}
23
+ * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually: boolean } }>>}
24
24
  */
25
25
  function get({
26
26
  token,
@@ -39,11 +39,12 @@ function marketPricingSettingsFactory({
39
39
  }
40
40
 
41
41
  /**
42
- * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable and displayExpiredSchedulesInUI required).
42
+ * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
43
+ * Optional: allowEachTripSegmentToBePricedIndividually.
43
44
  * @param {Object} opts
44
45
  * @param {string} [opts.token] - API key
45
46
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
46
- * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean }
47
+ * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually?: boolean }
47
48
  * @param {Object} [opts.headers] - Optional headers
48
49
  * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
49
50
  */
@@ -14,7 +14,7 @@ const {
14
14
  * @param {Object} deps
15
15
  * @param {import("axios").AxiosInstance} deps.client
16
16
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
17
- * @returns {{ create: function, validateCreate: function }}
17
+ * @returns {{ create: function, validateCreate: function, validateVoid: function }}
18
18
  */
19
19
  function infileJsonFactory({
20
20
  client,
@@ -83,9 +83,38 @@ function infileJsonFactory({
83
83
  data
84
84
  });
85
85
  }
86
+
87
+ /**
88
+ * GET /infile-json/validate-void - validate void for an original sale transaction.
89
+ * @param {Object} opts
90
+ * @param {string} [opts.token] - API key
91
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
92
+ * @param {{ originalTransactionId: string, invoiceProviderId?: string }} opts.query
93
+ * @param {Object} [opts.headers] - Optional headers
94
+ * @returns {Promise<import("axios").AxiosResponse>}
95
+ */
96
+ function validateVoid({
97
+ token,
98
+ jwtToken,
99
+ query,
100
+ headers
101
+ }) {
102
+ return client({
103
+ url: "/infile-json/validate-void",
104
+ method: "get",
105
+ headers: authorizationHeaders({
106
+ token,
107
+ jwtToken,
108
+ internalAuthTokenProvider,
109
+ headers
110
+ }),
111
+ params: query
112
+ });
113
+ }
86
114
  return {
87
115
  create,
88
- validateCreate
116
+ validateCreate,
117
+ validateVoid
89
118
  };
90
119
  }
91
120
  module.exports = infileJsonFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.9.0",
3
+ "version": "9.10.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,7 +17,7 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
17
17
  * @param {string} [opts.token] - API key
18
18
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
19
19
  * @param {Object} [opts.headers] - Optional headers
20
- * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean } }>>}
20
+ * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually: boolean } }>>}
21
21
  */
22
22
  function get({token, jwtToken, headers}) {
23
23
  return client({
@@ -27,11 +27,12 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
27
27
  }
28
28
 
29
29
  /**
30
- * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable and displayExpiredSchedulesInUI required).
30
+ * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
31
+ * Optional: allowEachTripSegmentToBePricedIndividually.
31
32
  * @param {Object} opts
32
33
  * @param {string} [opts.token] - API key
33
34
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean }
35
+ * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, allowEachTripSegmentToBePricedIndividually?: boolean }
35
36
  * @param {Object} [opts.headers] - Optional headers
36
37
  * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
37
38
  */
@@ -12,7 +12,7 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
12
12
  * @param {Object} deps
13
13
  * @param {import("axios").AxiosInstance} deps.client
14
14
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
15
- * @returns {{ create: function, validateCreate: function }}
15
+ * @returns {{ create: function, validateCreate: function, validateVoid: function }}
16
16
  */
17
17
  function infileJsonFactory({client, internalAuthTokenProvider}) {
18
18
  /**
@@ -57,9 +57,28 @@ function infileJsonFactory({client, internalAuthTokenProvider}) {
57
57
  });
58
58
  }
59
59
 
60
+ /**
61
+ * GET /infile-json/validate-void - validate void for an original sale transaction.
62
+ * @param {Object} opts
63
+ * @param {string} [opts.token] - API key
64
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
+ * @param {{ originalTransactionId: string, invoiceProviderId?: string }} opts.query
66
+ * @param {Object} [opts.headers] - Optional headers
67
+ * @returns {Promise<import("axios").AxiosResponse>}
68
+ */
69
+ function validateVoid({token, jwtToken, query, headers}) {
70
+ return client({
71
+ url: "/infile-json/validate-void",
72
+ method: "get",
73
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
74
+ params: query
75
+ });
76
+ }
77
+
60
78
  return {
61
79
  create,
62
- validateCreate
80
+ validateCreate,
81
+ validateVoid
63
82
  };
64
83
  }
65
84
 
@@ -30,4 +30,16 @@ describe("invoices/infileJson", () => {
30
30
  data: {}
31
31
  });
32
32
  });
33
+
34
+ it("should validate void for an original sale transaction", () => {
35
+ axiosMock.onGet("/infile-json/validate-void").reply(expectRequest({statusCode: 200, token, jwtToken}));
36
+ return api.invoices.infileJson.validateVoid({
37
+ jwtToken,
38
+ token,
39
+ query: {
40
+ originalTransactionId: "original-trx-id",
41
+ invoiceProviderId: "provider1"
42
+ }
43
+ });
44
+ });
33
45
  });
@@ -9,7 +9,7 @@ export = infileJsonFactory;
9
9
  * @param {Object} deps
10
10
  * @param {import("axios").AxiosInstance} deps.client
11
11
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
12
- * @returns {{ create: function, validateCreate: function }}
12
+ * @returns {{ create: function, validateCreate: function, validateVoid: function }}
13
13
  */
14
14
  declare function infileJsonFactory({ client, internalAuthTokenProvider }: {
15
15
  client: import("axios").AxiosInstance;
@@ -19,10 +19,24 @@ declare function infileJsonFactory({ client, internalAuthTokenProvider }: {
19
19
  }): {
20
20
  create: Function;
21
21
  validateCreate: Function;
22
+ validateVoid: Function;
22
23
  };
23
24
  declare namespace infileJsonFactory {
24
- export { InvoiceInfileJsonPostQuery };
25
+ export { InvoiceInfileJsonPostQuery, InvoiceInfileJsonValidateVoidQuery };
25
26
  }
27
+ /**
28
+ * Query params for GET /infile-json/validate-void (btrz-api-invoices).
29
+ */
30
+ type InvoiceInfileJsonValidateVoidQuery = {
31
+ /**
32
+ * - Original sale transaction `_id` (24-character hex ObjectId)
33
+ */
34
+ originalTransactionId: string;
35
+ /**
36
+ * - Optional infileJson invoice provider id
37
+ */
38
+ invoiceProviderId?: string;
39
+ };
26
40
  /**
27
41
  * Query params for POST /infile-json (btrz-api-invoices). onlyValidateRequest optional.
28
42
  */