Skip to content

Commit 8b970f4

Browse files
committed
Update imports in README
1 parent 0cb9002 commit 8b970f4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ Alternatively, you can use the `Types` included in this module for Typescript an
254254
#### Deserializing JSON Strings
255255
In some setups you might need to deserialize JSON strings to request objects. For example, when using the libraries in combination with [Dropin/Components](https://github.com/Adyen/adyen-web). Please use the built-in deserialization functions:
256256
``` typescript
257-
// Import the required model class
258-
import { checkout } from "../typings";
257+
// Import the models
258+
import { Types } from "@adyen/api-library";
259259

260260
// Deserialize using built-in ObjectSerializer class
261261
const requestJson: JSON = JSON.parse(`YOUR_JSON_STRING`);
262-
const paymentRequest: checkout.PaymentRequest = await checkout.ObjectSerializer.deserialize(requestJson,"PaymentRequest");
262+
const paymentRequest: Types.checkout.PaymentRequest = await Types.checkout.ObjectSerializer.deserialize(requestJson,"PaymentRequest");
263263
```
264264

265265
### Custom HTTP client configuration
@@ -299,8 +299,12 @@ const client = new Client({
299299
### Parsing and Authenticating Banking Webhooks
300300
Parse an AccountHolderNotificationRequest webhook;
301301
``` typescript
302+
// import models
303+
import { Types } from "@adyen/api-library";
304+
const { ConfigurationWebhooksHandler } = require('@adyen/api-library/lib/src/typings/configurationWebhooks/configurationWebhooksHandler');
305+
302306
const configurationWebhooksHandler = new ConfigurationWebhooksHandler(YOUR_BANKING_WEBHOOK);
303-
const accountHolderNotificationRequest: AccountHolderNotificationRequest = configurationWebhooksHandler.getAccountHolderNotificationRequest();
307+
const accountHolderNotificationRequest: Types.configurationWebhooks.AccountHolderNotificationRequest = configurationWebhooksHandler.getAccountHolderNotificationRequest();
304308
```
305309
You can also parse the webhook with a generic type, in case you do not know the webhook type in advance. In this case you can check the instance of the webhook in order to parse it to the respective type (or just use it dynamically);
306310
``` typescript
@@ -331,7 +335,7 @@ To configure a proxy connection, set the `proxy` property of your `HttpURLConnec
331335
For example:
332336

333337
``` javascript
334-
const {HttpURLConnectionClient, Client, Config} = require('@adyen/api-library');
338+
const {HttpURLConnectionClient, Client, Config, EnvironmentEnum} = require('@adyen/api-library');
335339
// ... more code
336340
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST});
337341
const httpClient = new HttpURLConnectionClient();
@@ -494,7 +498,7 @@ const paymentRequest: SaleToPOIRequest = {
494498
}
495499

496500
// Step 6: Make the request
497-
const terminalApiResponse: terminal.TerminalApiResponse = await terminalLocalAPI.request(paymentRequest, securityKey);
501+
const terminalApiResponse: Types.terminal.TerminalApiResponse = await terminalLocalAPI.request(paymentRequest, securityKey);
498502
```
499503
## Using the Local Terminal API Integration without Encryption (Only on TEST)
500504
If you wish to develop the Local Terminal API integration parallel to your encryption implementation, you can opt for the unencrypted version. Be sure to remove any encryption details from the CA terminal config page.
@@ -517,15 +521,15 @@ const paymentRequest: SaleToPOIRequest = {
517521
}
518522

519523
// Step 5: Make the request
520-
const terminalApiResponse: terminal.TerminalApiResponse = await terminalLocalAPI.request(paymentRequest);
524+
const terminalApiResponse: Types.terminal.TerminalApiResponse = await terminalLocalAPI.request(paymentRequest);
521525
```
522526
### Using the Cloud Terminal API Integration (async)
523527
If you choose to integrate [Terminal API over Cloud](https://docs.adyen.com/point-of-sale/design-your-integration/choose-your-architecture/cloud/) **asynchronously**, you need to follow similar steps to initialize the client and prepare the request object. However the response will be asynchronous:
524528
* a successful request will return `200` status code and `ok` as response body. Make sure to setup the [event notifications](https://docs.adyen.com/point-of-sale/design-your-integration/notifications/event-notifications/)
525529
* a request that fails will return `200` status code and the `TerminalApiResponse` as response body
526530
``` typescript
527531
// Step 1: Require the parts of the module you want to use
528-
const {Client, TerminalCloudAPI} from "@adyen/api-library";
532+
const {Client, TerminalCloudAPI, EnvironmentEnum} from "@adyen/api-library";
529533

530534
// Step 2: Initialize the client object
531535
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST});

0 commit comments

Comments
 (0)