btrz-api-client 8.33.0 → 8.35.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 +3 -3
- package/lib/client.js +10 -2
- package/lib/endpoints/btrzpay/adyen.js +58 -0
- package/lib/endpoints/btrzpay/cardpointe.js +6 -3
- package/lib/endpoints/btrzpay/customerCards.js +19 -19
- package/lib/endpoints/btrzpay/customers.js +13 -13
- package/lib/endpoints/btrzpay/cybersource3ds.js +142 -0
- package/lib/endpoints/btrzpay/datalogic.js +64 -28
- package/lib/endpoints/btrzpay/oxxo.js +54 -28
- package/lib/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/lib/endpoints/btrzpay/referenced-payments.js +4 -4
- package/lib/endpoints/btrzpay/square.js +8 -8
- package/lib/endpoints/btrzpay/stripe-terminals.js +16 -11
- package/lib/endpoints/btrzpay/stripe3ds.js +54 -0
- package/lib/endpoints/btrzpay/terminalPayments.js +19 -19
- package/lib/endpoints/inventory/banks.js +39 -21
- package/lib/endpoints/inventory/change-requests.js +59 -31
- package/lib/endpoints/inventory/control-classes.js +39 -20
- package/lib/endpoints/inventory/countries.js +25 -9
- package/lib/endpoints/inventory/custom-content.js +39 -21
- package/lib/endpoints/inventory/custom-fields.js +25 -17
- package/lib/endpoints/inventory/document-types.js +33 -42
- package/lib/endpoints/inventory/external-wallets.js +26 -20
- package/lib/endpoints/inventory/fees.js +19 -13
- package/lib/endpoints/inventory/filtered-trips.js +34 -8
- package/lib/endpoints/inventory/financing-costs.js +19 -14
- package/lib/endpoints/inventory/garages.js +19 -14
- package/lib/endpoints/inventory/getnet-terminals.js +20 -15
- package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/lib/endpoints/inventory/holidays.js +158 -0
- package/lib/endpoints/inventory/insurances.js +17 -13
- package/lib/endpoints/inventory/items.js +13 -9
- package/lib/endpoints/inventory/labels.js +16 -11
- package/lib/endpoints/inventory/marital-status.js +16 -11
- package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/lib/endpoints/inventory/mit-terminals.js +16 -11
- package/lib/endpoints/inventory/operation-messages.js +18 -12
- package/lib/endpoints/inventory/operation-reasons.js +15 -10
- package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
- package/lib/endpoints/inventory/payment-terminals.js +15 -10
- package/lib/endpoints/inventory/products.js +22 -10
- package/lib/endpoints/inventory/promos.js +27 -18
- package/lib/endpoints/inventory/segments-information-tables.js +13 -7
- package/lib/endpoints/inventory/station-groups.js +2 -4
- package/lib/endpoints/inventory/taxes.js +11 -2
- package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
- package/lib/endpoints/inventory/trip-ids.js +67 -0
- package/lib/endpoints/inventory/trips.js +60 -13
- package/lib/endpoints/inventory/vehicle-types.js +2 -5
- package/lib/endpoints/inventory/vehicles.js +4 -2
- package/lib/endpoints/invoices/emails.js +15 -5
- package/lib/endpoints/invoices/invoices.js +46 -25
- package/lib/endpoints/invoices/pdfs.js +15 -8
- package/lib/endpoints/invoices/providers.js +42 -25
- package/lib/endpoints/invoices/tax-ids.js +11 -7
- package/lib/endpoints/notifications/customers.js +1 -1
- package/lib/endpoints/notifications/external-customers.js +54 -0
- package/lib/endpoints/notifications/pdfs.js +0 -3
- package/lib/endpoints/operations/accounting_items.js +7 -1
- package/lib/endpoints/operations/flexpasses.js +9 -7
- package/lib/endpoints/operations/gift-certificates.js +53 -0
- package/lib/endpoints/operations/loans.js +16 -10
- package/lib/endpoints/operations/movements.js +17 -6
- package/lib/endpoints/operations/pago-express.js +96 -0
- package/lib/endpoints/operations/parcels.js +11 -11
- package/lib/endpoints/operations/parcels_manifests.js +7 -4
- package/lib/endpoints/sales/cancellations.js +43 -31
- package/lib/endpoints/sales/cart.js +21 -18
- package/lib/endpoints/sales/flexpasses.js +2 -5
- package/lib/endpoints/sales/order.js +41 -7
- package/lib/endpoints/sales/parcel-quotes.js +2 -2
- package/package.json +1 -1
- package/src/client.js +10 -2
- package/src/endpoints/btrzpay/adyen.js +44 -0
- package/src/endpoints/btrzpay/cardpointe.js +6 -4
- package/src/endpoints/btrzpay/customerCards.js +19 -19
- package/src/endpoints/btrzpay/customers.js +13 -13
- package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
- package/src/endpoints/btrzpay/datalogic.js +63 -28
- package/src/endpoints/btrzpay/oxxo.js +53 -26
- package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/src/endpoints/btrzpay/referenced-payments.js +4 -4
- package/src/endpoints/btrzpay/square.js +8 -8
- package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
- package/src/endpoints/btrzpay/stripe3ds.js +40 -0
- package/src/endpoints/btrzpay/terminalPayments.js +19 -19
- package/src/endpoints/inventory/banks.js +39 -21
- package/src/endpoints/inventory/change-requests.js +59 -31
- package/src/endpoints/inventory/control-classes.js +39 -20
- package/src/endpoints/inventory/countries.js +25 -10
- package/src/endpoints/inventory/custom-content.js +39 -22
- package/src/endpoints/inventory/custom-fields.js +25 -19
- package/src/endpoints/inventory/document-types.js +34 -33
- package/src/endpoints/inventory/external-wallets.js +25 -20
- package/src/endpoints/inventory/fees.js +19 -14
- package/src/endpoints/inventory/filtered-trips.js +29 -8
- package/src/endpoints/inventory/financing-costs.js +19 -14
- package/src/endpoints/inventory/garages.js +19 -14
- package/src/endpoints/inventory/getnet-terminals.js +20 -15
- package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/src/endpoints/inventory/holidays.js +121 -0
- package/src/endpoints/inventory/insurances.js +17 -13
- package/src/endpoints/inventory/items.js +13 -9
- package/src/endpoints/inventory/labels.js +16 -11
- package/src/endpoints/inventory/marital-status.js +16 -11
- package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/src/endpoints/inventory/mit-terminals.js +16 -11
- package/src/endpoints/inventory/operation-messages.js +18 -12
- package/src/endpoints/inventory/operation-reasons.js +15 -10
- package/src/endpoints/inventory/pay-on-accounts.js +5 -4
- package/src/endpoints/inventory/payment-terminals.js +15 -10
- package/src/endpoints/inventory/products.js +22 -10
- package/src/endpoints/inventory/promos.js +27 -18
- package/src/endpoints/inventory/segments-information-tables.js +13 -7
- package/src/endpoints/inventory/station-groups.js +2 -4
- package/src/endpoints/inventory/taxes.js +11 -2
- package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
- package/src/endpoints/inventory/trip-ids.js +54 -0
- package/src/endpoints/inventory/trips.js +52 -14
- package/src/endpoints/inventory/vehicle-types.js +3 -4
- package/src/endpoints/inventory/vehicles.js +4 -3
- package/src/endpoints/invoices/emails.js +15 -5
- package/src/endpoints/invoices/invoices.js +46 -25
- package/src/endpoints/invoices/pdfs.js +15 -8
- package/src/endpoints/invoices/providers.js +42 -25
- package/src/endpoints/invoices/tax-ids.js +11 -7
- package/src/endpoints/notifications/customers.js +1 -1
- package/src/endpoints/notifications/external-customers.js +41 -0
- package/src/endpoints/notifications/pdfs.js +0 -3
- package/src/endpoints/operations/accounting_items.js +7 -2
- package/src/endpoints/operations/flexpasses.js +9 -7
- package/src/endpoints/operations/gift-certificates.js +39 -0
- package/src/endpoints/operations/loans.js +16 -11
- package/src/endpoints/operations/movements.js +17 -6
- package/src/endpoints/operations/pago-express.js +73 -0
- package/src/endpoints/operations/parcels.js +11 -11
- package/src/endpoints/operations/parcels_manifests.js +7 -5
- package/src/endpoints/sales/cancellations.js +43 -31
- package/src/endpoints/sales/cart.js +20 -18
- package/src/endpoints/sales/flexpasses.js +3 -4
- package/src/endpoints/sales/order.js +34 -7
- package/src/endpoints/sales/parcel-quotes.js +2 -2
- package/test/endpoints/btrzpay/adyen.tests.js +27 -0
- package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
- package/test/endpoints/btrzpay/customerCards.test.js +9 -6
- package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
- package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
- package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
- package/test/endpoints/inventory/banks.test.js +8 -10
- package/test/endpoints/inventory/filtered-trips.test.js +6 -0
- package/test/endpoints/inventory/holidays.test.js +52 -0
- package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
- package/test/endpoints/inventory/trip-ids.test.js +27 -0
- package/test/endpoints/inventory/trips.test.js +19 -14
- package/test/endpoints/notifications/external-customers.test.js +30 -0
- package/test/endpoints/operations/gift_certificates.test.js +37 -0
- package/test/endpoints/operations/operations.test.js +30 -0
- package/test/endpoints/sales/order.test.js +7 -1
|
@@ -6,11 +6,30 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
6
6
|
/**
|
|
7
7
|
* Query params for GET /datalogic/payments (btrz-api-payments). See get-payments-handler getSpec().
|
|
8
8
|
* @typedef {Object} DatalogicPaymentsListQuery
|
|
9
|
-
* @property {string}
|
|
9
|
+
* @property {string} referenceNumber - Payment reference number (required)
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Request body for POST /datalogic/payments/:referenceNumber. PostDatalogicPaymentsPayload.
|
|
14
|
+
* @typedef {Object} PostDatalogicPaymentsPayload
|
|
15
|
+
* @property {string} folio - FEMSA transaction id
|
|
16
|
+
* @property {number} id_terminal - Terminal/group ID
|
|
17
|
+
* @property {string} local_date - Local date (e.g. "02/08/2022 20:33:43")
|
|
18
|
+
* @property {string} amount - Debt amount
|
|
19
|
+
* @property {number} trx_no - Transaction number
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Request body for POST /datalogic/reverse/:referenceNumber. PostDatalogicReversePayload.
|
|
24
|
+
* @typedef {Object} PostDatalogicReversePayload
|
|
25
|
+
* @property {string} folio - FEMSA transaction id
|
|
26
|
+
* @property {number} id_terminal - Terminal/group ID
|
|
27
|
+
* @property {string} local_date - Local date (e.g. "02/08/2022 20:33:43")
|
|
28
|
+
* @property {number} trx_no - Transaction number
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Factory for Datalogic API (btrz-api-payments). Endpoints are hideInDocumentation; client for internal use.
|
|
14
33
|
* @param {Object} deps
|
|
15
34
|
* @param {import("axios").AxiosInstance} deps.client
|
|
16
35
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -19,41 +38,51 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
19
38
|
|
|
20
39
|
|
|
21
40
|
function datalogicFactory(_ref) {
|
|
22
|
-
var client = _ref.client
|
|
41
|
+
var client = _ref.client,
|
|
42
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
43
|
+
|
|
44
|
+
function authProvider(opts) {
|
|
45
|
+
return opts !== undefined && opts !== null ? opts : internalAuthTokenProvider;
|
|
46
|
+
}
|
|
23
47
|
|
|
24
48
|
var payments = {
|
|
25
49
|
/**
|
|
26
|
-
* GET /datalogic/payments - list Datalogic payments.
|
|
50
|
+
* GET /datalogic/payments - list Datalogic payments by reference number.
|
|
27
51
|
* @param {Object} opts
|
|
28
52
|
* @param {string} [opts.token] - API key
|
|
29
53
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
30
|
-
* @param {DatalogicPaymentsListQuery}
|
|
54
|
+
* @param {DatalogicPaymentsListQuery} opts.query - referenceNumber (required)
|
|
31
55
|
* @param {Object} [opts.headers] - Optional headers
|
|
32
|
-
* @
|
|
56
|
+
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider] - Internal auth provider
|
|
57
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payments: Array }>>}
|
|
58
|
+
* GetDatalogicPaymentsResponse. Rejects 400, 401, 500.
|
|
33
59
|
*/
|
|
34
60
|
all: function all(_ref2) {
|
|
35
61
|
var token = _ref2.token,
|
|
36
62
|
jwtToken = _ref2.jwtToken,
|
|
37
63
|
headers = _ref2.headers,
|
|
38
64
|
query = _ref2.query,
|
|
39
|
-
|
|
65
|
+
optsAuth = _ref2.internalAuthTokenProvider;
|
|
40
66
|
|
|
41
67
|
return client({
|
|
42
68
|
url: "/datalogic/payments",
|
|
43
69
|
params: query,
|
|
44
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider:
|
|
70
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
45
71
|
});
|
|
46
72
|
},
|
|
47
73
|
|
|
48
74
|
/**
|
|
49
|
-
* POST /datalogic/payments/:referenceNumber -
|
|
75
|
+
* POST /datalogic/payments/:referenceNumber - pay by reference (20 digits).
|
|
76
|
+
* Body: datalogicInfo or flat PostDatalogicPaymentsPayload.
|
|
50
77
|
* @param {Object} opts
|
|
51
78
|
* @param {string} [opts.token] - API key
|
|
52
79
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
53
|
-
* @param {string} opts.referenceNumber - Reference number
|
|
54
|
-
* @param {
|
|
80
|
+
* @param {string} opts.referenceNumber - Reference number (20 digits)
|
|
81
|
+
* @param {PostDatalogicPaymentsPayload|{ datalogicInfo: PostDatalogicPaymentsPayload }} opts.data - Body
|
|
55
82
|
* @param {Object} [opts.headers] - Optional headers
|
|
56
|
-
* @
|
|
83
|
+
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider] - Internal auth provider
|
|
84
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payment: Object }>>}
|
|
85
|
+
* PostDatalogicPaymentsResponse. Rejects 400, 401, 500.
|
|
57
86
|
*/
|
|
58
87
|
update: function update(_ref3) {
|
|
59
88
|
var token = _ref3.token,
|
|
@@ -62,26 +91,29 @@ function datalogicFactory(_ref) {
|
|
|
62
91
|
query = _ref3.query,
|
|
63
92
|
referenceNumber = _ref3.referenceNumber,
|
|
64
93
|
data = _ref3.data,
|
|
65
|
-
|
|
94
|
+
optsAuth = _ref3.internalAuthTokenProvider;
|
|
66
95
|
|
|
67
96
|
return client({
|
|
68
97
|
url: "/datalogic/payments/" + referenceNumber,
|
|
69
98
|
method: "post",
|
|
70
99
|
params: query,
|
|
71
100
|
data: data,
|
|
72
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider:
|
|
101
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
73
102
|
});
|
|
74
103
|
},
|
|
75
104
|
|
|
76
105
|
/**
|
|
77
|
-
* POST /datalogic/reverse/:referenceNumber - reverse
|
|
106
|
+
* POST /datalogic/reverse/:referenceNumber - reverse by reference (20 digits).
|
|
107
|
+
* Body: datalogicReverseInfo or flat PostDatalogicReversePayload.
|
|
78
108
|
* @param {Object} opts
|
|
79
109
|
* @param {string} [opts.token] - API key
|
|
80
110
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
81
|
-
* @param {string} opts.referenceNumber - Reference number
|
|
82
|
-
* @param {
|
|
111
|
+
* @param {string} opts.referenceNumber - Reference number (20 digits)
|
|
112
|
+
* @param {PostDatalogicReversePayload|{ datalogicReverseInfo: PostDatalogicReversePayload }} opts.data - Body
|
|
83
113
|
* @param {Object} [opts.headers] - Optional headers
|
|
84
|
-
* @
|
|
114
|
+
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider] - Internal auth provider
|
|
115
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payment: Object }>>}
|
|
116
|
+
* PostDatalogicPaymentsResponse. Rejects 400, 401, 500.
|
|
85
117
|
*/
|
|
86
118
|
reverse: function reverse(_ref4) {
|
|
87
119
|
var token = _ref4.token,
|
|
@@ -90,58 +122,62 @@ function datalogicFactory(_ref) {
|
|
|
90
122
|
query = _ref4.query,
|
|
91
123
|
referenceNumber = _ref4.referenceNumber,
|
|
92
124
|
data = _ref4.data,
|
|
93
|
-
|
|
125
|
+
optsAuth = _ref4.internalAuthTokenProvider;
|
|
94
126
|
|
|
95
127
|
return client({
|
|
96
128
|
url: "/datalogic/reverse/" + referenceNumber,
|
|
97
129
|
method: "post",
|
|
98
130
|
params: query,
|
|
99
131
|
data: data,
|
|
100
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider:
|
|
132
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
101
133
|
});
|
|
102
134
|
}
|
|
103
135
|
};
|
|
104
136
|
|
|
105
137
|
var referenceNumber = {
|
|
106
138
|
/**
|
|
107
|
-
* GET /datalogic/reference-number - get reference number.
|
|
139
|
+
* GET /datalogic/reference-number - get new Datalogic reference number.
|
|
108
140
|
* @param {Object} opts
|
|
109
141
|
* @param {string} [opts.token] - API key
|
|
110
142
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
111
143
|
* @param {Object} [opts.headers] - Optional headers
|
|
112
|
-
* @
|
|
144
|
+
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider] - Internal auth provider
|
|
145
|
+
* @returns {Promise<import("axios").AxiosResponse<{ referenceNumber: string }>>}
|
|
146
|
+
* GetDatalogicReferenceNumberResponse. Rejects 401, 404, 500.
|
|
113
147
|
*/
|
|
114
148
|
get: function get(_ref5) {
|
|
115
149
|
var token = _ref5.token,
|
|
116
150
|
jwtToken = _ref5.jwtToken,
|
|
117
151
|
headers = _ref5.headers,
|
|
118
|
-
|
|
152
|
+
optsAuth = _ref5.internalAuthTokenProvider;
|
|
119
153
|
|
|
120
154
|
return client({
|
|
121
155
|
url: "/datalogic/reference-number",
|
|
122
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider:
|
|
156
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
123
157
|
});
|
|
124
158
|
}
|
|
125
159
|
};
|
|
126
160
|
|
|
127
161
|
var authCode = {
|
|
128
162
|
/**
|
|
129
|
-
* GET /datalogic/auth-code - get
|
|
163
|
+
* GET /datalogic/auth-code - get new Datalogic authorization code.
|
|
130
164
|
* @param {Object} opts
|
|
131
165
|
* @param {string} [opts.token] - API key
|
|
132
166
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
133
167
|
* @param {Object} [opts.headers] - Optional headers
|
|
134
|
-
* @
|
|
168
|
+
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider] - Internal auth provider
|
|
169
|
+
* @returns {Promise<import("axios").AxiosResponse<{ authCode: string }>>}
|
|
170
|
+
* GetDatalogicAuthCodeResponse. Rejects 401, 404, 500.
|
|
135
171
|
*/
|
|
136
172
|
get: function get(_ref6) {
|
|
137
173
|
var token = _ref6.token,
|
|
138
174
|
jwtToken = _ref6.jwtToken,
|
|
139
175
|
headers = _ref6.headers,
|
|
140
|
-
|
|
176
|
+
optsAuth = _ref6.internalAuthTokenProvider;
|
|
141
177
|
|
|
142
178
|
return client({
|
|
143
179
|
url: "/datalogic/auth-code",
|
|
144
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider:
|
|
180
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
145
181
|
});
|
|
146
182
|
}
|
|
147
183
|
};
|
|
@@ -6,11 +6,31 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
6
6
|
/**
|
|
7
7
|
* Query params for GET /oxxo/:token/payments (btrz-api-payments). See get-payments-handler getSpec().
|
|
8
8
|
* @typedef {Object} OxxoPaymentsListQuery
|
|
9
|
-
* @property {string}
|
|
9
|
+
* @property {string} referenceNumber - Payment reference number (required)
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Request body for POST /oxxo/:token/payments/:referenceNumber. PostOxxoPaymentsPayload.
|
|
14
|
+
* @typedef {Object} PostOxxoPaymentsPayload
|
|
15
|
+
* @property {string} ticket - Oxxo sale ticket id
|
|
16
|
+
* @property {number} amount - Amount to pay in cents
|
|
17
|
+
* @property {string} folio - FEMSA transaction id
|
|
18
|
+
* @property {string} store - Store id
|
|
19
|
+
* @property {string} account - Account id (ObjectId)
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Request body for POST /oxxo/:token/reverse/:referenceNumber. PostOxxoReversePayload.
|
|
24
|
+
* @typedef {Object} PostOxxoReversePayload
|
|
25
|
+
* @property {string} ticket - Oxxo sale ticket id
|
|
26
|
+
* @property {number} amount - Amount in cents
|
|
27
|
+
* @property {string} folio - FEMSA transaction id
|
|
28
|
+
* @property {string} store - Store id
|
|
29
|
+
* @property {string} account - Account id (ObjectId)
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Factory for OXXO API (btrz-api-payments). Endpoints are hideInDocumentation; client for internal use.
|
|
14
34
|
* @param {Object} deps
|
|
15
35
|
* @param {import("axios").AxiosInstance} deps.client
|
|
16
36
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -20,64 +40,71 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
20
40
|
|
|
21
41
|
function oxxoFactory(_ref) {
|
|
22
42
|
var client = _ref.client,
|
|
23
|
-
|
|
43
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
44
|
+
|
|
45
|
+
function authProvider(opts) {
|
|
46
|
+
return opts !== undefined && opts !== null ? opts : internalAuthTokenProvider;
|
|
47
|
+
}
|
|
24
48
|
|
|
25
49
|
var token = {
|
|
26
50
|
/**
|
|
27
|
-
* GET /oxxo/token - get
|
|
51
|
+
* GET /oxxo/token - get new Oxxo token. No query params.
|
|
28
52
|
* @param {Object} opts
|
|
29
53
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
30
54
|
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider]
|
|
31
55
|
* @param {Object} [opts.headers] - Optional request headers
|
|
32
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
56
|
+
* @returns {Promise<import("axios").AxiosResponse<{ token: string }>>}
|
|
57
|
+
* GetOxxoTokenResponse. Rejects with 401, 500.
|
|
33
58
|
*/
|
|
34
59
|
get: function get(_ref2) {
|
|
35
60
|
var jwtToken = _ref2.jwtToken,
|
|
36
61
|
headers = _ref2.headers,
|
|
37
|
-
|
|
62
|
+
optsAuth = _ref2.internalAuthTokenProvider;
|
|
38
63
|
|
|
39
64
|
return client({
|
|
40
65
|
url: "/oxxo/token",
|
|
41
|
-
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider:
|
|
66
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
42
67
|
});
|
|
43
68
|
}
|
|
44
69
|
};
|
|
45
70
|
|
|
46
71
|
var payments = {
|
|
47
72
|
/**
|
|
48
|
-
* GET /oxxo/:
|
|
73
|
+
* GET /oxxo/:token/payments - list Oxxo payments by token and reference number.
|
|
49
74
|
* @param {Object} opts
|
|
50
75
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
51
|
-
* @param {string} opts.oxxoToken -
|
|
52
|
-
* @param {OxxoPaymentsListQuery}
|
|
76
|
+
* @param {string} opts.oxxoToken - Oxxo token
|
|
77
|
+
* @param {OxxoPaymentsListQuery} opts.query - referenceNumber (required)
|
|
53
78
|
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider]
|
|
54
79
|
* @param {Object} [opts.headers] - Optional request headers
|
|
55
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
80
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payments: Array }>>}
|
|
81
|
+
* GetOxxoPaymentsResponse. Rejects with 400 (ERROR_GETTING_PAYMENT_METHODS, OXXO_PAY_NOT_ENABLED), 401, 500.
|
|
56
82
|
*/
|
|
57
83
|
all: function all(_ref3) {
|
|
58
84
|
var jwtToken = _ref3.jwtToken,
|
|
59
85
|
headers = _ref3.headers,
|
|
60
86
|
oxxoToken = _ref3.oxxoToken,
|
|
61
87
|
query = _ref3.query,
|
|
62
|
-
|
|
88
|
+
optsAuth = _ref3.internalAuthTokenProvider;
|
|
63
89
|
|
|
64
90
|
return client({
|
|
65
91
|
url: "/oxxo/" + oxxoToken + "/payments",
|
|
66
92
|
params: query,
|
|
67
|
-
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider:
|
|
93
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
68
94
|
});
|
|
69
95
|
},
|
|
70
96
|
|
|
71
97
|
/**
|
|
72
|
-
* POST /oxxo/:
|
|
98
|
+
* POST /oxxo/:token/payments/:referenceNumber - pay Oxxo payment (referenceNumber: UUID v4 or 20 digits).
|
|
73
99
|
* @param {Object} opts
|
|
74
100
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
75
|
-
* @param {string} opts.oxxoToken -
|
|
101
|
+
* @param {string} opts.oxxoToken - Oxxo token
|
|
76
102
|
* @param {string} opts.referenceNumber - Payment reference number
|
|
77
|
-
* @param {
|
|
103
|
+
* @param {PostOxxoPaymentsPayload|{ oxxoInfo: PostOxxoPaymentsPayload }} opts.data - Request body
|
|
78
104
|
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider]
|
|
79
105
|
* @param {Object} [opts.headers] - Optional request headers
|
|
80
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
106
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payment: Object }>>}
|
|
107
|
+
* Rejects with 400 (INVALID_REFERENCE_NUMBER_FORMAT, INVALID_ACCOUNT, OXXO_PAY_NOT_ENABLED), 401, 500.
|
|
81
108
|
*/
|
|
82
109
|
update: function update(_ref4) {
|
|
83
110
|
var jwtToken = _ref4.jwtToken,
|
|
@@ -86,37 +113,36 @@ function oxxoFactory(_ref) {
|
|
|
86
113
|
query = _ref4.query,
|
|
87
114
|
referenceNumber = _ref4.referenceNumber,
|
|
88
115
|
data = _ref4.data,
|
|
89
|
-
|
|
116
|
+
optsAuth = _ref4.internalAuthTokenProvider;
|
|
90
117
|
|
|
91
118
|
return client({
|
|
92
119
|
url: "/oxxo/" + oxxoToken + "/payments/" + referenceNumber,
|
|
93
120
|
method: "post",
|
|
94
121
|
params: query,
|
|
95
122
|
data: data,
|
|
96
|
-
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider:
|
|
123
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
97
124
|
});
|
|
98
125
|
},
|
|
99
126
|
|
|
100
127
|
/**
|
|
101
|
-
* POST /oxxo/:
|
|
128
|
+
* POST /oxxo/:token/reverse/:referenceNumber - reverse Oxxo payment (referenceNumber: UUID v4 or 20 digits).
|
|
102
129
|
* @param {Object} opts
|
|
103
|
-
* @param {string} [opts.token] - API key
|
|
104
130
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
105
|
-
* @param {string} opts.oxxoToken -
|
|
131
|
+
* @param {string} opts.oxxoToken - Oxxo token
|
|
106
132
|
* @param {string} opts.referenceNumber - Payment reference number
|
|
107
|
-
* @param {
|
|
133
|
+
* @param {PostOxxoReversePayload|{ oxxoInfo: PostOxxoReversePayload }} [opts.data] - Request body
|
|
108
134
|
* @param {{ getToken: function(): string }} [opts.internalAuthTokenProvider]
|
|
109
135
|
* @param {Object} [opts.headers] - Optional request headers
|
|
110
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
136
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payment: Object }>>}
|
|
137
|
+
* Rejects with 400 (INVALID_REFERENCE_NUMBER_FORMAT, INVALID_ACCOUNT, OXXO_PAY_NOT_ENABLED), 401, 500.
|
|
111
138
|
*/
|
|
112
139
|
reverse: function reverse(_ref5) {
|
|
113
|
-
var
|
|
114
|
-
jwtToken = _ref5.jwtToken,
|
|
140
|
+
var jwtToken = _ref5.jwtToken,
|
|
115
141
|
headers = _ref5.headers,
|
|
116
142
|
query = _ref5.query,
|
|
117
143
|
referenceNumber = _ref5.referenceNumber,
|
|
118
144
|
data = _ref5.data,
|
|
119
|
-
|
|
145
|
+
optsAuth = _ref5.internalAuthTokenProvider,
|
|
120
146
|
oxxoToken = _ref5.oxxoToken;
|
|
121
147
|
|
|
122
148
|
return client({
|
|
@@ -124,7 +150,7 @@ function oxxoFactory(_ref) {
|
|
|
124
150
|
method: "post",
|
|
125
151
|
params: query,
|
|
126
152
|
data: data,
|
|
127
|
-
headers: authorizationHeaders({
|
|
153
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: authProvider(optsAuth), headers: headers })
|
|
128
154
|
});
|
|
129
155
|
}
|
|
130
156
|
};
|
|
@@ -4,10 +4,11 @@ var _require = require("../endpoints_helpers.js"),
|
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Query params for
|
|
7
|
+
* Query params for Prisma terminals endpoints (btrz-api-payments).
|
|
8
8
|
* @typedef {Object} PrismaTerminalsQuery
|
|
9
9
|
* @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers
|
|
10
10
|
* @property {boolean} [validateRefund] - (PUT refunds only) If true, fetch current state from Prisma before applying
|
|
11
|
+
* @property {boolean} [validatePayment] - (PUT payments only) If true, validate payment against the provider
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -49,12 +50,13 @@ function prismaTerminalsFactory(_ref) {
|
|
|
49
50
|
},
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
* POST /prisma-terminals/payments/:id/reversals - create reversal.
|
|
53
|
+
* POST /prisma-terminals/payments/:id/reversals - create reversal.
|
|
53
54
|
* @param {Object} opts
|
|
54
55
|
* @param {string} [opts.token] - API key
|
|
55
56
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
56
|
-
* @param {string} opts.id - Payment id
|
|
57
|
+
* @param {string} opts.id - Payment id (prismaPaymentId)
|
|
57
58
|
* @param {Object} opts.prismaReversal - Prisma reversal payload
|
|
59
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
58
60
|
* @param {Object} [opts.headers] - Optional headers
|
|
59
61
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
60
62
|
*/
|
|
@@ -77,11 +79,12 @@ function prismaTerminalsFactory(_ref) {
|
|
|
77
79
|
},
|
|
78
80
|
|
|
79
81
|
/**
|
|
80
|
-
* DELETE /prisma-terminals/reversals/:id - delete reversal.
|
|
82
|
+
* DELETE /prisma-terminals/reversals/:id - delete reversal.
|
|
81
83
|
* @param {Object} opts
|
|
82
84
|
* @param {string} [opts.token] - API key
|
|
83
85
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
84
|
-
* @param {string} opts.id - Reversal id
|
|
86
|
+
* @param {string} opts.id - Reversal id (prismaPaymentId)
|
|
87
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
85
88
|
* @param {Object} [opts.headers] - Optional headers
|
|
86
89
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
87
90
|
*/
|
|
@@ -128,12 +131,13 @@ function prismaTerminalsFactory(_ref) {
|
|
|
128
131
|
},
|
|
129
132
|
|
|
130
133
|
/**
|
|
131
|
-
* POST /prisma-terminals/payments/:id/refunds - create refund.
|
|
134
|
+
* POST /prisma-terminals/payments/:id/refunds - create refund.
|
|
132
135
|
* @param {Object} opts
|
|
133
136
|
* @param {string} [opts.token] - API key
|
|
134
137
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
135
|
-
* @param {string} opts.id - Payment id
|
|
138
|
+
* @param {string} opts.id - Payment id (prismaPaymentId)
|
|
136
139
|
* @param {Object} opts.prismaRefund - Prisma refund payload
|
|
140
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
137
141
|
* @param {Object} [opts.headers] - Optional headers
|
|
138
142
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
139
143
|
*/
|
|
@@ -156,11 +160,12 @@ function prismaTerminalsFactory(_ref) {
|
|
|
156
160
|
},
|
|
157
161
|
|
|
158
162
|
/**
|
|
159
|
-
* DELETE /prisma-terminals/refunds/:id - delete refund.
|
|
163
|
+
* DELETE /prisma-terminals/refunds/:id - delete refund.
|
|
160
164
|
* @param {Object} opts
|
|
161
165
|
* @param {string} [opts.token] - API key
|
|
162
166
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
163
|
-
* @param {string} opts.id - Refund id
|
|
167
|
+
* @param {string} opts.id - Refund id (prismaPaymentId)
|
|
168
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
164
169
|
* @param {Object} [opts.headers] - Optional headers
|
|
165
170
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
166
171
|
*/
|
|
@@ -236,11 +241,12 @@ function prismaTerminalsFactory(_ref) {
|
|
|
236
241
|
},
|
|
237
242
|
|
|
238
243
|
/**
|
|
239
|
-
* POST /prisma-terminals/payments - create payment.
|
|
244
|
+
* POST /prisma-terminals/payments - create payment.
|
|
240
245
|
* @param {Object} opts
|
|
241
246
|
* @param {string} [opts.token] - API key
|
|
242
247
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
243
248
|
* @param {Object} opts.prismaPayment - Prisma payment payload
|
|
249
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
244
250
|
* @param {Object} [opts.headers] - Optional headers
|
|
245
251
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
246
252
|
*/
|
|
@@ -262,11 +268,12 @@ function prismaTerminalsFactory(_ref) {
|
|
|
262
268
|
},
|
|
263
269
|
|
|
264
270
|
/**
|
|
265
|
-
* DELETE /prisma-terminals/payments/:id - delete payment.
|
|
271
|
+
* DELETE /prisma-terminals/payments/:id - delete payment.
|
|
266
272
|
* @param {Object} opts
|
|
267
273
|
* @param {string} [opts.token] - API key
|
|
268
274
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
269
|
-
* @param {string} opts.id - Payment id
|
|
275
|
+
* @param {string} opts.id - Payment id (prismaPaymentId)
|
|
276
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
270
277
|
* @param {Object} [opts.headers] - Optional headers
|
|
271
278
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
272
279
|
*/
|
|
@@ -287,12 +294,13 @@ function prismaTerminalsFactory(_ref) {
|
|
|
287
294
|
},
|
|
288
295
|
|
|
289
296
|
/**
|
|
290
|
-
* PUT /prisma-terminals/payments/:id - update payment
|
|
297
|
+
* PUT /prisma-terminals/payments/:id - update payment (hidden in API docs).
|
|
291
298
|
* @param {Object} opts
|
|
292
299
|
* @param {string} [opts.token] - API key
|
|
293
300
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
294
|
-
* @param {string} opts.id - Payment id
|
|
301
|
+
* @param {string} opts.id - Payment id (prismaPaymentId)
|
|
295
302
|
* @param {Object} opts.prismaPayment - Prisma payment payload
|
|
303
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId, validatePayment)
|
|
296
304
|
* @param {Object} [opts.headers] - Optional headers
|
|
297
305
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
298
306
|
*/
|
|
@@ -320,11 +328,12 @@ function prismaTerminalsFactory(_ref) {
|
|
|
320
328
|
|
|
321
329
|
var settlements = {
|
|
322
330
|
/**
|
|
323
|
-
* POST /prisma-terminals/settlements - create settlement.
|
|
331
|
+
* POST /prisma-terminals/settlements - create settlement.
|
|
324
332
|
* @param {Object} opts
|
|
325
333
|
* @param {string} [opts.token] - API key
|
|
326
334
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
327
335
|
* @param {Object} opts.settlement - Settlement payload
|
|
336
|
+
* @param {PrismaTerminalsQuery} [opts.query] - Query params (providerId)
|
|
328
337
|
* @param {Object} [opts.headers] - Optional headers
|
|
329
338
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
330
339
|
*/
|
|
@@ -23,14 +23,14 @@ function referencedPaymentsFactory(_ref) {
|
|
|
23
23
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* GET /referenced-payments/:transactionId/:referenceNumber/status - get status.
|
|
26
|
+
* GET /referenced-payments/:transactionId/:referenceNumber/status - get referenced payment status. Requires backoffice auth. Response body: { paymentResult: { status, result } | null }.
|
|
27
27
|
* @param {Object} opts
|
|
28
28
|
* @param {string} [opts.token] - API key
|
|
29
29
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
30
|
-
* @param {string} opts.transactionId - Transaction
|
|
31
|
-
* @param {string} opts.referenceNumber - Reference number
|
|
30
|
+
* @param {string} opts.transactionId - Transaction ID
|
|
31
|
+
* @param {string} opts.referenceNumber - Reference number of the payment
|
|
32
32
|
* @param {Object} [opts.headers] - Optional headers
|
|
33
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
33
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentResult: { status: "error"|"pending"|"success"|"review", result: object } | null }>>}
|
|
34
34
|
*/
|
|
35
35
|
function getStatus(_ref2) {
|
|
36
36
|
var token = _ref2.token,
|
|
@@ -4,7 +4,7 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Factory for Square webhooks API (btrz-api-payments).
|
|
7
|
+
* Factory for Square webhooks API (btrz-api-payments). Used to forward or simulate Square webhook requests to the Payments API.
|
|
8
8
|
* @param {Object} deps
|
|
9
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
10
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -17,14 +17,14 @@ function squareWebhooksFactory(_ref) {
|
|
|
17
17
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* POST /square-webhooks/:providerId -
|
|
20
|
+
* POST /square-webhooks/:providerId - send Square webhook payload to the Payments API. API verifies x-square-signature when present. Body must include type and data (Square webhook format).
|
|
21
21
|
* @param {Object} opts
|
|
22
22
|
* @param {string} [opts.token] - API key
|
|
23
23
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
24
|
-
* @param {string} opts.providerId - Provider
|
|
25
|
-
* @param {Object} opts.data - Request body
|
|
26
|
-
* @param {Object} [opts.headers] - Optional headers
|
|
27
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
24
|
+
* @param {string} opts.providerId - Provider ID (square_terminal payment method owner)
|
|
25
|
+
* @param {Object} opts.data - Request body (Square webhook payload: type, data required; optional merchant_id, event_id, created_at)
|
|
26
|
+
* @param {Object} [opts.headers] - Optional headers (e.g. x-square-signature for verification)
|
|
27
|
+
* @returns {Promise<import("axios").AxiosResponse<{ status: "OK" }>>}
|
|
28
28
|
*/
|
|
29
29
|
function create(_ref2) {
|
|
30
30
|
var token = _ref2.token,
|
|
@@ -58,12 +58,12 @@ function squareTerminalsFactory(_ref3) {
|
|
|
58
58
|
internalAuthTokenProvider = _ref3.internalAuthTokenProvider;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* GET /square-terminals -
|
|
61
|
+
* GET /square-terminals - list Square terminals for the account. Requires JWT (BETTEREZ_APP or MOBILE_SCANNER). Response body: { terminals } with terminal objects (id, name, code, deviceId, productType, locationId, status, pairBy, createdAt, statusChangedAt).
|
|
62
62
|
* @param {Object} opts
|
|
63
63
|
* @param {string} [opts.token] - API key
|
|
64
64
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
65
65
|
* @param {Object} [opts.headers] - Optional headers
|
|
66
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
66
|
+
* @returns {Promise<import("axios").AxiosResponse<{ terminals: Array<{ id: string, name: string, code: string, deviceId?: string, productType?: string, locationId: string, status?: string, pairBy?: string, createdAt?: string, statusChangedAt?: string }> }>>}
|
|
67
67
|
*/
|
|
68
68
|
function get(_ref4) {
|
|
69
69
|
var token = _ref4.token,
|
|
@@ -6,7 +6,15 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
6
6
|
/**
|
|
7
7
|
* Query params for GET /stripe-terminals (btrz-api-payments). See get-handler getSpec().
|
|
8
8
|
* @typedef {Object} StripeTerminalsListQuery
|
|
9
|
-
* @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers
|
|
9
|
+
* @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers; when omitted, authenticated account ID is used
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Response for GET /stripe-terminals. Paginated list of Stripe readers.
|
|
14
|
+
* @typedef {Object} GetStripeTerminalsResponse
|
|
15
|
+
* @property {Object[]} stripeTerminals - Stripe Terminal reader objects (id, label, serial_number, status, etc.)
|
|
16
|
+
* @property {string} next - Next page link; empty if no next page
|
|
17
|
+
* @property {string} previous - Previous page link; empty if no previous page
|
|
10
18
|
*/
|
|
11
19
|
|
|
12
20
|
/**
|
|
@@ -23,13 +31,13 @@ function stripeTerminalsFactory(_ref) {
|
|
|
23
31
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
24
32
|
|
|
25
33
|
/**
|
|
26
|
-
* GET /stripe-terminals - list Stripe
|
|
34
|
+
* GET /stripe-terminals - list Stripe Terminal readers for the account (paginated).
|
|
27
35
|
* @param {Object} opts
|
|
28
36
|
* @param {string} [opts.token] - API key
|
|
29
37
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
30
|
-
* @param {StripeTerminalsListQuery} [opts.query] -
|
|
38
|
+
* @param {StripeTerminalsListQuery} [opts.query] - Optional providerId
|
|
31
39
|
* @param {Object} [opts.headers] - Optional headers
|
|
32
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
40
|
+
* @returns {Promise<import("axios").AxiosResponse<GetStripeTerminalsResponse>>} Rejects with 400 (STRIPE_SECRET_KEY_INVALID), 401, 404 (PAYMENT_METHOD_NOT_FOUND), 500.
|
|
33
41
|
*/
|
|
34
42
|
function all(_ref2) {
|
|
35
43
|
var token = _ref2.token,
|
|
@@ -47,29 +55,26 @@ function stripeTerminalsFactory(_ref) {
|
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
/**
|
|
50
|
-
* POST /stripe-terminals/:
|
|
58
|
+
* POST /stripe-terminals/:terminalId/simulate - simulate a payment on a Stripe Terminal reader. API does not accept query params.
|
|
51
59
|
* @param {Object} opts
|
|
52
60
|
* @param {string} [opts.token] - API key
|
|
53
61
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
54
|
-
* @param {string} opts.id - Terminal id
|
|
55
|
-
* @param {
|
|
62
|
+
* @param {string} opts.id - Terminal ID (Stripe reader id, e.g. tmr_xxx)
|
|
63
|
+
* @param {{ ccNumber: string }} opts.stripePayment - Payment to simulate; ccNumber required
|
|
56
64
|
* @param {Object} [opts.headers] - Optional headers
|
|
57
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
65
|
+
* @returns {Promise<import("axios").AxiosResponse<{ stripeTerminalPayment: Object }>>} Rejects with 400 (WRONG_DATA), 401, 404 (PAYMENT_METHOD_NOT_FOUND, TRANSACTION_NOT_FOUND), 409 (errorCode/errorMessage), 500.
|
|
58
66
|
*/
|
|
59
67
|
function simulate(_ref3) {
|
|
60
68
|
var token = _ref3.token,
|
|
61
69
|
jwtToken = _ref3.jwtToken,
|
|
62
70
|
id = _ref3.id,
|
|
63
71
|
stripePayment = _ref3.stripePayment,
|
|
64
|
-
_ref3$query = _ref3.query,
|
|
65
|
-
query = _ref3$query === undefined ? {} : _ref3$query,
|
|
66
72
|
headers = _ref3.headers;
|
|
67
73
|
|
|
68
74
|
return client({
|
|
69
75
|
url: "/stripe-terminals/" + id + "/simulate",
|
|
70
76
|
method: "post",
|
|
71
77
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
72
|
-
params: query,
|
|
73
78
|
data: { stripePayment: stripePayment }
|
|
74
79
|
});
|
|
75
80
|
}
|