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
package/lib/client.js
CHANGED
|
@@ -98,6 +98,7 @@ function createInventory(_ref) {
|
|
|
98
98
|
getnetTerminals: require("./endpoints/inventory/getnet-terminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
99
99
|
giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
100
100
|
healthCheck: require("./endpoints/inventory/healthcheck.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
101
|
+
holidays: require("./endpoints/inventory/holidays.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
101
102
|
insurances: require("./endpoints/inventory/insurances.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
102
103
|
insurancesCost: require("./endpoints/inventory/insurancesCost.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
103
104
|
items: require("./endpoints/inventory/items.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -147,9 +148,9 @@ function createInventory(_ref) {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
/**
|
|
150
|
-
* Creates the trips API client (trips, segmentsInformationTables). Uses inventory base path.
|
|
151
|
+
* Creates the trips API client (trips, tripIds, segmentsInformationTables). Uses inventory base path.
|
|
151
152
|
* @param {CreateModuleOptions} opts - Client options
|
|
152
|
-
* @returns {Object} Object with trips
|
|
153
|
+
* @returns {Object} Object with trips, tripIds, segmentsInformationTables endpoint namespaces and __test_trips.client
|
|
153
154
|
*/
|
|
154
155
|
function createTrips(_ref2) {
|
|
155
156
|
var baseURL = _ref2.baseURL,
|
|
@@ -163,6 +164,7 @@ function createTrips(_ref2) {
|
|
|
163
164
|
|
|
164
165
|
return {
|
|
165
166
|
trips: require("./endpoints/inventory/trips.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
167
|
+
tripIds: require("./endpoints/inventory/trip-ids.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
166
168
|
segmentsInformationTables: require("./endpoints/inventory/segments-information-tables.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
167
169
|
__test_trips: {
|
|
168
170
|
client: client
|
|
@@ -340,11 +342,13 @@ function createOperations(_ref6) {
|
|
|
340
342
|
calendarEntries: require("./endpoints/operations/calendar_entries.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
341
343
|
externalBookings: require("./endpoints/operations/external-bookings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
342
344
|
flexpasses: require("./endpoints/operations/flexpasses.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
345
|
+
giftCertificates: require("./endpoints/operations/gift-certificates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
343
346
|
loans: require("./endpoints/operations/loans.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
344
347
|
manifest: require("./endpoints/operations/manifest.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
345
348
|
manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
346
349
|
movements: require("./endpoints/operations/movements.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
347
350
|
outlookTrips: require("./endpoints/operations/outlook-trips.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
351
|
+
pagoExpress: require("./endpoints/operations/pago-express.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
348
352
|
parcel: require("./endpoints/operations/parcels.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
349
353
|
parcelManifests: require("./endpoints/operations/parcels_manifests.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
350
354
|
passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -417,6 +421,7 @@ function createNotifications(_ref8) {
|
|
|
417
421
|
pdfData: require("./endpoints/notifications/pdf-data.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
418
422
|
email: require("./endpoints/notifications/email.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
419
423
|
customers: require("./endpoints/notifications/customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
424
|
+
externalCustomers: require("./endpoints/notifications/external-customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
420
425
|
twilio: require("./endpoints/notifications/twilio.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
421
426
|
salesforce: require("./endpoints/notifications/salesforce.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
422
427
|
notify: require("./endpoints/notifications/notify.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -541,6 +546,8 @@ function createBtrzPay(_ref13) {
|
|
|
541
546
|
var client = clientFactory({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: overrideFn, agents: agents });
|
|
542
547
|
|
|
543
548
|
return {
|
|
549
|
+
adyen: require("./endpoints/btrzpay/adyen.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
550
|
+
cybersource3ds: require("./endpoints/btrzpay/cybersource3ds.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
544
551
|
docs: require("./endpoints/btrzpay/docs.js")({ client: client }),
|
|
545
552
|
cardpointeTerminals: require("./endpoints/btrzpay/cardpointe.js").cardpointeTerminalsFactory({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
546
553
|
paymentMethods: require("./endpoints/btrzpay/payment-methods.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -556,6 +563,7 @@ function createBtrzPay(_ref13) {
|
|
|
556
563
|
prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
557
564
|
terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
558
565
|
stripeTerminals: require("./endpoints/btrzpay/stripe-terminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
566
|
+
stripe3ds: require("./endpoints/btrzpay/stripe3ds.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
559
567
|
__test: {
|
|
560
568
|
client: client
|
|
561
569
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
/* eslint-disable import/extensions */
|
|
5
|
+
var _require = require("../endpoints_helpers.js"),
|
|
6
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Query params for GET /adyen-payment-methods (btrz-api-payments). See getAdyenPaymentMethods getSpec().
|
|
10
|
+
* @typedef {Object} AdyenPaymentMethodsQuery
|
|
11
|
+
* @property {string} [countryCode] - Two-letter ISO country code to filter allowed payment methods
|
|
12
|
+
* @property {string} [currencyCode] - Three-letter ISO currency code to filter allowed payment methods
|
|
13
|
+
* @property {number} [amount] - Amount used to determine allowed payment methods
|
|
14
|
+
* @property {string} [transactionId] - Transaction identifier for the payment session
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Factory for Adyen API (btrz-api-payments).
|
|
19
|
+
* @param {Object} deps
|
|
20
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
21
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
22
|
+
* @returns {{ getPaymentMethods: function }}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function adyenFactory(_ref) {
|
|
27
|
+
var client = _ref.client,
|
|
28
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* GET /adyen-payment-methods - returns allowed Adyen payment methods for the account.
|
|
32
|
+
* @param {Object} opts
|
|
33
|
+
* @param {string} [opts.token] - API key
|
|
34
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
35
|
+
* @param {AdyenPaymentMethodsQuery} [opts.query] - Query params (countryCode, currencyCode, amount, transactionId)
|
|
36
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
37
|
+
* @returns {Promise<import("axios").AxiosResponse<{ AdyenPaymentMethods: Array<{ name: string, type: string, brands?: string[] }> }>>}
|
|
38
|
+
* Resolves with GetAdyenPaymentMethodsResponse. Rejects with 400 (INVALID_*), 404 (ADYEN_PAYMENT_METHODS_NOT_FOUND, PROVIDER_NOT_FOUND, PAYMENT_METHOD_NOT_FOUND).
|
|
39
|
+
*/
|
|
40
|
+
function getPaymentMethods(_ref2) {
|
|
41
|
+
var token = _ref2.token,
|
|
42
|
+
jwtToken = _ref2.jwtToken,
|
|
43
|
+
_ref2$query = _ref2.query,
|
|
44
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
45
|
+
headers = _ref2.headers;
|
|
46
|
+
|
|
47
|
+
return client.get("/adyen-payment-methods", {
|
|
48
|
+
params: query,
|
|
49
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
getPaymentMethods: getPaymentMethods
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = adyenFactory;
|
|
@@ -67,7 +67,7 @@ function cardpointeTerminalsFactory(_ref) {
|
|
|
67
67
|
* @param {Object} opts
|
|
68
68
|
* @param {string} [opts.token] - API key
|
|
69
69
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
70
|
-
* @param {string} opts.readCardResultId - Read card result id
|
|
70
|
+
* @param {string} opts.readCardResultId - Read card result id (UUID v4)
|
|
71
71
|
* @param {Object} [opts.headers] - Optional headers
|
|
72
72
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
73
73
|
*/
|
|
@@ -84,11 +84,12 @@ function cardpointeTerminalsFactory(_ref) {
|
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* POST /cardpointe-terminals/read-card -
|
|
87
|
+
* POST /cardpointe-terminals/read-card - start read card session. API accepts optional query providerId.
|
|
88
88
|
* @param {Object} opts
|
|
89
89
|
* @param {string} [opts.token] - API key
|
|
90
90
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
91
|
-
* @param {Object} opts.readCard - Read card payload
|
|
91
|
+
* @param {Object} opts.readCard - Read card payload (merchantId, terminalId, amount)
|
|
92
|
+
* @param {string} [opts.providerId] - Provider (payment method) ID; if omitted, account ID is used
|
|
92
93
|
* @param {Object} [opts.headers] - Optional headers
|
|
93
94
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
94
95
|
*/
|
|
@@ -97,11 +98,13 @@ function cardpointeTerminalsFactory(_ref) {
|
|
|
97
98
|
var token = _ref5.token,
|
|
98
99
|
jwtToken = _ref5.jwtToken,
|
|
99
100
|
readCard = _ref5.readCard,
|
|
101
|
+
providerId = _ref5.providerId,
|
|
100
102
|
headers = _ref5.headers;
|
|
101
103
|
|
|
102
104
|
return client({
|
|
103
105
|
url: "/cardpointe-terminals/read-card",
|
|
104
106
|
method: "post",
|
|
107
|
+
params: providerId != null ? { providerId: providerId } : {},
|
|
105
108
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
106
109
|
data: { readCard: readCard }
|
|
107
110
|
});
|
|
@@ -17,15 +17,15 @@ function customerCardsFactory(_ref) {
|
|
|
17
17
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* GET
|
|
20
|
+
* GET .../cards/:customerCardId - get one card by id. No query params.
|
|
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.paymentMethodId - Payment method
|
|
25
|
-
* @param {string} opts.customerId - Customer
|
|
26
|
-
* @param {string} opts.customerCardId -
|
|
24
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
25
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
26
|
+
* @param {string} opts.customerCardId - Card ID (UUID v4)
|
|
27
27
|
* @param {Object} [opts.headers] - Optional headers
|
|
28
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
28
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customerCard: Object }>>}
|
|
29
29
|
*/
|
|
30
30
|
function get(_ref2) {
|
|
31
31
|
var token = _ref2.token,
|
|
@@ -42,14 +42,14 @@ function customerCardsFactory(_ref) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* GET
|
|
45
|
+
* GET .../cards - list all cards for customer. No query params.
|
|
46
46
|
* @param {Object} opts
|
|
47
47
|
* @param {string} [opts.token] - API key
|
|
48
48
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
49
|
-
* @param {string} opts.paymentMethodId - Payment method
|
|
50
|
-
* @param {string} opts.customerId - Customer
|
|
49
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
50
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
51
51
|
* @param {Object} [opts.headers] - Optional headers
|
|
52
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
52
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customerCards: Array<Object> }>>}
|
|
53
53
|
*/
|
|
54
54
|
function all(_ref3) {
|
|
55
55
|
var token = _ref3.token,
|
|
@@ -65,15 +65,15 @@ function customerCardsFactory(_ref) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* POST
|
|
68
|
+
* POST .../cards - create stored card. Body: { customerCard }. No query params.
|
|
69
69
|
* @param {Object} opts
|
|
70
70
|
* @param {string} [opts.token] - API key
|
|
71
71
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
72
|
-
* @param {string} opts.paymentMethodId - Payment method
|
|
73
|
-
* @param {string} opts.customerId - Customer
|
|
74
|
-
* @param {Object} opts.customerCard -
|
|
72
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
73
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
74
|
+
* @param {Object} opts.customerCard - Card payload (see PostCustomerCardRequest)
|
|
75
75
|
* @param {Object} [opts.headers] - Optional headers
|
|
76
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
76
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customerCard: Object }>>}
|
|
77
77
|
*/
|
|
78
78
|
function create(_ref4) {
|
|
79
79
|
var token = _ref4.token,
|
|
@@ -92,15 +92,15 @@ function customerCardsFactory(_ref) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* DELETE
|
|
95
|
+
* DELETE .../cards/:customerCardId - remove stored card. No query params.
|
|
96
96
|
* @param {Object} opts
|
|
97
97
|
* @param {string} [opts.token] - API key
|
|
98
98
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
99
|
-
* @param {string} opts.paymentMethodId - Payment method
|
|
100
|
-
* @param {string} opts.customerId - Customer
|
|
101
|
-
* @param {string} opts.customerCardId -
|
|
99
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
100
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
101
|
+
* @param {string} opts.customerCardId - Card ID (UUID v4)
|
|
102
102
|
* @param {Object} [opts.headers] - Optional headers
|
|
103
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
103
|
+
* @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
|
|
104
104
|
*/
|
|
105
105
|
function remove(_ref5) {
|
|
106
106
|
var token = _ref5.token,
|
|
@@ -4,7 +4,7 @@ var _require = require("../endpoints_helpers.js"),
|
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Factory for payment-method customers API (btrz-api-payments).
|
|
7
|
+
* Factory for payment-method customers API (btrz-api-payments). Path: payment-methods/{id}/customers.
|
|
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 customersFactory(_ref) {
|
|
|
17
17
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* GET
|
|
20
|
+
* GET .../customers/:customerId - get customer. No query params.
|
|
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.paymentMethodId - Payment method
|
|
25
|
-
* @param {string} opts.customerId - Customer
|
|
24
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
25
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
26
26
|
* @param {Object} [opts.headers] - Optional headers
|
|
27
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
27
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customer: Object }>>}
|
|
28
28
|
*/
|
|
29
29
|
function get(_ref2) {
|
|
30
30
|
var token = _ref2.token,
|
|
@@ -40,14 +40,14 @@ function customersFactory(_ref) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* POST
|
|
43
|
+
* POST .../customers - create customer. Body: { customer } (PostCustomerRequest: channel, customer.id/number/email). No query params.
|
|
44
44
|
* @param {Object} opts
|
|
45
45
|
* @param {string} [opts.token] - API key
|
|
46
46
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
47
|
-
* @param {string} opts.paymentMethodId - Payment method
|
|
48
|
-
* @param {Object} opts.customer -
|
|
47
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
48
|
+
* @param {Object} opts.customer - PostCustomerRequest (channel, customer with id, number, email)
|
|
49
49
|
* @param {Object} [opts.headers] - Optional headers
|
|
50
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
50
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customer: Object }>>}
|
|
51
51
|
*/
|
|
52
52
|
function create(_ref3) {
|
|
53
53
|
var token = _ref3.token,
|
|
@@ -65,14 +65,14 @@ function customersFactory(_ref) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* DELETE
|
|
68
|
+
* DELETE .../customers/:customerId - remove customer (and saved cards). No query params.
|
|
69
69
|
* @param {Object} opts
|
|
70
70
|
* @param {string} [opts.token] - API key
|
|
71
71
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
72
|
-
* @param {string} opts.paymentMethodId - Payment method
|
|
73
|
-
* @param {string} opts.customerId - Customer
|
|
72
|
+
* @param {string} opts.paymentMethodId - Payment method ID (UUID v4)
|
|
73
|
+
* @param {string} opts.customerId - Customer ID (object ID)
|
|
74
74
|
* @param {Object} [opts.headers] - Optional headers
|
|
75
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
75
|
+
* @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
|
|
76
76
|
*/
|
|
77
77
|
function remove(_ref4) {
|
|
78
78
|
var token = _ref4.token,
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
var _require = require("../endpoints_helpers.js"),
|
|
5
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Query params for GET /cbs-token (btrz-api-payments). See getSpec() in get-token-handler.
|
|
9
|
+
* @typedef {Object} Cybersource3dsTokenQuery
|
|
10
|
+
* @property {string} transactionId - Transaction ID for which to create the 3DS token (required). ObjectId format.
|
|
11
|
+
* @property {string} [operatingCompanyId] - Operating company ID when Cybersource uses overrides by operating company. ObjectId format.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Request body for POST /cbs-evaluate-risk. RiskEvaluationPostData.
|
|
16
|
+
* @typedef {Object} RiskEvaluationPostData
|
|
17
|
+
* @property {Object} paymentData - Payment information (required)
|
|
18
|
+
* @property {Object} [cartPayload] - Cart information (CartData)
|
|
19
|
+
* @property {string} [operatingCompanyId] - Operating company ID
|
|
20
|
+
* @property {string} [providerName] - Provider name (e.g. "cybersource")
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Request body for POST /cbs-pa-enrollment. PayerAuthenticationPostData.
|
|
25
|
+
* @typedef {Object} PayerAuthenticationPostData
|
|
26
|
+
* @property {Object} paymentData - Payment information (required)
|
|
27
|
+
* @property {string} [operatingCompanyId] - Operating company ID
|
|
28
|
+
* @property {string} [providerName] - Provider name (e.g. "cybersource")
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Request body for POST /cbs-validate-pa-enrollment. ValidateAuthenticationPostData.
|
|
33
|
+
* @typedef {Object} ValidateAuthenticationPostData
|
|
34
|
+
* @property {Object} paymentData - Payment information (required)
|
|
35
|
+
* @property {string} processorTransactionId - Processor transaction ID from payer authentication enrollment (required)
|
|
36
|
+
* @property {string} [operatingCompanyId] - Operating company ID
|
|
37
|
+
* @property {string} [providerName] - Provider name (e.g. "cybersource")
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Factory for Cybersource 3DS API (btrz-api-payments): Cardinal/Cybersource token, evaluate risk, payer auth enrollment, validate enrollment.
|
|
42
|
+
* @param {Object} deps
|
|
43
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
44
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
45
|
+
* @returns {{ getToken: function, evaluateRisk: function, payerAuthenticationEnrollment: function, validatePayerAuthenticationEnrollment: function }}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function cybersource3dsFactory(_ref) {
|
|
50
|
+
var client = _ref.client,
|
|
51
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* GET /cbs-token - returns JWT to use with Cardinal (3DS).
|
|
55
|
+
* @param {Object} opts
|
|
56
|
+
* @param {string} [opts.token] - API key
|
|
57
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
58
|
+
* @param {Cybersource3dsTokenQuery} opts.query - transactionId (required), optional operatingCompanyId
|
|
59
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
60
|
+
* @returns {Promise<import("axios").AxiosResponse<{ token: string }>>} ThreeDSTokenResponse. Rejects with 400 (WRONG_DATA, INVALID_TRANSACTION_ID, PROVIDER_NOT_FOUND, PAYMENT_METHOD_NOT_FOUND), 401, 500.
|
|
61
|
+
*/
|
|
62
|
+
function getToken(_ref2) {
|
|
63
|
+
var token = _ref2.token,
|
|
64
|
+
jwtToken = _ref2.jwtToken,
|
|
65
|
+
query = _ref2.query,
|
|
66
|
+
headers = _ref2.headers;
|
|
67
|
+
|
|
68
|
+
return client.get("/cbs-token", {
|
|
69
|
+
params: query,
|
|
70
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* POST /cbs-evaluate-risk - evaluate fraud risk (Decision Manager).
|
|
76
|
+
* @param {Object} opts
|
|
77
|
+
* @param {string} [opts.token] - API key
|
|
78
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
79
|
+
* @param {RiskEvaluationPostData} opts.riskEvaluation - paymentData (required), optional cartPayload, operatingCompanyId
|
|
80
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
81
|
+
* @returns {Promise<import("axios").AxiosResponse<RiskEvaluationResponse>>} RiskEvaluationResponse. Rejects with 400 (EVAL_RISK_*), 401, 409 (CYBERSOURCE_AUTH_FAILED), 500.
|
|
82
|
+
*/
|
|
83
|
+
function evaluateRisk(_ref3) {
|
|
84
|
+
var token = _ref3.token,
|
|
85
|
+
jwtToken = _ref3.jwtToken,
|
|
86
|
+
riskEvaluation = _ref3.riskEvaluation,
|
|
87
|
+
headers = _ref3.headers;
|
|
88
|
+
|
|
89
|
+
return client.post("/cbs-evaluate-risk", riskEvaluation, {
|
|
90
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* POST /cbs-pa-enrollment - check payer authentication enrollment.
|
|
96
|
+
* @param {Object} opts
|
|
97
|
+
* @param {string} [opts.token] - API key
|
|
98
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
99
|
+
* @param {PayerAuthenticationPostData} opts.body - paymentData (required), optional operatingCompanyId
|
|
100
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
101
|
+
* @returns {Promise<import("axios").AxiosResponse<PAEnrollmentResponse>>} PAEnrollmentResponse. Rejects with 400 (PAENROLL_*, PROVIDER_NOT_FOUND, PAYMENT_METHOD_NOT_FOUND), 401, 500.
|
|
102
|
+
*/
|
|
103
|
+
function payerAuthenticationEnrollment(_ref4) {
|
|
104
|
+
var token = _ref4.token,
|
|
105
|
+
jwtToken = _ref4.jwtToken,
|
|
106
|
+
body = _ref4.body,
|
|
107
|
+
headers = _ref4.headers;
|
|
108
|
+
|
|
109
|
+
return client.post("/cbs-pa-enrollment", body, {
|
|
110
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* POST /cbs-validate-pa-enrollment - validate payer authentication challenge response.
|
|
116
|
+
* @param {Object} opts
|
|
117
|
+
* @param {string} [opts.token] - API key
|
|
118
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
119
|
+
* @param {ValidateAuthenticationPostData} opts.body - paymentData and processorTransactionId (required)
|
|
120
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
121
|
+
* @returns {Promise<import("axios").AxiosResponse<ValidatePAEnrollmentResponse>>} ValidatePAEnrollmentResponse. Rejects with 400 (VALIDATE_PAENROLL_*), 401, 500.
|
|
122
|
+
*/
|
|
123
|
+
function validatePayerAuthenticationEnrollment(_ref5) {
|
|
124
|
+
var token = _ref5.token,
|
|
125
|
+
jwtToken = _ref5.jwtToken,
|
|
126
|
+
body = _ref5.body,
|
|
127
|
+
headers = _ref5.headers;
|
|
128
|
+
|
|
129
|
+
return client.post("/cbs-validate-pa-enrollment", body, {
|
|
130
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
getToken: getToken,
|
|
136
|
+
evaluateRisk: evaluateRisk,
|
|
137
|
+
payerAuthenticationEnrollment: payerAuthenticationEnrollment,
|
|
138
|
+
validatePayerAuthenticationEnrollment: validatePayerAuthenticationEnrollment
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
module.exports = cybersource3dsFactory;
|