@enfuce/nextgen-sdk 0.0.1
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/dist/authorisation-control/api.d.ts +771 -0
- package/dist/authorisation-control/api.js +240 -0
- package/dist/authorisation-control/base.d.ts +66 -0
- package/dist/authorisation-control/base.js +65 -0
- package/dist/authorisation-control/common.d.ts +65 -0
- package/dist/authorisation-control/common.js +161 -0
- package/dist/authorisation-control/configuration.d.ts +91 -0
- package/dist/authorisation-control/configuration.js +44 -0
- package/dist/authorisation-control/index.d.ts +13 -0
- package/dist/authorisation-control/index.js +31 -0
- package/dist/card/api.d.ts +2065 -0
- package/dist/card/api.js +1406 -0
- package/dist/card/base.d.ts +66 -0
- package/dist/card/base.js +65 -0
- package/dist/card/common.d.ts +65 -0
- package/dist/card/common.js +161 -0
- package/dist/card/configuration.d.ts +91 -0
- package/dist/card/configuration.js +44 -0
- package/dist/card/index.d.ts +13 -0
- package/dist/card/index.js +31 -0
- package/dist/cardholder/api.d.ts +1890 -0
- package/dist/cardholder/api.js +1239 -0
- package/dist/cardholder/base.d.ts +66 -0
- package/dist/cardholder/base.js +65 -0
- package/dist/cardholder/common.d.ts +65 -0
- package/dist/cardholder/common.js +161 -0
- package/dist/cardholder/configuration.d.ts +91 -0
- package/dist/cardholder/configuration.js +44 -0
- package/dist/cardholder/index.d.ts +13 -0
- package/dist/cardholder/index.js +31 -0
- package/dist/cards/api.d.ts +78 -0
- package/dist/cards/api.js +142 -0
- package/dist/cards/base.d.ts +66 -0
- package/dist/cards/base.js +65 -0
- package/dist/cards/common.d.ts +65 -0
- package/dist/cards/common.js +161 -0
- package/dist/cards/configuration.d.ts +91 -0
- package/dist/cards/configuration.js +44 -0
- package/dist/cards/index.d.ts +13 -0
- package/dist/cards/index.js +31 -0
- package/dist/clearing-file-copy/api.d.ts +1245 -0
- package/dist/clearing-file-copy/api.js +139 -0
- package/dist/clearing-file-copy/base.d.ts +66 -0
- package/dist/clearing-file-copy/base.js +65 -0
- package/dist/clearing-file-copy/common.d.ts +65 -0
- package/dist/clearing-file-copy/common.js +161 -0
- package/dist/clearing-file-copy/configuration.d.ts +91 -0
- package/dist/clearing-file-copy/configuration.js +44 -0
- package/dist/clearing-file-copy/index.d.ts +13 -0
- package/dist/clearing-file-copy/index.js +31 -0
- package/dist/esm/authorisation-control/api.d.ts +771 -0
- package/dist/esm/authorisation-control/api.js +233 -0
- package/dist/esm/authorisation-control/base.d.ts +66 -0
- package/dist/esm/authorisation-control/base.js +60 -0
- package/dist/esm/authorisation-control/common.d.ts +65 -0
- package/dist/esm/authorisation-control/common.js +149 -0
- package/dist/esm/authorisation-control/configuration.d.ts +91 -0
- package/dist/esm/authorisation-control/configuration.js +40 -0
- package/dist/esm/authorisation-control/index.d.ts +13 -0
- package/dist/esm/authorisation-control/index.js +15 -0
- package/dist/esm/card/api.d.ts +2065 -0
- package/dist/esm/card/api.js +1379 -0
- package/dist/esm/card/base.d.ts +66 -0
- package/dist/esm/card/base.js +60 -0
- package/dist/esm/card/common.d.ts +65 -0
- package/dist/esm/card/common.js +149 -0
- package/dist/esm/card/configuration.d.ts +91 -0
- package/dist/esm/card/configuration.js +40 -0
- package/dist/esm/card/index.d.ts +13 -0
- package/dist/esm/card/index.js +15 -0
- package/dist/esm/cardholder/api.d.ts +1890 -0
- package/dist/esm/cardholder/api.js +1220 -0
- package/dist/esm/cardholder/base.d.ts +66 -0
- package/dist/esm/cardholder/base.js +60 -0
- package/dist/esm/cardholder/common.d.ts +65 -0
- package/dist/esm/cardholder/common.js +149 -0
- package/dist/esm/cardholder/configuration.d.ts +91 -0
- package/dist/esm/cardholder/configuration.js +40 -0
- package/dist/esm/cardholder/index.d.ts +13 -0
- package/dist/esm/cardholder/index.js +15 -0
- package/dist/esm/cards/api.d.ts +78 -0
- package/dist/esm/cards/api.js +135 -0
- package/dist/esm/cards/base.d.ts +66 -0
- package/dist/esm/cards/base.js +60 -0
- package/dist/esm/cards/common.d.ts +65 -0
- package/dist/esm/cards/common.js +149 -0
- package/dist/esm/cards/configuration.d.ts +91 -0
- package/dist/esm/cards/configuration.js +40 -0
- package/dist/esm/cards/index.d.ts +13 -0
- package/dist/esm/cards/index.js +15 -0
- package/dist/esm/clearing-file-copy/api.d.ts +1245 -0
- package/dist/esm/clearing-file-copy/api.js +136 -0
- package/dist/esm/clearing-file-copy/base.d.ts +66 -0
- package/dist/esm/clearing-file-copy/base.js +60 -0
- package/dist/esm/clearing-file-copy/common.d.ts +65 -0
- package/dist/esm/clearing-file-copy/common.js +149 -0
- package/dist/esm/clearing-file-copy/configuration.d.ts +91 -0
- package/dist/esm/clearing-file-copy/configuration.js +40 -0
- package/dist/esm/clearing-file-copy/index.d.ts +13 -0
- package/dist/esm/clearing-file-copy/index.js +15 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/issuer-events/api.d.ts +1721 -0
- package/dist/esm/issuer-events/api.js +940 -0
- package/dist/esm/issuer-events/base.d.ts +66 -0
- package/dist/esm/issuer-events/base.js +60 -0
- package/dist/esm/issuer-events/common.d.ts +65 -0
- package/dist/esm/issuer-events/common.js +149 -0
- package/dist/esm/issuer-events/configuration.d.ts +91 -0
- package/dist/esm/issuer-events/configuration.js +40 -0
- package/dist/esm/issuer-events/index.d.ts +13 -0
- package/dist/esm/issuer-events/index.js +15 -0
- package/dist/esm/oauth/axios.d.ts +14 -0
- package/dist/esm/oauth/axios.js +58 -0
- package/dist/esm/oauth/clientCredentials.d.ts +24 -0
- package/dist/esm/oauth/clientCredentials.js +59 -0
- package/dist/esm/oauth/index.d.ts +3 -0
- package/dist/esm/oauth/index.js +24 -0
- package/dist/esm/oauth/tokenManager.d.ts +38 -0
- package/dist/esm/oauth/tokenManager.js +77 -0
- package/dist/esm/pin/api.d.ts +329 -0
- package/dist/esm/pin/api.js +341 -0
- package/dist/esm/pin/base.d.ts +66 -0
- package/dist/esm/pin/base.js +60 -0
- package/dist/esm/pin/common.d.ts +65 -0
- package/dist/esm/pin/common.js +149 -0
- package/dist/esm/pin/configuration.d.ts +91 -0
- package/dist/esm/pin/configuration.js +40 -0
- package/dist/esm/pin/index.d.ts +13 -0
- package/dist/esm/pin/index.js +15 -0
- package/dist/esm/threeds/api.d.ts +104 -0
- package/dist/esm/threeds/api.js +136 -0
- package/dist/esm/threeds/base.d.ts +66 -0
- package/dist/esm/threeds/base.js +60 -0
- package/dist/esm/threeds/common.d.ts +65 -0
- package/dist/esm/threeds/common.js +149 -0
- package/dist/esm/threeds/configuration.d.ts +91 -0
- package/dist/esm/threeds/configuration.js +40 -0
- package/dist/esm/threeds/index.d.ts +13 -0
- package/dist/esm/threeds/index.js +15 -0
- package/dist/esm/threeds-oob/api.d.ts +241 -0
- package/dist/esm/threeds-oob/api.js +141 -0
- package/dist/esm/threeds-oob/base.d.ts +66 -0
- package/dist/esm/threeds-oob/base.js +60 -0
- package/dist/esm/threeds-oob/common.d.ts +65 -0
- package/dist/esm/threeds-oob/common.js +149 -0
- package/dist/esm/threeds-oob/configuration.d.ts +91 -0
- package/dist/esm/threeds-oob/configuration.js +40 -0
- package/dist/esm/threeds-oob/index.d.ts +13 -0
- package/dist/esm/threeds-oob/index.js +15 -0
- package/dist/esm/transaction-event/api.d.ts +1082 -0
- package/dist/esm/transaction-event/api.js +163 -0
- package/dist/esm/transaction-event/base.d.ts +66 -0
- package/dist/esm/transaction-event/base.js +60 -0
- package/dist/esm/transaction-event/common.d.ts +65 -0
- package/dist/esm/transaction-event/common.js +149 -0
- package/dist/esm/transaction-event/configuration.d.ts +91 -0
- package/dist/esm/transaction-event/configuration.js +40 -0
- package/dist/esm/transaction-event/index.d.ts +13 -0
- package/dist/esm/transaction-event/index.js +15 -0
- package/dist/esm/wallet/api.d.ts +1385 -0
- package/dist/esm/wallet/api.js +1342 -0
- package/dist/esm/wallet/base.d.ts +66 -0
- package/dist/esm/wallet/base.js +60 -0
- package/dist/esm/wallet/common.d.ts +65 -0
- package/dist/esm/wallet/common.js +149 -0
- package/dist/esm/wallet/configuration.d.ts +91 -0
- package/dist/esm/wallet/configuration.js +40 -0
- package/dist/esm/wallet/index.d.ts +13 -0
- package/dist/esm/wallet/index.js +15 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +17 -0
- package/dist/issuer-events/api.d.ts +1721 -0
- package/dist/issuer-events/api.js +947 -0
- package/dist/issuer-events/base.d.ts +66 -0
- package/dist/issuer-events/base.js +65 -0
- package/dist/issuer-events/common.d.ts +65 -0
- package/dist/issuer-events/common.js +161 -0
- package/dist/issuer-events/configuration.d.ts +91 -0
- package/dist/issuer-events/configuration.js +44 -0
- package/dist/issuer-events/index.d.ts +13 -0
- package/dist/issuer-events/index.js +31 -0
- package/dist/oauth/axios.d.ts +14 -0
- package/dist/oauth/axios.js +61 -0
- package/dist/oauth/clientCredentials.d.ts +24 -0
- package/dist/oauth/clientCredentials.js +63 -0
- package/dist/oauth/index.d.ts +3 -0
- package/dist/oauth/index.js +31 -0
- package/dist/oauth/tokenManager.d.ts +38 -0
- package/dist/oauth/tokenManager.js +81 -0
- package/dist/pin/api.d.ts +329 -0
- package/dist/pin/api.js +352 -0
- package/dist/pin/base.d.ts +66 -0
- package/dist/pin/base.js +65 -0
- package/dist/pin/common.d.ts +65 -0
- package/dist/pin/common.js +161 -0
- package/dist/pin/configuration.d.ts +91 -0
- package/dist/pin/configuration.js +44 -0
- package/dist/pin/index.d.ts +13 -0
- package/dist/pin/index.js +31 -0
- package/dist/threeds/api.d.ts +104 -0
- package/dist/threeds/api.js +143 -0
- package/dist/threeds/base.d.ts +66 -0
- package/dist/threeds/base.js +65 -0
- package/dist/threeds/common.d.ts +65 -0
- package/dist/threeds/common.js +161 -0
- package/dist/threeds/configuration.d.ts +91 -0
- package/dist/threeds/configuration.js +44 -0
- package/dist/threeds/index.d.ts +13 -0
- package/dist/threeds/index.js +31 -0
- package/dist/threeds-oob/api.d.ts +241 -0
- package/dist/threeds-oob/api.js +148 -0
- package/dist/threeds-oob/base.d.ts +66 -0
- package/dist/threeds-oob/base.js +65 -0
- package/dist/threeds-oob/common.d.ts +65 -0
- package/dist/threeds-oob/common.js +161 -0
- package/dist/threeds-oob/configuration.d.ts +91 -0
- package/dist/threeds-oob/configuration.js +44 -0
- package/dist/threeds-oob/index.d.ts +13 -0
- package/dist/threeds-oob/index.js +31 -0
- package/dist/transaction-event/api.d.ts +1082 -0
- package/dist/transaction-event/api.js +166 -0
- package/dist/transaction-event/base.d.ts +66 -0
- package/dist/transaction-event/base.js +65 -0
- package/dist/transaction-event/common.d.ts +65 -0
- package/dist/transaction-event/common.js +161 -0
- package/dist/transaction-event/configuration.d.ts +91 -0
- package/dist/transaction-event/configuration.js +44 -0
- package/dist/transaction-event/index.d.ts +13 -0
- package/dist/transaction-event/index.js +31 -0
- package/dist/wallet/api.d.ts +1385 -0
- package/dist/wallet/api.js +1377 -0
- package/dist/wallet/base.d.ts +66 -0
- package/dist/wallet/base.js +65 -0
- package/dist/wallet/common.d.ts +65 -0
- package/dist/wallet/common.js +161 -0
- package/dist/wallet/configuration.d.ts +91 -0
- package/dist/wallet/configuration.js +44 -0
- package/dist/wallet/index.d.ts +13 -0
- package/dist/wallet/index.js +31 -0
- package/package.json +25 -0
- package/src/authorisation-control/api.ts +876 -0
- package/src/authorisation-control/base.ts +86 -0
- package/src/authorisation-control/common.ts +150 -0
- package/src/authorisation-control/configuration.ts +115 -0
- package/src/authorisation-control/index.ts +18 -0
- package/src/card/api.ts +2792 -0
- package/src/card/base.ts +86 -0
- package/src/card/common.ts +150 -0
- package/src/card/configuration.ts +115 -0
- package/src/card/index.ts +18 -0
- package/src/cardholder/api.ts +2244 -0
- package/src/cardholder/base.ts +86 -0
- package/src/cardholder/common.ts +150 -0
- package/src/cardholder/configuration.ts +115 -0
- package/src/cardholder/index.ts +18 -0
- package/src/cards/api.ts +141 -0
- package/src/cards/base.ts +86 -0
- package/src/cards/common.ts +150 -0
- package/src/cards/configuration.ts +115 -0
- package/src/cards/index.ts +18 -0
- package/src/clearing-file-copy/api.ts +1309 -0
- package/src/clearing-file-copy/base.ts +86 -0
- package/src/clearing-file-copy/common.ts +150 -0
- package/src/clearing-file-copy/configuration.ts +115 -0
- package/src/clearing-file-copy/index.ts +18 -0
- package/src/index.ts +16 -0
- package/src/issuer-events/api.ts +1926 -0
- package/src/issuer-events/base.ts +86 -0
- package/src/issuer-events/common.ts +150 -0
- package/src/issuer-events/configuration.ts +115 -0
- package/src/issuer-events/index.ts +18 -0
- package/src/oauth/axios.ts +60 -0
- package/src/oauth/clientCredentials.ts +72 -0
- package/src/oauth/index.ts +24 -0
- package/src/oauth/tokenManager.ts +85 -0
- package/src/pin/api.ts +507 -0
- package/src/pin/base.ts +86 -0
- package/src/pin/common.ts +150 -0
- package/src/pin/configuration.ts +115 -0
- package/src/pin/index.ts +18 -0
- package/src/threeds/api.ts +173 -0
- package/src/threeds/base.ts +86 -0
- package/src/threeds/common.ts +150 -0
- package/src/threeds/configuration.ts +115 -0
- package/src/threeds/index.ts +18 -0
- package/src/threeds-oob/api.ts +311 -0
- package/src/threeds-oob/base.ts +86 -0
- package/src/threeds-oob/common.ts +150 -0
- package/src/threeds-oob/configuration.ts +115 -0
- package/src/threeds-oob/index.ts +18 -0
- package/src/transaction-event/api.ts +1152 -0
- package/src/transaction-event/base.ts +86 -0
- package/src/transaction-event/common.ts +150 -0
- package/src/transaction-event/configuration.ts +115 -0
- package/src/transaction-event/index.ts +18 -0
- package/src/wallet/api.ts +2083 -0
- package/src/wallet/base.ts +86 -0
- package/src/wallet/common.ts +150 -0
- package/src/wallet/configuration.ts +115 -0
- package/src/wallet/index.ts +18 -0
- package/test/authorisation-control.test.ts +71 -0
- package/test/card.test.ts +39 -0
- package/test/cardholder.test.ts +51 -0
- package/test/cards.test.ts +35 -0
- package/test/issuer-events.test.ts +55 -0
- package/test/oauth.test.ts +205 -0
- package/test/pin.test.ts +39 -0
- package/test/threeds-oob.test.ts +90 -0
- package/test/threeds.test.ts +55 -0
- package/test/wallet.test.ts +62 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Wallet operations
|
|
5
|
+
* Wallet API enables getting needed data for tokenization and enablement in programs like Apple Pay and Google Pay. #### Terms used <table> <tr> <th>Term</th> <th>Definition</th> <tr> <td>Customer</td> <td>End customer using financial institution\'s mobile application</td> </tr> <tr> <td>In-app activation</td> <td>Wallet provisioning using financial institution app as authentication method</td> </tr> <tr> <td>In-app provisioning</td> <td>Mastercard\'s term for push provisioning</td> </tr> <tr> <td>Push provisioning</td> <td>VISA\'s term for pushing card details from within mobile application. This term will be used in this document</td> </tr> <tr> <td>Wallet provider</td> <td>Such as Apple Pay, Google Pay or Samsung Pay </td> </tr> </table> It\'s called in two cases: - *Push provisioning* - this is usually done within issuers own application and card holder does not need to enter any information. Then the different endpoints for push provisioning must be used. - *In-app activation* - activating a card by manually adding information, then endpoint for generate activation data must be used after authentication of end customer is completed.  In above case the difference between push provisioning and in-app activation is which endpoint that is called in step 3. Note that diagram above is a simplification of full flow in order to explain it from a developer point of view.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1
|
|
8
|
+
* Contact: info@enfuce.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import type { Configuration } from './configuration';
|
|
17
|
+
// Some imports not used depending on template conditions
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
20
|
+
import globalAxios from 'axios';
|
|
21
|
+
|
|
22
|
+
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
*/
|
|
28
|
+
export const COLLECTION_FORMATS = {
|
|
29
|
+
csv: ",",
|
|
30
|
+
ssv: " ",
|
|
31
|
+
tsv: "\t",
|
|
32
|
+
pipes: "|",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @interface RequestArgs
|
|
39
|
+
*/
|
|
40
|
+
export interface RequestArgs {
|
|
41
|
+
url: string;
|
|
42
|
+
options: RawAxiosRequestConfig;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @class BaseAPI
|
|
49
|
+
*/
|
|
50
|
+
export class BaseAPI {
|
|
51
|
+
protected configuration: Configuration | undefined;
|
|
52
|
+
|
|
53
|
+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
54
|
+
if (configuration) {
|
|
55
|
+
this.configuration = configuration;
|
|
56
|
+
this.basePath = configuration.basePath ?? basePath;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
* @class RequiredError
|
|
65
|
+
* @extends {Error}
|
|
66
|
+
*/
|
|
67
|
+
export class RequiredError extends Error {
|
|
68
|
+
constructor(public field: string, msg?: string) {
|
|
69
|
+
super(msg);
|
|
70
|
+
this.name = "RequiredError"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ServerMap {
|
|
75
|
+
[key: string]: {
|
|
76
|
+
url: string,
|
|
77
|
+
description: string,
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @export
|
|
84
|
+
*/
|
|
85
|
+
export const operationServerMap: ServerMap = {
|
|
86
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Wallet operations
|
|
5
|
+
* Wallet API enables getting needed data for tokenization and enablement in programs like Apple Pay and Google Pay. #### Terms used <table> <tr> <th>Term</th> <th>Definition</th> <tr> <td>Customer</td> <td>End customer using financial institution\'s mobile application</td> </tr> <tr> <td>In-app activation</td> <td>Wallet provisioning using financial institution app as authentication method</td> </tr> <tr> <td>In-app provisioning</td> <td>Mastercard\'s term for push provisioning</td> </tr> <tr> <td>Push provisioning</td> <td>VISA\'s term for pushing card details from within mobile application. This term will be used in this document</td> </tr> <tr> <td>Wallet provider</td> <td>Such as Apple Pay, Google Pay or Samsung Pay </td> </tr> </table> It\'s called in two cases: - *Push provisioning* - this is usually done within issuers own application and card holder does not need to enter any information. Then the different endpoints for push provisioning must be used. - *In-app activation* - activating a card by manually adding information, then endpoint for generate activation data must be used after authentication of end customer is completed.  In above case the difference between push provisioning and in-app activation is which endpoint that is called in step 3. Note that diagram above is a simplification of full flow in order to explain it from a developer point of view.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1
|
|
8
|
+
* Contact: info@enfuce.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import type { Configuration } from "./configuration";
|
|
17
|
+
import type { RequestArgs } from "./base";
|
|
18
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
19
|
+
import { RequiredError } from "./base";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export const DUMMY_BASE_URL = 'https://example.com'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @throws {RequiredError}
|
|
30
|
+
* @export
|
|
31
|
+
*/
|
|
32
|
+
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
|
33
|
+
if (paramValue === null || paramValue === undefined) {
|
|
34
|
+
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
*/
|
|
42
|
+
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
|
43
|
+
if (configuration && configuration.apiKey) {
|
|
44
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
45
|
+
? await configuration.apiKey(keyParamName)
|
|
46
|
+
: await configuration.apiKey;
|
|
47
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
56
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
57
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
66
|
+
if (configuration && configuration.accessToken) {
|
|
67
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
68
|
+
? await configuration.accessToken()
|
|
69
|
+
: await configuration.accessToken;
|
|
70
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @export
|
|
77
|
+
*/
|
|
78
|
+
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
|
79
|
+
if (configuration && configuration.accessToken) {
|
|
80
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
81
|
+
? await configuration.accessToken(name, scopes)
|
|
82
|
+
: await configuration.accessToken;
|
|
83
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
|
88
|
+
if (parameter == null) return;
|
|
89
|
+
if (typeof parameter === "object") {
|
|
90
|
+
if (Array.isArray(parameter)) {
|
|
91
|
+
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
Object.keys(parameter).forEach(currentKey =>
|
|
95
|
+
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (urlSearchParams.has(key)) {
|
|
101
|
+
urlSearchParams.append(key, parameter);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
urlSearchParams.set(key, parameter);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @export
|
|
112
|
+
*/
|
|
113
|
+
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
|
114
|
+
const searchParams = new URLSearchParams(url.search);
|
|
115
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
116
|
+
url.search = searchParams.toString();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @export
|
|
122
|
+
*/
|
|
123
|
+
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
|
124
|
+
const nonString = typeof value !== 'string';
|
|
125
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
126
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
127
|
+
: nonString;
|
|
128
|
+
return needsSerialization
|
|
129
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
130
|
+
: (value || "");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @export
|
|
136
|
+
*/
|
|
137
|
+
export const toPathString = function (url: URL) {
|
|
138
|
+
return url.pathname + url.search + url.hash
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @export
|
|
144
|
+
*/
|
|
145
|
+
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
146
|
+
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
147
|
+
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
|
148
|
+
return axios.request<T, R>(axiosRequestArgs);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Wallet operations
|
|
5
|
+
* Wallet API enables getting needed data for tokenization and enablement in programs like Apple Pay and Google Pay. #### Terms used <table> <tr> <th>Term</th> <th>Definition</th> <tr> <td>Customer</td> <td>End customer using financial institution\'s mobile application</td> </tr> <tr> <td>In-app activation</td> <td>Wallet provisioning using financial institution app as authentication method</td> </tr> <tr> <td>In-app provisioning</td> <td>Mastercard\'s term for push provisioning</td> </tr> <tr> <td>Push provisioning</td> <td>VISA\'s term for pushing card details from within mobile application. This term will be used in this document</td> </tr> <tr> <td>Wallet provider</td> <td>Such as Apple Pay, Google Pay or Samsung Pay </td> </tr> </table> It\'s called in two cases: - *Push provisioning* - this is usually done within issuers own application and card holder does not need to enter any information. Then the different endpoints for push provisioning must be used. - *In-app activation* - activating a card by manually adding information, then endpoint for generate activation data must be used after authentication of end customer is completed.  In above case the difference between push provisioning and in-app activation is which endpoint that is called in step 3. Note that diagram above is a simplification of full flow in order to explain it from a developer point of view.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1
|
|
8
|
+
* Contact: info@enfuce.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export interface ConfigurationParameters {
|
|
17
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
18
|
+
username?: string;
|
|
19
|
+
password?: string;
|
|
20
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
21
|
+
basePath?: string;
|
|
22
|
+
serverIndex?: number;
|
|
23
|
+
baseOptions?: any;
|
|
24
|
+
formDataCtor?: new () => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class Configuration {
|
|
28
|
+
/**
|
|
29
|
+
* parameter for apiKey security
|
|
30
|
+
* @param name security name
|
|
31
|
+
* @memberof Configuration
|
|
32
|
+
*/
|
|
33
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
34
|
+
/**
|
|
35
|
+
* parameter for basic security
|
|
36
|
+
*
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof Configuration
|
|
39
|
+
*/
|
|
40
|
+
username?: string;
|
|
41
|
+
/**
|
|
42
|
+
* parameter for basic security
|
|
43
|
+
*
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof Configuration
|
|
46
|
+
*/
|
|
47
|
+
password?: string;
|
|
48
|
+
/**
|
|
49
|
+
* parameter for oauth2 security
|
|
50
|
+
* @param name security name
|
|
51
|
+
* @param scopes oauth2 scope
|
|
52
|
+
* @memberof Configuration
|
|
53
|
+
*/
|
|
54
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
55
|
+
/**
|
|
56
|
+
* override base path
|
|
57
|
+
*
|
|
58
|
+
* @type {string}
|
|
59
|
+
* @memberof Configuration
|
|
60
|
+
*/
|
|
61
|
+
basePath?: string;
|
|
62
|
+
/**
|
|
63
|
+
* override server index
|
|
64
|
+
*
|
|
65
|
+
* @type {number}
|
|
66
|
+
* @memberof Configuration
|
|
67
|
+
*/
|
|
68
|
+
serverIndex?: number;
|
|
69
|
+
/**
|
|
70
|
+
* base options for axios calls
|
|
71
|
+
*
|
|
72
|
+
* @type {any}
|
|
73
|
+
* @memberof Configuration
|
|
74
|
+
*/
|
|
75
|
+
baseOptions?: any;
|
|
76
|
+
/**
|
|
77
|
+
* The FormData constructor that will be used to create multipart form data
|
|
78
|
+
* requests. You can inject this here so that execution environments that
|
|
79
|
+
* do not support the FormData class can still run the generated client.
|
|
80
|
+
*
|
|
81
|
+
* @type {new () => FormData}
|
|
82
|
+
*/
|
|
83
|
+
formDataCtor?: new () => any;
|
|
84
|
+
|
|
85
|
+
constructor(param: ConfigurationParameters = {}) {
|
|
86
|
+
this.apiKey = param.apiKey;
|
|
87
|
+
this.username = param.username;
|
|
88
|
+
this.password = param.password;
|
|
89
|
+
this.accessToken = param.accessToken;
|
|
90
|
+
this.basePath = param.basePath;
|
|
91
|
+
this.serverIndex = param.serverIndex;
|
|
92
|
+
this.baseOptions = {
|
|
93
|
+
...param.baseOptions,
|
|
94
|
+
headers: {
|
|
95
|
+
...param.baseOptions?.headers,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
this.formDataCtor = param.formDataCtor;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Check if the given MIME is a JSON MIME.
|
|
103
|
+
* JSON MIME examples:
|
|
104
|
+
* application/json
|
|
105
|
+
* application/json; charset=UTF8
|
|
106
|
+
* APPLICATION/JSON
|
|
107
|
+
* application/vnd.company+json
|
|
108
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
109
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
110
|
+
*/
|
|
111
|
+
public isJsonMime(mime: string): boolean {
|
|
112
|
+
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
113
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Wallet operations
|
|
5
|
+
* Wallet API enables getting needed data for tokenization and enablement in programs like Apple Pay and Google Pay. #### Terms used <table> <tr> <th>Term</th> <th>Definition</th> <tr> <td>Customer</td> <td>End customer using financial institution\'s mobile application</td> </tr> <tr> <td>In-app activation</td> <td>Wallet provisioning using financial institution app as authentication method</td> </tr> <tr> <td>In-app provisioning</td> <td>Mastercard\'s term for push provisioning</td> </tr> <tr> <td>Push provisioning</td> <td>VISA\'s term for pushing card details from within mobile application. This term will be used in this document</td> </tr> <tr> <td>Wallet provider</td> <td>Such as Apple Pay, Google Pay or Samsung Pay </td> </tr> </table> It\'s called in two cases: - *Push provisioning* - this is usually done within issuers own application and card holder does not need to enter any information. Then the different endpoints for push provisioning must be used. - *In-app activation* - activating a card by manually adding information, then endpoint for generate activation data must be used after authentication of end customer is completed.  In above case the difference between push provisioning and in-app activation is which endpoint that is called in step 3. Note that diagram above is a simplification of full flow in order to explain it from a developer point of view.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1
|
|
8
|
+
* Contact: info@enfuce.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export * from "./api";
|
|
17
|
+
export * from "./configuration";
|
|
18
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level tests for the authorisation-control API client, asserting the request
|
|
3
|
+
* against an exact JSON payload. A capturing axios adapter intercepts the request
|
|
4
|
+
* instead of hitting the network, so this exercises the real generated client (URL
|
|
5
|
+
* building, Content-Type, body serialization) without a live server or a mock library.
|
|
6
|
+
*/
|
|
7
|
+
import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { AuthorisationRequestAPIApi, CardApplicationSelectionEnum } from '../src/authorisation-control';
|
|
10
|
+
|
|
11
|
+
function capturingClient() {
|
|
12
|
+
const captured: { config?: InternalAxiosRequestConfig } = {};
|
|
13
|
+
const instance = axios.create({
|
|
14
|
+
adapter: async (config) => {
|
|
15
|
+
captured.config = config;
|
|
16
|
+
return { data: undefined, status: 200, statusText: 'OK', headers: {}, config };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return { captured, instance };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('AuthorisationRequestAPIApi.authPost', () => {
|
|
23
|
+
it('POSTs the exact authorisation-request JSON to the auth endpoint', async () => {
|
|
24
|
+
const { captured, instance } = capturingClient();
|
|
25
|
+
const api = new AuthorisationRequestAPIApi(undefined, 'http://localhost', instance);
|
|
26
|
+
|
|
27
|
+
await api.authPost({
|
|
28
|
+
card: {
|
|
29
|
+
id: '11111111-1111-1111-1111-111111111111',
|
|
30
|
+
applicationSelection: CardApplicationSelectionEnum.Debit,
|
|
31
|
+
},
|
|
32
|
+
merchant: {
|
|
33
|
+
id: 'MERCHANT-0001',
|
|
34
|
+
country: 'FIN',
|
|
35
|
+
},
|
|
36
|
+
transaction: {
|
|
37
|
+
transactionAmount: { amount: 1000, currency: 'EUR' },
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(captured.config?.method?.toUpperCase()).toBe('POST');
|
|
42
|
+
expect(captured.config?.url).toBe('http://localhost/auth');
|
|
43
|
+
expect(captured.config?.headers?.['Content-Type']).toBe('application/json');
|
|
44
|
+
expect(captured.config?.data).toBe(
|
|
45
|
+
'{"card":{"id":"11111111-1111-1111-1111-111111111111","applicationSelection":"DEBIT"},"merchant":{"id":"MERCHANT-0001","country":"FIN"},"transaction":{"transactionAmount":{"amount":1000,"currency":"EUR"}}}',
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('serializes the CREDIT application selection to the exact JSON body', async () => {
|
|
50
|
+
const { captured, instance } = capturingClient();
|
|
51
|
+
const api = new AuthorisationRequestAPIApi(undefined, 'http://localhost', instance);
|
|
52
|
+
|
|
53
|
+
await api.authPost({
|
|
54
|
+
card: {
|
|
55
|
+
id: '22222222-2222-2222-2222-222222222222',
|
|
56
|
+
applicationSelection: CardApplicationSelectionEnum.Credit,
|
|
57
|
+
},
|
|
58
|
+
merchant: {
|
|
59
|
+
id: 'MERCHANT-0002',
|
|
60
|
+
country: 'SWE',
|
|
61
|
+
},
|
|
62
|
+
transaction: {
|
|
63
|
+
transactionAmount: { amount: 2500, currency: 'EUR' },
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
expect(captured.config?.data).toBe(
|
|
68
|
+
'{"card":{"id":"22222222-2222-2222-2222-222222222222","applicationSelection":"CREDIT"},"merchant":{"id":"MERCHANT-0002","country":"SWE"},"transaction":{"transactionAmount":{"amount":2500,"currency":"EUR"}}}',
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level tests for the card API client, asserting the request against an
|
|
3
|
+
* exact JSON payload. A capturing axios adapter intercepts the request instead of
|
|
4
|
+
* hitting the network, so this exercises the real generated client (URL building,
|
|
5
|
+
* Content-Type, body serialization) without a live server or a mock library.
|
|
6
|
+
*/
|
|
7
|
+
import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { CreatePINControlAccessTokenApi, PinScope } from '../src/card';
|
|
10
|
+
|
|
11
|
+
function capturingClient() {
|
|
12
|
+
const captured: { config?: InternalAxiosRequestConfig } = {};
|
|
13
|
+
const instance = axios.create({
|
|
14
|
+
adapter: async (config) => {
|
|
15
|
+
captured.config = config;
|
|
16
|
+
return { data: undefined, status: 200, statusText: 'OK', headers: {}, config };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return { captured, instance };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('CreatePINControlAccessTokenApi.createPinControl', () => {
|
|
23
|
+
it('POSTs the exact PIN-control JSON to the card pinControl endpoint', async () => {
|
|
24
|
+
const { captured, instance } = capturingClient();
|
|
25
|
+
const api = new CreatePINControlAccessTokenApi(undefined, 'http://localhost', instance);
|
|
26
|
+
|
|
27
|
+
await api.createPinControl('11111111-1111-1111-1111-111111111111', {
|
|
28
|
+
scope: PinScope.ChangePin,
|
|
29
|
+
sequenceNumber: 1,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(captured.config?.method?.toUpperCase()).toBe('POST');
|
|
33
|
+
expect(captured.config?.url).toBe(
|
|
34
|
+
'http://localhost/v1/cards/11111111-1111-1111-1111-111111111111/pinControl',
|
|
35
|
+
);
|
|
36
|
+
expect(captured.config?.headers?.['Content-Type']).toBe('application/json');
|
|
37
|
+
expect(captured.config?.data).toBe('{"scope":"CHANGE_PIN","sequenceNumber":1}');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level tests for the cardholder API client, asserting the request against an
|
|
3
|
+
* exact JSON payload. A capturing axios adapter intercepts the request instead of
|
|
4
|
+
* hitting the network, so this exercises the real generated client (URL building,
|
|
5
|
+
* Content-Type, body serialization) without a live server or a mock library.
|
|
6
|
+
*/
|
|
7
|
+
import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { UpdateCardholderApi, Locale } from '../src/cardholder';
|
|
10
|
+
|
|
11
|
+
function capturingClient() {
|
|
12
|
+
const captured: { config?: InternalAxiosRequestConfig } = {};
|
|
13
|
+
const instance = axios.create({
|
|
14
|
+
adapter: async (config) => {
|
|
15
|
+
captured.config = config;
|
|
16
|
+
return { data: undefined, status: 200, statusText: 'OK', headers: {}, config };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return { captured, instance };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('UpdateCardholderApi.updateCardholder', () => {
|
|
23
|
+
it('PATCHes the exact cardholder-update JSON to the cardholder endpoint', async () => {
|
|
24
|
+
const { captured, instance } = capturingClient();
|
|
25
|
+
const api = new UpdateCardholderApi(undefined, 'http://localhost', instance);
|
|
26
|
+
|
|
27
|
+
await api.updateCardholder('11111111-1111-1111-1111-111111111111', {
|
|
28
|
+
customerNumber: 'CUST-0001',
|
|
29
|
+
locale: Locale.EnGb,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(captured.config?.method?.toUpperCase()).toBe('PATCH');
|
|
33
|
+
expect(captured.config?.url).toBe(
|
|
34
|
+
'http://localhost/v1/cardholders/11111111-1111-1111-1111-111111111111',
|
|
35
|
+
);
|
|
36
|
+
expect(captured.config?.headers?.['Content-Type']).toBe('application/json');
|
|
37
|
+
expect(captured.config?.data).toBe('{"customerNumber":"CUST-0001","locale":"en-GB"}');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('serializes the en-US locale enum to the exact JSON body', async () => {
|
|
41
|
+
const { captured, instance } = capturingClient();
|
|
42
|
+
const api = new UpdateCardholderApi(undefined, 'http://localhost', instance);
|
|
43
|
+
|
|
44
|
+
await api.updateCardholder('22222222-2222-2222-2222-222222222222', {
|
|
45
|
+
customerNumber: 'CUST-0002',
|
|
46
|
+
locale: Locale.EnUs,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(captured.config?.data).toBe('{"customerNumber":"CUST-0002","locale":"en-US"}');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level tests for the cards API client. The only method on this client is a
|
|
3
|
+
* POST with no request body (path parameters only), so this asserts the HTTP method
|
|
4
|
+
* and the resolved URL. A capturing axios adapter intercepts the request instead of
|
|
5
|
+
* hitting the network, exercising the real generated client (URL building) without a
|
|
6
|
+
* live server or a mock library.
|
|
7
|
+
*/
|
|
8
|
+
import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { CardsApi } from '../src/cards';
|
|
11
|
+
|
|
12
|
+
function capturingClient() {
|
|
13
|
+
const captured: { config?: InternalAxiosRequestConfig } = {};
|
|
14
|
+
const instance = axios.create({
|
|
15
|
+
adapter: async (config) => {
|
|
16
|
+
captured.config = config;
|
|
17
|
+
return { data: undefined, status: 200, statusText: 'OK', headers: {}, config };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return { captured, instance };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('CardsApi.resetPinCounter', () => {
|
|
24
|
+
it('POSTs to the reset-pin-counter endpoint with the path parameters resolved', async () => {
|
|
25
|
+
const { captured, instance } = capturingClient();
|
|
26
|
+
const api = new CardsApi(undefined, 'http://localhost', instance);
|
|
27
|
+
|
|
28
|
+
await api.resetPinCounter('11111111-1111-1111-1111-111111111111', 0);
|
|
29
|
+
|
|
30
|
+
expect(captured.config?.method?.toUpperCase()).toBe('POST');
|
|
31
|
+
expect(captured.config?.url).toBe(
|
|
32
|
+
'http://localhost/v1/cards/11111111-1111-1111-1111-111111111111/card-versions/0/reset-pin-counter',
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level tests for the issuer-events API client, asserting the request against
|
|
3
|
+
* an exact JSON payload. A capturing axios adapter intercepts the request instead
|
|
4
|
+
* of hitting the network, so this exercises the real generated client (URL building,
|
|
5
|
+
* Content-Type, body serialization) without a live server or a mock library.
|
|
6
|
+
*/
|
|
7
|
+
import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { IssuerEventWebhooksApi, CardRole } from '../src/issuer-events';
|
|
10
|
+
|
|
11
|
+
function capturingClient() {
|
|
12
|
+
const captured: { config?: InternalAxiosRequestConfig } = {};
|
|
13
|
+
const instance = axios.create({
|
|
14
|
+
adapter: async (config) => {
|
|
15
|
+
captured.config = config;
|
|
16
|
+
return { data: undefined, status: 200, statusText: 'OK', headers: {}, config };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return { captured, instance };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('IssuerEventWebhooksApi.cardEvent', () => {
|
|
23
|
+
it('POSTs the exact card-event JSON to the card webhook endpoint', async () => {
|
|
24
|
+
const { captured, instance } = capturingClient();
|
|
25
|
+
const api = new IssuerEventWebhooksApi(undefined, 'http://localhost', instance);
|
|
26
|
+
|
|
27
|
+
await api.cardEvent({
|
|
28
|
+
id: '11111111-1111-1111-1111-111111111111',
|
|
29
|
+
programId: '22222222-2222-2222-2222-222222222222',
|
|
30
|
+
role: CardRole.MainCard,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
expect(captured.config?.method?.toUpperCase()).toBe('POST');
|
|
34
|
+
expect(captured.config?.url).toBe('http://localhost/card');
|
|
35
|
+
expect(captured.config?.headers?.['Content-Type']).toBe('application/json');
|
|
36
|
+
expect(captured.config?.data).toBe(
|
|
37
|
+
'{"id":"11111111-1111-1111-1111-111111111111","programId":"22222222-2222-2222-2222-222222222222","role":"MAIN_CARD"}',
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('serializes the CARD_APPLICATION role to the exact JSON body', async () => {
|
|
42
|
+
const { captured, instance } = capturingClient();
|
|
43
|
+
const api = new IssuerEventWebhooksApi(undefined, 'http://localhost', instance);
|
|
44
|
+
|
|
45
|
+
await api.cardEvent({
|
|
46
|
+
id: '33333333-3333-3333-3333-333333333333',
|
|
47
|
+
programId: '44444444-4444-4444-4444-444444444444',
|
|
48
|
+
role: CardRole.CardApplication,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect(captured.config?.data).toBe(
|
|
52
|
+
'{"id":"33333333-3333-3333-3333-333333333333","programId":"44444444-4444-4444-4444-444444444444","role":"CARD_APPLICATION"}',
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
});
|