From 19646f7c4736d80dba7f45f7f2165767f6c0712f Mon Sep 17 00:00:00 2001 From: wouterboe Date: Fri, 30 Apr 2021 17:05:08 +0200 Subject: [PATCH 1/5] README updated to new template --- README.md | 71 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 5d8a871..5f27d4b 100644 --- a/README.md +++ b/README.md @@ -8,24 +8,28 @@ [![Total alerts](https://img.shields.io/lgtm/alerts/g/Adyen/adyen-node-api-library.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Adyen/adyen-node-api-library/alerts/) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Adyen/adyen-node-api-library.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Adyen/adyen-node-api-library/context:javascript) -The Adyen API Library for NodeJS enables you to work with Adyen APIs. +This is the officially supported NodeJS library for using Adyen's APIs. ## Integration The Library supports all APIs under the following services: -* [x] checkout -* [x] checkout utility -* [x] payments -* [x] modifications -* [x] payouts -* [x] recurring -* [x] notifications -* [x] BIN lookup -* [x] Terminal API +* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v67/overview): Our latest integration for accepting online payments. Current supported version: **v67** +* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64** +* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49** +* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64** +* [Platforms APIs](https://docs.adyen.com/platforms/api): Set of APIs when using Adyen for Platforms. + * [Account API](https://docs.adyen.com/api-explorer/#/Account/v6/overview) Current supported version: **v6** + * [Fund API](https://docs.adyen.com/api-explorer/#/Fund/v6/overview) Current supported version: **v6** + * [Notification Configuration API](https://docs.adyen.com/api-explorer/#/NotificationConfigurationService/v6/overview) Current supported version: **v6** +* [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference): Our point-of-sale integration. +* [BIN lookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v50/overview): The BIN Lookup API provides endpoints for retrieving information based on a given BIN. Current supported version: **v50** -## Requirements +For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/). -* Node 10 or higher +## Prerequisites +- [Adyen test account](https://docs.adyen.com/get-started-with-adyen) +- [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles). +- Node 10 or higher ## Installation @@ -37,12 +41,28 @@ You can use NPM to add our library to your project npm install --save @adyen/api-library ``` -## Documentation -* https://docs.adyen.com/developers/development-resources/libraries -* https://docs.adyen.com/developers/checkout +Alternatively, you can download the [release on GitHub](https://github.com/Adyen/adyen-node-api-library/releases). -## HTTP Client Configuration +## Using the library + +### General use with API key + +Set up the client as a singleton resource; you can then use it to create service objects for the API calls that you make to Adyen: + +```typescript + const client = new Client({apiKey: "YOUR_API_KEY", environment: "TEST"}); +``` +### General use with API key for live environment + ```typescript + const client = new Client({apiKey: "YOUR_API_KEY", environment: "LIVE"}); + ``` +### General use with basic auth +```typescript + const client = new Client({username: "YOUR_USERNAME", password: "YOUR_PASSWORD", environment: "TEST"}); +``` + +### Custom HTTP Client Configuration By default, NodeJS [https](https://nodejs.org/api/https.html) will be used to submit requests to the API. But you can change that by injecting your own HttpClient on your client instance. In the example below, we use `axios`: ```javascript @@ -89,20 +109,23 @@ client.httpClient = httpClient; ... ``` -## Testing -`$ npm run test` +### Example integration + +For a closer look at how our PHP library works, clone our [example integration](https://github.com/adyen-examples/adyen-node-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library. -## Support -If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our [support team](https://support.adyen.com/hc/en-us/requests/new?ticket_form_id=360000705420). - -## Contributing +## Contributing We strongly encourage you to join us in contributing to this repository so everyone can benefit from: * New features and functionality * Resolved bug fixes and issues * Any general improvements -Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how. +Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how to create a pull request. + +## Support +If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our [support team](https://support.adyen.com/). ## Licence +This repository is available under the [MIT license](LICENSE). -MIT license. For more information, see the LICENSE file. +## See also +* [example integration](https://github.com/adyen-examples/adyen-node-online-payments) \ No newline at end of file From 54bbb3858e7b4bcd4983f481a5968a764af87f40 Mon Sep 17 00:00:00 2001 From: wouterboe Date: Tue, 4 May 2021 16:46:19 +0200 Subject: [PATCH 2/5] bug fix in PaymentCompletionDetails --- src/__tests__/checkout.spec.ts | 4 ++-- src/typings/checkout/paymentCompletionDetails.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/__tests__/checkout.spec.ts b/src/__tests__/checkout.spec.ts index 5706f58..81e9c2b 100644 --- a/src/__tests__/checkout.spec.ts +++ b/src/__tests__/checkout.spec.ts @@ -61,8 +61,8 @@ function createAmountObject(currency: string, value: number): Amount { function createPaymentsDetailsRequest(): DetailsRequest { return { details: { - mD: "mdValue", - paRes: "paResValue", + MD: "mdValue", + PaRes: "paResValue", }, paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", }; diff --git a/src/typings/checkout/paymentCompletionDetails.ts b/src/typings/checkout/paymentCompletionDetails.ts index c53ca58..ab153bc 100644 --- a/src/typings/checkout/paymentCompletionDetails.ts +++ b/src/typings/checkout/paymentCompletionDetails.ts @@ -14,15 +14,15 @@ export class PaymentCompletionDetails { /** * A payment session identifier returned by the card issuer. */ - 'mD'?: string; + 'MD'?: string; /** * (3D) Payment Authentication Request data for the card issuer. */ - 'paReq'?: string; + 'PaReq'?: string; /** * (3D) Payment Authentication Response data by the card issuer. */ - 'paRes'?: string; + 'PaRes'?: string; /** * PayPal-generated token for recurring payments. */ From c4d8acd8e7ebb4485a2d20e60098369f27e420af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 04:03:33 +0000 Subject: [PATCH 3/5] Bump acorn from 8.2.2 to 8.2.4 Bumps [acorn](https://github.com/acornjs/acorn) from 8.2.2 to 8.2.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/8.2.2...8.2.4) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- yarn.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 252d6df..702467f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1185,9 +1185,9 @@ "dev": true }, "acorn": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.2.tgz", - "integrity": "sha512-VrMS8kxT0e7J1EX0p6rI/E0FbfOVcvBpbIqHThFv+f8YrZIlMfVotYcXKVPmTvPW8sW5miJzfUFrrvthUZg8VQ==", + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz", + "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==", "dev": true }, "acorn-globals": { diff --git a/yarn.lock b/yarn.lock index 4b41122..c89f30c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -908,9 +908,9 @@ acorn@^7.1.0, acorn@^7.1.1: integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== acorn@^8.0.1: - version "8.2.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.2.tgz#c4574e4fea298d6e6ed4b85ab844b06dd59f26d6" - integrity sha512-VrMS8kxT0e7J1EX0p6rI/E0FbfOVcvBpbIqHThFv+f8YrZIlMfVotYcXKVPmTvPW8sW5miJzfUFrrvthUZg8VQ== + version "8.2.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.4.tgz#caba24b08185c3b56e3168e97d15ed17f4d31fd0" + integrity sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg== agent-base@6: version "6.0.1" From 835638351f56b5d1858fe99fa80fb1c85e824102 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 04:06:17 +0000 Subject: [PATCH 4/5] Bump dotenv from 8.2.0 to 8.4.0 Bumps [dotenv](https://github.com/motdotla/dotenv) from 8.2.0 to 8.4.0. - [Release notes](https://github.com/motdotla/dotenv/releases) - [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) - [Commits](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.4.0) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- yarn.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 252d6df..f3b1781 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2373,9 +2373,9 @@ } }, "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.4.0.tgz", + "integrity": "sha512-l+pIWjvRva0AhnLerv9VvpscgXa72iPW1qKlCgA7COzJA414vGQ/PMcOuNfR1CmQbK208WWYeVwQUa8yfuqH8Q==", "dev": true }, "duplexer3": { diff --git a/yarn.lock b/yarn.lock index 4b41122..2572431 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1784,9 +1784,9 @@ dot-prop@^5.2.0: is-obj "^2.0.0" dotenv@^8.2.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" - integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + version "8.4.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.4.0.tgz#08576a9d5dc63b4fc58df087015c768eb102e0f3" + integrity sha512-l+pIWjvRva0AhnLerv9VvpscgXa72iPW1qKlCgA7COzJA414vGQ/PMcOuNfR1CmQbK208WWYeVwQUa8yfuqH8Q== duplexer3@^0.1.4: version "0.1.4" From 5fa5c33d6bb2e52b8afd5fd60f04fe70ebdf8dac Mon Sep 17 00:00:00 2001 From: wouterboe Date: Wed, 5 May 2021 10:10:42 +0200 Subject: [PATCH 5/5] set live endpoint for terminal API in Client --- src/client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client.ts b/src/client.ts index 3345dc3..4a5c97f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -111,6 +111,7 @@ class Client { this.config.endpoint = Client.ENDPOINT_LIVE; this.config.marketPayEndpoint = Client.MARKETPAY_ENDPOINT_LIVE; this.config.hppEndpoint = Client.HPP_LIVE; + this.config.terminalApiCloudEndpoint = Client.TERMINAL_API_ENDPOINT_LIVE; if (liveEndpointUrlPrefix) { this.config.endpoint = `${Client.ENDPOINT_PROTOCOL}${liveEndpointUrlPrefix}${Client.ENDPOINT_LIVE_SUFFIX}`;