@enfuce/nextgen-sdk 0.0.10 → 0.0.11
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/README.md +25 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ OAuth2 `client_credentials` bearer token:
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { oauth, card, config } from '@enfuce/nextgen-sdk';
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
const te = { tenant: '<tenant>', environment: '
|
|
22
|
+
// Set the tenant + environment once; the config helper derives every base URL (and the token URL) from it.
|
|
23
|
+
const te = { tenant: '<tenant>', environment: '<environment>' };
|
|
24
24
|
|
|
25
25
|
// One token manager (cached client-credentials grant) — reuse it across every module.
|
|
26
26
|
const clientCredentialsManager = oauth.clientCredentials({
|
|
@@ -39,10 +39,10 @@ const client = card.CardClient.builder()
|
|
|
39
39
|
const { data } = await client.getCardApi().getCard(cardId, 'you@example.com');
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
`environment` is the target platform — e.g. `ext-uat1-sandbox` (sandbox) or `eu.live.prod`
|
|
43
|
+
(production). One `clientCredentialsManager` authenticates every module, so build it once and reuse it
|
|
44
|
+
across all your clients. See [Client customization](#client-customization) for transport tuning
|
|
45
|
+
(timeouts, proxy, interceptors).
|
|
46
46
|
|
|
47
47
|
Keeping the token URL separate from the client identity? Pass a `ClientCredentials` — e.g. with the
|
|
48
48
|
`config` helper deriving the URL:
|
|
@@ -110,12 +110,12 @@ const client = card.CardClient.builder()
|
|
|
110
110
|
|
|
111
111
|
## API modules
|
|
112
112
|
|
|
113
|
-
Each module builds the same way —
|
|
113
|
+
Each module builds the same way — set its base URL with the matching accessor
|
|
114
114
|
(`config.issuerBaseUrl`, `config.processorBaseUrl`, or `config.exchangeRateBaseUrl`) and reuse the
|
|
115
|
-
shared `clientCredentialsManager`. Every call resolves to an axios response, so read `.data`.
|
|
116
|
-
|
|
115
|
+
shared `clientCredentialsManager`. Every call resolves to an axios response, so read `.data`.
|
|
116
|
+
Snippets assume `te` and `clientCredentialsManager` are in scope.
|
|
117
117
|
|
|
118
|
-
### `cardholder` —
|
|
118
|
+
### `cardholder` — `issuerBaseUrl`
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
121
|
import { cardholder, config } from '@enfuce/nextgen-sdk';
|
|
@@ -127,7 +127,7 @@ const { data: cards } = await client.getCardsByCardholderIdApi()
|
|
|
127
127
|
.getCardsByCardholderId(cardholderId, undefined, undefined, 'you@example.com');
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
### `card` —
|
|
130
|
+
### `card` — `issuerBaseUrl`
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
133
|
import { card, config } from '@enfuce/nextgen-sdk';
|
|
@@ -138,7 +138,7 @@ const { data } = await client.getCardApi().getCard(cardId, 'you@example.com');
|
|
|
138
138
|
await client.updateCardApi().activateCard(cardId, undefined, 'you@example.com'); // (id, idempotencyKey, auditUser)
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
### `wallet` —
|
|
141
|
+
### `wallet` — `issuerBaseUrl`
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
import { wallet, config } from '@enfuce/nextgen-sdk';
|
|
@@ -148,7 +148,7 @@ const client = wallet.WalletClient.builder().baseUrl(config.issuerBaseUrl(te)).o
|
|
|
148
148
|
const { data: tokens } = await client.getTokensApi().getTokens(cardId, false, undefined, 'you@example.com');
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
### `pin` —
|
|
151
|
+
### `pin` — `issuerBaseUrl`
|
|
152
152
|
|
|
153
153
|
```typescript
|
|
154
154
|
import { pin, config } from '@enfuce/nextgen-sdk';
|
|
@@ -158,7 +158,7 @@ const client = pin.PinClient.builder().baseUrl(config.issuerBaseUrl(te)).oauth(c
|
|
|
158
158
|
const { data } = await client.pINOperationsUsingPKIApi().viewPin(viewPinRequestBody, 'you@example.com');
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
### `exchangeRate` —
|
|
161
|
+
### `exchangeRate` — `exchangeRateBaseUrl`
|
|
162
162
|
|
|
163
163
|
```typescript
|
|
164
164
|
import { exchangeRate, config } from '@enfuce/nextgen-sdk';
|
|
@@ -169,7 +169,7 @@ const { data: currencies } = await client.getECBSupportedCurrenciesApi().getEcbS
|
|
|
169
169
|
const { data: rate } = await client.getECBExchangeRateApi().getEcbRateV1('EUR', 'USD');
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
### `threeds` —
|
|
172
|
+
### `threeds` — `processorBaseUrl`
|
|
173
173
|
|
|
174
174
|
```typescript
|
|
175
175
|
import { threeds, config } from '@enfuce/nextgen-sdk';
|
|
@@ -179,7 +179,7 @@ const client = threeds.ThreedsClient.builder().baseUrl(config.processorBaseUrl(t
|
|
|
179
179
|
await client.threeDSApi().handleAuthenticationChallengeResult(challengeResultBody);
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
### `cards` —
|
|
182
|
+
### `cards` — `processorBaseUrl`
|
|
183
183
|
|
|
184
184
|
```typescript
|
|
185
185
|
import { cards, config } from '@enfuce/nextgen-sdk';
|
|
@@ -189,11 +189,11 @@ const client = cards.CardsClient.builder().baseUrl(config.processorBaseUrl(te)).
|
|
|
189
189
|
await client.cardsApi().resetPinCounter(cardId, sequenceNumber);
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
## Webhooks
|
|
192
|
+
## Webhooks
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
These are the calls Enfuce makes **to you**: you host the endpoint and Enfuce POSTs to it. Such
|
|
195
|
+
modules export only the payload types — there is no client to call, since your app receives these
|
|
196
|
+
rather than requesting them. Use the types to type the inbound request body:
|
|
197
197
|
|
|
198
198
|
```typescript
|
|
199
199
|
import type { issuerEvents } from '@enfuce/nextgen-sdk';
|
|
@@ -222,13 +222,13 @@ const decision: authorisationControl.AuthResponseBody = {
|
|
|
222
222
|
| `transactionEvent` | `TransactionEvent` |
|
|
223
223
|
|
|
224
224
|
> A runnable Express example of all of the above (both the API modules and the webhook receivers)
|
|
225
|
-
> lives in [`examples/backends/typescript`](
|
|
225
|
+
> lives in [`examples/backends/typescript`](https://gitlab.com/enfuce/mycore/client-sdks/-/tree/master/examples/backends/typescript).
|
|
226
226
|
|
|
227
|
-
## File
|
|
227
|
+
## File parsing
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
`
|
|
229
|
+
Enfuce delivers some data as a **file** rather than an HTTP API. These modules export only the
|
|
230
|
+
types — parse the file's JSON into them. `clearingFileCopy` is a clearing (settlement) file: a
|
|
231
|
+
`FileData` header plus a list of records.
|
|
232
232
|
|
|
233
233
|
```typescript
|
|
234
234
|
import type { clearingFileCopy } from '@enfuce/nextgen-sdk';
|