btrz-api-client 9.13.0 → 9.15.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
@@ -544,6 +544,14 @@ function createAccounts({
544
544
  client,
545
545
  internalAuthTokenProvider
546
546
  }),
547
+ emailTemplateSettings: require("./endpoints/accounts/email-template-settings.js")({
548
+ client,
549
+ internalAuthTokenProvider
550
+ }),
551
+ smsTemplateSettings: require("./endpoints/accounts/sms-template-settings.js")({
552
+ client,
553
+ internalAuthTokenProvider
554
+ }),
547
555
  emailTemplates: require("./endpoints/accounts/email-templates.js")({
548
556
  client,
549
557
  internalAuthTokenProvider
@@ -0,0 +1,74 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Factory for email-template-settings API (btrz-api-accounts).
7
+ * @param {Object} deps
8
+ * @param {import("axios").AxiosInstance} deps.client
9
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
+ * @returns {{ get: function, update: function }}
11
+ */
12
+ function emailTemplateSettingsFactory({
13
+ client,
14
+ internalAuthTokenProvider
15
+ }) {
16
+ /**
17
+ * GET /email-template-settings – email template flow preference for the account.
18
+ * @param {Object} opts
19
+ * @param {string} [opts.token] - API key
20
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
21
+ * @param {Object} [opts.headers] - Optional headers
22
+ * @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
23
+ */
24
+ function get({
25
+ token,
26
+ jwtToken,
27
+ headers
28
+ }) {
29
+ return client({
30
+ url: "/email-template-settings",
31
+ headers: authorizationHeaders({
32
+ token,
33
+ jwtToken,
34
+ internalAuthTokenProvider,
35
+ headers
36
+ })
37
+ });
38
+ }
39
+
40
+ /**
41
+ * PUT /email-template-settings – update email template flow preference.
42
+ * @param {Object} opts
43
+ * @param {string} [opts.token] - API key
44
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
+ * @param {Object} opts.emailTemplateSettings - Payload with useEmailTemplates
46
+ * @param {Object} [opts.headers] - Optional headers
47
+ * @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
48
+ */
49
+ function update({
50
+ token,
51
+ jwtToken,
52
+ emailTemplateSettings,
53
+ headers
54
+ }) {
55
+ return client({
56
+ url: "/email-template-settings",
57
+ method: "put",
58
+ headers: authorizationHeaders({
59
+ token,
60
+ jwtToken,
61
+ internalAuthTokenProvider,
62
+ headers
63
+ }),
64
+ data: {
65
+ emailTemplateSettings
66
+ }
67
+ });
68
+ }
69
+ return {
70
+ get,
71
+ update
72
+ };
73
+ }
74
+ module.exports = emailTemplateSettingsFactory;
@@ -0,0 +1,74 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Factory for sms-template-settings API (btrz-api-accounts).
7
+ * @param {Object} deps
8
+ * @param {import("axios").AxiosInstance} deps.client
9
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
+ * @returns {{ get: function, update: function }}
11
+ */
12
+ function smsTemplateSettingsFactory({
13
+ client,
14
+ internalAuthTokenProvider
15
+ }) {
16
+ /**
17
+ * GET /sms-template-settings – SMS template flow preference for the account.
18
+ * @param {Object} opts
19
+ * @param {string} [opts.token] - API key
20
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
21
+ * @param {Object} [opts.headers] - Optional headers
22
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
23
+ */
24
+ function get({
25
+ token,
26
+ jwtToken,
27
+ headers
28
+ }) {
29
+ return client({
30
+ url: "/sms-template-settings",
31
+ headers: authorizationHeaders({
32
+ token,
33
+ jwtToken,
34
+ internalAuthTokenProvider,
35
+ headers
36
+ })
37
+ });
38
+ }
39
+
40
+ /**
41
+ * PUT /sms-template-settings – update SMS template flow preference.
42
+ * @param {Object} opts
43
+ * @param {string} [opts.token] - API key
44
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
+ * @param {Object} opts.smsTemplateSettings - Payload with useSmsTemplates
46
+ * @param {Object} [opts.headers] - Optional headers
47
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
48
+ */
49
+ function update({
50
+ token,
51
+ jwtToken,
52
+ smsTemplateSettings,
53
+ headers
54
+ }) {
55
+ return client({
56
+ url: "/sms-template-settings",
57
+ method: "put",
58
+ headers: authorizationHeaders({
59
+ token,
60
+ jwtToken,
61
+ internalAuthTokenProvider,
62
+ headers
63
+ }),
64
+ data: {
65
+ smsTemplateSettings
66
+ }
67
+ });
68
+ }
69
+ return {
70
+ get,
71
+ update
72
+ };
73
+ }
74
+ module.exports = smsTemplateSettingsFactory;
@@ -7,7 +7,6 @@ const {
7
7
  * @typedef {Object} PrismaTerminalsQuery
8
8
  * @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers
9
9
  * @property {boolean} [validateRefund] - (PUT refunds only) If true, fetch current state from Prisma before applying
10
- * @property {boolean} [validatePayment] - (PUT payments only) If true, validate payment against the provider
11
10
  */
12
11
 
13
12
  /**
@@ -335,7 +334,7 @@ function prismaTerminalsFactory({
335
334
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
336
335
  * @param {string} opts.id - Payment id (prismaPaymentId)
337
336
  * @param {Object} opts.prismaPayment - Prisma payment payload
338
- * @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId, validatePayment)
337
+ * @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
339
338
  * @param {Object} [opts.headers] - Optional headers
340
339
  * @returns {Promise<import("axios").AxiosResponse>}
341
340
  */
@@ -6,7 +6,7 @@ const {
6
6
  /**
7
7
  * Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
8
8
  * @typedef {Object} SegmentsInformationTablesQuery
9
- * @property {string} [providerId] - Provider/account id of the route when different from the authenticated user (24-char hex ObjectId)
9
+ * @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
10
10
  */
11
11
 
12
12
  /**
@@ -26,7 +26,7 @@ function segmentInformationTableFactory({
26
26
  * @param {string} [opts.token] - API key (X-API-KEY)
27
27
  * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
28
28
  * @param {string} opts.routeId - Route id (24-char hex ObjectId)
29
- * @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
29
+ * @param {SegmentsInformationTablesQuery} [opts.query] - Optional query params (providerId)
30
30
  * @param {Object} [opts.headers] - Optional headers
31
31
  * @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
32
32
  * @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
@@ -6,12 +6,12 @@ const {
6
6
  /**
7
7
  * Request body for POST /notify/email (btrz-api-notifications). See post-notify-email-handler getSpec() and NotifyEmailPostData.
8
8
  * @typedef {Object} NotifyEmailByTypePostData
9
- * @property {string} type - Document/template type (e.g. product, voucher, order, transaction)
9
+ * @property {string} type - Document/PDF type (e.g. order, voucher, movement, cancellation)
10
10
  * @property {string} itemId - ObjectId of the item (24-char hex)
11
11
  * @property {string} [to] - Recipient email (optional; derived from item when omitted)
12
12
  * @property {string} [lang] - ISO language code (e.g. en-us)
13
13
  * @property {string} [channel] - Channel filter for template selection
14
- * @property {string} [family] - Required when type is 'product'. One of: ticket, reservation, paid in, paid out, parcel, flexpass, bundle
14
+ * @property {string} [family] - When type is product or movement: ticket, reservation, parcel, etc.
15
15
  * @property {string} [humanDate] - "mm" | "dd"
16
16
  */
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.13.0",
3
+ "version": "9.15.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -202,6 +202,8 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
202
202
  dynamicForms: require("./endpoints/accounts/dynamic-forms.js")({client, internalAuthTokenProvider}),
203
203
  qrMappings: require("./endpoints/accounts/qr-mappings.js")({client, internalAuthTokenProvider}),
204
204
  emailSettings: require("./endpoints/accounts/email-settings.js")({client, internalAuthTokenProvider}),
205
+ emailTemplateSettings: require("./endpoints/accounts/email-template-settings.js")({client, internalAuthTokenProvider}),
206
+ smsTemplateSettings: require("./endpoints/accounts/sms-template-settings.js")({client, internalAuthTokenProvider}),
205
207
  emailTemplates: require("./endpoints/accounts/email-templates.js")({client, internalAuthTokenProvider}),
206
208
  smsTemplates: require("./endpoints/accounts/sms-templates.js")({client, internalAuthTokenProvider}),
207
209
  exchangeRates: require("./endpoints/accounts/exchange-rates.js")({client, internalAuthTokenProvider}),
@@ -0,0 +1,54 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Factory for email-template-settings API (btrz-api-accounts).
7
+ * @param {Object} deps
8
+ * @param {import("axios").AxiosInstance} deps.client
9
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
+ * @returns {{ get: function, update: function }}
11
+ */
12
+ function emailTemplateSettingsFactory({client, internalAuthTokenProvider}) {
13
+ /**
14
+ * GET /email-template-settings – email template flow preference for the account.
15
+ * @param {Object} opts
16
+ * @param {string} [opts.token] - API key
17
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
18
+ * @param {Object} [opts.headers] - Optional headers
19
+ * @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
20
+ */
21
+ function get({token, jwtToken, headers}) {
22
+ return client({
23
+ url: "/email-template-settings",
24
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
25
+ });
26
+ }
27
+
28
+ /**
29
+ * PUT /email-template-settings – update email template flow preference.
30
+ * @param {Object} opts
31
+ * @param {string} [opts.token] - API key
32
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
+ * @param {Object} opts.emailTemplateSettings - Payload with useEmailTemplates
34
+ * @param {Object} [opts.headers] - Optional headers
35
+ * @returns {Promise<import("axios").AxiosResponse<{ emailTemplateSettings: { useEmailTemplates: boolean } }>>}
36
+ */
37
+ function update({token, jwtToken, emailTemplateSettings, headers}) {
38
+ return client({
39
+ url: "/email-template-settings",
40
+ method: "put",
41
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
42
+ data: {
43
+ emailTemplateSettings
44
+ }
45
+ });
46
+ }
47
+
48
+ return {
49
+ get,
50
+ update
51
+ };
52
+ }
53
+
54
+ module.exports = emailTemplateSettingsFactory;
@@ -0,0 +1,54 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Factory for sms-template-settings API (btrz-api-accounts).
7
+ * @param {Object} deps
8
+ * @param {import("axios").AxiosInstance} deps.client
9
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
+ * @returns {{ get: function, update: function }}
11
+ */
12
+ function smsTemplateSettingsFactory({client, internalAuthTokenProvider}) {
13
+ /**
14
+ * GET /sms-template-settings – SMS template flow preference for the account.
15
+ * @param {Object} opts
16
+ * @param {string} [opts.token] - API key
17
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
18
+ * @param {Object} [opts.headers] - Optional headers
19
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
20
+ */
21
+ function get({token, jwtToken, headers}) {
22
+ return client({
23
+ url: "/sms-template-settings",
24
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
25
+ });
26
+ }
27
+
28
+ /**
29
+ * PUT /sms-template-settings – update SMS template flow preference.
30
+ * @param {Object} opts
31
+ * @param {string} [opts.token] - API key
32
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
+ * @param {Object} opts.smsTemplateSettings - Payload with useSmsTemplates
34
+ * @param {Object} [opts.headers] - Optional headers
35
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplateSettings: { useSmsTemplates: boolean } }>>}
36
+ */
37
+ function update({token, jwtToken, smsTemplateSettings, headers}) {
38
+ return client({
39
+ url: "/sms-template-settings",
40
+ method: "put",
41
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
42
+ data: {
43
+ smsTemplateSettings
44
+ }
45
+ });
46
+ }
47
+
48
+ return {
49
+ get,
50
+ update
51
+ };
52
+ }
53
+
54
+ module.exports = smsTemplateSettingsFactory;
@@ -7,7 +7,6 @@ const {
7
7
  * @typedef {Object} PrismaTerminalsQuery
8
8
  * @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers
9
9
  * @property {boolean} [validateRefund] - (PUT refunds only) If true, fetch current state from Prisma before applying
10
- * @property {boolean} [validatePayment] - (PUT payments only) If true, validate payment against the provider
11
10
  */
12
11
 
13
12
  /**
@@ -213,7 +212,7 @@ function prismaTerminalsFactory({client, internalAuthTokenProvider}) {
213
212
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
214
213
  * @param {string} opts.id - Payment id (prismaPaymentId)
215
214
  * @param {Object} opts.prismaPayment - Prisma payment payload
216
- * @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId, validatePayment)
215
+ * @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
217
216
  * @param {Object} [opts.headers] - Optional headers
218
217
  * @returns {Promise<import("axios").AxiosResponse>}
219
218
  */
@@ -6,7 +6,7 @@ const {
6
6
  /**
7
7
  * Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
8
8
  * @typedef {Object} SegmentsInformationTablesQuery
9
- * @property {string} [providerId] - Provider/account id of the route when different from the authenticated user (24-char hex ObjectId)
9
+ * @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
10
10
  */
11
11
 
12
12
  /**
@@ -23,7 +23,7 @@ function segmentInformationTableFactory({client, internalAuthTokenProvider}) {
23
23
  * @param {string} [opts.token] - API key (X-API-KEY)
24
24
  * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
25
25
  * @param {string} opts.routeId - Route id (24-char hex ObjectId)
26
- * @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
26
+ * @param {SegmentsInformationTablesQuery} [opts.query] - Optional query params (providerId)
27
27
  * @param {Object} [opts.headers] - Optional headers
28
28
  * @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
29
29
  * @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
@@ -6,12 +6,12 @@ const {
6
6
  /**
7
7
  * Request body for POST /notify/email (btrz-api-notifications). See post-notify-email-handler getSpec() and NotifyEmailPostData.
8
8
  * @typedef {Object} NotifyEmailByTypePostData
9
- * @property {string} type - Document/template type (e.g. product, voucher, order, transaction)
9
+ * @property {string} type - Document/PDF type (e.g. order, voucher, movement, cancellation)
10
10
  * @property {string} itemId - ObjectId of the item (24-char hex)
11
11
  * @property {string} [to] - Recipient email (optional; derived from item when omitted)
12
12
  * @property {string} [lang] - ISO language code (e.g. en-us)
13
13
  * @property {string} [channel] - Channel filter for template selection
14
- * @property {string} [family] - Required when type is 'product'. One of: ticket, reservation, paid in, paid out, parcel, flexpass, bundle
14
+ * @property {string} [family] - When type is product or movement: ticket, reservation, parcel, etc.
15
15
  * @property {string} [humanDate] - "mm" | "dd"
16
16
  */
17
17
 
@@ -1,7 +1,7 @@
1
1
  export = segmentInformationTableFactory;
2
2
  /**
3
3
  * @typedef {Object} SegmentsInformationTablesQuery
4
- * @property {string} [providerId] - Provider account ID
4
+ * @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
5
5
  */
6
6
  /**
7
7
  * Factory for segments-information-tables API (btrz-api-inventory).
@@ -23,7 +23,7 @@ declare namespace segmentInformationTableFactory {
23
23
  }
24
24
  type SegmentsInformationTablesQuery = {
25
25
  /**
26
- * - Provider account ID
26
+ * - Provider account ID when route belongs to a provider in the requester's network
27
27
  */
28
28
  providerId?: string;
29
29
  };