Compare commits

...

95 Commits

Author SHA1 Message Date
jillingk
b76846c031 Update package.json (#1084) 2023-01-20 09:15:22 +01:00
jillingk
bf1e643973 [PW-7765] add create/disablePermit and simple UT (#1082)
* add create/disablePermit and simple UT

* Add serializer for Date objects and quick test

Co-authored-by: Michael Paul <michael@michaelpaul.com.br>
2023-01-19 16:57:26 +01:00
Michael Paul
316542a166 PW-7514: Fully Generated Management API client (#1064)
* PW-7514: Update models

* PW-7514: Switch to JAR based installation

* PW-7514: Default API template

* PW-7514: Customize API template

* PW-7514: Serialize request

* PW-7514: Query string

* PW-7514: Fix version patch

* PW-7514: Client generated

* PW-7514: Export class by default

* PW-7514: Make path and body params required

* PW-7514: Dynamic service name

* PW-7514: Link all classes into one parent

* PW-7514: Dynamic method names

* PW-7514: Fix merge issues

* PW-7514: Generate using latest specs

Co-authored-by: jillingk <93914435+jillingk@users.noreply.github.com>
2023-01-19 15:59:16 +01:00
Wouter Boereboom
8c451502e3 Remove LGTM badges from README (#1080) 2023-01-19 15:46:05 +01:00
Wouter Boereboom
bd70b93c08 update unit tests to test uniform error handling over APIs (#1079)
Co-authored-by: jillingk <93914435+jillingk@users.noreply.github.com>
2023-01-13 15:54:15 +01:00
renovate[bot]
fd7b05ab09 chore(deps): update dependency nock to v13.3.0 (#1081)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-12 09:49:03 +01:00
renovate[bot]
4ed7e77d0e chore(deps): update dependency @types/node to v14.18.36 (#1044)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-03 08:20:22 +01:00
Michael Paul
a289846a16 PW-7502: Bind QueryString type to URLSearchParams (#1077) 2022-12-30 13:22:21 +01:00
Wouter Boereboom
277edb212c remove API calls from unit tests. Remove ASCII headers from test files, use typings index in test classes. add missing entries to typings index class (#1075) 2022-12-23 10:05:52 +01:00
Wouter Boereboom
be9194fafe add basic auth option to the client (#1076) 2022-12-22 10:38:07 +01:00
renovate[bot]
f210123964 Update dependency typescript to v4.9.4 (#1073)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-22 10:18:50 +01:00
Wouter Boereboom
872f86064f Add banner to README (#1074) 2022-12-14 11:07:55 +01:00
Wouter Boereboom
ba18fcb181 Pw 7156/update readme (#1069)
* update README

* fix link to integration section

* add webhooks to README.md

* fix bullet lists in README

* minor code example fix

* process feedback

* Update README.md

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* Update README.md

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* Grammar

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>
2022-12-05 16:04:59 +01:00
Wouter Boereboom
79aaf6580e update .npmignore (#1072) 2022-12-05 15:37:44 +01:00
renovate[bot]
2d6330b552 Update dependency ts-loader to v9 (#1055)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-02 09:27:55 +01:00
renovate[bot]
ad540c8964 Update dependency typescript to v4.9.3 (#1050)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-30 14:01:37 +01:00
renovate[bot]
e10cd25364 Update dependency eslint to v8.28.0 (#1057)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-30 13:28:37 +01:00
Wouter Boereboom
7ed7299480 Delete dependabot.yml (#1059) 2022-11-30 13:07:43 +01:00
Wouter Boereboom
c8220fe6d4 fix: add balancePlatform to services index (#1068) 2022-11-30 12:58:05 +01:00
Wouter Boereboom
790c880eef add dataProtection service to library (#1063)
* add dataProtection service to library

* add missing import

* fix mock class for unit test
2022-11-30 12:51:27 +01:00
renovate[bot]
e3a2918fa9 Update actions/checkout action to v3 (#1052)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-11-30 08:46:33 +01:00
dependabot[bot]
aa35700e88 Bump @typescript-eslint/parser from 5.43.0 to 5.45.0 (#1067)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.43.0 to 5.45.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-30 08:39:45 +01:00
renovate[bot]
7a8ef2bc40 Update actions/setup-node action to v3 (#1053)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-21 15:25:07 +01:00
jillingk
791f68163a Changed name of Value to BarcodeValue corresponding to docs(and API) (#1051) 2022-11-18 14:50:54 +01:00
renovate[bot]
91306b86d3 Update dependency @typescript-eslint/parser to v5.43.0 (#1046)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-18 09:09:18 +01:00
renovate[bot]
086b8bc929 Update dependency eslint to v8.27.0 (#1047)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-18 09:05:23 +01:00
Eoin Falconer
8aa158b943 Arribatec/fix terminal comms typo (#1029)
* Fix the namings of CommunicationOKFlag

* Revert "Fix the namings of CommunicationOKFlag"

This reverts commit 15e85c2665947a87ce7cfd8b6dae5df0fde16cb1.

* Updated with correct linting

* Update pOIStatus.ts

Co-authored-by: jillingk <93914435+jillingk@users.noreply.github.com>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-11-18 08:47:40 +01:00
renovate[bot]
4ac101a30c Update dependency @types/jest to v27.5.2 (#1043)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-18 08:33:35 +01:00
renovate[bot]
533a07c87e Add renovate.json (#1042)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-18 08:30:51 +01:00
dependabot[bot]
37b752de49 Bump @typescript-eslint/eslint-plugin from 5.41.0 to 5.43.0 (#1039)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.41.0 to 5.43.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.43.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-15 17:07:59 +01:00
wouterboe
59ce9c5d37 bump version for release 12.1.0 2022-10-28 16:47:02 +02:00
Wouter Boereboom
f5efb595ef Merge branch 'main' into develop 2022-10-28 16:32:33 +02:00
AdyenAutomationBot
50548c1857 [create-pull-request] automated change (#980) 2022-10-28 16:28:50 +02:00
dependabot[bot]
a298fa84fb Bump eslint from 8.25.0 to 8.26.0 (#1023)
Bumps [eslint](https://github.com/eslint/eslint) from 8.25.0 to 8.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.25.0...v8.26.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-10-28 08:50:06 +02:00
dependabot[bot]
e6d369506e Bump acorn from 8.8.0 to 8.8.1 (#1024)
Bumps [acorn](https://github.com/acornjs/acorn) from 8.8.0 to 8.8.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/8.8.0...8.8.1)

---
updated-dependencies:
- dependency-name: acorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-10-28 08:49:37 +02:00
dependabot[bot]
e084599757 Bump @typescript-eslint/parser from 5.40.1 to 5.41.0 (#1025)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.40.1 to 5.41.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.41.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-28 08:49:19 +02:00
dependabot[bot]
4246674d29 Bump @typescript-eslint/eslint-plugin from 5.40.1 to 5.41.0 (#1026)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.40.1 to 5.41.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.41.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-10-28 08:45:12 +02:00
Wouter Boereboom
ffbf955b95 Pw 6850/bank issueing fund transfers (#1027)
* add TransferService to Makefile

* add transfers API to library

* update typings and add unit tests
2022-10-27 16:45:47 +02:00
Wouter Boereboom
0d6535f32c Merge pull request #1020 from Adyen/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.40.1
Bump @typescript-eslint/eslint-plugin from 5.40.0 to 5.40.1
2022-10-19 08:57:15 +02:00
dependabot[bot]
343e04f475 Bump @typescript-eslint/eslint-plugin from 5.40.0 to 5.40.1
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.40.0 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 06:53:34 +00:00
Wouter Boereboom
f1f8161f2a Merge pull request #1021 from Adyen/dependabot/npm_and_yarn/typescript-eslint/parser-5.40.1
Bump @typescript-eslint/parser from 5.40.0 to 5.40.1
2022-10-19 08:52:05 +02:00
dependabot[bot]
ba8f2b44f3 Bump @typescript-eslint/parser from 5.40.0 to 5.40.1
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.40.0 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 04:02:07 +00:00
Wouter Boereboom
898be12d1c Merge pull request #1014 from Adyen/fix/LEM_service_index
add LEM service to services index
2022-10-14 08:56:33 +02:00
Wouter Boereboom
d0ba69a3a8 Merge branch 'develop' into fix/LEM_service_index 2022-10-14 08:52:59 +02:00
Wouter Boereboom
83662185f8 Merge pull request #1015 from Adyen/dependabot/npm_and_yarn/eslint-8.25.0
Bump eslint from 8.24.0 to 8.25.0
2022-10-14 08:51:59 +02:00
Wouter Boereboom
9eb30e7a25 Merge branch 'develop' into dependabot/npm_and_yarn/eslint-8.25.0 2022-10-14 08:51:52 +02:00
Wouter Boereboom
2d3eccf188 Merge pull request #1017 from Adyen/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.40.0
Bump @typescript-eslint/eslint-plugin from 5.39.0 to 5.40.0
2022-10-14 08:51:42 +02:00
dependabot[bot]
962c8d62cd Bump @typescript-eslint/eslint-plugin from 5.39.0 to 5.40.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.39.0 to 5.40.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-14 06:27:51 +00:00
dependabot[bot]
3e134634c0 Bump eslint from 8.24.0 to 8.25.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.24.0 to 8.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.24.0...v8.25.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-14 06:27:04 +00:00
Wouter Boereboom
8d7fec9d21 Merge pull request #1018 from Adyen/dependabot/npm_and_yarn/minimist-1.2.7
Bump minimist from 1.2.6 to 1.2.7
2022-10-14 08:24:26 +02:00
Wouter Boereboom
02996d6b9c Merge branch 'develop' into dependabot/npm_and_yarn/minimist-1.2.7 2022-10-14 08:24:03 +02:00
Wouter Boereboom
a3ac8b1144 Merge pull request #1019 from Adyen/dependabot/npm_and_yarn/typescript-eslint/parser-5.40.0
Bump @typescript-eslint/parser from 5.39.0 to 5.40.0
2022-10-14 08:23:52 +02:00
dependabot[bot]
7e790b6bfb Bump @typescript-eslint/parser from 5.39.0 to 5.40.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.39.0 to 5.40.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 04:02:43 +00:00
dependabot[bot]
3b24e07cd3 Bump minimist from 1.2.6 to 1.2.7
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 04:02:26 +00:00
Ángel Campos
f382796730 Replace individual codeowners with Adyen JS Github team (#1016) 2022-10-10 13:58:40 +02:00
Wouter Boereboom
1e83db3465 add LEM service to services index 2022-10-06 13:01:02 +02:00
Wouter Boereboom
72d856d1d6 Merge pull request #1013 from Adyen/dependabot/npm_and_yarn/release-it-15.5.0
Bump release-it from 15.4.1 to 15.5.0
2022-10-04 10:25:38 +02:00
Wouter Boereboom
b13a666a84 Merge branch 'develop' into dependabot/npm_and_yarn/release-it-15.5.0 2022-10-04 10:21:38 +02:00
Wouter Boereboom
6f8389e6cc Merge pull request #1011 from Adyen/dependabot/npm_and_yarn/typescript-eslint/parser-5.39.0
Bump @typescript-eslint/parser from 5.36.2 to 5.39.0
2022-10-04 10:21:28 +02:00
Wouter Boereboom
b15ccd88cb Merge branch 'develop' into dependabot/npm_and_yarn/typescript-eslint/parser-5.39.0 2022-10-04 10:21:21 +02:00
Wouter Boereboom
d9574bcfea Merge pull request #1009 from Adyen/dependabot/npm_and_yarn/dotenv-16.0.3
Bump dotenv from 16.0.1 to 16.0.3
2022-10-04 10:21:12 +02:00
Wouter Boereboom
677fe3cc8e Merge branch 'develop' into dependabot/npm_and_yarn/dotenv-16.0.3 2022-10-04 10:21:05 +02:00
Wouter Boereboom
983f8777e6 Merge pull request #1008 from Adyen/dependabot/npm_and_yarn/vm2-3.9.11
Bump vm2 from 3.9.10 to 3.9.11
2022-10-04 10:20:55 +02:00
Wouter Boereboom
81e4ee018e Merge branch 'develop' into dependabot/npm_and_yarn/vm2-3.9.11 2022-10-04 10:20:44 +02:00
Wouter Boereboom
163446bfab Merge pull request #1007 from Adyen/dependabot/npm_and_yarn/typescript-4.8.4
Bump typescript from 4.8.2 to 4.8.4
2022-10-04 10:20:33 +02:00
dependabot[bot]
0fda83998f Bump release-it from 15.4.1 to 15.5.0
Bumps [release-it](https://github.com/release-it/release-it) from 15.4.1 to 15.5.0.
- [Release notes](https://github.com/release-it/release-it/releases)
- [Changelog](https://github.com/release-it/release-it/blob/master/CHANGELOG.md)
- [Commits](https://github.com/release-it/release-it/compare/15.4.1...15.5.0)

---
updated-dependencies:
- dependency-name: release-it
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:12:53 +00:00
dependabot[bot]
f9ee123b7d Bump dotenv from 16.0.1 to 16.0.3
Bumps [dotenv](https://github.com/motdotla/dotenv) from 16.0.1 to 16.0.3.
- [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/v16.0.1...v16.0.3)

---
updated-dependencies:
- dependency-name: dotenv
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:12:34 +00:00
dependabot[bot]
ca0d866c18 Bump @typescript-eslint/parser from 5.36.2 to 5.39.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.36.2 to 5.39.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.39.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:12:29 +00:00
dependabot[bot]
a3683f6192 Bump typescript from 4.8.2 to 4.8.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.2 to 4.8.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.2...v4.8.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:12:14 +00:00
dependabot[bot]
d33a206543 Bump vm2 from 3.9.10 to 3.9.11
Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.10 to 3.9.11.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patriksimek/vm2/compare/3.9.10...3.9.11)

---
updated-dependencies:
- dependency-name: vm2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:11:00 +00:00
Wouter Boereboom
e28a72a6fa Merge pull request #1003 from Adyen/dependabot/npm_and_yarn/eslint-8.24.0
Bump eslint from 8.23.0 to 8.24.0
2022-10-04 09:10:06 +02:00
dependabot[bot]
01503307d0 Bump eslint from 8.23.0 to 8.24.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.23.0 to 8.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.23.0...v8.24.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 07:09:18 +00:00
Wouter Boereboom
2b1d2266f3 Merge pull request #1012 from Adyen/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.39.0
Bump @typescript-eslint/eslint-plugin from 5.35.1 to 5.39.0
2022-10-04 09:05:50 +02:00
dependabot[bot]
9021e205fc Bump @typescript-eslint/eslint-plugin from 5.35.1 to 5.39.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.35.1 to 5.39.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.39.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 04:03:10 +00:00
jillingk
ad5559c55a [PW-6847] Add support for LEM endpoints (#999)
* Generate models and add services

* Makefile changes and document

* PW-6847: Mocks

* Update src/__tests__/legalEntityManagement.spec.ts

Co-authored-by: Michael Paul <michael@michaelpaul.com.br>

* small fix and renames

* Update src/__tests__/balancePlatform.spec.ts

Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>

* modified README and index

* Update src/services/resource/legalEntityManagementResource.ts

Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>

* Update src/services/resource/legalEntityManagementResource.ts

Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>

Co-authored-by: michaelpa <michael.paul@adyen.com>
Co-authored-by: Michael Paul <michael@michaelpaul.com.br>
Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
2022-09-30 13:48:35 +02:00
jillingk
61a634def0 Merge pull request #997 from Adyen/fix/abort
[PW-7079] fix abort request localterminal API
2022-09-30 11:42:43 +02:00
jillingk
078b120725 Merge branch 'develop' into fix/abort 2022-09-30 11:11:20 +02:00
Michael Paul
0138e148e7 PW-7094: Dynamic title and body for automatic PR (#1006) 2022-09-28 15:34:33 +02:00
Jilling Kingma
aefb0e5e19 made simple if statement instead of catch block 2022-09-28 11:05:55 +02:00
Jilling Kingma
692a133058 return undefined response item 2022-09-19 14:18:46 +02:00
Jilling Kingma
e36af2f7c7 add catch block for nexocryptoexception 2022-09-19 13:28:56 +02:00
Jilling Kingma
9a12c9e46b Changed solution to try catch block and custom error 2022-09-19 11:20:46 +02:00
Jilling Kingma
1d365df9c8 Added jsonResponse empty string catch 2022-09-14 09:34:55 +02:00
Wouter Boereboom
bcdc42bd7a Merge pull request #989 from Adyen/dependabot/npm_and_yarn/release-it-15.4.1
Bump release-it from 15.4.0 to 15.4.1
2022-09-06 08:23:29 +02:00
Wouter Boereboom
d6ae7af069 Merge branch 'develop' into dependabot/npm_and_yarn/release-it-15.4.1 2022-09-06 08:21:21 +02:00
Wouter Boereboom
35542e5bce Merge pull request #991 from Adyen/dependabot/npm_and_yarn/typescript-eslint/parser-5.36.2
Bump @typescript-eslint/parser from 5.35.1 to 5.36.2
2022-09-06 08:21:06 +02:00
dependabot[bot]
b955690774 Bump @typescript-eslint/parser from 5.35.1 to 5.36.2
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.35.1 to 5.36.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.36.2/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-06 04:02:44 +00:00
dependabot[bot]
022f85b343 Bump release-it from 15.4.0 to 15.4.1
Bumps [release-it](https://github.com/release-it/release-it) from 15.4.0 to 15.4.1.
- [Release notes](https://github.com/release-it/release-it/releases)
- [Changelog](https://github.com/release-it/release-it/blob/master/CHANGELOG.md)
- [Commits](https://github.com/release-it/release-it/compare/15.4.0...15.4.1)

---
updated-dependencies:
- dependency-name: release-it
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-01 04:02:28 +00:00
Kilian Brachtendorf
e1f05edba1 update readme links to point to currently supported version of api docs (#982)
update support address pointing to 301 redirect address with invalid certificate
2022-08-29 11:49:05 +02:00
Wouter Boereboom
b8407eac70 Merge pull request #979 from Adyen/dependabot/npm_and_yarn/typescript-4.8.2
Bump typescript from 4.7.4 to 4.8.2
2022-08-29 09:33:19 +02:00
Wouter Boereboom
1f8b6351ce Merge branch 'develop' into dependabot/npm_and_yarn/typescript-4.8.2 2022-08-29 09:30:15 +02:00
Wouter Boereboom
93dad27fca Merge pull request #983 from Adyen/dependabot/npm_and_yarn/eslint-8.23.0
Bump eslint from 8.22.0 to 8.23.0
2022-08-29 09:29:56 +02:00
dependabot[bot]
1b42fa2125 Bump eslint from 8.22.0 to 8.23.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.22.0 to 8.23.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.22.0...v8.23.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-29 04:01:21 +00:00
Michael Paul
d47a876123 Bump Node version for the release workflow (#981) 2022-08-26 14:23:55 +02:00
dependabot[bot]
fb170c2f88 Bump typescript from 4.7.4 to 4.8.2
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.4 to 4.8.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.4...v4.8.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-26 04:01:25 +00:00
318 changed files with 12165 additions and 2045 deletions

2
.github/CODEOWNERS vendored
View File

@@ -1 +1 @@
* @zaiddreakh @maassenbas @AlexandrosMor @peterojo @wboereboom @michaelpaul
* @Adyen/javascript

View File

@@ -1,14 +0,0 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
reviewers:
- "zaiddreakh"
- "maassenbas"
- "AlexandrosMor"
- "peterojo"
- "wboereboom"

View File

@@ -13,7 +13,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.

View File

@@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.x

View File

@@ -8,8 +8,14 @@ jobs:
name: Generate Models
steps:
- uses: actions/checkout@v3
- name: Generate models
run: make models
- run: make models
- name: Set PR variables
id: vars
run: |
cd build/spec
echo ::set-output name=pr_title::"Update models"
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new models on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
@@ -18,7 +24,7 @@ jobs:
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
base: develop
branch: automation/models
title: Update models
body: OpenAPI spec or templates produced new models.
title: ${{ steps.vars.outputs.pr_title }}
body: ${{ steps.vars.outputs.pr_body }}
add-paths: |
src/typings

View File

@@ -12,9 +12,9 @@ jobs:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install, lint and test

View File

@@ -9,10 +9,10 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 14
registry-url: https://registry.npmjs.org/
- run: |
npm install

View File

@@ -9,7 +9,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Disabling shallow clone to improve relevancy of SonarCloud reporting
fetch-depth: 0

View File

@@ -1,11 +1,16 @@
src/
.babelrc
.eslintignore
.eslintrc.json
.eslintrc.js
.gitignore
.travis.yml
.release-it.json
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Makefile
config.ts
renovate.json
tsconfig.json
jest.config.js
tslint.json
webpack.config.js
.github
/**/__mocks__/
/**/__tests__/

View File

@@ -1,46 +1,74 @@
generator:=typescript-node
openapi-generator-cli:=docker run --user $(shell id -u):$(shell id -g) --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
services:=binlookup checkout storedValue terminalManagement payments recurring payouts management balancePlatform platformsAccount platformsFund platformsNotificationConfiguration platformsHostedOnboardingPage
openapi-generator-version:=5.4.0
openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi-generator-version)/openapi-generator-cli-$(openapi-generator-version).jar
openapi-generator-jar:=build/openapi-generator-cli.jar
openapi-generator-cli:=java -jar $(openapi-generator-jar)
services:=balancePlatform binlookup checkout dataProtection legalEntityManagement management payments payouts platformsAccount platformsFund platformsHostedOnboardingPage platformsNotificationConfiguration recurring storedValue terminalManagement transfer
# Generate models (for each service)
models: $(services)
binlookup: spec=BinLookupService-v52
checkout: spec=CheckoutService-v69
dataProtection: spec=DataProtectionService-v1
storedValue: spec=StoredValueService-v46
terminalManagement: spec=TfmAPIService-v1
payments: spec=PaymentService-v68
recurring: spec=RecurringService-v68
payouts: spec=PayoutService-v68
management: spec=ManagementService-v1
managementapi: spec=ManagementService-v1
managementapi: service=management
legalEntityManagement: spec=LegalEntityService-v2
balancePlatform: spec=BalancePlatformService-v2
platformsAccount: spec=AccountService-v6
platformsFund: spec=FundService-v6
platformsNotificationConfiguration: spec=NotificationConfigurationService-v6
platformsHostedOnboardingPage: spec=HopService-v6
transfer: spec=TransferService-v3
$(services): build/spec
$(services): build/spec $(openapi-generator-jar)
rm -rf src/typings/$@ build/model
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-t templates/typescript \
-o build \
--global-property models,supportingFiles
--global-property models,supportingFiles \
--additional-properties=serviceName=$@
mv build/model src/typings/$@
# Service
managementapi: build/spec $(openapi-generator-jar)
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-t templates/typescript \
-o build \
--api-package $(service) \
--model-package typings/$(service) \
--global-property apis \
--additional-properties=serviceName=$(service)
cp build/$(service)/* src/services/$(service)
sed -i.bak '/RestServiceError/d' src/services/$(service)/*
rm src/services/$(service)/*.bak
# Checkout spec (and patch version)
build/spec:
git clone https://github.com/Adyen/adyen-openapi.git build/spec
sed -i 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
perl -i -pe's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
# Extract templates (copy them for modifications)
templates:
templates: $(openapi-generator-jar)
$(openapi-generator-cli) author template -g $(generator) -o build/templates/typescript
# Download the generator
$(openapi-generator-jar):
wget --quiet -o /dev/null $(openapi-generator-url) -O $(openapi-generator-jar)
# Discard generated artifacts and changed models
clean:
git checkout src/typings
git clean -f -d src/typings
git checkout src/typings src/services/management
git clean -f -d src/typings src/services/management
.PHONY: templates models $(services)

137
README.md
View File

@@ -1,3 +1,6 @@
![Node js](https://user-images.githubusercontent.com/62436079/207373079-9cf9377f-f530-4b02-a515-9b64ef7b06e7.png)
# Adyen Node.js API Library
![Node.js CI](https://github.com/Adyen/adyen-node-api-library/workflows/Node.js%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/Adyen/adyen-node-api-library/badge.svg?branch=main)](https://coveralls.io/github/Adyen/adyen-node-api-library?branch=main)
@@ -5,38 +8,38 @@
![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@adyen/api-library.svg)
[![Version](https://img.shields.io/npm/v/@adyen/api-library.svg)](https://www.npmjs.com/package/@adyen/api-library)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Adyen_adyen-node-api-library&metric=alert_status)](https://sonarcloud.io/dashboard?id=Adyen_adyen-node-api-library)
[![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)
This is the officially supported NodeJS library for using Adyen's APIs.
## Integration
## Supported API versions
The Library supports all APIs under the following services:
* [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: **v52**
* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview): Our latest integration for accepting online payments. Current supported version: **v69**
* [Configuration API](https://docs.adyen.com/api-explorer/#/balanceplatform/v2/overview): The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. Current supported verison: **v2**
* [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference): Our point-of-sale integration.
* [Management API](https://docs.adyen.com/api-explorer/#/ManagementService/v1/overview): Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. Current supported version **v1**
* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v68/overview): Our classic integration for online payments. Current supported version: **v68**
* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v68**
* [Platforms APIs](https://docs.adyen.com/platforms/api): Set of APIs when using Adyen for Platforms. This API is used for the classic integration.
* [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**
* [Hosted onboarding API](https://docs.adyen.com/api-explorer/#/Hop/v6/overview): Current supported version: **v6**
* [Notification Configuration API](https://docs.adyen.com/api-explorer/#/NotificationConfigurationService/v6/overview) Current supported version: **v6**
* [POS Terminal Management API](https://docs.adyen.com/api-explorer/#/postfmapi/v1/overview): Endpoints for managing your point-of-sale payment terminals. Current supported version **v1**
* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v68/overview): Endpoints for managing saved payment details. Current supported version: **v68**
* [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api): Manage both online and point-of-sale gift cards and other stored-value cards. Current supported version: **v46**
In addition it supports the following type collections:
* [Platforms Notifications Webhooks](https://docs.adyen.com/api-explorer/#/NotificationService/v6/overview) Current supported version: **v6**
| API | Description | Service Name | Supported version |
| --- | ----------- | ------------ | ----------------- |
|[BIN lookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v52/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | **v52** |
| [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview)| Our latest integration for accepting online payments. | CheckoutAPI | **v69** |
| [Configuration API](https://docs.adyen.com/api-explorer/#/balanceplatform/v2/overview)| The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | BalancePlatform | **v2** |
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | DataProtection | **v1** |
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/#/legalentity/v2/overview)| Manage legal entities that contain information required for verification. | LegalEntityManagement | **v2** |
| [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference)| Our point-of-sale integration. | TerminalLocalAPI or TerminalCloudAPI | - |
| [Management API](https://docs.adyen.com/api-explorer/#/ManagementService/v1/overview)| Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | Management | **v1** |
| [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v68/overview)| Our classic integration for online payments. | ClassicIntegrationAPI | **v68** |
| [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v68/overview)| Endpoints for sending funds to your customers. | Payout | **v68** |
| [Platforms APIs](https://docs.adyen.com/platforms/api)| Set of APIs when using Adyen for Platforms. This API is used for the classic integration. | Platforms | - |
| [Account API](https://docs.adyen.com/api-explorer/#/Account/v6/overview) | *Platforms subclass* | Account | **v6** |
| [Fund API](https://docs.adyen.com/api-explorer/#/Fund/v6/overview) | *Platforms subclass* | Fund | **v6** |
| [Hosted onboarding API](https://docs.adyen.com/api-explorer/#/Hop/v6/overview)| *Platforms subclass* | HostedOnboardingPage | **v6** |
| [Notification Configuration API](https://docs.adyen.com/api-explorer/#/NotificationConfigurationService/v6/overview) | *Platforms subclass* | NotificationConfiguration | **v6** |
| [Platforms Notifications Webhooks](https://docs.adyen.com/api-explorer/#/NotificationService/v6/overview) || *Models only* | **v6** |
| [POS Terminal Management API](https://docs.adyen.com/api-explorer/#/postfmapi/v1/overview)| Endpoints for managing your point-of-sale payment terminals. | TerminalManagement | **v1** |
| [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v68/overview)| Endpoints for managing saved payment details. | Recurring | **v68** |
| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | Manage both online and point-of-sale gift cards and other stored-value cards. | StoredValue | **v46** |
| [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) | The Transfers API provides endpoints that can be used to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | Transfers | **v3** |
| [Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | Adyen uses webhooks to send notifications about payment status updates, newly available reports, and other events that can be subscribed to. For more information, refer to our [documentation](https://docs.adyen.com/development-resources/webhooks). | *Models only* | **v1** |
For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).
## Prerequisites
- [Adyen test account](https://docs.adyen.com/get-started-with-adyen)
- [Adyen test account](https://docs.adyen.com/get-started-with-adyen). To start using Adyen APIs, you will need a Merchant Account.
- [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 12 or higher
@@ -55,21 +58,93 @@ Alternatively, you can download the [release on GitHub](https://github.com/Adyen
## Using the library
### General use with API key
### Client initialisation
#### 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"});
const { Client } = require('@adyen/api-library');
const client = new Client({apiKey: "YOUR_API_KEY", environment: "TEST"});
```
### General use with API key for live environment
#### General use with API key for live environment
```typescript
const client = new Client({apiKey: "YOUR_API_KEY", environment: "LIVE"});
const { Client } = require('@adyen/api-library');
const client = new Client({apiKey: "YOUR_API_KEY", environment: "LIVE"});
```
### General use with basic auth
#### General use with basic auth
```typescript
const client = new Client({username: "YOUR_USERNAME", password: "YOUR_PASSWORD", environment: "TEST"});
const { Client } = require('@adyen/api-library');
const client = new Client({username: "YOUR_USERNAME", password: "YOUR_PASSWORD", environment: "TEST"});
```
### Consuming Services
Every API the library supports is represented by a service object. The name of the service matching the corresponding API is listed in the [Integrations](#supported-api-versions) section of this document.
```javascript
const { Client, CheckoutAPI } = require('@adyen/api-library');
const client = new Client({apiKey: "YOUR_API_KEY", environment: "TEST"});
const paymentRequest = {
amount: {
currency: "USD",
value: 1000 // value in minor units
},
reference: "Your order number",
paymentMethod: {
type: "scheme",
encryptedCardNumber: "test_4111111111111111",
encryptedExpiryMonth: "test_03",
encryptedExpiryYear: "test_2030",
encryptedSecurityCode: "test_737"
},
shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
storePaymentMethod: true,
shopperInteraction: "Ecommerce",
recurringProcessingModel: "CardOnFile",
returnUrl: "https://your-company.com/...",
merchantAccount: "YOUR_MERCHANT_ACCOUNT"
};
const checkoutAPI = new CheckoutAPI(client);
checkoutAPI.payments(paymentRequest)
.then( paymentResponse => console.log(paymentResponse.pspReference))
.catch(error => console.log(error));
```
Alternatively you can make use of the Types included in this library using Typescript, and/or use the async syntax:
```typescript
const { Client, CheckoutAPI } = require('@adyen/api-library');
const client = new Client({apiKey: "YOUR_API_KEY", environment: "TEST"});
import { Types } from '@adyen/api-library';
const doPaymentsRequest = async () => {
const paymentRequest : Types.checkout.PaymentRequest = {
amount: {
currency: "USD",
value: 1000 // value in minor units
},
reference: "Your order number",
paymentMethod: {
type: Types.checkout.CardDetails.TypeEnum.Scheme,
encryptedCardNumber: "test_4111111111111111",
encryptedExpiryMonth: "test_03",
encryptedExpiryYear: "test_2030",
encryptedSecurityCode: "test_737"
},
shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
storePaymentMethod: true,
shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.Ecommerce,
recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.CardOnFile,
returnUrl: "https://your-company.com/...",
merchantAccount: "YOUR_MERCHANT_ACCOUNT"
};
const checkoutAPI = new CheckoutAPI(client);
const paymentResponse : Types.checkout.PaymentResponse = await checkoutAPI.payments(paymentRequest);
console.log(paymentResponse.pspReference);
}
doPaymentsRequest();
```
### 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`:
@@ -131,7 +206,7 @@ We strongly encourage you to join us in contributing to this repository so every
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/).
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://www.adyen.help).
## Licence
This repository is available under the [MIT license](LICENSE).

View File

@@ -1,6 +1,6 @@
{
"name": "@adyen/api-library",
"version": "12.0.0",
"version": "12.2.0",
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
@@ -35,30 +35,30 @@
"author": "Ricardo Ambrogi",
"license": "MIT",
"devDependencies": {
"@types/jest": "27.5.0",
"@types/jest": "27.5.2",
"@types/nock": "11.1.0",
"@typescript-eslint/eslint-plugin": "5.35.1",
"@typescript-eslint/parser": "5.35.1",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.45.0",
"acorn": "^8.0.1",
"coveralls": "3.1.1",
"dotenv": "^16.0.0",
"eslint": "8.22.0",
"eslint": "8.28.0",
"jest": "^27.0.6",
"jest-ts-auto-mock": "^2.0.0",
"kind-of": "^6.0.3",
"minimist": ">=1.2.3",
"nock": "13.2.9",
"release-it": "15.4.0",
"nock": "13.3.0",
"release-it": "15.5.0",
"ts-auto-mock": "^3.3.5",
"ts-jest": "^27.0.4",
"ts-loader": "8.0.10",
"ts-loader": "9.4.2",
"ttypescript": "^1.5.10",
"typescript": "4.7.4"
"typescript": "4.9.4"
},
"dependencies": {
"https-proxy-agent": "5.0.1"
},
"optionalDependencies": {
"@types/node": "14.0.9"
"@types/node": "14.18.36"
}
}

6
renovate.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}

View File

@@ -49,6 +49,9 @@ export const createClient = (apiKey = process.env.ADYEN_API_KEY): Client => {
config.terminalManagementEndpoint = Client.TERMINAL_MANAGEMENT_API_ENDPOINT_TEST;
config.managementEndpoint = Client.MANAGEMENT_API_ENDPOINT_TEST;
config.balancePlatformEndpoint = Client.BALANCE_PLATFORM_API_ENDPOINT_TEST;
config.legalEntityManagementEndpoint = Client.LEGAL_ENTITY_MANAGEMENT_API_ENDPOINT_TEST;
config.transfersEndpoint = Client.TRANSFERS_API_ENDPOINT_TEST;
config.dataProtectionEndpoint = Client.DATA_PROTECTION_API_ENDPOINT_TEST;
return new Client({ config });
};

View File

@@ -0,0 +1,233 @@
export const businessLineInfo = {
"capability": "issueBankAccount",
"industryCode": "55",
"webData": [
{
"webAddress": "https://www.adyen.com"
}
],
"legalEntityId": "LE322KT223222D5FJ7THR293F",
"sourceOfFunds": {
"type": "business",
"adyenProcessedFunds": "false",
"description": "Funds from my flower shop business"
}
};
export const businessLineInfoUpdate = {
"capability": "string",
"industryCode": "string",
"legalEntityId": "string",
"salesChannels": ["string"],
"sourceOfFunds": {
"acquiringBusinessLineId": "string",
"adyenProcessedFunds": false,
"description": "string",
"type": "business"
},
"webData": [{ "webAddress": "string" }],
"webDataExemption": { "reason": "noOnlinePresence" }
};
export const document = {
"attachment": {
"content": "string",
"contentType": "string",
"filename": "string",
"pageName": "string",
"pageType": "string"
},
"attachments": [{
"content": "string",
"contentType": "string",
"filename": "string",
"pageName": "string",
"pageType": "string"
}],
"description": "string",
"expiryDate": "string",
"fileName": "string",
"id": "string",
"issuerCountry": "string",
"issuerState": "string",
"number": "string",
"owner": {
"id": "string",
"type": "string"
},
"type": "bankStatement"
};
export const onboardingLinkInfo = {
"locale": "cs-CZ",
"redirectUrl": "https://your.redirect-url.com",
"themeId": "123456789"
};
export const legalEntityInfo = {
"type": "individual",
"individual": {
"residentialAddress": {
"city": "San Francisco",
"country": "US",
"postalCode": "94107",
"street": "Brannan Street 274",
"stateOrProvince": "CA"
},
"phone": {
"countryCode": "US",
"number": "5551231234",
"type": "mobile"
},
"name": {
"firstName": "Simone",
"lastName": "Hopper"
},
"birthData": {
"dateOfBirth": "1981-12-01"
},
"email": "s.hopper@example.com"
}
};
export const genericEntityInfo = {
"entityAssociations": [{
"associatorId": "string",
"entityType": "string",
"jobTitle": "string",
"legalEntityId": "string",
"name": "string",
"type": "signatory"
}],
"individual": {
"birthData": { "dateOfBirth": "string" },
"email": "string",
"identificationData": {
"expiryDate": "string",
"issuerCountry": "string",
"issuerState": "string",
"nationalIdExempt": false,
"number": "string",
"type": "bankStatement"
},
"name": {
"firstName": "string",
"infix": "string",
"lastName": "string"
},
"nationality": "string",
"phone": {
"number": "string",
"type": "string"
},
"residentialAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"taxInformation": [{
"country": "string",
"number": "string",
"type": "string"
}],
"webData": { "webAddress": "string" }
},
"organization": {
"description": "string",
"doingBusinessAs": "string",
"email": "string",
"legalName": "string",
"phone": {
"number": "string",
"type": "string"
},
"principalPlaceOfBusiness": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registeredAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registrationNumber": "string",
"stockData": {
"marketIdentifier": "string",
"stockNumber": "string",
"tickerSymbol": "string"
},
"taxInformation": [{
"country": "string",
"number": "string",
"type": "string"
}],
"taxReportingClassification": {
"businessType": "other",
"financialInstitutionNumber": "string",
"mainSourceOfIncome": "businessOperation",
"type": "nonFinancialNonReportable"
},
"type": "associationIncorporated",
"vatAbsenceReason": "industryExemption",
"vatNumber": "string",
"webData": { "webAddress": "string" }
},
"soleProprietorship": {
"countryOfGoverningLaw": "string",
"doingBusinessAs": "string",
"name": "string",
"principalPlaceOfBusiness": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registeredAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registrationNumber": "string",
"vatAbsenceReason": "industryExemption",
"vatNumber": "string"
}
};
export const transferInstrumentInfo = {
"bankAccount": {
"accountNumber": "string",
"accountType": "string",
"bankBicSwift": "string",
"bankCity": "string",
"bankCode": "string",
"bankName": "string",
"branchCode": "string",
"checkCode": "string",
"countryCode": "string",
"currencyCode": "string",
"iban": "string"
},
"legalEntityId": "string",
"recurringDetail": {
"merchantAccount": "string",
"reference": "string",
"shopperReference": "string"
},
"type": "bankAccount"
};

View File

@@ -0,0 +1,241 @@
export const businessLine = {
"capability": "receivePayments",
"id": "123456789",
"industryCode": "123456789",
"legalEntityId": "123456789",
"salesChannels": ["string"],
"sourceOfFunds": {
"acquiringBusinessLineId": "string",
"adyenProcessedFunds": false,
"description": "string",
"type": "business"
},
"webData": [{ "webAddress": "string" }],
"webDataExemption": { "reason": "noOnlinePresence" }
};
export const document = {
"attachment": {
"content": "string",
"contentType": "string",
"filename": "string",
"pageName": "string",
"pageType": "string"
},
"attachments": [{
"content": "string",
"contentType": "string",
"filename": "string",
"pageName": "string",
"pageType": "string"
}],
"description": "string",
"expiryDate": "string",
"fileName": "string",
"id": "123456789",
"issuerCountry": "string",
"issuerState": "string",
"number": "string",
"owner": {
"id": "123456789",
"type": "passport"
},
"type": "driversLicense"
};
export const onboardingLink = { "url": "https://your.redirect-url.com" };
export const onboardingThemes = {
"next": "string",
"previous": "string",
"themes": [{
"createdAt": "2022-10-31T01:30:00.000Z",
"description": "string",
"id": "123456789",
"properties": { "sample": "string" },
"updatedAt": "2022-10-31T01:30:00.000Z"
}]
};
export const onboardingTheme = {
"createdAt": "string",
"description": "string",
"id": "123456789",
"properties": { "sample": "string" },
"updatedAt": "string"
};
export const legalEntity = {
"documentDetails": [{
"active": false,
"fileName": "string",
"id": "string"
}],
"documents": [{ "id": "string" }],
"entityAssociations": [{
"associatorId": "string",
"entityType": "string",
"jobTitle": "string",
"legalEntityId": "string",
"name": "string",
"type": "signatory"
}],
"id": "123456789",
"individual": {
"birthData": { "dateOfBirth": "string" },
"email": "string",
"identificationData": {
"expiryDate": "string",
"issuerCountry": "string",
"issuerState": "string",
"nationalIdExempt": false,
"number": "string",
"type": "bankStatement"
},
"name": {
"firstName": "string",
"infix": "string",
"lastName": "string"
},
"nationality": "string",
"phone": {
"number": "string",
"type": "string"
},
"residentialAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"taxInformation": [{
"country": "string",
"number": "string",
"type": "string"
}],
"webData": { "webAddress": "string" }
},
"organization": {
"description": "string",
"doingBusinessAs": "string",
"email": "string",
"legalName": "string",
"phone": {
"number": "string",
"type": "string"
},
"principalPlaceOfBusiness": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registeredAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registrationNumber": "string",
"stockData": {
"marketIdentifier": "string",
"stockNumber": "string",
"tickerSymbol": "string"
},
"taxInformation": [{
"country": "string",
"number": "string",
"type": "string"
}],
"taxReportingClassification": {
"businessType": "other",
"financialInstitutionNumber": "string",
"mainSourceOfIncome": "businessOperation",
"type": "nonFinancialNonReportable"
},
"type": "associationIncorporated",
"vatAbsenceReason": "industryExemption",
"vatNumber": "string",
"webData": { "webAddress": "string" }
},
"reference": "string",
"soleProprietorship": {
"countryOfGoverningLaw": "string",
"doingBusinessAs": "string",
"name": "string",
"principalPlaceOfBusiness": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registeredAddress": {
"city": "string",
"country": "string",
"postalCode": "string",
"stateOrProvince": "string",
"street": "string",
"street2": "string"
},
"registrationNumber": "string",
"vatAbsenceReason": "industryExemption",
"vatNumber": "string"
},
"transferInstruments": [{ "id": "string" }],
"type": "individual"
};
export const businessLines = {
"businessLines": [{
"capability": "receivePayments",
"id": "123456789",
"industryCode": "123456789",
"legalEntityId": "123456789",
"salesChannels": ["string"],
"sourceOfFunds": {
"acquiringBusinessLineId": "string",
"adyenProcessedFunds": false,
"description": "string",
"type": "business"
},
"webData": [{ "webAddress": "string" }],
"webDataExemption": { "reason": "noOnlinePresence" }
}]
};
export const transferInstrument = {
"bankAccount": {
"accountNumber": "string",
"accountType": "string",
"bankBicSwift": "string",
"bankCity": "string",
"bankCode": "string",
"bankName": "string",
"branchCode": "string",
"checkCode": "string",
"countryCode": "string",
"currencyCode": "string",
"iban": "string"
},
"documentDetails": [{
"active": false,
"fileName": "string",
"id": "string"
}],
"id": "123456789",
"legalEntityId": "123456789",
"recurringDetail": {
"merchantAccount": "string",
"reference": "string",
"shopperReference": "string"
},
"type": "bankAccount"
};

View File

@@ -0,0 +1,135 @@
export const transfersSuccess = {
"id" : "1W1UG35U8A9J5ZLG",
"amount" : {
"value" : 110000,
"currency" : "EUR"
},
"balanceAccountId" : "BAB8B2C3D4E5F6G7H8D9J6GD4",
"category" : "bank",
"counterparty" : {
"accountHolder" : {
"fullName" : "A. Klaassen",
"address" : {
"city" : "San Francisco",
"country" : "US",
"postalCode" : "94678",
"stateOrProvince" : "CA",
"street" : "Brannan Street",
"street2" : "274"
}
},
"accountIdentification" : {
"type" : "numberBic",
"accountNumber" : "123456789",
"bic" : "BOFAUS3NXXX"
}
},
"priority" : "wire",
"referenceForBeneficiary" : "Your reference sent to the beneficiary",
"reference" : "Your internal reference for the transfer",
"description" : "Your description for the transfer",
"direction" : "outgoing",
"reason" : "approved",
"status" : "authorised"
};
export const getTransactionSuccess = {
"accountHolderId" : "AHA1B2C3D4E5F6G7H8I9J0",
"amount" : {
"currency" : "EUR",
"value" : 9887
},
"balanceAccountId" : "BAB8B2C3D4E5F6G7H8D9J6GD4",
"balancePlatform" : "YOUR_BALANCE_PLATFORM",
"bookingDate" : "2022-03-14T12:01:00+01:00",
"category" : "bank",
"counterparty" : {
"balanceAccountId" : "NL29ADYX0000000001"
},
"createdAt" : "2022-03-14T12:01:00+01:00",
"description" : "YOUR_DESCRIPTION",
"id" : "IZK7C25U7DYVX03Y",
"instructedAmount" : {
"currency" : "EUR",
"value" : 9887
},
"reference" : "2L6C6B5U7DYULLXC",
"referenceForBeneficiary" : "YOUR_REFERENCE_FOR_BENEFICIARY",
"status" : "booked",
"transferId" : "2QP32A5U7IWC5WKG",
"type" : "bankTransfer",
"valueDate" : "2022-03-14T12:01:00+01:00"
};
export const listTransactionsSuccess = {
"data" : [
{
"accountHolderId" : "AHA1B2C3D4E5F6G7H8I9J0",
"amount" : {
"currency" : "EUR",
"value" : -9
},
"balanceAccountId" : "BAB8B2C3D4E5F6G7H8D9J6GD4",
"balancePlatform" : "YOUR_BALANCE_PLATFORM",
"bookingDate" : "2022-03-11T11:21:24+01:00",
"category" : "internal",
"createdAt" : "2022-03-11T11:21:24+01:00",
"id" : "1VVF0D5U66PIUIVP",
"instructedAmount" : {
"currency" : "EUR",
"value" : -9
},
"reference" : "REFERENCE_46e8c40e",
"status" : "booked",
"transferId" : "1VVF0D5U66PIUIVP",
"type" : "fee",
"valueDate" : "2022-03-11T11:21:24+01:00"
},
{
"accountHolderId" : "AHA1B2C3D4E5F6G7H8I9J0",
"amount" : {
"currency" : "EUR",
"value" : -46
},
"balanceAccountId" : "BAB8B2C3D4E5F6G7H8D9J6GD4",
"balancePlatform" : "YOUR_BALANCE_PLATFORM",
"bookingDate" : "2022-03-12T14:22:52+01:00",
"category" : "internal",
"createdAt" : "2022-03-12T14:22:52+01:00",
"id" : "1WEPGD5U6MS1CFK3",
"instructedAmount" : {
"currency" : "EUR",
"value" : -46
},
"reference" : "YOUR_REFERENCE",
"status" : "booked",
"transferId" : "1WEPGD5U6MS1CFK3",
"type" : "fee",
"valueDate" : "2022-03-12T14:22:52+01:00"
},
{
"accountHolderId" : "AHA1B2C3D4E5F6G7H8I9J0",
"amount" : {
"currency" : "EUR",
"value" : -8
},
"balanceAccountId" : "BAB8B2C3D4E5F6G7H8D9J6GD4",
"balancePlatform" : "YOUR_BALANCE_PLATFORM",
"bookingDate" : "2022-03-14T21:00:48+01:00",
"createdAt" : "2022-03-14T15:00:00+01:00",
"description" : "YOUR_DESCRIPTION_2",
"id" : "2QP32A5U7IWC5WKG",
"instructedAmount" : {
"currency" : "EUR",
"value" : -8
},
"status" : "booked",
"valueDate" : "2022-03-14T21:00:48+01:00"
}
],
"_links" : {
"next" : {
"href" : "https://balanceplatform-api-test.adyen.com/btl/v2/transactions?balancePlatform=Bastronaut&createdUntil=2022-03-21T00%3A00%3A00Z&createdSince=2022-03-11T00%3A00%3A00Z&limit=3&cursor=S2B-TSAjOkIrYlIlbjdqe0RreHRyM32lKRSxubXBHRkhHL2E32XitQQz5SfzpucD5HbHwpM1p6NDR1eXVQLFF6MmY33J32sobDxQYT90MHIud1hwLnd6JitcX32xJ"
}
}
};

View File

@@ -2,13 +2,13 @@ import nock from "nock";
import Client from "../client";
import { createClient } from "../__mocks__/base";
import BalancePlatform from "../services/balancePlatform";
import * as models from "../typings/balancePlatform/models";
import { balancePlatform } from "../typings";
import { AccountHolderUpdate } from "../services/balancePlaftform/accountHolders";
import { SweepConfigurationV2Create, SweepConfigurationV2Update } from "../services/balancePlaftform/balanceAccounts";
import { TransactionRuleInfoUpdate } from "../services/balancePlaftform/transactionRules";
let client: Client;
let balancePlatform: BalancePlatform;
let balancePlatformService: BalancePlatform;
let scope: nock.Scope;
beforeEach((): void => {
@@ -17,7 +17,7 @@ beforeEach((): void => {
}
client = createClient();
scope = nock(`${client.config.balancePlatformEndpoint}/${Client.BALANCE_PLATFORM_API_VERSION}`);
balancePlatform = new BalancePlatform(client);
balancePlatformService = new BalancePlatform(client);
});
afterEach(() => {
@@ -55,7 +55,7 @@ describe("Balance Platform", (): void => {
"id": "AH3227C223222B5CMD2SXFKGT",
"status": "active"
});
const request: models.AccountHolderInfo = {
const request: balancePlatform.AccountHolderInfo = {
"balancePlatform": "YOUR_BALANCE_PLATFORM",
"description": "S.Hopper - Staff 123",
"legalEntityId": "LE322KT223222D5FJ7THR293F",
@@ -63,7 +63,7 @@ describe("Balance Platform", (): void => {
"email": "s.hopper@example.com",
"phone": {
"number": "+315551231234",
"type": models.Phone.TypeEnum.Mobile
"type": balancePlatform.Phone.TypeEnum.Mobile
},
"address": {
"city": "Amsterdam",
@@ -75,7 +75,7 @@ describe("Balance Platform", (): void => {
}
};
const response: models.AccountHolder = await balancePlatform.AccountHolders.create(request);
const response: balancePlatform.AccountHolder = await balancePlatformService.AccountHolders.create(request);
expect(response.id).toBe("AH3227C223222B5CMD2SXFKGT");
expect(response.legalEntityId).toBe("LE322KT223222D5FJ7THR293F");
@@ -104,7 +104,7 @@ describe("Balance Platform", (): void => {
"status": "Active"
});
const response: models.AccountHolder = await balancePlatform.AccountHolders.retrieve("AH32272223222B5CM4MWJ892H");
const response: balancePlatform.AccountHolder = await balancePlatformService.AccountHolders.retrieve("AH32272223222B5CM4MWJ892H");
expect(response.id).toBe("AH32272223222B5CM4MWJ892H");
expect(response.balancePlatform).toBe("YOUR_BALANCE_PLATFORM");
@@ -133,11 +133,11 @@ describe("Balance Platform", (): void => {
"status": "Suspended"
});
const request: AccountHolderUpdate = {
status: models.AccountHolder.StatusEnum.Suspended,
status: balancePlatform.AccountHolder.StatusEnum.Suspended,
legalEntityId: "LE322KT223222D5FJ7THR293F",
};
const response: models.AccountHolder = await balancePlatform.AccountHolders.update("AH32272223222B5CM4MWJ892H", request);
const response: balancePlatform.AccountHolder = await balancePlatformService.AccountHolders.update("AH32272223222B5CM4MWJ892H", request);
expect(response.status).toBe("Suspended");
});
@@ -169,7 +169,7 @@ describe("Balance Platform", (): void => {
"hasPrevious": false
});
const response: models.PaginatedBalanceAccountsResponse = await balancePlatform.AccountHolders.listBalanceAccounts("AH32272223222B5CM4MWJ892H", {
const response: balancePlatform.PaginatedBalanceAccountsResponse = await balancePlatformService.AccountHolders.listBalanceAccounts("AH32272223222B5CM4MWJ892H", {
params: {
"limit": "5",
"offset": "10"
@@ -198,12 +198,12 @@ describe("Balance Platform", (): void => {
"id": balanceAccountId,
"status": "active"
});
const request: models.BalanceAccountInfo = {
const request: balancePlatform.BalanceAccountInfo = {
"accountHolderId": "AH32272223222B59K6ZKBBFNQ",
"description": "S.Hopper - Main balance account"
};
const response: models.BalanceAccount = await balancePlatform.BalanceAccounts.create(request);
const response: balancePlatform.BalanceAccount = await balancePlatformService.BalanceAccounts.create(request);
expect(response.id).toBe(balanceAccountId);
});
@@ -237,7 +237,7 @@ describe("Balance Platform", (): void => {
]
});
const response: models.BalanceSweepConfigurationsResponse = await balancePlatform.BalanceAccounts.listSweeps(balanceAccountId, {
const response: balancePlatform.BalanceSweepConfigurationsResponse = await balancePlatformService.BalanceAccounts.listSweeps(balanceAccountId, {
params: {
"limit": "5",
"offset": "10"
@@ -276,13 +276,13 @@ describe("Balance Platform", (): void => {
},
"currency": "EUR",
"schedule": {
"type": models.SweepSchedule.TypeEnum.Balance
"type": balancePlatform.SweepSchedule.TypeEnum.Balance
},
"type": models.SweepConfigurationV2.TypeEnum.Pull,
"status": models.SweepConfigurationV2.StatusEnum.Active
"type": balancePlatform.SweepConfigurationV2.TypeEnum.Pull,
"status": balancePlatform.SweepConfigurationV2.StatusEnum.Active
};
const response: models.SweepConfigurationV2 = await balancePlatform.BalanceAccounts.createSweep(balanceAccountId, request);
const response: balancePlatform.SweepConfigurationV2 = await balancePlatformService.BalanceAccounts.createSweep(balanceAccountId, request);
expect(response.id).toBe(sweepId);
expect(response.triggerAmount!.value).toBe(50000);
@@ -291,7 +291,7 @@ describe("Balance Platform", (): void => {
it("should support DELETE /balanceAccounts/{balanceAccountId}/sweeps/{sweepId}", async (): Promise<void> => {
scope.delete(`/balanceAccounts/${balanceAccountId}/sweeps/${sweepId}`).reply(204);
await balancePlatform.BalanceAccounts.deleteSweep(balanceAccountId, sweepId);
await balancePlatformService.BalanceAccounts.deleteSweep(balanceAccountId, sweepId);
});
it("should support GET /balanceAccounts/{balanceAccountId}/sweeps/{sweepId}", async (): Promise<void> => {
@@ -317,7 +317,7 @@ describe("Balance Platform", (): void => {
"currency": "EUR"
});
const response: models.SweepConfigurationV2 = await balancePlatform.BalanceAccounts.retrieveSweep(balanceAccountId, sweepId);
const response: balancePlatform.SweepConfigurationV2 = await balancePlatformService.BalanceAccounts.retrieveSweep(balanceAccountId, sweepId);
expect(response.id).toBe(sweepId);
expect(response.status).toBe("active");
@@ -342,10 +342,10 @@ describe("Balance Platform", (): void => {
"status": "inactive"
});
const request: SweepConfigurationV2Update = {
"status": models.SweepConfigurationV2.StatusEnum.Inactive
"status": balancePlatform.SweepConfigurationV2.StatusEnum.Inactive
};
const response: models.SweepConfigurationV2 = await balancePlatform.BalanceAccounts.updateSweep(balanceAccountId, sweepId, request);
const response: balancePlatform.SweepConfigurationV2 = await balancePlatformService.BalanceAccounts.updateSweep(balanceAccountId, sweepId, request);
expect(response.status).toBe("inactive");
});
@@ -367,7 +367,7 @@ describe("Balance Platform", (): void => {
"status": "Active"
});
const response: models.BalanceAccount = await balancePlatform.BalanceAccounts.retrieve(balanceAccountId);
const response: balancePlatform.BalanceAccount = await balancePlatformService.BalanceAccounts.retrieve(balanceAccountId);
expect(response.id).toBe(balanceAccountId);
expect(response.status).toBe("Active");
@@ -392,13 +392,13 @@ describe("Balance Platform", (): void => {
"status": "active",
"timeZone": "Europe/Amsterdam"
});
const request: models.BalanceAccountUpdateRequest = {
const request: balancePlatform.BalanceAccountUpdateRequest = {
"description": "Testing",
"status": models.BalanceAccountUpdateRequest.StatusEnum.Active,
"status": balancePlatform.BalanceAccountUpdateRequest.StatusEnum.Active,
"timeZone": "Europe/Amsterdam"
};
const response: models.BalanceAccount = await balancePlatform.BalanceAccounts.update(balanceAccountId, request);
const response: balancePlatform.BalanceAccount = await balancePlatformService.BalanceAccounts.update(balanceAccountId, request);
expect(response.status).toBe("active");
expect(response.timeZone).toBe("Europe/Amsterdam");
@@ -451,7 +451,7 @@ describe("Balance Platform", (): void => {
]
});
const response: models.PaginatedPaymentInstrumentsResponse = await balancePlatform.BalanceAccounts.listPaymentInstruments(balanceAccountId, {
const response: balancePlatform.PaginatedPaymentInstrumentsResponse = await balancePlatformService.BalanceAccounts.listPaymentInstruments(balanceAccountId, {
params: {
limit: "3",
offset: "6",
@@ -471,7 +471,7 @@ describe("Balance Platform", (): void => {
"status": "Active"
});
const response: models.BalancePlatform = await balancePlatform.General.retrieve(balanceAccountId);
const response: balancePlatform.BalancePlatform = await balancePlatformService.General.retrieve(balanceAccountId);
expect(response.id).toBe(balanceAccountId);
expect(response.status).toBe("Active");
@@ -514,7 +514,7 @@ describe("Balance Platform", (): void => {
"hasPrevious": "false"
});
const response: models.PaginatedAccountHoldersResponse = await balancePlatform.General.listAccountHolders(balanceAccountId);
const response: balancePlatform.PaginatedAccountHoldersResponse = await balancePlatformService.General.listAccountHolders(balanceAccountId);
expect(response.accountHolders.length).toBe(2);
expect(response.accountHolders[0].id).toBe("AH32272223222B59DDWSCCMP7");
@@ -545,13 +545,13 @@ describe("Balance Platform", (): void => {
},
"id": paymentInstrumentId
});
const request: models.PaymentInstrumentInfo = {
"type": models.PaymentInstrumentInfo.TypeEnum.Card,
const request: balancePlatform.PaymentInstrumentInfo = {
"type": balancePlatform.PaymentInstrumentInfo.TypeEnum.Card,
"issuingCountryCode": "NL",
"balanceAccountId": balanceAccountId,
"status": models.PaymentInstrumentInfo.StatusEnum.Inactive,
"status": balancePlatform.PaymentInstrumentInfo.StatusEnum.Inactive,
"card": {
"formFactor": models.CardInfo.FormFactorEnum.Physical,
"formFactor": balancePlatform.CardInfo.FormFactorEnum.Physical,
"brand": "mc",
"brandVariant": "mcdebit",
"cardholderName": "Sam Hopper",
@@ -576,7 +576,7 @@ describe("Balance Platform", (): void => {
"description": "S.Hopper - Main card"
};
const response: models.PaymentInstrument = await balancePlatform.PaymentInstruments.create(request);
const response: balancePlatform.PaymentInstrument = await balancePlatformService.PaymentInstruments.create(request);
expect(response.id).toBe(paymentInstrumentId);
expect(response.balanceAccountId).toBe(balanceAccountId);
@@ -606,7 +606,7 @@ describe("Balance Platform", (): void => {
"id": paymentInstrumentId
});
const response: models.PaymentInstrument = await balancePlatform.PaymentInstruments.retrieve(paymentInstrumentId);
const response: balancePlatform.PaymentInstrument = await balancePlatformService.PaymentInstruments.retrieve(paymentInstrumentId);
expect(response.id).toBe(paymentInstrumentId);
expect(response.status).toBe("active");
@@ -635,11 +635,11 @@ describe("Balance Platform", (): void => {
},
"id": paymentInstrumentId
});
const request: models.PaymentInstrumentUpdateRequest = {
const request: balancePlatform.PaymentInstrumentUpdateRequest = {
"balanceAccountId": "BA32272223222B5CM82WL892M"
};
const response: models.PaymentInstrument = await balancePlatform.PaymentInstruments.update(paymentInstrumentId, request);
const response: balancePlatform.PaymentInstrument = await balancePlatformService.PaymentInstruments.update(paymentInstrumentId, request);
expect(response.id).toBe(paymentInstrumentId);
expect(response.balanceAccountId).toBe("BA32272223222B5CM82WL892M");
@@ -681,7 +681,7 @@ describe("Balance Platform", (): void => {
]
});
const response: models.TransactionRulesResponse = await balancePlatform.PaymentInstruments.listTransactionRules(paymentInstrumentId);
const response: balancePlatform.TransactionRulesResponse = await balancePlatformService.PaymentInstruments.listTransactionRules(paymentInstrumentId);
expect(response.transactionRules!.length).toBe(2);
expect(response.transactionRules![0].id).toBe("TR32272223222B5CMDGMC9F4F");
@@ -696,12 +696,12 @@ describe("Balance Platform", (): void => {
"txVariant": "mc",
"id": paymentInstrumentGroupId
});
const request: models.PaymentInstrumentGroupInfo = {
const request: balancePlatform.PaymentInstrumentGroupInfo = {
"balancePlatform": "YOUR_BALANCE_PLATFORM",
"txVariant": "mc"
};
const response: models.PaymentInstrumentGroup = await balancePlatform.PaymentInstrumentGroups.create(request);
const response: balancePlatform.PaymentInstrumentGroup = await balancePlatformService.PaymentInstrumentGroups.create(request);
expect(response.id).toBe(paymentInstrumentGroupId);
expect(response.txVariant).toBe("mc");
@@ -715,7 +715,7 @@ describe("Balance Platform", (): void => {
"id": paymentInstrumentGroupId
});
const response: models.PaymentInstrumentGroup = await balancePlatform.PaymentInstrumentGroups.retrieve(paymentInstrumentGroupId);
const response: balancePlatform.PaymentInstrumentGroup = await balancePlatformService.PaymentInstrumentGroups.retrieve(paymentInstrumentGroupId);
expect(response.id).toBe(paymentInstrumentGroupId);
expect(response.txVariant).toBe("mc");
@@ -757,7 +757,7 @@ describe("Balance Platform", (): void => {
]
});
const response: models.TransactionRulesResponse = await balancePlatform.PaymentInstrumentGroups.listTransactionRules(paymentInstrumentGroupId);
const response: balancePlatform.TransactionRulesResponse = await balancePlatformService.PaymentInstrumentGroups.listTransactionRules(paymentInstrumentGroupId);
expect(response.transactionRules!.length).toBe(2);
expect(response.transactionRules![0].id).toBe("TR32272223222B5CMDGMC9F4F");
@@ -793,29 +793,29 @@ describe("Balance Platform", (): void => {
"type": "blockList",
"id": transactionRuleId
});
const request: models.TransactionRuleInfo = {
const request: balancePlatform.TransactionRuleInfo = {
"description": "Allow only point-of-sale transactions",
"reference": "YOUR_REFERENCE_4F7346",
"entityKey": {
"entityType": "paymentInstrument",
"entityReference": "PI3227C223222B5BPCMFXD2XG"
},
"status": models.TransactionRuleInfo.StatusEnum.Active,
"status": balancePlatform.TransactionRuleInfo.StatusEnum.Active,
"interval": {
"type": models.TransactionRuleInterval.TypeEnum.PerTransaction
"type": balancePlatform.TransactionRuleInterval.TypeEnum.PerTransaction
},
"ruleRestrictions": {
"processingTypes": {
"operation": "noneMatch",
"value": [
models.ProcessingTypesRestriction.ValueEnum.Pos
balancePlatform.ProcessingTypesRestriction.ValueEnum.Pos
]
}
},
"type": models.TransactionRuleInfo.TypeEnum.BlockList
"type": balancePlatform.TransactionRuleInfo.TypeEnum.BlockList
};
const response: models.TransactionRule = await balancePlatform.TransactionRules.create(request);
const response: balancePlatform.TransactionRule = await balancePlatformService.TransactionRules.create(request);
expect(response.id).toBe(transactionRuleId);
expect(response.status).toBe("active");
@@ -839,7 +839,7 @@ describe("Balance Platform", (): void => {
}
});
const response: models.TransactionRuleResponse = await balancePlatform.TransactionRules.retrieve(transactionRuleId);
const response: balancePlatform.TransactionRuleResponse = await balancePlatformService.TransactionRules.retrieve(transactionRuleId);
expect(response.transactionRule!.id).toBe(transactionRuleId);
expect(response.transactionRule!.type).toBe("velocity");
@@ -859,10 +859,10 @@ describe("Balance Platform", (): void => {
"id": transactionRuleId
});
const request: TransactionRuleInfoUpdate = {
"status": models.TransactionRuleInfo.StatusEnum.Inactive
"status": balancePlatform.TransactionRuleInfo.StatusEnum.Inactive
};
const response: models.TransactionRule = await balancePlatform.TransactionRules.update(transactionRuleId, request);
const response: balancePlatform.TransactionRule = await balancePlatformService.TransactionRules.update(transactionRuleId, request);
expect(response.status).toBe("inactive");
expect(response.reference).toBe("myRule12345");
@@ -886,7 +886,7 @@ describe("Balance Platform", (): void => {
"id": transactionRuleId
});
const response: models.TransactionRule = await balancePlatform.TransactionRules.delete(transactionRuleId);
const response: balancePlatform.TransactionRule = await balancePlatformService.TransactionRules.delete(transactionRuleId);
expect(response.id).toBe(transactionRuleId);
});

View File

@@ -3,11 +3,7 @@ import { createClient } from "../__mocks__/base";
import BinLookup from "../services/binLookup";
import Client from "../client";
import HttpClientException from "../httpClient/httpClientException";
import {
ThreeDSAvailabilityRequest,
ThreeDSAvailabilityResponse,
CostEstimateRequest,
} from "../typings/binlookup/models";
import { binlookup } from "../typings";
const threeDSAvailabilitySuccess = {
binDetails: {
@@ -19,7 +15,7 @@ const threeDSAvailabilitySuccess = {
};
let client: Client;
let binLookup: BinLookup;
let binLookupService: BinLookup;
let scope: nock.Scope;
beforeEach((): void => {
@@ -27,7 +23,7 @@ beforeEach((): void => {
nock.activate();
}
client = createClient();
binLookup = new BinLookup(client);
binLookupService = new BinLookup(client);
scope = nock(`${client.config.endpoint}${Client.BIN_LOOKUP_PAL_SUFFIX}${Client.BIN_LOOKUP_API_VERSION}`);
});
@@ -37,7 +33,7 @@ afterEach((): void => {
describe("Bin Lookup", function (): void {
test("should succeed on get 3ds availability", async function (): Promise<void> {
const threeDSAvailabilityRequest: ThreeDSAvailabilityRequest = {
const threeDSAvailabilityRequest: binlookup.ThreeDSAvailabilityRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
brands: ["randomBrand"],
cardNumber: "4111111111111111"
@@ -46,13 +42,12 @@ describe("Bin Lookup", function (): void {
scope.post("/get3dsAvailability")
.reply(200, threeDSAvailabilitySuccess);
const response = await binLookup.get3dsAvailability(threeDSAvailabilityRequest);
const response = await binLookupService.get3dsAvailability(threeDSAvailabilityRequest);
expect(response).toEqual<ThreeDSAvailabilityResponse>(threeDSAvailabilitySuccess);
expect(response).toEqual< binlookup.ThreeDSAvailabilityResponse>(threeDSAvailabilitySuccess);
});
test.each([false, true])("should fail with invalid merchant. isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
test("should fail with invalid merchant", async function (): Promise<void> {
const threeDSAvailabilityRequest: { [key: string]: undefined|string|[] } = {
merchantAccount: undefined,
cardNumber: "4111111111111",
@@ -63,15 +58,14 @@ describe("Bin Lookup", function (): void {
.reply(403, JSON.stringify({status: 403, message: "fail", errorCode: "171"}));
try {
await binLookup.get3dsAvailability(threeDSAvailabilityRequest as unknown as ThreeDSAvailabilityRequest);
await binLookupService.get3dsAvailability(threeDSAvailabilityRequest as unknown as binlookup.ThreeDSAvailabilityRequest);
fail("Expected request to fail");
} catch (e) {
expect(e instanceof HttpClientException).toBeTruthy();
}
});
test.each([false, true])("should succeed on get cost estimate. isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
test("should succeed on get cost estimate", async function (): Promise<void> {
const expected = {
cardBin: {
bin: "",
@@ -89,7 +83,7 @@ describe("Bin Lookup", function (): void {
resultCode: "Unsupported",
surchargeType: "ZERO"
};
const costEstimateRequest: CostEstimateRequest = {
const costEstimateRequest: binlookup.CostEstimateRequest = {
amount: { currency: "EUR", value: 1000 },
assumptions: {
assumeLevel3Data: true,
@@ -102,13 +96,13 @@ describe("Bin Lookup", function (): void {
mcc: "7411",
enrolledIn3DSecure: true
},
shopperInteraction: CostEstimateRequest.ShopperInteractionEnum.Ecommerce,
shopperInteraction: binlookup.CostEstimateRequest.ShopperInteractionEnum.Ecommerce,
};
scope.post("/getCostEstimate")
.reply(200, expected);
const response = await binLookup.getCostEstimate(costEstimateRequest);
const response = await binLookupService.getCostEstimate(costEstimateRequest);
expect(response).toEqual(expected);
});

View File

@@ -1,22 +1,3 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import checkServerIdentity from "../helpers/checkServerIdentity";
import { PeerCertificate } from "tls";

View File

@@ -11,41 +11,19 @@ import {sessionsSuccess} from "../__mocks__/checkout/sessionsSuccess";
import Client from "../client";
import Checkout from "../services/checkout";
import HttpClientException from "../httpClient/httpClientException";
import {
Amount,
CardDetails,
CheckoutBalanceCheckRequest,
CheckoutBalanceCheckResponse,
CheckoutCancelOrderResponse,
CheckoutCreateOrderRequest,
CheckoutCreateOrderResponse,
CheckoutUtilityRequest,
CreatePaymentLinkRequest,
DetailsRequest,
PaymentLinkResponse,
PaymentMethodsRequest,
PaymentRequest,
PaymentResponse,
PaymentSetupRequest,
PaymentVerificationRequest,
CreateCheckoutSessionRequest,
CreateCheckoutSessionResponse,
CardDetailsRequest,
CardDetailsResponse
} from "../typings/checkout/models";
import { checkout } from "../typings";
const merchantAccount = process.env.ADYEN_MERCHANT!;
const reference = "Your order number";
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
function createAmountObject(currency: string, value: number): Amount {
function createAmountObject(currency: string, value: number): checkout.Amount {
return {
currency,
value,
};
}
function createPaymentsDetailsRequest(): DetailsRequest {
function createPaymentsDetailsRequest(): checkout.DetailsRequest {
return {
details: {
mD: "mdValue",
@@ -55,9 +33,9 @@ function createPaymentsDetailsRequest(): DetailsRequest {
};
}
export function createPaymentsCheckoutRequest(): PaymentRequest {
export function createPaymentsCheckoutRequest(): checkout.PaymentRequest {
const paymentMethodDetails = {
type: CardDetails.TypeEnum.Scheme,
type: checkout.CardDetails.TypeEnum.Scheme,
encryptedCardNumber: "test_4111111111111111",
encryptedExpiryMonth: "test_03",
encryptedExpiryYear: "test_2030",
@@ -75,18 +53,18 @@ export function createPaymentsCheckoutRequest(): PaymentRequest {
};
}
function createPaymentSessionRequest(): PaymentSetupRequest {
function createPaymentSessionRequest(): checkout.PaymentSetupRequest {
return {
amount: createAmountObject("USD", 1000),
countryCode: "NL",
merchantAccount,
reference,
returnUrl: "https://your-company.com/...",
channel: PaymentSetupRequest.ChannelEnum.Web,
channel: checkout.PaymentSetupRequest.ChannelEnum.Web,
sdkVersion: "3.7.0"
};
}
function getPaymentLinkSuccess(expiresAt: string): PaymentLinkResponse {
function getPaymentLinkSuccess(expiresAt: string): checkout.PaymentLinkResponse {
return {
amount: createAmountObject("USD", 1000),
expiresAt,
@@ -94,11 +72,11 @@ function getPaymentLinkSuccess(expiresAt: string): PaymentLinkResponse {
url: "PaymentLinkResponse.url",
id: "mocked_id",
merchantAccount,
status: PaymentLinkResponse.StatusEnum.Active
status: checkout.PaymentLinkResponse.StatusEnum.Active
};
}
function createPaymentLinkRequest(): CreatePaymentLinkRequest {
function createPaymentLinkRequest(): checkout.CreatePaymentLinkRequest {
return {
allowedPaymentMethods: ["scheme", "boletobancario"],
amount: createAmountObject("USD", 1000),
@@ -127,7 +105,7 @@ function createPaymentLinkRequest(): CreatePaymentLinkRequest {
};
}
function createSessionRequest(): CreateCheckoutSessionRequest {
function createSessionRequest(): checkout.CreateCheckoutSessionRequest {
return {
amount: createAmountObject("USD", 1000),
countryCode: "NL",
@@ -138,7 +116,7 @@ function createSessionRequest(): CreateCheckoutSessionRequest {
}
let client: Client;
let checkout: Checkout;
let checkoutService: Checkout;
let scope: nock.Scope;
beforeEach((): void => {
@@ -147,7 +125,7 @@ beforeEach((): void => {
}
client = createClient();
scope = nock(`${client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}`);
checkout = new Checkout(client);
checkoutService = new Checkout(client);
});
afterEach(() => {
@@ -156,55 +134,55 @@ afterEach(() => {
describe("Checkout", (): void => {
test("should add idempotency key to request headers", async (): Promise<void> => {
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsRequest: checkout.PaymentRequest = createPaymentsCheckoutRequest();
scope.post("/payments")
.reply(200, paymentsSuccess)
.matchHeader("Idempotency-Key", "testKey");
await checkout.payments(paymentsRequest, {idempotencyKey: "testKey"});
await checkoutService.payments(paymentsRequest, {idempotencyKey: "testKey"});
const paymentMethodsRequest: PaymentMethodsRequest = {merchantAccount};
const paymentMethodsRequest: checkout.PaymentMethodsRequest = {merchantAccount};
scope.post("/paymentMethods")
.reply(200, paymentMethodsSuccess)
.matchHeader("Idempotency-Key", "testKey");
await checkout.paymentMethods(paymentMethodsRequest, {idempotencyKey: "testKey"});
await checkoutService.paymentMethods(paymentMethodsRequest, {idempotencyKey: "testKey"});
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
scope.post("/paymentLinks")
.reply(200, paymentLinkSuccess)
.matchHeader("Idempotency-Key", "testKey");
await checkout.paymentLinks(createPaymentLinkRequest(), {idempotencyKey: "testKey"});
await checkoutService.paymentLinks(createPaymentLinkRequest(), {idempotencyKey: "testKey"});
scope.patch("/paymentLinks/321")
.reply(200, { ...paymentLinkSuccess, status: "expired" })
.matchHeader("Idempotency-Key", "testKey");
await checkout.updatePaymentLinks("321", "expired", {idempotencyKey: "testKey"});
await checkoutService.updatePaymentLinks("321", "expired", {idempotencyKey: "testKey"});
scope.get("/paymentLinks/123")
.reply(200, paymentLinkSuccess)
.matchHeader("Idempotency-Key", "testKey");
await checkout.getPaymentLinks("123", {idempotencyKey: "testKey"});
await checkoutService.getPaymentLinks("123", {idempotencyKey: "testKey"});
scope.post("/payments/details")
.reply(200, paymentDetailsSuccess)
.matchHeader("Idempotency-Key", "testKey");
await checkout.paymentsDetails(createPaymentsDetailsRequest(), {idempotencyKey: "testKey"});
await checkoutService.paymentsDetails(createPaymentsDetailsRequest(), {idempotencyKey: "testKey"});
scope.post("/paymentSession")
.reply(200, paymentSessionSuccess)
.matchHeader("Idempotency-Key", "testKey");
const paymentSessionRequest: PaymentSetupRequest = createPaymentSessionRequest();
await checkout.paymentSession(paymentSessionRequest, {idempotencyKey: "testKey"});
const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
await checkoutService.paymentSession(paymentSessionRequest, {idempotencyKey: "testKey"});
scope.post("/payments/result")
.reply(200, paymentsResultSuccess)
.matchHeader("Idempotency-Key", "testKey");
const paymentResultRequest: PaymentVerificationRequest = {
const paymentResultRequest: checkout.PaymentVerificationRequest = {
payload: "This is a test payload",
};
await checkout.paymentResult(paymentResultRequest, {idempotencyKey: "testKey"});
await checkoutService.paymentResult(paymentResultRequest, {idempotencyKey: "testKey"});
const orderRequest: CheckoutCreateOrderRequest = {
const orderRequest: checkout.CheckoutCreateOrderRequest = {
amount: createAmountObject("USD", 1000),
merchantAccount,
reference
@@ -212,12 +190,12 @@ describe("Checkout", (): void => {
scope.post("/orders")
.reply(200, {})
.matchHeader("Idempotency-Key", "testKey");
await checkout.orders(orderRequest, {idempotencyKey: "testKey"});
await checkoutService.orders(orderRequest, {idempotencyKey: "testKey"});
scope.post("/orders/cancel")
.reply(200, {})
.matchHeader("Idempotency-Key", "testKey");
await checkout.ordersCancel({
await checkoutService.ordersCancel({
order: {
orderData: "mock_data",
pspReference: "mock_pspref"
@@ -229,43 +207,52 @@ describe("Checkout", (): void => {
.reply(200, sessionsSuccess)
.matchHeader("Idempotency-Key", "testKey");
const sessionsRequest: CreateCheckoutSessionRequest = createSessionRequest();
await checkout.sessions(sessionsRequest, {idempotencyKey: "testKey"});
const sessionsRequest: checkout.CreateCheckoutSessionRequest = createSessionRequest();
await checkoutService.sessions(sessionsRequest, {idempotencyKey: "testKey"});
});
test.each([false, true])("should make a payment. isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should make a payment.", async (): Promise<void> => {
scope.post("/payments")
.reply(200, paymentsSuccess);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: PaymentResponse = await checkout.payments(paymentsRequest);
const paymentsRequest: checkout.PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: checkout.PaymentResponse = await checkoutService.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toBeTruthy();
});
test.each([false, true])("should return correct Exception, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("Should properly handle error responses from API", async (): Promise<void> => {
try {
scope.post("/payments")
.reply(401);
.reply(422, {
"status": 422,
"errorCode": "200",
"message": "Field 'countryCode' is not valid.",
"errorType": "validation",
"pspReference": "DMB552CV6JHKGK82",
});
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
await checkout.payments(paymentsRequest);
} catch (e) {
expect(e instanceof HttpClientException).toBeTruthy();
const paymentsRequest: checkout.PaymentRequest = createPaymentsCheckoutRequest();
await checkoutService.payments(paymentsRequest);
fail("No exception was thrown");
} catch (error) {
expect(error instanceof HttpClientException).toBeTruthy();
if(error instanceof HttpClientException && error.responseBody) {
expect(JSON.parse(error.responseBody).errorType).toBe("validation");
} else {
fail("Error did not contain the expected data");
}
}
});
test.each([false, true])("should have valid payment methods, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
const paymentMethodsRequest: PaymentMethodsRequest = {merchantAccount};
test("should have valid payment methods", async (): Promise<void> => {
const paymentMethodsRequest: checkout.PaymentMethodsRequest = {merchantAccount};
scope.post("/paymentMethods")
.reply(200, paymentMethodsSuccess);
const paymentMethodsResponse = await checkout.paymentMethods(paymentMethodsRequest);
const paymentMethodsResponse = await checkoutService.paymentMethods(paymentMethodsRequest);
if (paymentMethodsResponse && paymentMethodsResponse.paymentMethods) {
expect(paymentMethodsResponse.paymentMethods.length).toBeGreaterThan(0);
} else {
@@ -273,76 +260,69 @@ describe("Checkout", (): void => {
}
});
test.each([false, true])("should have valid payment link, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should have valid payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkoutService.paymentLinks(createPaymentLinkRequest());
expect(paymentSuccessLinkResponse).toBeTruthy();
});
test.each([isCI, true])("should get payment link, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should get payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkoutService.paymentLinks(createPaymentLinkRequest());
scope.get(`/paymentLinks/${paymentSuccessLinkResponse.id}`).reply(200, paymentLinkSuccess);
const paymentLink = await checkout.getPaymentLinks(paymentSuccessLinkResponse.id);
const paymentLink = await checkoutService.getPaymentLinks(paymentSuccessLinkResponse.id);
expect(paymentLink).toBeTruthy();
});
test.each([isCI, true])("should patch payment link, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should patch payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
scope.post("/paymentLinks").reply(200, paymentLinkSuccess);
const paymentSuccessLinkResponse = await checkout.paymentLinks(createPaymentLinkRequest());
const paymentSuccessLinkResponse = await checkoutService.paymentLinks(createPaymentLinkRequest());
scope.patch(`/paymentLinks/${paymentSuccessLinkResponse.id}`).reply(200, { ...paymentLinkSuccess, status: "expired" });
const paymentLink = await checkout.updatePaymentLinks(paymentSuccessLinkResponse.id, "expired");
const paymentLink = await checkoutService.updatePaymentLinks(paymentSuccessLinkResponse.id, "expired");
expect(paymentLink.status).toEqual("expired");
});
test.each([isCI, true])("should have payment details, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should have payment details", async (): Promise<void> => {
scope.post("/payments/details")
.reply(200, paymentDetailsSuccess);
const paymentsResponse = await checkout.paymentsDetails(createPaymentsDetailsRequest());
const paymentsResponse = await checkoutService.paymentsDetails(createPaymentsDetailsRequest());
expect(paymentsResponse.resultCode).toEqual("Authorised");
});
test.each([false, true])("should have payment session success, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should have payment session success", async (): Promise<void> => {
scope.post("/paymentSession")
.reply(200, paymentSessionSuccess);
const paymentSessionRequest: PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkout.paymentSession(paymentSessionRequest);
const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkoutService.paymentSession(paymentSessionRequest);
expect(paymentSessionResponse.paymentSession).not.toBeUndefined();
});
test.each([isCI, true])("should have payments result, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should have payments result", async (): Promise<void> => {
scope.post("/payments/result")
.reply(200, paymentsResultSuccess);
const paymentResultRequest: PaymentVerificationRequest = {
const paymentResultRequest: checkout.PaymentVerificationRequest = {
payload: "This is a test payload",
};
const paymentResultResponse = await checkout.paymentResult(paymentResultRequest);
const paymentResultResponse = await checkoutService.paymentResult(paymentResultRequest);
expect(paymentResultResponse.resultCode).toEqual("Authorised");
});
test.each([false, true])("should have missing identifier on live, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should have missing identifier on live", async (): Promise<void> => {
client.setEnvironment("LIVE");
try {
new Checkout(client);
@@ -358,22 +338,20 @@ describe("Checkout", (): void => {
});
test.each([false, true])("should succeed on multibanco payment, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should succeed on multibanco payment", async (): Promise<void> => {
scope.post("/payments")
.reply(200, paymentsResultMultibancoSuccess);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: PaymentResponse = await checkout.payments(paymentsRequest);
const paymentsRequest: checkout.PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: checkout.PaymentResponse = await checkoutService.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toBeTruthy();
expect(paymentsResponse.additionalData).toBeTruthy();
});
test.each([false, true])("should get origin keys. isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should get origin keys", async (): Promise<void> => {
const checkoutUtility = new Checkout(client);
const originKeysRequest: CheckoutUtilityRequest = {
const originKeysRequest: checkout.CheckoutUtilityRequest = {
originDomains: ["https://www.your-domain.com"],
};
@@ -389,78 +367,75 @@ describe("Checkout", (): void => {
});
// TODO: add gift card to PaymentMethod and unmock test
test.each([true, true])("should get payment methods balance", async (isMock): Promise<void> => {
!isMock && nock.restore();
const paymentMethodsRequest: CheckoutBalanceCheckRequest = {
test("should get payment methods balance", async (): Promise<void> => {
const paymentMethodsRequest: checkout.CheckoutBalanceCheckRequest = {
merchantAccount,
amount: createAmountObject("USD", 1000),
paymentMethod: { },
reference: "mocked_reference"
};
const paymentMethodsBalanceResponse: CheckoutBalanceCheckResponse = {
const paymentMethodsBalanceResponse: checkout.CheckoutBalanceCheckResponse = {
balance: {currency: "USD", value: 1000},
resultCode: CheckoutBalanceCheckResponse.ResultCodeEnum.Success
resultCode: checkout.CheckoutBalanceCheckResponse.ResultCodeEnum.Success
};
scope.post("/paymentMethods/balance")
.reply(200, paymentMethodsBalanceResponse);
const paymentsResponse: CheckoutBalanceCheckResponse = await checkout.paymentMethodsBalance(paymentMethodsRequest);
const paymentsResponse: checkout.CheckoutBalanceCheckResponse = await checkoutService.paymentMethodsBalance(paymentMethodsRequest);
expect(paymentsResponse.balance.value).toEqual(1000);
});
test.each([false, true])("should create order", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should create order", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const orderRequest: CheckoutCreateOrderRequest = {
const orderRequest: checkout.CheckoutCreateOrderRequest = {
amount: createAmountObject("USD", 1000),
merchantAccount,
reference
};
const orderResponse: CheckoutCreateOrderResponse = {
const orderResponse: checkout.CheckoutCreateOrderResponse = {
expiresAt,
amount: createAmountObject("USD", 500),
orderData: "mocked_order_data",
remainingAmount: {currency: "USD", value: 500} ,
resultCode: CheckoutCreateOrderResponse.ResultCodeEnum.Success
resultCode: checkout.CheckoutCreateOrderResponse.ResultCodeEnum.Success
};
scope.post("/orders")
.reply(200, orderResponse);
const response: CheckoutCreateOrderResponse = await checkout.orders(orderRequest);
const response: checkout.CheckoutCreateOrderResponse = await checkoutService.orders(orderRequest);
expect(response).toBeTruthy();
});
test.each([false, true])("should cancel order", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should cancel order", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const orderRequest: CheckoutCreateOrderRequest = {
const orderRequest: checkout.CheckoutCreateOrderRequest = {
amount: createAmountObject("USD", 1000),
merchantAccount,
reference
};
const orderResponse: CheckoutCreateOrderResponse = {
const orderResponse: checkout.CheckoutCreateOrderResponse = {
expiresAt,
amount: createAmountObject("USD", 500),
orderData: "mocked_order_data",
remainingAmount: {currency: "USD", value: 500},
resultCode: CheckoutCreateOrderResponse.ResultCodeEnum.Success
resultCode: checkout.CheckoutCreateOrderResponse.ResultCodeEnum.Success
};
scope.post("/orders")
.reply(200, orderResponse);
const createOrderResponse: CheckoutCreateOrderResponse = await checkout.orders(orderRequest);
const createOrderResponse: checkout.CheckoutCreateOrderResponse = await checkoutService.orders(orderRequest);
const orderCancelResponse: CheckoutCancelOrderResponse = {
const orderCancelResponse: checkout.CheckoutCancelOrderResponse = {
pspReference: "mocked_psp_ref",
resultCode: CheckoutCancelOrderResponse.ResultCodeEnum.Received
resultCode: checkout.CheckoutCancelOrderResponse.ResultCodeEnum.Received
};
scope.post("/orders/cancel")
.reply(200, orderCancelResponse);
const response: CheckoutCancelOrderResponse = await checkout.ordersCancel({
const response: checkout.CheckoutCancelOrderResponse = await checkoutService.ordersCancel({
order: {
orderData: createOrderResponse.orderData,
pspReference: createOrderResponse.pspReference!
@@ -470,13 +445,12 @@ describe("Checkout", (): void => {
expect(response).toBeTruthy();
});
test.each([false, true])("should create a session. isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should create a session.", async (): Promise<void> => {
scope.post("/sessions")
.reply(200, sessionsSuccess);
const sessionsRequest: CreateCheckoutSessionRequest = createSessionRequest();
const sessionsResponse: CreateCheckoutSessionResponse = await checkout.sessions(sessionsRequest);
const sessionsRequest: checkout.CreateCheckoutSessionRequest = createSessionRequest();
const sessionsResponse: checkout.CreateCheckoutSessionResponse = await checkoutService.sessions(sessionsRequest);
expect(sessionsResponse.sessionData).toBeTruthy();
expect(sessionsResponse.expiresAt).toBeInstanceOf(Date);
expect(sessionsResponse.expiresAt.getFullYear()).toBeGreaterThan(0);
@@ -493,11 +467,11 @@ describe("Checkout", (): void => {
]
});
const cardDetailsRequest: CardDetailsRequest = {
const cardDetailsRequest: checkout.CardDetailsRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"cardNumber": "411111"
};
const cardDetailsReponse: CardDetailsResponse = await checkout.cardDetails(cardDetailsRequest);
const cardDetailsReponse: checkout.CardDetailsResponse = await checkoutService.cardDetails(cardDetailsRequest);
expect(cardDetailsReponse?.brands?.length).toBe(1);
});
});

View File

@@ -2,23 +2,7 @@ import nock from "nock";
import {createClient} from "../__mocks__/base";
import Client from "../client";
import ClassicIntegration from "../services/classicIntegration";
import { PaymentRequest } from "../typings/payments/paymentRequest";
import { PaymentResult } from "../typings/payments/paymentResult";
import { PaymentRequest3d } from "../typings/payments/paymentRequest3d";
import { PaymentRequest3ds2 } from "../typings/payments/paymentRequest3ds2";
import { AuthenticationResultRequest } from "../typings/payments/authenticationResultRequest";
import { AuthenticationResultResponse } from "../typings/payments/authenticationResultResponse";
import { ThreeDS2ResultRequest } from "../typings/payments/threeDS2ResultRequest";
import { ThreeDS2ResultResponse } from "../typings/payments/threeDS2ResultResponse";
import { ModificationResult } from "../typings/payments/modificationResult";
import { CaptureRequest } from "../typings/payments/captureRequest";
import { CancelRequest } from "../typings/payments/cancelRequest";
import { RefundRequest } from "../typings/payments/refundRequest";
import { CancelOrRefundRequest } from "../typings/payments/cancelOrRefundRequest";
import { TechnicalCancelRequest } from "../typings/payments/technicalCancelRequest";
import { AdjustAuthorisationRequest } from "../typings/payments/adjustAuthorisationRequest";
import { DonationRequest } from "../typings/payments/donationRequest";
import { VoidPendingRefundRequest } from "../typings/payments/voidPendingRefundRequest";
import { payments } from "../typings";
let client: Client;
let classicIntegration: ClassicIntegration;
@@ -50,7 +34,7 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: PaymentRequest = {
const paymentRequest: payments.PaymentRequest = {
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
@@ -66,7 +50,7 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const paymentResult: PaymentResult = await classicIntegration.authorise(paymentRequest);
const paymentResult: payments.PaymentResult = await classicIntegration.authorise(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});
@@ -82,14 +66,14 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: PaymentRequest3d = {
const paymentRequest: payments.PaymentRequest3d = {
"md": "31h..........vOXek7w",
"paResponse": "eNqtmF........wGVA4Ch",
"shopperIP": "61.294.12.12",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const paymentResult: PaymentResult = await classicIntegration.authorise3d(paymentRequest);
const paymentResult: payments.PaymentResult = await classicIntegration.authorise3d(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});
@@ -105,7 +89,7 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: PaymentRequest3ds2 = {
const paymentRequest: payments.PaymentRequest3ds2 = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"amount": {
"value": 1500,
@@ -119,7 +103,7 @@ describe("Classic Integration", (): void => {
"threeDS2Token": "— - BINARY DATA - -"
};
const paymentResult: PaymentResult = await classicIntegration.authorise3ds2(paymentRequest);
const paymentResult: payments.PaymentResult = await classicIntegration.authorise3ds2(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});
@@ -128,12 +112,12 @@ describe("Classic Integration", (): void => {
"threeDS2Result": { "authenticationValue": "THREEDS2RESULT"}
});
const getAuthenticationResultrequest: AuthenticationResultRequest = {
const getAuthenticationResultrequest: payments.AuthenticationResultRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"pspReference": "9935272408535455"
};
const getAuthenticationResultResponse: AuthenticationResultResponse = await classicIntegration.getAuthenticationResult(getAuthenticationResultrequest);
const getAuthenticationResultResponse: payments.AuthenticationResultResponse = await classicIntegration.getAuthenticationResult(getAuthenticationResultrequest);
expect(getAuthenticationResultResponse?.threeDS2Result?.authenticationValue).toEqual("THREEDS2RESULT");
});
@@ -141,12 +125,12 @@ describe("Classic Integration", (): void => {
scope.post("/retrieve3ds2Result").reply(200, {
"threeDS2Result": { "authenticationValue": "THREEDS2RESULT"}
});
const retrieve3ds2ResultRequest: ThreeDS2ResultRequest = {
const retrieve3ds2ResultRequest: payments.ThreeDS2ResultRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"pspReference": "9935272408535455"
};
const retrieve3ds2ResultResponse: ThreeDS2ResultResponse = await classicIntegration.retrieve3ds2Result(retrieve3ds2ResultRequest);
const retrieve3ds2ResultResponse: payments.ThreeDS2ResultResponse = await classicIntegration.retrieve3ds2Result(retrieve3ds2ResultRequest);
expect(retrieve3ds2ResultResponse?.threeDS2Result?.authenticationValue).toEqual("THREEDS2RESULT");
});
@@ -157,7 +141,7 @@ describe("Classic Integration", (): void => {
"response": "[capture-received]"
});
const modificationRequest: CaptureRequest = {
const modificationRequest: payments.CaptureRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
@@ -167,8 +151,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.capture(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.CaptureReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.capture(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CaptureReceived);
});
test("Should succesfully send Cancel request", async (): Promise<void> => {
@@ -178,14 +162,14 @@ describe("Classic Integration", (): void => {
"response": "[cancel-received]"
});
const modificationRequest: CancelRequest = {
const modificationRequest: payments.CancelRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"reference": "YourModificationReference",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.cancel(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.CancelReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.cancel(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CancelReceived);
});
test("Should succesfully send Refund request", async (): Promise<void> => {
@@ -195,7 +179,7 @@ describe("Classic Integration", (): void => {
"response": "[refund-received]"
});
const modificationRequest: RefundRequest = {
const modificationRequest: payments.RefundRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
@@ -205,8 +189,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.refund(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.RefundReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.refund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.RefundReceived);
});
test("Should succesfully send CancelOrRefund request", async (): Promise<void> => {
@@ -216,14 +200,14 @@ describe("Classic Integration", (): void => {
"response": "[cancelOrRefund-received]"
});
const modificationRequest: CancelOrRefundRequest = {
const modificationRequest: payments.CancelOrRefundRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"reference": "YourModificationReference",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.cancelOrRefund(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.CancelOrRefundReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.cancelOrRefund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CancelOrRefundReceived);
});
test("Should succesfully send TechnicalCancel request", async (): Promise<void> => {
@@ -233,7 +217,7 @@ describe("Classic Integration", (): void => {
"response": "[technical-cancel-received]"
});
const modificationRequest: TechnicalCancelRequest = {
const modificationRequest: payments.TechnicalCancelRequest = {
"originalMerchantReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
@@ -243,8 +227,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.technicalCancel(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.TechnicalCancelReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.technicalCancel(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.TechnicalCancelReceived);
});
test("Should succesfully send AdjustAuthorisation request", async (): Promise<void> => {
@@ -254,7 +238,7 @@ describe("Classic Integration", (): void => {
"response": "[adjustAuthorisation-received]"
});
const modificationRequest: AdjustAuthorisationRequest = {
const modificationRequest: payments.AdjustAuthorisationRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
@@ -264,8 +248,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.adjustAuthorisation(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.AdjustAuthorisationReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.adjustAuthorisation(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.AdjustAuthorisationReceived);
});
test("Should succesfully send Donate request", async (): Promise<void> => {
@@ -275,7 +259,7 @@ describe("Classic Integration", (): void => {
"response": "[donation-received]"
});
const modificationRequest: DonationRequest = {
const modificationRequest: payments.DonationRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
@@ -286,8 +270,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};
const modificationResult: ModificationResult = await classicIntegration.donate(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.DonationReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.donate(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.DonationReceived);
});
test("Should succesfully send VoidPendingRefund request", async (): Promise<void> => {
@@ -297,13 +281,13 @@ describe("Classic Integration", (): void => {
"response": "[voidPendingRefund-received]"
});
const modificationRequest: VoidPendingRefundRequest = {
const modificationRequest: payments.VoidPendingRefundRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"tenderReference": "5Iw8001176969533005",
"uniqueTerminalId": "VX820-123456789"
};
const modificationResult: ModificationResult = await classicIntegration.voidPendingRefund(modificationRequest);
expect(modificationResult.response).toEqual(ModificationResult.ResponseEnum.VoidPendingRefundReceived);
const modificationResult: payments.ModificationResult = await classicIntegration.voidPendingRefund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.VoidPendingRefundReceived);
});
});

View File

@@ -0,0 +1,11 @@
import Client from "../client";
describe("API Client", function (): void {
test("should be able to make a request using basic auth", async function (): Promise<void> {
new Client({
username: process.env.ADYEN_USER!,
password: process.env.ADYEN_PASSWORD!,
environment: "TEST"
});
});
});

View File

@@ -0,0 +1,59 @@
import nock from "nock";
import { createClient } from "../__mocks__/base";
import { DataProtection } from "../services";
import Client from "../client";
import HttpClientException from "../httpClient/httpClientException";
import { dataProtection } from "../typings";
let client: Client,
dataProtectionService: DataProtection,
scope: nock.Scope;
beforeEach((): void => {
if(!nock.isActive()) {
nock.activate();
}
client = createClient();
dataProtectionService = new DataProtection(client);
scope = nock(`${client.config.dataProtectionEndpoint}/${Client.DATA_PROTECTION_API_VERSION}`);
});
afterEach(() => {
nock.cleanAll();
});
describe("DataProtection", (): void => {
test("should make succesful subjectErasure call", async (): Promise<void> => {
const requestSubjectErasureSuccess: dataProtection.SubjectErasureResponse = {
"result": dataProtection.SubjectErasureResponse.ResultEnum.Success,
};
const requestSubjectErasureRequest: dataProtection.SubjectErasureByPspReferenceRequest = {
"merchantAccount": "MY_MERCHANT_ACCOUNT",
"forceErasure": true,
"pspReference": "0123456789"
};
scope.post("/requestSubjectErasure")
.reply(200, requestSubjectErasureSuccess);
const response: dataProtection.SubjectErasureResponse = await dataProtectionService.requestSubjectErasure(requestSubjectErasureRequest);
expect(response.result).toEqual(dataProtection.SubjectErasureResponse.ResultEnum.Success);
});
test("should return correct Exception", async (): Promise<void> => {
try {
scope.post("/requestSubjectErasure")
.reply(401);
const requestSubjectErasureRequest: dataProtection.SubjectErasureByPspReferenceRequest = {
"merchantAccount": "MY_MERCHANT_ACCOUNT",
"forceErasure": true,
"pspReference": "0123456789"
};
await dataProtectionService.requestSubjectErasure(requestSubjectErasureRequest);
} catch (e) {
expect(e instanceof HttpClientException).toBeTruthy();
}
});
});

View File

@@ -1,22 +1,3 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import HmacValidator from "../utils/hmacValidator";
import { AdditionalData, NotificationItem, NotificationRequestItem } from "../typings/notification/models";
import { ApiConstants } from "../constants/apiConstants";

View File

@@ -1,22 +1,3 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import nock, { Interceptor } from "nock";
import Client from "../client";
import Checkout from "../services/checkout";

View File

@@ -0,0 +1,326 @@
import nock from "nock";
import Client from "../client";
import {createClient} from "../__mocks__/base";
import * as models from "../typings/legalEntityManagement/models";
import {Document, LegalEntityInfo, OnboardingLinkInfo, TransferInstrumentInfo} from "../typings/legalEntityManagement/models";
import {DocumentUpdate} from "../services/legalEntityManagement/documents";
import {businessLine, businessLines, document, legalEntity, onboardingLink, onboardingTheme, onboardingThemes, transferInstrument} from "../__mocks__/legalEntityManagement/responses";
import TransferEnum = TransferInstrumentInfo.TypeEnum;
import TypeEnum = LegalEntityInfo.TypeEnum
import DocEnum = Document.TypeEnum
import {onboardingLinkInfo} from "../__mocks__/legalEntityManagement/requests";
import LegalEntityManagement from "../services/legalEntityManagement";
let client: Client;
let legalEntityManagement: LegalEntityManagement;
let scope: nock.Scope;
beforeEach((): void => {
if (!nock.isActive()) {
nock.activate();
}
client = createClient();
scope = nock(`${client.config.legalEntityManagementEndpoint}/${Client.LEGAL_ENTITY_MANAGEMENT_API_VERSION}`);
legalEntityManagement = new LegalEntityManagement(client);
});
afterEach(() => {
nock.cleanAll();
});
describe("Legal Entity Management", (): void => {
const id = "123456789"
describe("LegalEntities", (): void => {
it("should support POST /legalEntities", async (): Promise<void> => {
scope.post("/legalEntities")
.reply(200, legalEntity);
const request: models.LegalEntityInfo = {
type : TypeEnum.Individual,
individual : undefined
};
const response: models.LegalEntity = await legalEntityManagement.LegalEntities.create(request);
expect(response.id).toBe(id);
expect(response.type).toBe("individual");
});
it("should support GET /legalEntities/{id}", async (): Promise<void> => {
scope.get(`/legalEntities/${id}`)
.reply(200, legalEntity);
const response: models.LegalEntity = await legalEntityManagement.LegalEntities.retrieve("123456789");
expect(response.id).toBe(id);
expect(response.type).toBe("individual");
});
it("should support PATCH /legalEntities/{id}", async (): Promise<void> => {
scope.patch(`/legalEntities/${id}`)
.reply(200, legalEntity);
const request: models.LegalEntityInfo = {
type : TypeEnum.Individual,
individual : undefined
};
const response: models.LegalEntity = await legalEntityManagement.LegalEntities.update(id, request);
expect(response.id).toBe(id);
expect(response.type).toBe("individual");
});
it("should support GET /legalEntities/{id}/BusinessLines", async (): Promise<void> => {
scope.get(`/legalEntities/${id}/businessLines`)
.reply(200, businessLines);
const response: models.BusinessLines = await legalEntityManagement.LegalEntities.listBusinessLines(id);
expect(response.businessLines).toEqual( [{
"capability": "receivePayments",
"id": "123456789",
"industryCode": "123456789",
"legalEntityId": "123456789",
"salesChannels": ["string"],
"sourceOfFunds": {
"acquiringBusinessLineId": "string",
"adyenProcessedFunds": false,
"description": "string",
"type": "business"
},
"webData": [{ "webAddress": "string" }],
"webDataExemption": { "reason": "noOnlinePresence" }
}]);
});
});
describe("Transfer Instruments", (): void => {
it("should support POST /transferInstruments", async (): Promise<void> => {
scope.post("/transferInstruments")
.reply(200, transferInstrument);
const request: models.TransferInstrumentInfo = {
type : TransferEnum.BankAccount,
legalEntityId : id,
bankAccount : {accountNumber: "string",
accountType: "string",
bankBicSwift: "string",
bankCity: "string",
bankCode: "string",
bankName: "string",
branchCode: "string",
checkCode: "string",
countryCode: "string",
currencyCode: "string",
iban: "string"
}
};
const response: models.TransferInstrument = await legalEntityManagement.TransferInstruments.create(request);
expect(response.id).toBe(id);
expect(response.type).toBe(TransferEnum.BankAccount);
});
it("should support GET /transferInstruments/{id}", async (): Promise<void> => {
scope.get(`/transferInstruments/${id}`)
.reply(200, transferInstrument);
const response: models.TransferInstrument = await legalEntityManagement.TransferInstruments.retrieve(id);
expect(response.id).toBe(id);
expect(response.type).toBe(TransferEnum.BankAccount);
});
it("should support PATCH /transferInstruments/{id}", async (): Promise<void> => {
scope.patch(`/transferInstruments/${id}`)
.reply(200, transferInstrument);
const request: models.TransferInstrumentInfo = {
type : TransferEnum.BankAccount,
legalEntityId : id,
bankAccount : {accountNumber: "string",
accountType: "string",
bankBicSwift: "string",
bankCity: "string",
bankCode: "string",
bankName: "string",
branchCode: "string",
checkCode: "string",
countryCode: "string",
currencyCode: "string",
iban: "string"
}
};
const response: models.TransferInstrument = await legalEntityManagement.TransferInstruments.update(id, request);
expect(response.id).toBe(id);
expect(response.type).toBe(TransferEnum.BankAccount);
});
it("should support DELETE /transferInstruments/{id}", async (): Promise<void> => {
scope.delete(`/transferInstruments/${id}`)
.reply(200);
await legalEntityManagement.TransferInstruments.delete(id);
expect(200);
});
});
describe("Business Lines", (): void => {
it("should support POST /businessLines", async (): Promise<void> => {
scope.post("/businessLines")
.reply(200, businessLine);
const request: models.BusinessLineInfo = {
capability: "receivePayments",
industryCode: id,
legalEntityId: id };
const response: models.BusinessLine = await legalEntityManagement.BusinessLineService.create(request);
expect(response.id).toBe(id);
expect(response.capability).toBe("receivePayments");
expect(response.industryCode).toBe(id);
expect(response.legalEntityId).toBe(id);
});
it("should support GET /businessLines/{id}", async (): Promise<void> => {
scope.get(`/businessLines/${id}`)
.reply(200, businessLine);
const response: models.BusinessLine = await legalEntityManagement.BusinessLineService.retrieve(id);
expect(response.id).toBe(id);
expect(response.capability).toBe("receivePayments");
});
it("should support PATCH /businessLines/{id}", async (): Promise<void> => {
scope.patch(`/businessLines/${id}`)
.reply(200, businessLine);
const request: models.BusinessLineInfo = {
capability: "receivePayments",
industryCode: id,
legalEntityId: id };
const response: models.BusinessLine = await legalEntityManagement.BusinessLineService.update(id, request);
expect(response.id).toBe(id);
expect(response.capability).toBe("receivePayments");
expect(response.industryCode).toBe(id);
expect(response.legalEntityId).toBe(id);
});
});
describe("Documents", (): void => {
it("should support POST /documents", async (): Promise<void> => {
scope.post("/documents")
.reply(200, document);
const request: DocumentUpdate = {
attachments: [{
content: "string",
contentType: "string",
filename: "string",
pageName: "string",
pageType: "string"
}],
description: "document",
owner: {
"id": "123456789",
"type": "passport"
},
type : DocEnum.DriversLicense
};
const response: models.Document = await legalEntityManagement.Documents.create(request);
expect(response.id).toBe(id);
expect(response.type).toBe(DocEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
});
it("should support GET /documents/{id}", async (): Promise<void> => {
scope.get(`/documents/${id}`)
.reply(200, document);
const response: models.Document = await legalEntityManagement.Documents.retrieve(id);
expect(response.id).toBe(id);
expect(response.type).toBe(DocEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
});
it("should support PATCH /documents/{id}", async (): Promise<void> => {
scope.patch(`/documents/${id}`)
.reply(200, document);
const request: DocumentUpdate = {
attachments: [{
content: "string",
contentType: "string",
filename: "string",
pageName: "string",
pageType: "string"
}],
description: "document",
owner: {
"id": "123456789",
"type": "passport"
},
type : DocEnum.DriversLicense
};
const response: models.Document = await legalEntityManagement.Documents.update(id, request);
expect(response.id).toBe(id);
expect(response.type).toBe(DocEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
});
it("should support DELETE /documents/{id}", async (): Promise<void> => {
scope.delete(`/documents/${id}`)
.reply(200);
await legalEntityManagement.Documents.delete(id);
});
});
describe("OnboardingLinks and Themes", (): void => {
it("should support POST /onboardingLinks", async (): Promise<void> => {
scope.post(`/legalEntities/${id}/onboardingLinks`)
.reply(200, onboardingLink);
const request: OnboardingLinkInfo = onboardingLinkInfo;
const response: models.OnboardingLink = await legalEntityManagement.HostedOnboardingPage.create(id, request);
expect(response.url).toBe("https://your.redirect-url.com");
});
it("should support GET /themes", async (): Promise<void> => {
scope.get(`/themes`)
.reply(200, onboardingThemes);
const response: models.OnboardingThemes = await legalEntityManagement.HostedOnboardingPage.listThemes();
expect(response.themes[0].id).toEqual(id);
});
it("should support GET /themes/{id}", async (): Promise<void> => {
scope.get(`/themes/${id}`)
.reply(200, onboardingTheme);
const response: models.OnboardingTheme = await legalEntityManagement.HostedOnboardingPage.retrieveTheme(id);
expect(response.id).toBe(id);
});
});
});

View File

@@ -2,13 +2,13 @@ import nock from "nock";
import Client from "../client";
import { createClient } from "../__mocks__/base";
import { Management } from "../services";
import { AllowedOrigin, AllowedOriginsResponse, MeApiCredential } from "../typings/management/models";
import * as models from "../typings/management/models";
import { management } from "../typings";
import * as requests from "../__mocks__/management/requests";
import * as responses from "../__mocks__/management/responses";
import HttpClientException from "../httpClient/httpClientException";
let client: Client;
let management: Management;
let managementService: Management;
let scope: nock.Scope;
const merchantId = "merchantId";
@@ -26,7 +26,7 @@ beforeEach((): void => {
}
client = createClient();
scope = nock(`${client.config.managementEndpoint}/${Client.MANAGEMENT_API_VERSION}`);
management = new Management(client);
managementService = new Management(client);
});
afterEach(() => {
@@ -35,6 +35,32 @@ afterEach(() => {
describe("Management", (): void => {
describe("Me", (): void => {
test("Should properly handle error responses from API", async (): Promise<void> => {
scope.post("/me/allowedOrigins")
.reply(422, {
"type": "https://docs.adyen.com/errors/not-found",
"title": "Entity was not found",
"status": 422,
"detail": "The origin id is invalid or does not exist.",
"requestId": "KQZ5LXK2VMPRMC82",
"errorCode": "30_112",
});
try {
const createAllowedOriginRequest : management.CreateAllowedOriginRequest = {
domain: "test.com",
};
await managementService.Me.createAllowedOrigin(createAllowedOriginRequest);
fail("No exception was thrown");
} catch (error) {
expect(error instanceof HttpClientException).toBeTruthy();
if(error instanceof HttpClientException && error.responseBody) {
expect(JSON.parse(error.responseBody).requestId).toBe("KQZ5LXK2VMPRMC82");
} else {
fail("Error did not contain the expected data");
}
}
});
test("Should get API credential details based on the API Key used in the request", async (): Promise<void> => {
scope.get("/me")
.reply(200, {
@@ -63,7 +89,7 @@ describe("Management", (): void => {
"companyName": "Test",
"active": true,
});
const meResponse: MeApiCredential = await management.Me.retrieve();
const meResponse: management.MeApiCredential = await managementService.Me.retrieve();
expect(meResponse.id).toEqual("S2-6262224667");
});
@@ -78,11 +104,11 @@ describe("Management", (): void => {
}
}
});
const allowedOriginRequest: AllowedOrigin = {
const allowedOriginRequest: management.AllowedOrigin = {
"domain": "https://www.us.mystore.com"
};
const allowedOriginsResponse: AllowedOrigin = await management.Me.createAllowedOrigin(allowedOriginRequest);
const allowedOriginsResponse: management.AllowedOrigin = await managementService.Me.createAllowedOrigin(allowedOriginRequest);
expect(allowedOriginsResponse.domain).toEqual("https://www.us.mystore.com");
});
@@ -102,7 +128,7 @@ describe("Management", (): void => {
]
});
const allowedOriginsResponse: AllowedOriginsResponse = await management.Me.retrieveAllowedOrigins();
const allowedOriginsResponse: management.AllowedOriginsResponse = await managementService.Me.retrieveAllowedOrigins();
expect(allowedOriginsResponse.data?.length).toEqual(1);
});
});
@@ -119,13 +145,13 @@ describe("Management", (): void => {
}
});
const allowedOriginResponse: AllowedOrigin = await management.Me.retrieveAllowedOrigin("S2-123123123123123");
const allowedOriginResponse: management.AllowedOrigin = await managementService.Me.retrieveAllowedOrigin("S2-123123123123123");
expect(allowedOriginResponse.id).toEqual("S2-123123123123123");
});
test("Should remove the allowed origin specified in the path", async () => {
scope.delete("/me/allowedOrigins/S2-123123123123123").reply(204, {});
const allowedOriginResponse: Record<string, unknown> = await management.Me.deleteAllowerdOrigin("S2-123123123123123");
const allowedOriginResponse: Record<string, unknown> = await managementService.Me.deleteAllowerdOrigin("S2-123123123123123");
expect(scope.isDone()).toBe(true);
expect(Object.entries(allowedOriginResponse).length).toBe(0);
});
@@ -135,7 +161,7 @@ describe("Management", (): void => {
scope.get("/merchants?pageNumber=1&pageSize=1")
.reply(200, responses.listMerchantResponse);
const response: models.ListMerchantResponse = await management.MerchantAccount.list({
const response: management.ListMerchantResponse = await managementService.MerchantAccount.list({
params: {
"pageNumber": "1",
"pageSize": "1"
@@ -149,7 +175,7 @@ describe("Management", (): void => {
scope.post("/merchants")
.reply(200, responses.createMerchantResponse);
const response: models.CreateMerchantResponse = await management.MerchantAccount.create(requests.createMerchantRequest);
const response: management.CreateMerchantResponse = await managementService.MerchantAccount.create(requests.createMerchantRequest);
expect(response).toBeTruthy();
});
@@ -158,7 +184,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}`)
.reply(200, responses.merchant);
const response: models.Merchant = await management.MerchantAccount.retrieve(merchantId);
const response: management.Merchant = await managementService.MerchantAccount.retrieve(merchantId);
expect(response).toBeTruthy();
});
@@ -167,7 +193,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/activate`)
.reply(200, responses.requestActivationResponse);
const response: models.RequestActivationResponse = await management.MerchantAccount.activate(merchantId);
const response: management.RequestActivationResponse = await managementService.MerchantAccount.activate(merchantId);
expect(response).toBeTruthy();
});
@@ -178,7 +204,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/allowedOrigins`)
.reply(200, responses.allowedOriginsResponse);
const response: models.AllowedOriginsResponse = await management.MerchantAllowedOrigins.list(merchantId, apiCredentialId);
const response: management.AllowedOriginsResponse = await managementService.MerchantAllowedOrigins.list(merchantId, apiCredentialId);
expect(response).toBeTruthy();
});
@@ -187,7 +213,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/allowedOrigins`)
.reply(200, responses.allowedOriginsResponse);
const response: models.AllowedOriginsResponse = await management.MerchantAllowedOrigins.create(merchantId, apiCredentialId, requests.allowedOrigin);
const response: management.AllowedOriginsResponse = await managementService.MerchantAllowedOrigins.create(merchantId, apiCredentialId, requests.allowedOrigin);
expect(response).toBeTruthy();
});
@@ -196,14 +222,14 @@ describe("Management", (): void => {
scope.delete(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/allowedOrigins/${originId}`)
.reply(204);
await management.MerchantAllowedOrigins.delete(merchantId, apiCredentialId, originId);
await managementService.MerchantAllowedOrigins.delete(merchantId, apiCredentialId, originId);
});
it("should support GET /merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}", async (): Promise<void> => {
scope.get(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/allowedOrigins/${originId}`)
.reply(200, responses.allowedOrigin);
const response: models.AllowedOrigin = await management.MerchantAllowedOrigins.retrieve(merchantId, apiCredentialId, originId);
const response: management.AllowedOrigin = await managementService.MerchantAllowedOrigins.retrieve(merchantId, apiCredentialId, originId);
expect(response).toBeTruthy();
});
@@ -214,7 +240,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/apiCredentials?pageNumber=1&pageSize=1`)
.reply(200, responses.listMerchantApiCredentialsResponse);
const response: models.ListMerchantApiCredentialsResponse = await management.MerchantApiCredentials.list(merchantId, {
const response: management.ListMerchantApiCredentialsResponse = await managementService.MerchantApiCredentials.list(merchantId, {
params: {
"pageNumber": "1",
"pageSize": "1"
@@ -228,7 +254,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/apiCredentials`)
.reply(200, responses.createApiCredentialResponse);
const response: models.CreateApiCredentialResponse = await management.MerchantApiCredentials.create(merchantId, requests.createMerchantApiCredentialRequest);
const response: management.CreateApiCredentialResponse = await managementService.MerchantApiCredentials.create(merchantId, requests.createMerchantApiCredentialRequest);
expect(response).toBeTruthy();
});
@@ -237,7 +263,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}`)
.reply(200, responses.apiCredential);
const response: models.ApiCredential = await management.MerchantApiCredentials.retrieve(merchantId, apiCredentialId);
const response: management.ApiCredential = await managementService.MerchantApiCredentials.retrieve(merchantId, apiCredentialId);
expect(response).toBeTruthy();
});
@@ -246,7 +272,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}`)
.reply(200, responses.apiCredential);
const response: models.ApiCredential = await management.MerchantApiCredentials.update(merchantId, apiCredentialId, requests.updateMerchantApiCredentialRequest);
const response: management.ApiCredential = await managementService.MerchantApiCredentials.update(merchantId, apiCredentialId, requests.updateMerchantApiCredentialRequest);
expect(response).toBeTruthy();
});
@@ -257,7 +283,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/generateApiKey`)
.reply(200, responses.generateApiKeyResponse);
const response: models.GenerateApiKeyResponse = await management.MerchantApiKey.create(merchantId, apiCredentialId);
const response: management.GenerateApiKeyResponse = await managementService.MerchantApiKey.create(merchantId, apiCredentialId);
expect(response).toBeTruthy();
});
@@ -268,7 +294,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/apiCredentials/${apiCredentialId}/generateClientKey`)
.reply(200, responses.generateClientKeyResponse);
const response: models.GenerateClientKeyResponse = await management.MerchantClientKey.create(merchantId, apiCredentialId);
const response: management.GenerateClientKeyResponse = await managementService.MerchantClientKey.create(merchantId, apiCredentialId);
expect(response).toBeTruthy();
});
@@ -279,7 +305,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/paymentMethodSettings?storeId=1&businessLineId=1&pageNumber=1&pageSize=1`)
.reply(200, responses.paymentMethodResponse);
const response: models.PaymentMethodResponse = await management.MerchantPaymentMethods.listPaymentMethodSettings(merchantId, {
const response: management.PaymentMethodResponse = await managementService.MerchantPaymentMethods.listPaymentMethodSettings(merchantId, {
params: {
"storeId": "1",
"businessLineId": "1",
@@ -295,9 +321,9 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/paymentMethodSettings`)
.reply(200, responses.paymentMethod);
const response: models.PaymentMethod = await management.MerchantPaymentMethods.create(merchantId, {
const response: management.PaymentMethod = await managementService.MerchantPaymentMethods.create(merchantId, {
...requests.paymentMethodSetupInfo,
type: models.PaymentMethodSetupInfo.TypeEnum.Ideal
type: management.PaymentMethodSetupInfo.TypeEnum.Ideal
});
expect(response).toBeTruthy();
@@ -307,7 +333,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/paymentMethodSettings/${paymentMethodId}`)
.reply(200, responses.paymentMethod);
const response: models.PaymentMethod = await management.MerchantPaymentMethods.retrieve(merchantId, paymentMethodId);
const response: management.PaymentMethod = await managementService.MerchantPaymentMethods.retrieve(merchantId, paymentMethodId);
expect(response).toBeTruthy();
});
@@ -316,7 +342,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/paymentMethodSettings/${paymentMethodId}`)
.reply(200, responses.paymentMethod);
const response: models.PaymentMethod = await management.MerchantPaymentMethods.update(merchantId, paymentMethodId, requests.updatePaymentMethodInfo);
const response: management.PaymentMethod = await managementService.MerchantPaymentMethods.update(merchantId, paymentMethodId, requests.updatePaymentMethodInfo);
expect(response).toBeTruthy();
});
@@ -327,7 +353,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/payoutSettings`)
.reply(200, responses.payoutSettingsResponse);
const response: models.PayoutSettingsResponse = await management.MerchantPayoutSettings.listPayoutSettings(merchantId);
const response: management.PayoutSettingsResponse = await managementService.MerchantPayoutSettings.listPayoutSettings(merchantId);
expect(response).toBeTruthy();
});
@@ -336,7 +362,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/payoutSettings`)
.reply(200, responses.payoutSettings);
const response: models.PayoutSettings = await management.MerchantPayoutSettings.create(merchantId, requests.payoutSettingsRequest);
const response: management.PayoutSettings = await managementService.MerchantPayoutSettings.create(merchantId, requests.payoutSettingsRequest);
expect(response).toBeTruthy();
});
@@ -345,14 +371,14 @@ describe("Management", (): void => {
scope.delete(`/merchants/${merchantId}/payoutSettings/${payoutSettingsId}`)
.reply(200);
await management.MerchantPayoutSettings.delete(merchantId, payoutSettingsId);
await managementService.MerchantPayoutSettings.delete(merchantId, payoutSettingsId);
});
it("should support GET /merchants/{merchantId}/payoutSettings/{payoutSettingsId}", async (): Promise<void> => {
scope.get(`/merchants/${merchantId}/payoutSettings/${payoutSettingsId}`)
.reply(200, responses.payoutSettings);
const response: models.PayoutSettings = await management.MerchantPayoutSettings.retrieve(merchantId, payoutSettingsId);
const response: management.PayoutSettings = await managementService.MerchantPayoutSettings.retrieve(merchantId, payoutSettingsId);
expect(response).toBeTruthy();
});
@@ -361,7 +387,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/payoutSettings/${payoutSettingsId}`)
.reply(200, responses.payoutSettings);
const response: models.PayoutSettings = await management.MerchantPayoutSettings.update(merchantId, payoutSettingsId, requests.updatePayoutSettingsRequest);
const response: management.PayoutSettings = await managementService.MerchantPayoutSettings.update(merchantId, payoutSettingsId, requests.updatePayoutSettingsRequest);
expect(response).toBeTruthy();
});
@@ -372,7 +398,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/billingEntities?name=bill`)
.reply(200, responses.billingEntitiesResponse);
const response: models.BillingEntitiesResponse = await management.MerchantTerminalOrders.listBillingEntities(merchantId, {
const response: management.BillingEntitiesResponse = await managementService.MerchantTerminalOrders.listBillingEntities(merchantId, {
params: {
"name": "bill"
}
@@ -385,7 +411,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/shippingLocations?name=1&offset=1&limit=1`)
.reply(200, responses.shippingLocationsResponse);
const response: models.ShippingLocationsResponse = await management.MerchantTerminalOrders.listShippingLocations(merchantId, {
const response: management.ShippingLocationsResponse = await managementService.MerchantTerminalOrders.listShippingLocations(merchantId, {
params: {
"name": "1",
"offset": "1",
@@ -400,7 +426,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/shippingLocations`)
.reply(200, responses.shippingLocation);
const response: models.ShippingLocation = await management.MerchantTerminalOrders.createShippingLocation(merchantId, requests.shippingLocation);
const response: management.ShippingLocation = await managementService.MerchantTerminalOrders.createShippingLocation(merchantId, requests.shippingLocation);
expect(response).toBeTruthy();
});
@@ -409,7 +435,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalModels`)
.reply(200, responses.terminalModelsResponse);
const response: models.TerminalModelsResponse = await management.MerchantTerminalOrders.listTerminalModels(merchantId);
const response: management.TerminalModelsResponse = await managementService.MerchantTerminalOrders.listTerminalModels(merchantId);
expect(response).toBeTruthy();
});
@@ -418,7 +444,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalOrders?customerOrderReference=1&status=1&offset=1&limit=1`)
.reply(200, responses.terminalOrdersResponse);
const response: models.TerminalOrdersResponse = await management.MerchantTerminalOrders.listTerminalOrders(merchantId, {
const response: management.TerminalOrdersResponse = await managementService.MerchantTerminalOrders.listTerminalOrders(merchantId, {
params: {
"customerOrderReference": "1",
"status": "1",
@@ -434,7 +460,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/terminalOrders`)
.reply(200, responses.terminalOrder);
const response: models.TerminalOrder = await management.MerchantTerminalOrders.create(merchantId, requests.terminalOrderRequest);
const response: management.TerminalOrder = await managementService.MerchantTerminalOrders.create(merchantId, requests.terminalOrderRequest);
expect(response).toBeTruthy();
});
@@ -443,7 +469,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalOrders/${orderId}`)
.reply(200, responses.terminalOrder);
const response: models.TerminalOrder = await management.MerchantTerminalOrders.retrieve(merchantId, orderId);
const response: management.TerminalOrder = await managementService.MerchantTerminalOrders.retrieve(merchantId, orderId);
expect(response).toBeTruthy();
});
@@ -452,7 +478,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/terminalOrders/${orderId}`)
.reply(200, responses.terminalOrder);
const response: models.TerminalOrder = await management.MerchantTerminalOrders.update(merchantId, orderId, requests.terminalOrderRequest);
const response: management.TerminalOrder = await managementService.MerchantTerminalOrders.update(merchantId, orderId, requests.terminalOrderRequest);
expect(response).toBeTruthy();
});
@@ -461,7 +487,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/terminalOrders/${orderId}/cancel`)
.reply(200, responses.terminalOrder);
const response: models.TerminalOrder = await management.MerchantTerminalOrders.cancel(merchantId, orderId);
const response: management.TerminalOrder = await managementService.MerchantTerminalOrders.cancel(merchantId, orderId);
expect(response).toBeTruthy();
});
@@ -470,7 +496,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalProducts?country=1&terminalModelId=1&offset=1&limit=1`)
.reply(200, responses.terminalProductsResponse);
const response: models.TerminalProductsResponse = await management.MerchantTerminalOrders.listTerminalProducts(merchantId, {
const response: management.TerminalProductsResponse = await managementService.MerchantTerminalOrders.listTerminalProducts(merchantId, {
params: {
"country": "1",
"terminalModelId": "1",
@@ -488,7 +514,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalLogos?model=1`)
.reply(200, responses.logo);
const response: models.Logo = await management.MerchantTerminalSettings.retrieveLogo(merchantId, {
const response: management.Logo = await managementService.MerchantTerminalSettings.retrieveLogo(merchantId, {
params: {
"model": "1"
}
@@ -501,7 +527,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/terminalLogos?model=1`)
.reply(200, responses.logo);
const response: models.Logo = await management.MerchantTerminalSettings.updateLogo(merchantId, requests.logo, {
const response: management.Logo = await managementService.MerchantTerminalSettings.updateLogo(merchantId, requests.logo, {
params: {
"model": "1"
}
@@ -514,7 +540,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/terminalSettings`)
.reply(200, responses.terminalSettings);
const response: models.TerminalSettings = await management.MerchantTerminalSettings.retrieve(merchantId);
const response: management.TerminalSettings = await managementService.MerchantTerminalSettings.retrieve(merchantId);
expect(response).toBeTruthy();
});
@@ -523,7 +549,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/terminalSettings`)
.reply(200, responses.terminalSettings);
const response: models.TerminalSettings = await management.MerchantTerminalSettings.update(merchantId, requests.terminalSettings);
const response: management.TerminalSettings = await managementService.MerchantTerminalSettings.update(merchantId, requests.terminalSettings);
expect(response).toBeTruthy();
});
@@ -534,7 +560,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/users?pageNumber=1&pageSize=1`)
.reply(200, responses.listMerchantUsersResponse);
const response: models.ListMerchantUsersResponse = await management.MerchantUsers.list(merchantId, {
const response: management.ListMerchantUsersResponse = await managementService.MerchantUsers.list(merchantId, {
params: {
"pageNumber": "1",
"pageSize": "1"
@@ -548,7 +574,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/users`)
.reply(200, responses.createUserResponse);
const response: models.CreateUserResponse = await management.MerchantUsers.create(merchantId, requests.createMerchantUserRequest);
const response: management.CreateUserResponse = await managementService.MerchantUsers.create(merchantId, requests.createMerchantUserRequest);
expect(response).toBeTruthy();
});
@@ -557,7 +583,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/users/${userId}`)
.reply(200, responses.user);
const response: models.User = await management.MerchantUsers.retrieve(merchantId, userId);
const response: management.User = await managementService.MerchantUsers.retrieve(merchantId, userId);
expect(response).toBeTruthy();
});
@@ -566,7 +592,7 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/users/${userId}`)
.reply(200, responses.user);
const response: models.User = await management.MerchantUsers.update(merchantId, userId, requests.updateMerchantUserRequest);
const response: management.User = await managementService.MerchantUsers.update(merchantId, userId, requests.updateMerchantUserRequest);
expect(response).toBeTruthy();
});
@@ -577,7 +603,7 @@ describe("Management", (): void => {
scope.get(`/merchants/${merchantId}/webhooks?pageNumber=1&pageSize=1`)
.reply(200, responses.listWebhooksResponse);
const response: models.ListWebhooksResponse = await management.MerchantWebhooks.list(merchantId, {
const response: management.ListWebhooksResponse = await managementService.MerchantWebhooks.list(merchantId, {
params: {
"pageNumber": "1",
"pageSize": "1"
@@ -591,11 +617,11 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/webhooks`)
.reply(200, responses.webhook);
const response: models.Webhook = await management.MerchantWebhooks.create(merchantId, {
const response: management.Webhook = await managementService.MerchantWebhooks.create(merchantId, {
...requests.createMerchantWebhookRequest,
communicationFormat: models.CreateMerchantWebhookRequest.CommunicationFormatEnum.Json,
networkType: models.CreateMerchantWebhookRequest.NetworkTypeEnum.Public,
sslVersion: models.CreateMerchantWebhookRequest.SslVersionEnum.Tls
communicationFormat: management.CreateMerchantWebhookRequest.CommunicationFormatEnum.Json,
networkType: management.CreateMerchantWebhookRequest.NetworkTypeEnum.Public,
sslVersion: management.CreateMerchantWebhookRequest.SslVersionEnum.Tls
});
expect(response).toBeTruthy();
@@ -605,14 +631,14 @@ describe("Management", (): void => {
scope.delete(`/merchants/${merchantId}/webhooks/${webhookId}`)
.reply(204);
await management.MerchantWebhooks.delete(merchantId, webhookId);
await managementService.MerchantWebhooks.delete(merchantId, webhookId);
});
it("should support GET /merchants/{merchantId}/webhooks/{webhookId}", async (): Promise<void> => {
scope.get(`/merchants/${merchantId}/webhooks/${webhookId}`)
.reply(200, responses.webhook);
const response: models.Webhook = await management.MerchantWebhooks.retrieve(merchantId, webhookId);
const response: management.Webhook = await managementService.MerchantWebhooks.retrieve(merchantId, webhookId);
expect(response).toBeTruthy();
});
@@ -621,11 +647,11 @@ describe("Management", (): void => {
scope.patch(`/merchants/${merchantId}/webhooks/${webhookId}`)
.reply(200, responses.webhook);
const response: models.Webhook = await management.MerchantWebhooks.update(merchantId, webhookId, {
const response: management.Webhook = await managementService.MerchantWebhooks.update(merchantId, webhookId, {
...requests.updateMerchantWebhookRequest,
communicationFormat: models.CreateMerchantWebhookRequest.CommunicationFormatEnum.Soap,
networkType: models.CreateMerchantWebhookRequest.NetworkTypeEnum.Local,
sslVersion: models.CreateMerchantWebhookRequest.SslVersionEnum.Sslv3
communicationFormat: management.CreateMerchantWebhookRequest.CommunicationFormatEnum.Soap,
networkType: management.CreateMerchantWebhookRequest.NetworkTypeEnum.Local,
sslVersion: management.CreateMerchantWebhookRequest.SslVersionEnum.Sslv3
});
expect(response).toBeTruthy();
@@ -635,7 +661,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/webhooks/${webhookId}/generateHmac`)
.reply(200, responses.generateHmacKeyResponse);
const response: models.GenerateHmacKeyResponse = await management.MerchantWebhooks.generateHmac(merchantId, webhookId);
const response: management.GenerateHmacKeyResponse = await managementService.MerchantWebhooks.generateHmac(merchantId, webhookId);
expect(response).toBeTruthy();
});
@@ -644,7 +670,7 @@ describe("Management", (): void => {
scope.post(`/merchants/${merchantId}/webhooks/${webhookId}/test`)
.reply(200, responses.testWebhookResponse);
const testWebhookRequest: models.TestWebhookRequest = {
const testWebhookRequest: management.TestWebhookRequest = {
"notification": {
"amount": {
"currency": "string",
@@ -659,9 +685,45 @@ describe("Management", (): void => {
},
"types": ["string"]
};
const response: models.TestWebhookResponse = await management.MerchantWebhooks.test(merchantId, webhookId, testWebhookRequest);
const response: management.TestWebhookResponse = await managementService.MerchantWebhooks.test(merchantId, webhookId, testWebhookRequest);
expect(response).toBeTruthy();
});
});
describe("AllowedOriginsMerchantLevelApi", (): void => {
test("Delete an allowed origin", async () => {
scope.delete("/merchants/foo/apiCredentials/BAR123/allowedOrigins/fishy%20one").reply(204);
await managementService.AllowedOriginsMerchantLevelApi
.deleteAllowedOrigin("foo", "BAR123", "fishy one");
});
test("Create an allowed origin", async () => {
const requestBody = {
"domain": "https://www.eu.mystore.com"
};
scope.post("/merchants/YOUR_MERCHANT_ACCOUNT/apiCredentials/YOUR_API_CREDENTIAL/allowedOrigins", requestBody)
.reply(200, {
"id": "YOUR_ALLOWED_ORIGIN",
"data": [
{
"domain": "https://www.eu.mystore.com",
}
],
"_links": {
"self": {
"href": "https://management-test.adyen.com/v1/merchants/YOUR_MERCHANT_ACCOUNT/apiCredentials/YOUR_API_CREDENTIAL/allowedOrigins/YOUR_ALLOWED_ORIGIN"
}
}
});
const response: management.AllowedOriginsResponse = await managementService.AllowedOriginsMerchantLevelApi
.createAllowedOrigin("YOUR_MERCHANT_ACCOUNT", "YOUR_API_CREDENTIAL", {
domain: "https://www.eu.mystore.com",
});
expect(response.data![0].domain).toEqual("https://www.eu.mystore.com");
});
});
});

View File

@@ -154,7 +154,6 @@ let checkout: Checkout;
let scope: nock.Scope;
const paymentPspReference = "863620292981235A";
const invalidPaymentPspReference = "invalid_psp_reference";
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
beforeEach((): void => {
if (!nock.isActive()) {
@@ -170,8 +169,7 @@ afterEach(() => {
});
describe("Modification", (): void => {
test.each([isCI, true])("should perform an amount update request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform an amount update request", async (): Promise<void> => {
const request = createAmountUpdateRequest();
scope.post(`/payments/${paymentPspReference}/amountUpdates`)
.reply(200, createAmountUpdateResponse());
@@ -187,8 +185,7 @@ describe("Modification", (): void => {
}
});
test.each([false, true])("should fail to perform an amount update request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should fail to perform an amount update request", async (): Promise<void> => {
expect.assertions(2);
const request = createAmountUpdateRequest();
scope.post(`/payments/${invalidPaymentPspReference}/amountUpdates`)
@@ -206,8 +203,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a cancels request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform a cancels request", async (): Promise<void> => {
const request = createCancelsRequest();
scope.post(`/payments/${paymentPspReference}/cancels`)
.reply(200, createCancelsResponse());
@@ -223,8 +219,7 @@ describe("Modification", (): void => {
}
});
test.each([false, true])("should fail to perform a cancels request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should fail to perform a cancels request", async (): Promise<void> => {
expect.assertions(2);
const request = createCancelsRequest();
scope.post(`/payments/${invalidPaymentPspReference}/cancels`)
@@ -241,8 +236,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a standalone cancels request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform a standalone cancels request", async (): Promise<void> => {
const request = createStandaloneCancelsRequest();
scope.post("/cancels")
.reply(200, createStandaloneCancelsResponse());
@@ -258,8 +252,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a captures request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform a captures request", async (): Promise<void> => {
const request = createCapturesRequest();
scope.post(`/payments/${paymentPspReference}/captures`)
.reply(200, createCapturesResponse());
@@ -275,8 +268,7 @@ describe("Modification", (): void => {
}
});
test.each([false, true])("should fail to perform a captures request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should fail to perform a captures request", async (): Promise<void> => {
expect.assertions(2);
const request = createCapturesRequest();
scope.post(`/payments/${invalidPaymentPspReference}/captures`)
@@ -293,8 +285,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a refunds request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform a refunds request", async (): Promise<void> => {
const request = createRefundsRequest();
scope.post(`/payments/${paymentPspReference}/refunds`)
.reply(200, createRefundsResponse());
@@ -310,8 +301,7 @@ describe("Modification", (): void => {
}
});
test.each([false, true])("should fail to perform a refunds request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should fail to perform a refunds request", async (): Promise<void> => {
expect.assertions(2);
const request = createRefundsRequest();
scope.post(`/payments/${invalidPaymentPspReference}/refunds`)
@@ -328,8 +318,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a reversals request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should perform a reversals request", async (): Promise<void> => {
const request = createReversalsRequest();
scope.post(`/payments/${paymentPspReference}/reversals`)
.reply(200, createReversalsResponse());
@@ -345,8 +334,7 @@ describe("Modification", (): void => {
}
});
test.each([false, true])("should fail to perform a reversals request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should fail to perform a reversals request", async (): Promise<void> => {
expect.assertions(2);
const request = createReversalsRequest();
scope.post(`/payments/${invalidPaymentPspReference}/reversals`)

View File

@@ -1,22 +1,3 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import authorisationTrue from "../__mocks__/notification/authorisationTrue.json";
import captureTrue from "../__mocks__/notification/captureTrue.json";
import captureFalse from "../__mocks__/notification/captureFalse.json";

View File

@@ -2,17 +2,9 @@ import nock from "nock";
import { createClient } from "../__mocks__/base";
import Payout from "../services/payout";
import Client from "../client";
import {
ModifyRequest,
PayoutRequest,
Recurring,
StoreDetailAndSubmitRequest,
StoreDetailRequest,
SubmitRequest
} from "../typings/payouts/models";
import { payouts } from "../typings";
import { ApiConstants } from "../constants/apiConstants";
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
const storeDetailAndSubmitThirdParty = JSON.stringify({
additionalData: {
fraudResultType: "GREEN",
@@ -44,7 +36,7 @@ const defaultData = {
shopperReference: "shopperReference",
};
const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): StoreDetailRequest => ({
const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): payouts.StoreDetailRequest => ({
...defaultData,
card: {
cvc: "737",
@@ -53,29 +45,29 @@ const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERC
number: "4111111111111111",
holderName: "John Smith"
},
entityType: StoreDetailRequest.EntityTypeEnum.Company,
entityType: payouts.StoreDetailRequest.EntityTypeEnum.Company,
recurring: {
contract: Recurring.ContractEnum.Payout,
contract: payouts.Recurring.ContractEnum.Payout,
},
merchantAccount,
});
const mockSubmitRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): SubmitRequest => ({
const mockSubmitRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): payouts.SubmitRequest => ({
selectedRecurringDetailReference: "LATEST",
recurring: {
contract: Recurring.ContractEnum.Payout
contract: payouts.Recurring.ContractEnum.Payout
},
...defaultData,
...amountAndReference,
merchantAccount,
});
const mockStoreDetailAndSubmitRequest = (merchantAccount?: string): StoreDetailAndSubmitRequest => ({
const mockStoreDetailAndSubmitRequest = (merchantAccount?: string): payouts.StoreDetailAndSubmitRequest => ({
...amountAndReference,
...(mockStoreDetailRequest(merchantAccount)),
});
const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): PayoutRequest => ({
const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): payouts.PayoutRequest => ({
...amountAndReference,
...defaultData,
card: {
@@ -90,7 +82,7 @@ const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!
let client: Client;
let clientStore: Client;
let clientReview: Client;
let payout: Payout;
let payoutService: Payout;
let scope: nock.Scope;
beforeEach((): void => {
@@ -101,7 +93,7 @@ beforeEach((): void => {
clientStore = createClient(process.env.ADYEN_STOREPAYOUT_APIKEY);
clientReview = createClient(process.env.ADYEN_REVIEWPAYOUT_APIKEY);
scope = nock(`${client.config.endpoint}/pal/servlet/Payout/${Client.API_VERSION}`);
payout = new Payout(client);
payoutService = new Payout(client);
});
afterEach((): void => {
@@ -109,60 +101,56 @@ afterEach((): void => {
});
describe("PayoutTest", function (): void {
test.each([isCI, true])("should succeed on store detail and submit third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payout = new Payout(clientStore);
const request: StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest();
test("should succeed on store detail and submit third party", async function (): Promise<void> {
payoutService = new Payout(clientStore);
const request: payouts.StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest();
scope.post("/storeDetailAndSubmitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
const result = await payout.storeDetailAndSubmitThirdParty(request);
const result = await payoutService.storeDetailAndSubmitThirdParty(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toBeTruthy();
});
test.each([false, true])("should succeed on store detail, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payout = new Payout(clientStore);
test("should succeed on store detail", async function (): Promise<void> {
payoutService = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const request: StoreDetailRequest = mockStoreDetailRequest();
const result = await payout.storeDetail(request);
const request: payouts.StoreDetailRequest = mockStoreDetailRequest();
const result = await payoutService.storeDetail(request);
expect("Success").toEqual(result.resultCode);
expect(result.pspReference).toBeTruthy();
expect(result.recurringDetailReference).toBeTruthy();
});
test.each([isCI, true])("should succeed on confirm third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payout = new Payout(clientStore);
test("should succeed on confirm third party", async function (): Promise<void> {
payoutService = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const storeRequest: StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payout.storeDetail(storeRequest);
const storeRequest: payouts.StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payoutService.storeDetail(storeRequest);
payout = new Payout(clientReview);
payoutService = new Payout(clientReview);
scope.post("/confirmThirdParty")
.reply(200, {
pspReference: "8815131762537886",
response: "[payout-confirm-received]"
});
const request: ModifyRequest = {
const request: payouts.ModifyRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
originalReference: storeResult.pspReference
};
const result = await payout.confirmThirdParty(request);
const result = await payoutService.confirmThirdParty(request);
expect(result.response).toEqual("[payout-confirm-received]");
expect(result.pspReference).toBeTruthy();
});
test.each([isCI, true])("should succeed on submit third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payout = new Payout(clientStore);
test("should succeed on submit third party", async function (): Promise<void> {
payoutService = new Payout(clientStore);
scope.post("/submitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
const request: SubmitRequest = mockSubmitRequest();
const result = await payout.submitThirdparty(request);
const request: payouts.SubmitRequest = mockSubmitRequest();
const result = await payoutService.submitThirdparty(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toBeTruthy();
@@ -173,15 +161,14 @@ describe("PayoutTest", function (): void {
}
});
test.each([false, true])("should succeed on decline third party, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
payout = new Payout(clientStore);
test("should succeed on decline third party", async function (): Promise<void> {
payoutService = new Payout(clientStore);
scope.post("/storeDetail").reply(200, storeDetail);
const storeRequest: StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payout.storeDetail(storeRequest);
const storeRequest: payouts.StoreDetailRequest = mockStoreDetailRequest();
const storeResult = await payoutService.storeDetail(storeRequest);
payout = new Payout(clientReview);
const request: ModifyRequest = {
payoutService = new Payout(clientReview);
const request: payouts.ModifyRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
originalReference: storeResult.pspReference
};
@@ -190,21 +177,20 @@ describe("PayoutTest", function (): void {
pspReference: "8815131762537886",
response: "[payout-decline-received]"
});
const result = await payout.declineThirdParty(request);
const result = await payoutService.declineThirdParty(request);
expect(result.response).toEqual("[payout-decline-received]");
expect(result.pspReference).toBeTruthy();
});
test.each([isCI, true])("should succeed on payout, isMock: %p", async function (isMock): Promise<void> {
!isMock && nock.restore();
test("should succeed on payout", async function (): Promise<void> {
scope.post("/payout").reply(200, {
pspReference: "8815131762537886",
resultCode: "Received",
});
const request = mockPayoutRequest();
const result = await payout.payout(request);
const result = await payoutService.payout(request);
expect(result.resultCode).toEqual("Received");
expect(result.pspReference).toBeTruthy();

View File

@@ -1,22 +1,3 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import nock from "nock";
import { createMock } from "ts-auto-mock";
import { createBasicAuthClient } from "../__mocks__/base";

View File

@@ -5,30 +5,21 @@ import { listRecurringDetailsSuccess } from "../__mocks__/recurring/listRecurrin
import { notifyShopperSuccess } from "../__mocks__/recurring/notifyShopperSuccess";
import RecurringService from "../services/recurring";
import Client from "../client";
import { paymentsSuccess } from "../__mocks__/checkout/paymentsSuccess";
import { createPaymentsCheckoutRequest } from "./checkout.spec";
import Checkout from "../services/checkout";
import { PaymentRequest } from "../typings/checkout/models";
import {
ScheduleAccountUpdaterRequest,
ScheduleAccountUpdaterResult,
DisableRequest,
RecurringDetailsRequest,
Recurring,
NotifyShopperRequest
} from "../typings/recurring/models";
import { recurring } from "../typings";
import {Permit} from "../typings/recurring/permit";
import {CreatePermitRequest} from "../typings/recurring/createPermitRequest";
import {ObjectSerializer} from "../typings/recurring/models";
const createRecurringDetailsRequest = (): RecurringDetailsRequest => {
const createRecurringDetailsRequest = (): recurring.RecurringDetailsRequest => {
return {
merchantAccount: process.env.ADYEN_MERCHANT!,
recurring: { contract: Recurring.ContractEnum.Recurring },
recurring: { contract: recurring.Recurring.ContractEnum.Recurring },
shopperReference: "shopperReference",
};
};
let client: Client;
let recurring: RecurringService;
let checkout: Checkout;
let recurringService: RecurringService;
let scope: nock.Scope;
beforeEach((): void => {
@@ -36,8 +27,7 @@ beforeEach((): void => {
nock.activate();
}
client = createClient();
recurring = new RecurringService(client);
checkout = new Checkout(client);
recurringService = new RecurringService(client);
scope = nock(`${client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}`);
});
@@ -51,30 +41,24 @@ describe("Recurring", (): void => {
.reply(200, listRecurringDetailsSuccess);
const request = createRecurringDetailsRequest();
const result = await recurring.listRecurringDetails(request);
const result = await recurringService.listRecurringDetails(request);
expect(result).toBeTruthy();
expect(result.details?.[0].recurringDetailReference).toBe("recurringReference");
});
test("should disable", async (): Promise<void> => {
scope.post("/payments")
.reply(200, paymentsSuccess);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const res = await checkout.payments(paymentsRequest);
scope.post("/disable")
.reply(200, disableSuccess);
const request: DisableRequest = {
const request: recurring.DisableRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
shopperReference: "shopperReference",
recurringDetailReference: res.additionalData!["recurring.recurringDetailReference"]
recurringDetailReference: "recurring.recurringDetailReference",
};
try {
const result = await recurring.disable(request);
const result = await recurringService.disable(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e);
@@ -85,7 +69,7 @@ describe("Recurring", (): void => {
scope.post("/notifyShopper")
.reply(200, notifyShopperSuccess);
const notifyShopperRequest: NotifyShopperRequest = {
const notifyShopperRequest: recurring.NotifyShopperRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
shopperReference: "shopperReference",
storedPaymentMethodId: "8415995487234100",
@@ -99,7 +83,7 @@ describe("Recurring", (): void => {
};
try {
const result = await recurring.notifyShopper(notifyShopperRequest);
const result = await recurringService.notifyShopper(notifyShopperRequest);
expect(result).toBeTruthy();
} catch (e) {
fail(e);
@@ -108,7 +92,7 @@ describe("Recurring", (): void => {
test("should schedule account updater", async (): Promise<void> => {
const scheduleAccountUpdaterSuccess: ScheduleAccountUpdaterResult = {
const scheduleAccountUpdaterSuccess: recurring.ScheduleAccountUpdaterResult = {
pspReference: "mocked_psp",
result: "SUCCESS"
};
@@ -116,7 +100,7 @@ describe("Recurring", (): void => {
scope.post("/scheduleAccountUpdater")
.reply(200, scheduleAccountUpdaterSuccess);
const request: ScheduleAccountUpdaterRequest = {
const request: recurring.ScheduleAccountUpdaterRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
reference: "ref",
card: {
@@ -128,7 +112,60 @@ describe("Recurring", (): void => {
};
try {
const result = await recurring.scheduleAccountUpdater(request);
const result = await recurringService.scheduleAccountUpdater(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e);
}
});
test("should do a createPermit request", async (): Promise<void> => {
const createPermitResultSuccess: recurring.CreatePermitResult = {
pspReference: "1234567890"
};
scope.post("/createPermit")
.reply(200, createPermitResultSuccess);
const permit: Permit = {
validTillDate: new Date("2022-03-25"),
partnerId: "partnerID"
};
const request: recurring.CreatePermitRequest = {
permits: [permit],
merchantAccount: process.env.ADYEN_MERCHANT!,
shopperReference: "shopperRef",
recurringDetailReference: "recurringRef",
};
const serializedRequest: CreatePermitRequest = ObjectSerializer.serialize(request, "CreatePermitRequest");
expect(serializedRequest.permits[0].validTillDate?.toString()).toBe("2022-03-25T00:00:00.000Z");
try {
const result = await recurringService.createPermit(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e);
}
});
test("should do a disablePermit request", async (): Promise<void> => {
const disablePermitResultSuccess: recurring.DisablePermitResult = {
pspReference: "1234567890",
status: "disabled",
};
scope.post("/disablePermit")
.reply(200, disablePermitResultSuccess);
const request: recurring.DisablePermitRequest = {
merchantAccount: process.env.ADYEN_MERCHANT!,
token: "permitToken"
};
try {
const result = await recurringService.disablePermit(request);
expect(result).toBeTruthy();
} catch (e) {
fail(e);

View File

@@ -2,23 +2,11 @@ import nock from "nock";
import Client from "../client";
import {createClient} from "../__mocks__/base";
import {StoredValue} from "../services";
import { StoredValueIssueRequest,
StoredValueIssueResponse,
StoredValueStatusChangeRequest,
StoredValueStatusChangeResponse,
StoredValueLoadRequest,
StoredValueLoadResponse,
StoredValueBalanceCheckRequest,
StoredValueBalanceCheckResponse,
StoredValueBalanceMergeRequest,
StoredValueBalanceMergeResponse,
StoredValueVoidRequest,
StoredValueVoidResponse
} from "../typings/storedValue/models";
import { storedValue } from "../typings";
let client: Client;
let storedValue: StoredValue;
let storedValueService: StoredValue;
let scope: nock.Scope;
beforeEach((): void => {
@@ -27,7 +15,7 @@ beforeEach((): void => {
}
client = createClient();
scope = nock(`${client.config.storedValueEndpoint}/${Client.STOREDVALUE_API_VERSION}`);
storedValue = new StoredValue(client);
storedValueService = new StoredValue(client);
});
afterEach(() => {
@@ -50,7 +38,7 @@ describe("StoredValue", (): void => {
"type": "givex"
}
});
const issueRequest: StoredValueIssueRequest = {
const issueRequest: storedValue.StoredValueIssueRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store": "YOUR_STORE_ID",
"paymentMethod": {
@@ -63,7 +51,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const issueResponse: StoredValueIssueResponse = await storedValue.issue(issueRequest);
const issueResponse: storedValue.StoredValueIssueResponse = await storedValueService.issue(issueRequest);
expect(issueResponse.pspReference).toEqual("851564651069192J");
});
@@ -83,7 +71,7 @@ describe("StoredValue", (): void => {
"type": "givex"
}
});
const issueRequest: StoredValueIssueRequest = {
const issueRequest: storedValue.StoredValueIssueRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store": "YOUR_STORE_ID",
"paymentMethod": {
@@ -93,7 +81,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const issueResponse: StoredValueIssueResponse = await storedValue.issue(issueRequest);
const issueResponse: storedValue.StoredValueIssueResponse = await storedValueService.issue(issueRequest);
expect(issueResponse.pspReference).toEqual("851564651069192J");
});
@@ -109,8 +97,8 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const statusRequest: StoredValueStatusChangeRequest = {
"status": StoredValueStatusChangeRequest.StatusEnum.Active,
const statusRequest: storedValue.StoredValueStatusChangeRequest = {
"status": storedValue.StoredValueStatusChangeRequest.StatusEnum.Active,
"amount": {
"currency": "USD",
"value": 1000
@@ -125,7 +113,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const changeStatusResponse: StoredValueStatusChangeResponse = await storedValue.changeStatus(statusRequest);
const changeStatusResponse: storedValue.StoredValueStatusChangeResponse = await storedValueService.changeStatus(statusRequest);
expect(changeStatusResponse.pspReference).toEqual("851564652149588K");
});
@@ -140,8 +128,8 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const statusRequest: StoredValueStatusChangeRequest = {
"status": StoredValueStatusChangeRequest.StatusEnum.Inactive,
const statusRequest: storedValue.StoredValueStatusChangeRequest = {
"status": storedValue.StoredValueStatusChangeRequest.StatusEnum.Inactive,
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store":"YOUR_STORE_ID",
"paymentMethod": {
@@ -149,11 +137,11 @@ describe("StoredValue", (): void => {
},
"recurringDetailReference": "7219627091701347",
"shopperReference": "YOUR_UNIQUE_SHOPPER_ID_P3fW3k9D2tvXFu6l",
"shopperInteraction": StoredValueStatusChangeRequest.ShopperInteractionEnum.Ecommerce,
"shopperInteraction": storedValue.StoredValueStatusChangeRequest.ShopperInteractionEnum.Ecommerce,
"reference": "YOUR_REFERENCE"
};
const changeStatusResponse: StoredValueStatusChangeResponse = await storedValue.changeStatus(statusRequest);
const changeStatusResponse: storedValue.StoredValueStatusChangeResponse = await storedValueService.changeStatus(statusRequest);
expect(changeStatusResponse.pspReference).toEqual("851564652149588K");
});
@@ -168,12 +156,12 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const loadRequest: StoredValueLoadRequest = {
const loadRequest: storedValue.StoredValueLoadRequest = {
"amount": {
"currency": "USD",
"value": 2000
},
"loadType": StoredValueLoadRequest.LoadTypeEnum.MerchandiseReturn,
"loadType": storedValue.StoredValueLoadRequest.LoadTypeEnum.MerchandiseReturn,
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store":"YOUR_STORE_ID",
"paymentMethod": {
@@ -184,7 +172,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const loadResponse: StoredValueLoadResponse = await storedValue.load(loadRequest);
const loadResponse: storedValue.StoredValueLoadResponse = await storedValueService.load(loadRequest);
expect(loadResponse.pspReference).toEqual("851564654294247B");
});
@@ -199,7 +187,7 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const checkBalanceRequest: StoredValueBalanceCheckRequest = {
const checkBalanceRequest: storedValue.StoredValueBalanceCheckRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store":"YOUR_STORE_ID",
"paymentMethod": {
@@ -210,7 +198,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const checkBalanceResponse: StoredValueBalanceCheckResponse = await storedValue.checkBalance(checkBalanceRequest);
const checkBalanceResponse: storedValue.StoredValueBalanceCheckResponse = await storedValueService.checkBalance(checkBalanceRequest);
expect(checkBalanceResponse.pspReference).toEqual("881564657480267D");
});
@@ -225,7 +213,7 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const mergeBalanceRequest: StoredValueBalanceMergeRequest = {
const mergeBalanceRequest: storedValue.StoredValueBalanceMergeRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"store":"YOUR_STORE_ID",
"sourcePaymentMethod": {
@@ -240,7 +228,7 @@ describe("StoredValue", (): void => {
"reference": "YOUR_REFERENCE"
};
const mergeBalanceResponse: StoredValueBalanceMergeResponse = await storedValue.mergebalance(mergeBalanceRequest);
const mergeBalanceResponse: storedValue.StoredValueBalanceMergeResponse = await storedValueService.mergebalance(mergeBalanceRequest);
expect(mergeBalanceResponse.pspReference).toEqual("881564657480267D");
});
@@ -255,13 +243,13 @@ describe("StoredValue", (): void => {
"resultCode": "Success"
});
const voidTransactionRequest: StoredValueVoidRequest = {
const voidTransactionRequest: storedValue.StoredValueVoidRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"originalReference": "851564654294247B",
"reference": "YOUR_REFERENCE"
};
const voidTransactionResponse: StoredValueVoidResponse = await storedValue.voidTransaction(voidTransactionRequest);
const voidTransactionResponse: storedValue.StoredValueVoidResponse = await storedValueService.voidTransaction(voidTransactionRequest);
expect(voidTransactionResponse.pspReference).toEqual("851564673300692A");
});
});

View File

@@ -1,29 +1,10 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2022 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import nock from "nock";
import { createClient, createTerminalAPIPaymentRequest, createTerminalAPIRefundRequest } from "../__mocks__/base";
import { asyncRes } from "../__mocks__/terminalApi/async";
import { syncRefund, syncRes, syncResEventNotification } from "../__mocks__/terminalApi/sync";
import Client from "../client";
import TerminalCloudAPI from "../services/terminalCloudAPI";
import { SaleToAcquirerData, TerminalApiResponse } from "../typings/terminal/models";
import { terminal} from "../typings";
let client: Client;
let terminalCloudAPI: TerminalCloudAPI;
@@ -44,10 +25,8 @@ afterEach((): void => {
nock.cleanAll();
});
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
describe("Terminal Cloud API", (): void => {
test.each([isCI])("should make an async payment request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should make an async payment request", async (): Promise<void> => {
scope.post("/async").reply(200, asyncRes);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
@@ -57,19 +36,17 @@ describe("Terminal Cloud API", (): void => {
expect(requestResponse).toEqual("ok");
});
test.each([isCI])("should make a sync payment request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should make a sync payment request", async (): Promise<void> => {
scope.post("/sync").reply(200, syncRes);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
const terminalAPIResponse: TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
const terminalAPIResponse: terminal.TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
expect(terminalAPIResponse.SaleToPOIResponse?.PaymentResponse).toBeDefined();
expect(terminalAPIResponse.SaleToPOIResponse?.MessageHeader).toBeDefined();
});
test.each([isCI])("should return event notification if response contains it, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should return event notification if response contains it", async (): Promise<void> => {
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
scope.post("/sync").reply(200, syncResEventNotification);
@@ -79,12 +56,11 @@ describe("Terminal Cloud API", (): void => {
expect(terminalAPIResponse.SaleToPOIRequest?.EventNotification).toBeDefined();
});
test.each([isCI])("should make an async refund request, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should make an async refund request", async (): Promise<void> => {
scope.post("/sync").reply(200, syncRes);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
const terminalAPIResponse: TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
const terminalAPIResponse: terminal.TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
const pOITransactionId = terminalAPIResponse.SaleToPOIResponse!.PaymentResponse!.POIData!.POITransactionID;
expect(pOITransactionId).toBeTruthy();
@@ -94,7 +70,7 @@ describe("Terminal Cloud API", (): void => {
const terminalAPIRefundRequest = createTerminalAPIRefundRequest(pOITransactionId);
const id = Math.floor(Math.random() * Math.floor(10000000)).toString();
terminalAPIRefundRequest.SaleToPOIRequest.MessageHeader.ServiceID = id;
const saleToAcquirerData: SaleToAcquirerData = new SaleToAcquirerData();
const saleToAcquirerData: terminal.SaleToAcquirerData = new terminal.SaleToAcquirerData();
saleToAcquirerData.currency = "EUR";
terminalAPIRefundRequest.SaleToPOIRequest.ReversalRequest!.SaleData!.SaleToAcquirerData = saleToAcquirerData;
const terminalAPIRefundResponse = await terminalCloudAPI.sync(terminalAPIRefundRequest);

View File

@@ -1,28 +1,9 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2021 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import nock from "nock";
import { createClient, createTerminalAPIPaymentRequest } from "../__mocks__/base";
import { localEncRes, wrongEncRes } from "../__mocks__/terminalApi/local";
import Client from "../client";
import TerminalLocalAPI from "../services/terminalLocalAPI";
import { SecurityKey, TerminalApiResponse } from "../typings/terminal/models";
import { terminal } from "../typings";
import NexoCryptoException from "../services/exception/nexoCryptoException";
let client: Client;
@@ -43,34 +24,30 @@ afterEach((): void => {
nock.cleanAll();
});
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
describe("Terminal Local API", (): void => {
test.each([isCI, true])("should make a local payment, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
test("should make a local payment", async (): Promise<void> => {
scope.post("/").reply(200, localEncRes);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
const securityKey: SecurityKey = {
const securityKey: terminal.SecurityKey = {
AdyenCryptoVersion: 0,
KeyIdentifier: "CryptoKeyIdentifier12345",
KeyVersion: 0,
Passphrase: "p@ssw0rd123456",
};
const terminalApiResponse: TerminalApiResponse =
const terminalApiResponse: terminal.TerminalApiResponse =
await terminalLocalAPI.request(terminalAPIPaymentRequest, securityKey);
expect(terminalApiResponse.SaleToPOIResponse?.PaymentResponse).toBeDefined();
expect(terminalApiResponse.SaleToPOIResponse?.MessageHeader).toBeDefined();
});
test.each([isCI, true])("should return NexoCryptoException, isMock: %p", async (isMock: boolean): Promise<void> => {
!isMock && nock.restore();
test("should return NexoCryptoException", async (): Promise<void> => {
scope.post("/").reply(200, wrongEncRes);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
const securityKey: SecurityKey = {
const securityKey: terminal.SecurityKey = {
AdyenCryptoVersion: 0,
KeyIdentifier: "CryptoKeyIdentifier12345",
KeyVersion: 0,

View File

@@ -2,21 +2,10 @@ import nock from "nock";
import Client from "../client";
import { createClient } from "../__mocks__/base";
import TerminalManagement from "../services/terminalManagement";
import {
AssignTerminalsRequest,
AssignTerminalsResponse,
FindTerminalRequest,
FindTerminalResponse,
GetStoresUnderAccountRequest,
GetStoresUnderAccountResponse,
GetTerminalDetailsRequest,
GetTerminalDetailsResponse,
GetTerminalsUnderAccountRequest,
GetTerminalsUnderAccountResponse
} from "../typings/terminalManagement/models";
import { terminalManagement } from "../typings";
let client: Client;
let terminalManagement: TerminalManagement;
let terminalManagementService: TerminalManagement;
let scope: nock.Scope;
beforeEach((): void => {
@@ -25,7 +14,7 @@ beforeEach((): void => {
}
client = createClient();
scope = nock(`${client.config.terminalManagementEndpoint}/${Client.TERMINAL_MANAGEMENT_API_VERSION}`);
terminalManagement = new TerminalManagement(client);
terminalManagementService = new TerminalManagement(client);
});
afterEach(() => {
@@ -40,14 +29,14 @@ describe("POS Terminal Management API", (): void => {
"P400Plus-275479597": "RemoveConfigScheduled"
}
});
const request: AssignTerminalsRequest = {
const request: terminalManagement.AssignTerminalsRequest = {
"companyAccount": "YOUR_COMPANY_ACCOUNT",
"terminals": [
"P400Plus-275479597"
]
};
const response: AssignTerminalsResponse = await terminalManagement.assignTerminals(request);
const response: terminalManagement.AssignTerminalsResponse = await terminalManagementService.assignTerminals(request);
expect(response.results["P400Plus-275479597"]).toEqual("RemoveConfigScheduled");
});
@@ -60,11 +49,11 @@ describe("POS Terminal Management API", (): void => {
"merchantInventory": false,
"terminal": "P400Plus-275479597"
});
const request: FindTerminalRequest = {
const request: terminalManagement.FindTerminalRequest = {
"terminal": "P400Plus-275479597"
};
const response: FindTerminalResponse = await terminalManagement.findTerminal(request);
const response: terminalManagement.FindTerminalResponse = await terminalManagementService.findTerminal(request);
expect(response.terminal).toEqual("P400Plus-275479597");
});
@@ -87,11 +76,11 @@ describe("POS Terminal Management API", (): void => {
}
]
});
const request: GetStoresUnderAccountRequest = {
const request: terminalManagement.GetStoresUnderAccountRequest = {
"companyAccount": "YOUR_COMPANY_ACCOUNT"
};
const response: GetStoresUnderAccountResponse = await terminalManagement.getStoresUnderAccount(request);
const response: terminalManagement.GetStoresUnderAccountResponse = await terminalManagementService.getStoresUnderAccount(request);
expect(response.stores).toHaveLength(1);
expect(response.stores![0].status).toEqual("Active");
@@ -113,11 +102,11 @@ describe("POS Terminal Management API", (): void => {
"country": "NETHERLANDS",
"dhcpEnabled": false
});
const request: GetTerminalDetailsRequest = {
const request: terminalManagement.GetTerminalDetailsRequest = {
"terminal": "P400Plus-275479597"
};
const response: GetTerminalDetailsResponse = await terminalManagement.getTerminalDetails(request);
const response: terminalManagement.GetTerminalDetailsResponse = await terminalManagementService.getTerminalDetails(request);
expect(response.deviceModel).toBe("P400Plus");
});
@@ -144,11 +133,11 @@ describe("POS Terminal Management API", (): void => {
}
]
});
const request: GetTerminalsUnderAccountRequest = {
const request: terminalManagement.GetTerminalsUnderAccountRequest = {
"companyAccount": "YOUR_COMPANY_ACCOUNT"
};
const response: GetTerminalsUnderAccountResponse = await terminalManagement.getTerminalsUnderAccount(request);
const response: terminalManagement.GetTerminalsUnderAccountResponse = await terminalManagementService.getTerminalsUnderAccount(request);
expect(response.merchantAccounts).toHaveLength(1);
expect(response.merchantAccounts![0].stores).toHaveLength(1);

View File

@@ -0,0 +1,68 @@
import nock from "nock";
import { createClient } from "../__mocks__/base";
import { transfersSuccess, getTransactionSuccess, listTransactionsSuccess } from "../__mocks__/transfers/responses";
import Client from "../client";
import { Transfers } from "../services";
import { transfer} from "../typings";
let client: Client;
let transferService: Transfers;
let scope: nock.Scope;
beforeEach((): void => {
if (!nock.isActive()) {
nock.activate();
}
client = createClient();
transferService = new Transfers(client);
scope = nock(`https://balanceplatform-api-test.adyen.com/btl/${Client.TRANSFERS_API_VERSION}`);
});
afterEach(() => {
nock.cleanAll();
});
describe("Transfers", (): void => {
test("should transfer fund", async (): Promise<void> => {
scope.post("/transfers")
.reply(200, transfersSuccess);
const request = new transfer.TransferInfo();
request.amount = { currency: "EUR", value: 1000};
request.category = transfer.TransferInfo.CategoryEnum.Bank;
request.counterparty = {
balanceAccountId: "123",
transferInstrumentId: "transfer_id",
bankAccount: {
accountHolder: {
fullName: "Wally Bizzle"
},
accountIdentification: {
iban: "NLRABO12321",
type: transfer.IbanAccountIdentification.TypeEnum.Iban
}
},
};
const response: transfer.Transfer = await transferService.transfers(request);
expect(response.id).toEqual("1W1UG35U8A9J5ZLG");
});
test("should get transaction", async (): Promise<void> => {
scope.get("/transactions/123")
.reply(200, getTransactionSuccess);
const response: transfer.Transaction = await transferService.getTransaction("123");
expect(response.id).toEqual("IZK7C25U7DYVX03Y");
});
test("should list transactions", async (): Promise<void> => {
scope.get("/transactions")
.reply(200, listTransactionsSuccess);
const response: transfer.TransactionSearchResponse = await transferService.listTransactions();
expect(response.data?.length).toEqual(3);
if(response.data && response.data?.length > 0) {
expect(response?.data[0]?.id).toEqual("1VVF0D5U66PIUIVP");
} else {
fail();
}
});
});

View File

@@ -6,6 +6,10 @@ import ClientInterface from "./httpClient/clientInterface";
type ClientParametersOverload =
| { config: Config }
| { config: Config; httpClient: ClientInterface }
| { username: string; password: string; environment: Environment}
| { username: string; password: string; environment: Environment; httpClient: ClientInterface }
| { username: string; password: string; environment: Environment; liveEndpointUrlPrefix: string }
| { username: string; password: string; environment: Environment; liveEndpointUrlPrefix: string; httpClient: ClientInterface }
| { username: string; password: string; environment: Environment; applicationName: string }
| { username: string; password: string; environment: Environment; applicationName: string; httpClient: ClientInterface }
| { username: string; password: string; environment: Environment; applicationName: string; liveEndpointUrlPrefix: string }
@@ -65,6 +69,16 @@ class Client {
public static BALANCE_PLATFORM_API_VERSION = "v2";
public static BALANCE_PLATFORM_API_ENDPOINT_TEST = "https://balanceplatform-api-test.adyen.com/bcl";
public static BALANCE_PLATFORM_API_ENDPOINT_LIVE = "https://balanceplatform-api-live.adyen.com/bcl";
public static LEGAL_ENTITY_MANAGEMENT_API_VERSION = "v2";
public static LEGAL_ENTITY_MANAGEMENT_API_ENDPOINT_TEST = "https://kyc-test.adyen.com/lem";
public static LEGAL_ENTITY_MANAGEMENT_API_ENDPOINT_LIVE = "https://kyc-live.adyen.com/lem";
public static TRANSFERS_API_VERSION = "v3";
public static TRANSFERS_API_ENDPOINT_TEST = "https://balanceplatform-api-test.adyen.com/btl";
public static TRANSFERS_API_ENDPOINT_LIVE = "https://balanceplatform-api-live.adyen.com/btl";
public static DATA_PROTECTION_API_VERSION = "v1";
public static DATA_PROTECTION_API_ENDPOINT_TEST = "https://ca-test.adyen.com/ca/services/DataProtectionService";
public static DATA_PROTECTION_API_ENDPOINT_LIVE = "https://ca-live.adyen.com/ca/services/DataProtectionService";
private _httpClient!: ClientInterface;
public config: Config;
@@ -80,10 +94,12 @@ class Client {
const environment = options.environment || this.config.environment;
if (environment) {
this.setEnvironment(environment, options.liveEndpointUrlPrefix);
if (options.username && options.password && options.applicationName) {
if (options.username && options.password) {
this.config.username = options.username;
this.config.password = options.password;
this.config.applicationName = options.applicationName;
if(options.applicationName) {
this.config.applicationName = options.applicationName;
}
}
if (options.apiKey) {
@@ -108,6 +124,9 @@ class Client {
this.config.terminalManagementEndpoint = Client.TERMINAL_MANAGEMENT_API_ENDPOINT_TEST;
this.config.managementEndpoint = Client.MANAGEMENT_API_ENDPOINT_TEST;
this.config.balancePlatformEndpoint = Client.BALANCE_PLATFORM_API_ENDPOINT_TEST;
this.config.legalEntityManagementEndpoint = Client.LEGAL_ENTITY_MANAGEMENT_API_ENDPOINT_TEST;
this.config.transfersEndpoint = Client.TRANSFERS_API_ENDPOINT_TEST;
this.config.dataProtectionEndpoint = Client.DATA_PROTECTION_API_ENDPOINT_TEST;
} else if (environment === "LIVE") {
this.config.endpoint = Client.ENDPOINT_LIVE;
this.config.marketPayEndpoint = Client.MARKETPAY_ENDPOINT_LIVE;
@@ -118,6 +137,9 @@ class Client {
this.config.terminalManagementEndpoint = Client.TERMINAL_MANAGEMENT_API_ENDPOINT_LIVE;
this.config.managementEndpoint = Client.MANAGEMENT_API_ENDPOINT_LIVE;
this.config.balancePlatformEndpoint = Client.BALANCE_PLATFORM_API_ENDPOINT_LIVE;
this.config.legalEntityManagementEndpoint = Client.LEGAL_ENTITY_MANAGEMENT_API_ENDPOINT_LIVE;
this.config.transfersEndpoint = Client.TRANSFERS_API_ENDPOINT_LIVE;
this.config.dataProtectionEndpoint = Client.DATA_PROTECTION_API_ENDPOINT_LIVE;
if (liveEndpointUrlPrefix) {
this.config.endpoint =

View File

@@ -39,6 +39,9 @@ interface ConfigConstructor {
terminalManagementEndpoint?: string;
managementEndpoint?: string;
balancePlatformEndpoint?: string;
legalEntityManagementEndpoint?: string;
transfersEndpoint?: string;
dataProtectionEndpoint?: string;
}
class Config {
@@ -68,6 +71,9 @@ class Config {
public terminalManagementEndpoint?: string;
public managementEndpoint?: string;
public balancePlatformEndpoint?: string;
public legalEntityManagementEndpoint?: string;
public transfersEndpoint?: string;
public dataProtectionEndpoint?: string;
public constructor(options: ConfigConstructor = {}) {
if (options.username) this.username = options.username;
@@ -92,6 +98,9 @@ class Config {
if (options.terminalManagementEndpoint) this.terminalManagementEndpoint = options.terminalManagementEndpoint;
if (options.managementEndpoint) this.managementEndpoint = options.managementEndpoint;
if (options.balancePlatformEndpoint) this.balancePlatformEndpoint = options.balancePlatformEndpoint;
if (options.legalEntityManagementEndpoint) this.legalEntityManagementEndpoint = options.legalEntityManagementEndpoint;
if (options.transfersEndpoint) this.transfersEndpoint = options.transfersEndpoint;
if (options.dataProtectionEndpoint) this.dataProtectionEndpoint = options.dataProtectionEndpoint;
}
public set checkoutEndpoint(checkoutEndpoint: string | undefined) {

View File

@@ -0,0 +1,25 @@
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { SubjectErasureByPspReferenceRequest, SubjectErasureResponse, ObjectSerializer } from "../typings/dataProtection/models";
import DataProtectionResource from "./resource/dataProtectionresource";
import { IRequest } from "../typings/requestOptions";
class DataProtection extends Service {
private readonly _dataProtectionResource: DataProtectionResource;
public constructor(client: Client) {
super(client);
this._dataProtectionResource = new DataProtectionResource(this, "/requestSubjectErasure");
}
public async requestSubjectErasure(subjectErasureByPspReferenceRequest: SubjectErasureByPspReferenceRequest, requestOptions?: IRequest.Options): Promise<SubjectErasureResponse> {
const response = await getJsonResponse<SubjectErasureByPspReferenceRequest, SubjectErasureResponse>(
this._dataProtectionResource,
subjectErasureByPspReferenceRequest,
requestOptions,
);
return ObjectSerializer.deserialize(response, "SubjectErasureResponse");
}
}
export default DataProtection;

View File

@@ -8,4 +8,8 @@ export { default as Payout } from "./payout";
export { default as Platforms } from "./platforms";
export { default as StoredValue} from "./storedValue";
export { default as TerminalManagement} from "./terminalManagement";
export { default as Management } from "./management";
export { default as Management } from "./management";
export { default as LegalEntityManagement } from "./legalEntityManagement";
export { default as Transfers } from "./transfers";
export { default as BalancePlatform } from "./balancePlatform";
export { default as DataProtection } from "./dataProtection";

View File

@@ -0,0 +1,36 @@
import Service from "../service";
import Client from "../client";
import LegalEntities from "./legalEntityManagement/legalEntities";
import OnboardingPage from "./legalEntityManagement/hostedOnboardingPage";
import TransferInstruments from "./legalEntityManagement/transferInstruments";
import BusinessLineService from "./legalEntityManagement/businessLineService";
import Documents from "./legalEntityManagement/documents";
class LegalEntityManagement extends Service {
public constructor(client: Client) {
super(client);
}
public get LegalEntities() {
return new LegalEntities(this.client);
}
public get TransferInstruments() {
return new TransferInstruments(this.client);
}
public get BusinessLineService() {
return new BusinessLineService(this.client);
}
public get Documents() {
return new Documents(this.client);
}
public get HostedOnboardingPage() {
return new OnboardingPage(this.client);
}
}
export default LegalEntityManagement;

View File

@@ -0,0 +1,42 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import LegalEntityManagementResource from "../resource/legalEntityManagementResource";
import {
BusinessLine,
BusinessLineInfo, BusinessLineInfoUpdate,
ObjectSerializer
} from "../../typings/legalEntityManagement/models";
class BusinessLineService extends Service {
public async create(request: BusinessLineInfo): Promise<BusinessLine> {
const resource = new LegalEntityManagementResource(this, "/businessLines");
const response = await getJsonResponse<BusinessLineInfo, BusinessLine>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "BusinessLine");
}
public async retrieve(id: string): Promise<BusinessLine> {
const resource = new LegalEntityManagementResource(this, `/businessLines/${id}`);
const response = await getJsonResponse<string, BusinessLine>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "BusinessLine");
}
public async update(id: string, request: BusinessLineInfoUpdate): Promise<BusinessLine> {
const resource = new LegalEntityManagementResource(this, `/businessLines/${id}`);
const response = await getJsonResponse<BusinessLineInfoUpdate, BusinessLine>(
resource,
request,
{ method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "BusinessLine");
}
}
export default BusinessLineService;

View File

@@ -0,0 +1,49 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import LegalEntityManagementResource from "../resource/legalEntityManagementResource";
import {Document, ObjectSerializer} from "../../typings/legalEntityManagement/models";
export type DocumentUpdate = Omit<Document, "id">
class Documents extends Service {
public async create(request: DocumentUpdate): Promise<Document> {
const resource = new LegalEntityManagementResource(this, "/documents");
const response = await getJsonResponse<DocumentUpdate, Document>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "Document");
}
public async retrieve(id: string): Promise<Document> {
const resource = new LegalEntityManagementResource(this, `/documents/${id}`);
const response = await getJsonResponse<string, Document>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "Document");
}
public async update(id: string, request: DocumentUpdate): Promise<Document> {
const resource = new LegalEntityManagementResource(this, `/documents/${id}`);
const response = await getJsonResponse<DocumentUpdate, Document>(
resource,
request,
{ method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Document");
}
public async delete(id: string): Promise<void> {
const resource = new LegalEntityManagementResource(this, `/documents/${id}`);
await getJsonResponse<string, string>(
resource,
"",
{method: "DELETE" }
);
}
}
export default Documents;

View File

@@ -0,0 +1,40 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import LegalEntityManagementResource from "../resource/legalEntityManagementResource";
import {OnboardingLinkInfo} from "../../typings/legalEntityManagement/onboardingLinkInfo";
import {OnboardingLink} from "../../typings/legalEntityManagement/onboardingLink";
import {ObjectSerializer, OnboardingTheme, OnboardingThemes} from "../../typings/legalEntityManagement/models";
class HostedOnboardingPage extends Service {
public async create(id: string, request: OnboardingLinkInfo): Promise<OnboardingLink> {
const resource = new LegalEntityManagementResource(this, `/legalEntities/${id}/onboardingLinks`);
const response = await getJsonResponse<OnboardingLinkInfo, OnboardingLink>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "OnboardingLink");
}
public async listThemes(): Promise<OnboardingThemes> {
const resource = new LegalEntityManagementResource(this, "/themes");
const response = await getJsonResponse<string, OnboardingThemes>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "OnboardingThemes");
}
public async retrieveTheme(id: string): Promise<OnboardingTheme> {
const resource = new LegalEntityManagementResource(this, `/themes/${id}`);
const response = await getJsonResponse<string, OnboardingTheme>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "OnboardingTheme");
}
}
export default HostedOnboardingPage;

View File

@@ -0,0 +1,50 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import LegalEntityManagementResource from "../resource/legalEntityManagementResource";
import {LegalEntity} from "../../typings/legalEntityManagement/legalEntity";
import {LegalEntityInfo} from "../../typings/legalEntityManagement/legalEntityInfo";
import {BusinessLines, ObjectSerializer} from "../../typings/legalEntityManagement/models";
class LegalEntities extends Service {
public async create(request: LegalEntityInfo): Promise<LegalEntity> {
const resource = new LegalEntityManagementResource(this, "/legalEntities");
const response = await getJsonResponse<LegalEntityInfo, LegalEntity>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "LegalEntity");
}
public async retrieve(id: string): Promise<LegalEntity> {
const resource = new LegalEntityManagementResource(this, `/legalEntities/${id}`);
const response = await getJsonResponse<string, LegalEntity>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "LegalEntity");
}
public async update(id: string, request: LegalEntityInfo): Promise<LegalEntity> {
const resource = new LegalEntityManagementResource(this, `/legalEntities/${id}`);
const response = await getJsonResponse<LegalEntityInfo, LegalEntity>(
resource,
request,
{ method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "LegalEntity");
}
public async listBusinessLines(id: string): Promise<BusinessLines> {
const resource = new LegalEntityManagementResource(this, `/legalEntities/${id}/businessLines`);
const response = await getJsonResponse<string, BusinessLines>(
resource,
"",
{method: "GET" }
);
return ObjectSerializer.deserialize(response, "BusinessLines");
}
}
export default LegalEntities;

View File

@@ -0,0 +1,49 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import LegalEntityManagementResource from "../resource/legalEntityManagementResource";
import {TransferInstrumentInfo} from "../../typings/legalEntityManagement/transferInstrumentInfo";
import {TransferInstrument} from "../../typings/legalEntityManagement/transferInstrument";
import {ObjectSerializer} from "../../typings/legalEntityManagement/models";
class TransferInstruments extends Service {
public async create(request: TransferInstrumentInfo): Promise<TransferInstrument> {
const resource = new LegalEntityManagementResource(this, "/transferInstruments");
const response = await getJsonResponse<TransferInstrumentInfo, TransferInstrument>(
resource,
request,
{ method: "POST" }
);
return ObjectSerializer.deserialize(response, "TransferInstrument");
}
public async retrieve(id: string): Promise<TransferInstrument> {
const resource = new LegalEntityManagementResource(this, `/transferInstruments/${id}`);
const response = await getJsonResponse<string, TransferInstrument>(
resource,
"",
{ method: "GET" }
);
return ObjectSerializer.deserialize(response, "TransferInstrument");
}
public async update(id: string, request: TransferInstrumentInfo): Promise<TransferInstrument> {
const resource = new LegalEntityManagementResource(this, `/transferInstruments/${id}`);
const response = await getJsonResponse<TransferInstrumentInfo, TransferInstrument>(
resource,
request,
{ method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TransferInstrument");
}
public async delete(id: string): Promise<void> {
const resource = new LegalEntityManagementResource(this, `/transferInstruments/${id}`);
await getJsonResponse<string, string>(
resource,
"",
{method: "DELETE" }
);
}
}
export default TransferInstruments;

View File

@@ -1,6 +1,7 @@
import Service from "../service";
import Client from "../client";
// Deprecated classes
import MeApi from "./management/meApi";
import MerchantAccount from "./management/merchantAccount";
import MerchantAllowedOrigins from "./management/merchantAllowedOrigins";
@@ -14,59 +15,208 @@ import MerchantTerminalSettings from "./management/merchantTerminalSettings";
import MerchantUsers from "./management/merchantUsers";
import MerchantWebhooks from "./management/merchantWebhooks";
// Recommended classes
import APICredentialsCompanyLevelApi from './management/aPICredentialsCompanyLevelApi';
import APICredentialsMerchantLevelApi from './management/aPICredentialsMerchantLevelApi';
import APIKeyCompanyLevelApi from './management/aPIKeyCompanyLevelApi';
import APIKeyMerchantLevelApi from './management/aPIKeyMerchantLevelApi';
import AccountCompanyLevelApi from './management/accountCompanyLevelApi';
import AccountMerchantLevelApi from './management/accountMerchantLevelApi';
import AccountStoreLevelApi from './management/accountStoreLevelApi';
import AllowedOriginsCompanyLevelApi from './management/allowedOriginsCompanyLevelApi';
import AllowedOriginsMerchantLevelApi from './management/allowedOriginsMerchantLevelApi';
import ClientKeyCompanyLevelApi from './management/clientKeyCompanyLevelApi';
import ClientKeyMerchantLevelApi from './management/clientKeyMerchantLevelApi';
import MyAPICredentialApi from './management/myAPICredentialApi';
import PaymentMethodsMerchantLevelApi from './management/paymentMethodsMerchantLevelApi';
import PayoutSettingsMerchantLevelApi from './management/payoutSettingsMerchantLevelApi';
import TerminalActionsCompanyLevelApi from './management/terminalActionsCompanyLevelApi';
import TerminalActionsTerminalLevelApi from './management/terminalActionsTerminalLevelApi';
import TerminalOrdersCompanyLevelApi from './management/terminalOrdersCompanyLevelApi';
import TerminalOrdersMerchantLevelApi from './management/terminalOrdersMerchantLevelApi';
import TerminalSettingsCompanyLevelApi from './management/terminalSettingsCompanyLevelApi';
import TerminalSettingsMerchantLevelApi from './management/terminalSettingsMerchantLevelApi';
import TerminalSettingsStoreLevelApi from './management/terminalSettingsStoreLevelApi';
import TerminalSettingsTerminalLevelApi from './management/terminalSettingsTerminalLevelApi';
import TerminalsTerminalLevelApi from './management/terminalsTerminalLevelApi';
import UsersCompanyLevelApi from './management/usersCompanyLevelApi';
import UsersMerchantLevelApi from './management/usersMerchantLevelApi';
import WebhooksCompanyLevelApi from './management/webhooksCompanyLevelApi';
import WebhooksMerchantLevelApi from './management/webhooksMerchantLevelApi';
class Management extends Service {
public constructor(client: Client) {
super(client);
}
/**
* @deprecated
*/
public get Me() {
const meApi = new MeApi(this.client);
return meApi.Me;
}
/**
* @deprecated
*/
public get MerchantAccount() {
return new MerchantAccount(this.client);
}
/**
* @deprecated
*/
public get MerchantAllowedOrigins() {
return new MerchantAllowedOrigins(this.client);
}
/**
* @deprecated
*/
public get MerchantApiCredentials() {
return new MerchantApiCredentials(this.client);
}
/**
* @deprecated
*/
public get MerchantApiKey() {
return new MerchantApiKey(this.client);
}
/**
* @deprecated
*/
public get MerchantClientKey() {
return new MerchantClientKey(this.client);
}
/**
* @deprecated
*/
public get MerchantPaymentMethods() {
return new MerchantPaymentMethods(this.client);
}
/**
* @deprecated
*/
public get MerchantPayoutSettings() {
return new MerchantPayoutSettings(this.client);
}
/**
* @deprecated
*/
public get MerchantTerminalOrders() {
return new MerchantTerminalOrders(this.client);
}
/**
* @deprecated
*/
public get MerchantTerminalSettings() {
return new MerchantTerminalSettings(this.client);
}
/**
* @deprecated
*/
public get MerchantUsers() {
return new MerchantUsers(this.client);
}
/**
* @deprecated
*/
public get MerchantWebhooks() {
return new MerchantWebhooks(this.client);
}
// ## Recommended classes
public get APICredentialsCompanyLevelApi() {
return new APICredentialsCompanyLevelApi(this.client);
}
public get APICredentialsMerchantLevelApi() {
return new APICredentialsMerchantLevelApi(this.client);
}
public get APIKeyCompanyLevelApi() {
return new APIKeyCompanyLevelApi(this.client);
}
public get APIKeyMerchantLevelApi() {
return new APIKeyMerchantLevelApi(this.client);
}
public get AccountCompanyLevelApi() {
return new AccountCompanyLevelApi(this.client);
}
public get AccountMerchantLevelApi() {
return new AccountMerchantLevelApi(this.client);
}
public get AccountStoreLevelApi() {
return new AccountStoreLevelApi(this.client);
}
public get AllowedOriginsCompanyLevelApi() {
return new AllowedOriginsCompanyLevelApi(this.client);
}
public get AllowedOriginsMerchantLevelApi() {
return new AllowedOriginsMerchantLevelApi(this.client);
}
public get ClientKeyCompanyLevelApi() {
return new ClientKeyCompanyLevelApi(this.client);
}
public get ClientKeyMerchantLevelApi() {
return new ClientKeyMerchantLevelApi(this.client);
}
public get MyAPICredentialApi() {
return new MyAPICredentialApi(this.client);
}
public get PaymentMethodsMerchantLevelApi() {
return new PaymentMethodsMerchantLevelApi(this.client);
}
public get PayoutSettingsMerchantLevelApi() {
return new PayoutSettingsMerchantLevelApi(this.client);
}
public get TerminalActionsCompanyLevelApi() {
return new TerminalActionsCompanyLevelApi(this.client);
}
public get TerminalActionsTerminalLevelApi() {
return new TerminalActionsTerminalLevelApi(this.client);
}
public get TerminalOrdersCompanyLevelApi() {
return new TerminalOrdersCompanyLevelApi(this.client);
}
public get TerminalOrdersMerchantLevelApi() {
return new TerminalOrdersMerchantLevelApi(this.client);
}
public get TerminalSettingsCompanyLevelApi() {
return new TerminalSettingsCompanyLevelApi(this.client);
}
public get TerminalSettingsMerchantLevelApi() {
return new TerminalSettingsMerchantLevelApi(this.client);
}
public get TerminalSettingsStoreLevelApi() {
return new TerminalSettingsStoreLevelApi(this.client);
}
public get TerminalSettingsTerminalLevelApi() {
return new TerminalSettingsTerminalLevelApi(this.client);
}
public get TerminalsTerminalLevelApi() {
return new TerminalsTerminalLevelApi(this.client);
}
public get UsersCompanyLevelApi() {
return new UsersCompanyLevelApi(this.client);
}
public get UsersMerchantLevelApi() {
return new UsersMerchantLevelApi(this.client);
}
public get WebhooksCompanyLevelApi() {
return new WebhooksCompanyLevelApi(this.client);
}
public get WebhooksMerchantLevelApi() {
return new WebhooksMerchantLevelApi(this.client);
}
}
export default Management;

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CompanyApiCredential } from '../../typings/management/models';
import { CreateCompanyApiCredentialRequest } from '../../typings/management/models';
import { CreateCompanyApiCredentialResponse } from '../../typings/management/models';
import { ListCompanyApiCredentialsResponse } from '../../typings/management/models';
import { UpdateCompanyApiCredentialRequest } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class APICredentialsCompanyLevelApi extends Service {
/**
* @summary Get a list of API credentials
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listApiCredentials(companyId: string, requestOptions?: IRequest.Options): Promise<ListCompanyApiCredentialsResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListCompanyApiCredentialsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListCompanyApiCredentialsResponse");
}
/**
* @summary Get an API credential
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async getApiCredential(companyId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<CompanyApiCredential> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, CompanyApiCredential>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "CompanyApiCredential");
}
/**
* @summary Update an API credential.
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
* @param updateCompanyApiCredentialRequest
*/
public async updateApiCredential(companyId: string, apiCredentialId: string, updateCompanyApiCredentialRequest: UpdateCompanyApiCredentialRequest, requestOptions?: IRequest.Options): Promise<CompanyApiCredential> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateCompanyApiCredentialRequest = ObjectSerializer.serialize(updateCompanyApiCredentialRequest, "UpdateCompanyApiCredentialRequest");
const response = await getJsonResponse<UpdateCompanyApiCredentialRequest, CompanyApiCredential>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "CompanyApiCredential");
}
/**
* @summary Create an API credential.
* @param companyId The unique identifier of the company account.
* @param createCompanyApiCredentialRequest
*/
public async createApiCredential(companyId: string, createCompanyApiCredentialRequest: CreateCompanyApiCredentialRequest, requestOptions?: IRequest.Options): Promise<CreateCompanyApiCredentialResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateCompanyApiCredentialRequest = ObjectSerializer.serialize(createCompanyApiCredentialRequest, "CreateCompanyApiCredentialRequest");
const response = await getJsonResponse<CreateCompanyApiCredentialRequest, CreateCompanyApiCredentialResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CreateCompanyApiCredentialResponse");
}
}

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { ApiCredential } from '../../typings/management/models';
import { CreateApiCredentialResponse } from '../../typings/management/models';
import { CreateMerchantApiCredentialRequest } from '../../typings/management/models';
import { ListMerchantApiCredentialsResponse } from '../../typings/management/models';
import { UpdateMerchantApiCredentialRequest } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class APICredentialsMerchantLevelApi extends Service {
/**
* @summary Get a list of API credentials
* @param merchantId The unique identifier of the merchant account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listApiCredentials(merchantId: string, requestOptions?: IRequest.Options): Promise<ListMerchantApiCredentialsResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListMerchantApiCredentialsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListMerchantApiCredentialsResponse");
}
/**
* @summary Get an API credential
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async getApiCredential(merchantId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<ApiCredential> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ApiCredential>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ApiCredential");
}
/**
* @summary Update an API credential
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
* @param updateMerchantApiCredentialRequest
*/
public async updateApiCredential(merchantId: string, apiCredentialId: string, updateMerchantApiCredentialRequest: UpdateMerchantApiCredentialRequest, requestOptions?: IRequest.Options): Promise<ApiCredential> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateMerchantApiCredentialRequest = ObjectSerializer.serialize(updateMerchantApiCredentialRequest, "UpdateMerchantApiCredentialRequest");
const response = await getJsonResponse<UpdateMerchantApiCredentialRequest, ApiCredential>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "ApiCredential");
}
/**
* @summary Create an API credential
* @param merchantId The unique identifier of the merchant account.
* @param createMerchantApiCredentialRequest
*/
public async createApiCredential(merchantId: string, createMerchantApiCredentialRequest: CreateMerchantApiCredentialRequest, requestOptions?: IRequest.Options): Promise<CreateApiCredentialResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateMerchantApiCredentialRequest = ObjectSerializer.serialize(createMerchantApiCredentialRequest, "CreateMerchantApiCredentialRequest");
const response = await getJsonResponse<CreateMerchantApiCredentialRequest, CreateApiCredentialResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CreateApiCredentialResponse");
}
}

View File

@@ -0,0 +1,38 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { GenerateApiKeyResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class APIKeyCompanyLevelApi extends Service {
/**
* @summary Generate new API key
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async generateNewApiKey(companyId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<GenerateApiKeyResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/generateApiKey"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateApiKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateApiKeyResponse");
}
}

View File

@@ -0,0 +1,38 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { GenerateApiKeyResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class APIKeyMerchantLevelApi extends Service {
/**
* @summary Generate new API key
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async generateNewApiKey(merchantId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<GenerateApiKeyResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/generateApiKey"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateApiKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateApiKeyResponse");
}
}

View File

@@ -0,0 +1,70 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { Company } from '../../typings/management/models';
import { ListCompanyResponse } from '../../typings/management/models';
import { ListMerchantResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class AccountCompanyLevelApi extends Service {
/**
* @summary Get a list of company accounts
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listCompanyAccounts(requestOptions?: IRequest.Options): Promise<ListCompanyResponse> {
const localVarPath = "/companies";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListCompanyResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListCompanyResponse");
}
/**
* @summary Get a company account
* @param companyId The unique identifier of the company account.
*/
public async getCompanyAccount(companyId: string, requestOptions?: IRequest.Options): Promise<Company> {
const localVarPath = "/companies/{companyId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Company>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Company");
}
/**
* @summary Get a list of merchant accounts
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listMerchantAccounts(companyId: string, requestOptions?: IRequest.Options): Promise<ListMerchantResponse> {
const localVarPath = "/companies/{companyId}/merchants"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListMerchantResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListMerchantResponse");
}
}

View File

@@ -0,0 +1,85 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CreateMerchantRequest } from '../../typings/management/models';
import { CreateMerchantResponse } from '../../typings/management/models';
import { ListMerchantResponse } from '../../typings/management/models';
import { Merchant } from '../../typings/management/models';
import { RequestActivationResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class AccountMerchantLevelApi extends Service {
/**
* @summary Get a list of merchant accounts
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listMerchantAccounts(requestOptions?: IRequest.Options): Promise<ListMerchantResponse> {
const localVarPath = "/merchants";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListMerchantResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListMerchantResponse");
}
/**
* @summary Get a merchant account
* @param merchantId The unique identifier of the merchant account.
*/
public async getMerchantAccount(merchantId: string, requestOptions?: IRequest.Options): Promise<Merchant> {
const localVarPath = "/merchants/{merchantId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Merchant>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Merchant");
}
/**
* @summary Create a merchant account
* @param createMerchantRequest
*/
public async createMerchantAccount(createMerchantRequest: CreateMerchantRequest, requestOptions?: IRequest.Options): Promise<CreateMerchantResponse> {
const localVarPath = "/merchants";
const resource = new ManagementResource(this, localVarPath);
const request: CreateMerchantRequest = ObjectSerializer.serialize(createMerchantRequest, "CreateMerchantRequest");
const response = await getJsonResponse<CreateMerchantRequest, CreateMerchantResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CreateMerchantResponse");
}
/**
* @summary Request to activate a merchant account
* @param merchantId The unique identifier of the merchant account.
*/
public async requestToActivateMerchantAccount(merchantId: string, requestOptions?: IRequest.Options): Promise<RequestActivationResponse> {
const localVarPath = "/merchants/{merchantId}/activate"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, RequestActivationResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "RequestActivationResponse");
}
}

View File

@@ -0,0 +1,160 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { ListStoresResponse } from '../../typings/management/models';
import { Store } from '../../typings/management/models';
import { StoreCreationRequest } from '../../typings/management/models';
import { StoreCreationWithMerchantCodeRequest } from '../../typings/management/models';
import { UpdateStoreRequest } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class AccountStoreLevelApi extends Service {
/**
* @summary Get a list of stores
* @param merchantId The unique identifier of the merchant account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
* @param reference The reference of the store.
*/
public async listStoresByMerchantId(merchantId: string, requestOptions?: IRequest.Options): Promise<ListStoresResponse> {
const localVarPath = "/merchants/{merchantId}/stores"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListStoresResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListStoresResponse");
}
/**
* @summary Get a store
* @param merchantId The unique identifier of the merchant account.
* @param storeId The unique identifier of the store.
*/
public async getStore(merchantId: string, storeId: string, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/merchants/{merchantId}/stores/{storeId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Store>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Store");
}
/**
* @summary Get a list of stores
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
* @param reference The reference of the store.
* @param merchantId The unique identifier of the merchant account.
*/
public async listStores(requestOptions?: IRequest.Options): Promise<ListStoresResponse> {
const localVarPath = "/stores";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListStoresResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListStoresResponse");
}
/**
* @summary Get a store
* @param storeId The unique identifier of the store.
*/
public async getStoreById(storeId: string, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/stores/{storeId}"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Store>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Store");
}
/**
* @summary Update a store
* @param merchantId The unique identifier of the merchant account.
* @param storeId The unique identifier of the store.
* @param updateStoreRequest
*/
public async updateStore(merchantId: string, storeId: string, updateStoreRequest: UpdateStoreRequest, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/merchants/{merchantId}/stores/{storeId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateStoreRequest = ObjectSerializer.serialize(updateStoreRequest, "UpdateStoreRequest");
const response = await getJsonResponse<UpdateStoreRequest, Store>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Store");
}
/**
* @summary Update a store
* @param storeId The unique identifier of the store.
* @param updateStoreRequest
*/
public async updateStoreById(storeId: string, updateStoreRequest: UpdateStoreRequest, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/stores/{storeId}"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateStoreRequest = ObjectSerializer.serialize(updateStoreRequest, "UpdateStoreRequest");
const response = await getJsonResponse<UpdateStoreRequest, Store>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Store");
}
/**
* @summary Create a store
* @param merchantId The unique identifier of the merchant account.
* @param storeCreationRequest
*/
public async createStoreByMerchantId(merchantId: string, storeCreationRequest: StoreCreationRequest, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/merchants/{merchantId}/stores"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: StoreCreationRequest = ObjectSerializer.serialize(storeCreationRequest, "StoreCreationRequest");
const response = await getJsonResponse<StoreCreationRequest, Store>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "Store");
}
/**
* @summary Create a store
* @param storeCreationWithMerchantCodeRequest
*/
public async createStore(storeCreationWithMerchantCodeRequest: StoreCreationWithMerchantCodeRequest, requestOptions?: IRequest.Options): Promise<Store> {
const localVarPath = "/stores";
const resource = new ManagementResource(this, localVarPath);
const request: StoreCreationWithMerchantCodeRequest = ObjectSerializer.serialize(storeCreationWithMerchantCodeRequest, "StoreCreationWithMerchantCodeRequest");
const response = await getJsonResponse<StoreCreationWithMerchantCodeRequest, Store>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "Store");
}
}

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { AllowedOrigin } from '../../typings/management/models';
import { AllowedOriginsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class AllowedOriginsCompanyLevelApi extends Service {
/**
* @summary Delete an allowed origin
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
* @param originId Unique identifier of the allowed origin.
*/
public async deleteAllowedOrigin(companyId: string, apiCredentialId: string, originId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)))
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary Get a list of allowed origins
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async listAllowedOrigins(companyId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOriginsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
/**
* @summary Get an allowed origin
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
* @param originId Unique identifier of the allowed origin.
*/
public async getAllowedOrigin(companyId: string, apiCredentialId: string, originId: string, requestOptions?: IRequest.Options): Promise<AllowedOrigin> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)))
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOrigin>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOrigin");
}
/**
* @summary Create an allowed origin
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
* @param allowedOrigin
*/
public async createAllowedOrigin(companyId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const request: AllowedOrigin = ObjectSerializer.serialize(allowedOrigin, "AllowedOrigin");
const response = await getJsonResponse<AllowedOrigin, AllowedOriginsResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
}

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { AllowedOrigin } from '../../typings/management/models';
import { AllowedOriginsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class AllowedOriginsMerchantLevelApi extends Service {
/**
* @summary Delete an allowed origin
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
* @param originId Unique identifier of the allowed origin.
*/
public async deleteAllowedOrigin(merchantId: string, apiCredentialId: string, originId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)))
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary Get a list of allowed origins
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async listAllowedOrigins(merchantId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOriginsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
/**
* @summary Get an allowed origin
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
* @param originId Unique identifier of the allowed origin.
*/
public async getAllowedOrigin(merchantId: string, apiCredentialId: string, originId: string, requestOptions?: IRequest.Options): Promise<AllowedOrigin> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)))
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOrigin>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOrigin");
}
/**
* @summary Create an allowed origin
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
* @param allowedOrigin
*/
public async createAllowedOrigin(merchantId: string, apiCredentialId: string, allowedOrigin: AllowedOrigin, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/allowedOrigins"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const request: AllowedOrigin = ObjectSerializer.serialize(allowedOrigin, "AllowedOrigin");
const response = await getJsonResponse<AllowedOrigin, AllowedOriginsResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
}

View File

@@ -0,0 +1,38 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { GenerateClientKeyResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class ClientKeyCompanyLevelApi extends Service {
/**
* @summary Generate new client key
* @param companyId The unique identifier of the company account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async generateNewClientKey(companyId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<GenerateClientKeyResponse> {
const localVarPath = "/companies/{companyId}/apiCredentials/{apiCredentialId}/generateClientKey"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateClientKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateClientKeyResponse");
}
}

View File

@@ -0,0 +1,38 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { GenerateClientKeyResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class ClientKeyMerchantLevelApi extends Service {
/**
* @summary Generate new client key
* @param merchantId The unique identifier of the merchant account.
* @param apiCredentialId Unique identifier of the API credential.
*/
public async generateNewClientKey(merchantId: string, apiCredentialId: string, requestOptions?: IRequest.Options): Promise<GenerateClientKeyResponse> {
const localVarPath = "/merchants/{merchantId}/apiCredentials/{apiCredentialId}/generateClientKey"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'apiCredentialId' + '}', encodeURIComponent(String(apiCredentialId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateClientKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateClientKeyResponse");
}
}

View File

@@ -0,0 +1,94 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { AllowedOrigin } from '../../typings/management/models';
import { AllowedOriginsResponse } from '../../typings/management/models';
import { CreateAllowedOriginRequest } from '../../typings/management/models';
import { MeApiCredential } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class MyAPICredentialApi extends Service {
/**
* @summary Remove allowed origin
* @param originId Unique identifier of the allowed origin.
*/
public async removeAllowedOrigin(originId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/me/allowedOrigins/{originId}"
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary Get API credential details
*/
public async getApiCredentialDetails(requestOptions?: IRequest.Options): Promise<MeApiCredential> {
const localVarPath = "/me";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, MeApiCredential>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "MeApiCredential");
}
/**
* @summary Get allowed origins
*/
public async getAllowedOrigins(requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/me/allowedOrigins";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOriginsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
/**
* @summary Get allowed origin details
* @param originId Unique identifier of the allowed origin.
*/
public async getAllowedOriginDetails(originId: string, requestOptions?: IRequest.Options): Promise<AllowedOrigin> {
const localVarPath = "/me/allowedOrigins/{originId}"
.replace('{' + 'originId' + '}', encodeURIComponent(String(originId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AllowedOrigin>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AllowedOrigin");
}
/**
* @summary Add allowed origin
* @param createAllowedOriginRequest
*/
public async addAllowedOrigin(createAllowedOriginRequest: CreateAllowedOriginRequest, requestOptions?: IRequest.Options): Promise<AllowedOriginsResponse> {
const localVarPath = "/me/allowedOrigins";
const resource = new ManagementResource(this, localVarPath);
const request: CreateAllowedOriginRequest = ObjectSerializer.serialize(createAllowedOriginRequest, "CreateAllowedOriginRequest");
const response = await getJsonResponse<CreateAllowedOriginRequest, AllowedOriginsResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
}

View File

@@ -0,0 +1,132 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { ApplePayInfo } from '../../typings/management/models';
import { PaymentMethod } from '../../typings/management/models';
import { PaymentMethodResponse } from '../../typings/management/models';
import { PaymentMethodSetupInfo } from '../../typings/management/models';
import { UpdatePaymentMethodInfo } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class PaymentMethodsMerchantLevelApi extends Service {
/**
* @summary Get all payment methods
* @param merchantId The unique identifier of the merchant account.
* @param storeId The unique identifier of the store for which to return the payment methods.
* @param businessLineId The unique identifier of the Business Line for which to return the payment methods.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
* @param pageNumber The number of the page to fetch.
*/
public async getAllPaymentMethods(merchantId: string, requestOptions?: IRequest.Options): Promise<PaymentMethodResponse> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, PaymentMethodResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "PaymentMethodResponse");
}
/**
* @summary Get payment method details
* @param merchantId The unique identifier of the merchant account.
* @param paymentMethodId The unique identifier of the payment method.
*/
public async getPaymentMethodDetails(merchantId: string, paymentMethodId: string, requestOptions?: IRequest.Options): Promise<PaymentMethod> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'paymentMethodId' + '}', encodeURIComponent(String(paymentMethodId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, PaymentMethod>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "PaymentMethod");
}
/**
* @summary Get Apple Pay domains
* @param merchantId The unique identifier of the merchant account.
* @param paymentMethodId The unique identifier of the payment method.
*/
public async getApplePayDomains(merchantId: string, paymentMethodId: string, requestOptions?: IRequest.Options): Promise<ApplePayInfo> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/getApplePayDomains"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'paymentMethodId' + '}', encodeURIComponent(String(paymentMethodId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ApplePayInfo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ApplePayInfo");
}
/**
* @summary Update a payment method
* @param merchantId The unique identifier of the merchant account.
* @param paymentMethodId The unique identifier of the payment method.
* @param updatePaymentMethodInfo
*/
public async updatePaymentMethod(merchantId: string, paymentMethodId: string, updatePaymentMethodInfo: UpdatePaymentMethodInfo, requestOptions?: IRequest.Options): Promise<PaymentMethod> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'paymentMethodId' + '}', encodeURIComponent(String(paymentMethodId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdatePaymentMethodInfo = ObjectSerializer.serialize(updatePaymentMethodInfo, "UpdatePaymentMethodInfo");
const response = await getJsonResponse<UpdatePaymentMethodInfo, PaymentMethod>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "PaymentMethod");
}
/**
* @summary Request a payment method
* @param merchantId The unique identifier of the merchant account.
* @param paymentMethodSetupInfo
*/
public async requestPaymentMethod(merchantId: string, paymentMethodSetupInfo: PaymentMethodSetupInfo, requestOptions?: IRequest.Options): Promise<PaymentMethod> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: PaymentMethodSetupInfo = ObjectSerializer.serialize(paymentMethodSetupInfo, "PaymentMethodSetupInfo");
const response = await getJsonResponse<PaymentMethodSetupInfo, PaymentMethod>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "PaymentMethod");
}
/**
* @summary Add an Apple Pay domain
* @param merchantId The unique identifier of the merchant account.
* @param paymentMethodId The unique identifier of the payment method.
* @param applePayInfo
*/
public async addApplePayDomain(merchantId: string, paymentMethodId: string, applePayInfo: ApplePayInfo, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/addApplePayDomains"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'paymentMethodId' + '}', encodeURIComponent(String(paymentMethodId)));
const resource = new ManagementResource(this, localVarPath);
const request: ApplePayInfo = ObjectSerializer.serialize(applePayInfo, "ApplePayInfo");
await getJsonResponse<ApplePayInfo, void>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
}
}

View File

@@ -0,0 +1,108 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { PayoutSettings } from '../../typings/management/models';
import { PayoutSettingsRequest } from '../../typings/management/models';
import { PayoutSettingsResponse } from '../../typings/management/models';
import { UpdatePayoutSettingsRequest } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class PayoutSettingsMerchantLevelApi extends Service {
/**
* @summary Delete a payout setting
* @param merchantId The unique identifier of the merchant account.
* @param payoutSettingsId The unique identifier of the payout setting.
*/
public async deletePayoutSetting(merchantId: string, payoutSettingsId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/merchants/{merchantId}/payoutSettings/{payoutSettingsId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'payoutSettingsId' + '}', encodeURIComponent(String(payoutSettingsId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary Get a list of payout settings
* @param merchantId The unique identifier of the merchant account.
*/
public async listPayoutSettings(merchantId: string, requestOptions?: IRequest.Options): Promise<PayoutSettingsResponse> {
const localVarPath = "/merchants/{merchantId}/payoutSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, PayoutSettingsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "PayoutSettingsResponse");
}
/**
* @summary Get a payout setting
* @param merchantId The unique identifier of the merchant account.
* @param payoutSettingsId The unique identifier of the payout setting.
*/
public async getPayoutSetting(merchantId: string, payoutSettingsId: string, requestOptions?: IRequest.Options): Promise<PayoutSettings> {
const localVarPath = "/merchants/{merchantId}/payoutSettings/{payoutSettingsId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'payoutSettingsId' + '}', encodeURIComponent(String(payoutSettingsId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, PayoutSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "PayoutSettings");
}
/**
* @summary Update a payout setting
* @param merchantId The unique identifier of the merchant account.
* @param payoutSettingsId The unique identifier of the payout setting.
* @param updatePayoutSettingsRequest
*/
public async updatePayoutSetting(merchantId: string, payoutSettingsId: string, updatePayoutSettingsRequest: UpdatePayoutSettingsRequest, requestOptions?: IRequest.Options): Promise<PayoutSettings> {
const localVarPath = "/merchants/{merchantId}/payoutSettings/{payoutSettingsId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'payoutSettingsId' + '}', encodeURIComponent(String(payoutSettingsId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdatePayoutSettingsRequest = ObjectSerializer.serialize(updatePayoutSettingsRequest, "UpdatePayoutSettingsRequest");
const response = await getJsonResponse<UpdatePayoutSettingsRequest, PayoutSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "PayoutSettings");
}
/**
* @summary Add a payout setting
* @param merchantId The unique identifier of the merchant account.
* @param payoutSettingsRequest
*/
public async addPayoutSetting(merchantId: string, payoutSettingsRequest: PayoutSettingsRequest, requestOptions?: IRequest.Options): Promise<PayoutSettings> {
const localVarPath = "/merchants/{merchantId}/payoutSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: PayoutSettingsRequest = ObjectSerializer.serialize(payoutSettingsRequest, "PayoutSettingsRequest");
const response = await getJsonResponse<PayoutSettingsRequest, PayoutSettings>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "PayoutSettings");
}
}

View File

@@ -0,0 +1,94 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { AndroidAppsResponse } from '../../typings/management/models';
import { AndroidCertificatesResponse } from '../../typings/management/models';
import { ExternalTerminalAction } from '../../typings/management/models';
import { ListExternalTerminalActionsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalActionsCompanyLevelApi extends Service {
/**
* @summary Get a list of Android apps
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 20 items on a page.
*/
public async listAndroidApps(companyId: string, requestOptions?: IRequest.Options): Promise<AndroidAppsResponse> {
const localVarPath = "/companies/{companyId}/androidApps"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AndroidAppsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AndroidAppsResponse");
}
/**
* @summary Get a list of Android certificates
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 20 items on a page.
*/
public async listAndroidCertificates(companyId: string, requestOptions?: IRequest.Options): Promise<AndroidCertificatesResponse> {
const localVarPath = "/companies/{companyId}/androidCertificates"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, AndroidCertificatesResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AndroidCertificatesResponse");
}
/**
* @summary Get a list of terminal actions
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 20 items on a page.
* @param status Returns terminal actions with the specified status. Allowed values: **pending**, **successful**, **failed**, **cancelled**, **tryLater**.
* @param type Returns terminal actions of the specified type. Allowed values: **InstallAndroidApp**, **UninstallAndroidApp**, **InstallAndroidCertificate**, **UninstallAndroidCertificate**.
*/
public async listTerminalActions(companyId: string, requestOptions?: IRequest.Options): Promise<ListExternalTerminalActionsResponse> {
const localVarPath = "/companies/{companyId}/terminalActions"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListExternalTerminalActionsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListExternalTerminalActionsResponse");
}
/**
* @summary Get terminal action
* @param companyId The unique identifier of the company account.
* @param actionId The unique identifier of the terminal action.
*/
public async getTerminalAction(companyId: string, actionId: string, requestOptions?: IRequest.Options): Promise<ExternalTerminalAction> {
const localVarPath = "/companies/{companyId}/terminalActions/{actionId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'actionId' + '}', encodeURIComponent(String(actionId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ExternalTerminalAction>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ExternalTerminalAction");
}
}

View File

@@ -0,0 +1,37 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { ScheduleTerminalActionsRequest } from '../../typings/management/models';
import { ScheduleTerminalActionsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalActionsTerminalLevelApi extends Service {
/**
* @summary Create a terminal action
* @param scheduleTerminalActionsRequest
*/
public async createTerminalAction(scheduleTerminalActionsRequest: ScheduleTerminalActionsRequest, requestOptions?: IRequest.Options): Promise<ScheduleTerminalActionsResponse> {
const localVarPath = "/terminals/scheduleActions";
const resource = new ManagementResource(this, localVarPath);
const request: ScheduleTerminalActionsRequest = ObjectSerializer.serialize(scheduleTerminalActionsRequest, "ScheduleTerminalActionsRequest");
const response = await getJsonResponse<ScheduleTerminalActionsRequest, ScheduleTerminalActionsResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "ScheduleTerminalActionsResponse");
}
}

View File

@@ -0,0 +1,202 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { BillingEntitiesResponse } from '../../typings/management/models';
import { ShippingLocation } from '../../typings/management/models';
import { ShippingLocationsResponse } from '../../typings/management/models';
import { TerminalModelsResponse } from '../../typings/management/models';
import { TerminalOrder } from '../../typings/management/models';
import { TerminalOrderRequest } from '../../typings/management/models';
import { TerminalOrdersResponse } from '../../typings/management/models';
import { TerminalProductsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalOrdersCompanyLevelApi extends Service {
/**
* @summary Get a list of billing entities
* @param companyId The unique identifier of the company account.
* @param name The name of the billing entity.
*/
public async listBillingEntities(companyId: string, requestOptions?: IRequest.Options): Promise<BillingEntitiesResponse> {
const localVarPath = "/companies/{companyId}/billingEntities"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, BillingEntitiesResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "BillingEntitiesResponse");
}
/**
* @summary Get a list of shipping locations
* @param companyId The unique identifier of the company account.
* @param name The name of the shipping location.
* @param offset The number of locations to skip.
* @param limit The number of locations to return.
*/
public async listShippingLocations(companyId: string, requestOptions?: IRequest.Options): Promise<ShippingLocationsResponse> {
const localVarPath = "/companies/{companyId}/shippingLocations"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ShippingLocationsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ShippingLocationsResponse");
}
/**
* @summary Get a list of terminal models
* @param companyId The unique identifier of the company account.
*/
public async listTerminalModels(companyId: string, requestOptions?: IRequest.Options): Promise<TerminalModelsResponse> {
const localVarPath = "/companies/{companyId}/terminalModels"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalModelsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalModelsResponse");
}
/**
* @summary Get a list of orders
* @param companyId The unique identifier of the company account.
* @param customerOrderReference Your purchase order number.
* @param status The order status. Possible values (not case-sensitive): Placed, Confirmed, Cancelled, Shipped, Delivered.
* @param offset The number of orders to skip.
* @param limit The number of orders to return.
*/
public async listOrders(companyId: string, requestOptions?: IRequest.Options): Promise<TerminalOrdersResponse> {
const localVarPath = "/companies/{companyId}/terminalOrders"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrdersResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalOrdersResponse");
}
/**
* @summary Get an order
* @param companyId The unique identifier of the company account.
* @param orderId The unique identifier of the order.
*/
public async getOrder(companyId: string, orderId: string, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/companies/{companyId}/terminalOrders/{orderId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrder>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Get a list of terminal products
* @param companyId The unique identifier of the company account.
* @param country The country to return products for, in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. For example, **US**
* @param terminalModelId The terminal model to return products for. Use the ID returned in the [GET &#x60;/terminalModels&#x60;](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/terminalModels) response. For example, **Verifone.M400**
* @param offset The number of products to skip.
* @param limit The number of products to return.
*/
public async listTerminalProducts(companyId: string, requestOptions?: IRequest.Options): Promise<TerminalProductsResponse> {
const localVarPath = "/companies/{companyId}/terminalProducts"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalProductsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalProductsResponse");
}
/**
* @summary Update an order
* @param companyId The unique identifier of the company account.
* @param orderId The unique identifier of the order.
* @param terminalOrderRequest
*/
public async updateOrder(companyId: string, orderId: string, terminalOrderRequest: TerminalOrderRequest, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/companies/{companyId}/terminalOrders/{orderId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalOrderRequest = ObjectSerializer.serialize(terminalOrderRequest, "TerminalOrderRequest");
const response = await getJsonResponse<TerminalOrderRequest, TerminalOrder>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Create a shipping location
* @param companyId The unique identifier of the company account.
* @param shippingLocation
*/
public async createShippingLocation(companyId: string, shippingLocation: ShippingLocation, requestOptions?: IRequest.Options): Promise<ShippingLocation> {
const localVarPath = "/companies/{companyId}/shippingLocations"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: ShippingLocation = ObjectSerializer.serialize(shippingLocation, "ShippingLocation");
const response = await getJsonResponse<ShippingLocation, ShippingLocation>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "ShippingLocation");
}
/**
* @summary Create an order
* @param companyId The unique identifier of the company account.
* @param terminalOrderRequest
*/
public async createOrder(companyId: string, terminalOrderRequest: TerminalOrderRequest, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/companies/{companyId}/terminalOrders"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalOrderRequest = ObjectSerializer.serialize(terminalOrderRequest, "TerminalOrderRequest");
const response = await getJsonResponse<TerminalOrderRequest, TerminalOrder>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Cancel an order
* @param companyId The unique identifier of the company account.
* @param orderId The unique identifier of the order.
*/
public async cancelOrder(companyId: string, orderId: string, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/companies/{companyId}/terminalOrders/{orderId}/cancel"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrder>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
}

View File

@@ -0,0 +1,202 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { BillingEntitiesResponse } from '../../typings/management/models';
import { ShippingLocation } from '../../typings/management/models';
import { ShippingLocationsResponse } from '../../typings/management/models';
import { TerminalModelsResponse } from '../../typings/management/models';
import { TerminalOrder } from '../../typings/management/models';
import { TerminalOrderRequest } from '../../typings/management/models';
import { TerminalOrdersResponse } from '../../typings/management/models';
import { TerminalProductsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalOrdersMerchantLevelApi extends Service {
/**
* @summary Get a list of billing entities
* @param merchantId The unique identifier of the merchant account.
* @param name The name of the billing entity.
*/
public async listBillingEntities(merchantId: string, requestOptions?: IRequest.Options): Promise<BillingEntitiesResponse> {
const localVarPath = "/merchants/{merchantId}/billingEntities"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, BillingEntitiesResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "BillingEntitiesResponse");
}
/**
* @summary Get a list of shipping locations
* @param merchantId The unique identifier of the merchant account.
* @param name The name of the shipping location.
* @param offset The number of locations to skip.
* @param limit The number of locations to return.
*/
public async listShippingLocations(merchantId: string, requestOptions?: IRequest.Options): Promise<ShippingLocationsResponse> {
const localVarPath = "/merchants/{merchantId}/shippingLocations"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ShippingLocationsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ShippingLocationsResponse");
}
/**
* @summary Get a list of terminal models
* @param merchantId The unique identifier of the merchant account.
*/
public async listTerminalModels(merchantId: string, requestOptions?: IRequest.Options): Promise<TerminalModelsResponse> {
const localVarPath = "/merchants/{merchantId}/terminalModels"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalModelsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalModelsResponse");
}
/**
* @summary Get a list of orders
* @param merchantId
* @param customerOrderReference Your purchase order number.
* @param status The order status. Possible values (not case-sensitive): Placed, Confirmed, Cancelled, Shipped, Delivered.
* @param offset The number of orders to skip.
* @param limit The number of orders to return.
*/
public async listOrders(merchantId: string, requestOptions?: IRequest.Options): Promise<TerminalOrdersResponse> {
const localVarPath = "/merchants/{merchantId}/terminalOrders"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrdersResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalOrdersResponse");
}
/**
* @summary Get an order
* @param merchantId The unique identifier of the merchant account.
* @param orderId The unique identifier of the order.
*/
public async getOrder(merchantId: string, orderId: string, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/merchants/{merchantId}/terminalOrders/{orderId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrder>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Get a list of terminal products
* @param merchantId The unique identifier of the merchant account.
* @param country The country to return products for, in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. For example, **US**
* @param terminalModelId The terminal model to return products for. Use the ID returned in the [GET &#x60;/terminalModels&#x60;](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/terminalModels) response. For example, **Verifone.M400**
* @param offset The number of products to skip.
* @param limit The number of products to return.
*/
public async listTerminalProducts(merchantId: string, requestOptions?: IRequest.Options): Promise<TerminalProductsResponse> {
const localVarPath = "/merchants/{merchantId}/terminalProducts"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalProductsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalProductsResponse");
}
/**
* @summary Update an order
* @param merchantId The unique identifier of the merchant account.
* @param orderId The unique identifier of the order.
* @param terminalOrderRequest
*/
public async updateOrder(merchantId: string, orderId: string, terminalOrderRequest: TerminalOrderRequest, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/merchants/{merchantId}/terminalOrders/{orderId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalOrderRequest = ObjectSerializer.serialize(terminalOrderRequest, "TerminalOrderRequest");
const response = await getJsonResponse<TerminalOrderRequest, TerminalOrder>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Create a shipping location
* @param merchantId The unique identifier of the merchant account.
* @param shippingLocation
*/
public async createShippingLocation(merchantId: string, shippingLocation: ShippingLocation, requestOptions?: IRequest.Options): Promise<ShippingLocation> {
const localVarPath = "/merchants/{merchantId}/shippingLocations"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: ShippingLocation = ObjectSerializer.serialize(shippingLocation, "ShippingLocation");
const response = await getJsonResponse<ShippingLocation, ShippingLocation>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "ShippingLocation");
}
/**
* @summary Create an order
* @param merchantId The unique identifier of the merchant account.
* @param terminalOrderRequest
*/
public async createOrder(merchantId: string, terminalOrderRequest: TerminalOrderRequest, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/merchants/{merchantId}/terminalOrders"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalOrderRequest = ObjectSerializer.serialize(terminalOrderRequest, "TerminalOrderRequest");
const response = await getJsonResponse<TerminalOrderRequest, TerminalOrder>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
/**
* @summary Cancel an order
* @param merchantId The unique identifier of the merchant account.
* @param orderId The unique identifier of the order.
*/
public async cancelOrder(merchantId: string, orderId: string, requestOptions?: IRequest.Options): Promise<TerminalOrder> {
const localVarPath = "/merchants/{merchantId}/terminalOrders/{orderId}/cancel"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalOrder>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TerminalOrder");
}
}

View File

@@ -0,0 +1,88 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { Logo } from '../../typings/management/models';
import { TerminalSettings } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalSettingsCompanyLevelApi extends Service {
/**
* @summary Get the terminal logo
* @param companyId The unique identifier of the company account.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
*/
public async getTerminalLogo(companyId: string, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/companies/{companyId}/terminalLogos"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Logo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Get terminal settings
* @param companyId The unique identifier of the company account.
*/
public async getTerminalSettings(companyId: string, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/companies/{companyId}/terminalSettings"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Update the terminal logo
* @param companyId The unique identifier of the company account.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
* @param logo
*/
public async updateTerminalLogo(companyId: string, logo: Logo, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/companies/{companyId}/terminalLogos"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: Logo = ObjectSerializer.serialize(logo, "Logo");
const response = await getJsonResponse<Logo, Logo>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Update terminal settings
* @param companyId The unique identifier of the company account.
* @param terminalSettings
*/
public async updateTerminalSettings(companyId: string, terminalSettings: TerminalSettings, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/companies/{companyId}/terminalSettings"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalSettings = ObjectSerializer.serialize(terminalSettings, "TerminalSettings");
const response = await getJsonResponse<TerminalSettings, TerminalSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
}

View File

@@ -0,0 +1,88 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { Logo } from '../../typings/management/models';
import { TerminalSettings } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalSettingsMerchantLevelApi extends Service {
/**
* @summary Get the terminal logo
* @param merchantId The unique identifier of the merchant account.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
*/
public async getTerminalLogo(merchantId: string, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/merchants/{merchantId}/terminalLogos"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Logo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Get terminal settings
* @param merchantId The unique identifier of the merchant account.
*/
public async getTerminalSettings(merchantId: string, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/merchants/{merchantId}/terminalSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Update the terminal logo
* @param merchantId The unique identifier of the merchant account.
* @param model The terminal model. Allowed values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
* @param logo
*/
public async updateTerminalLogo(merchantId: string, logo: Logo, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/merchants/{merchantId}/terminalLogos"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: Logo = ObjectSerializer.serialize(logo, "Logo");
const response = await getJsonResponse<Logo, Logo>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Update terminal settings
* @param merchantId The unique identifier of the merchant account.
* @param terminalSettings
*/
public async updateTerminalSettings(merchantId: string, terminalSettings: TerminalSettings, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/merchants/{merchantId}/terminalSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalSettings = ObjectSerializer.serialize(terminalSettings, "TerminalSettings");
const response = await getJsonResponse<TerminalSettings, TerminalSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
}

View File

@@ -0,0 +1,162 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { Logo } from '../../typings/management/models';
import { TerminalSettings } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalSettingsStoreLevelApi extends Service {
/**
* @summary Get the terminal logo
* @param merchantId The unique identifier of the merchant account.
* @param reference The reference that identifies the store.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
*/
public async getTerminalLogo(merchantId: string, reference: string, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/merchants/{merchantId}/stores/{reference}/terminalLogos"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'reference' + '}', encodeURIComponent(String(reference)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Logo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Get terminal settings
* @param merchantId The unique identifier of the merchant account.
* @param reference The reference that identifies the store.
*/
public async getTerminalSettings(merchantId: string, reference: string, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/merchants/{merchantId}/stores/{reference}/terminalSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'reference' + '}', encodeURIComponent(String(reference)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Get the terminal logo
* @param storeId The unique identifier of the store.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
*/
public async getTerminalLogoByStoreId(storeId: string, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/stores/{storeId}/terminalLogos"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Logo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Get terminal settings
* @param storeId The unique identifier of the store.
*/
public async getTerminalSettingsByStoreId(storeId: string, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/stores/{storeId}/terminalSettings"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Update the terminal logo
* @param merchantId The unique identifier of the merchant account.
* @param reference The reference that identifies the store.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T
* @param logo
*/
public async updateTerminalLogo(merchantId: string, reference: string, logo: Logo, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/merchants/{merchantId}/stores/{reference}/terminalLogos"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'reference' + '}', encodeURIComponent(String(reference)));
const resource = new ManagementResource(this, localVarPath);
const request: Logo = ObjectSerializer.serialize(logo, "Logo");
const response = await getJsonResponse<Logo, Logo>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Update terminal settings
* @param merchantId The unique identifier of the merchant account.
* @param reference The reference that identifies the store.
* @param terminalSettings
*/
public async updateTerminalSettings(merchantId: string, reference: string, terminalSettings: TerminalSettings, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/merchants/{merchantId}/stores/{reference}/terminalSettings"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'reference' + '}', encodeURIComponent(String(reference)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalSettings = ObjectSerializer.serialize(terminalSettings, "TerminalSettings");
const response = await getJsonResponse<TerminalSettings, TerminalSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Update the terminal logo
* @param storeId The unique identifier of the store.
* @param model The terminal model. Possible values: E355, VX675WIFIBT, VX680, VX690, VX700, VX820, M400, MX925, P400Plus, UX300, UX410, V200cPlus, V240mPlus, V400cPlus, V400m, e280, e285, e285p, S1E, S1EL, S1F2, S1L, S1U, S7T.
* @param logo
*/
public async updateTerminalLogoByStoreId(storeId: string, logo: Logo, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/stores/{storeId}/terminalLogos"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const request: Logo = ObjectSerializer.serialize(logo, "Logo");
const response = await getJsonResponse<Logo, Logo>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Update terminal settings
* @param storeId The unique identifier of the store.
* @param terminalSettings
*/
public async updateTerminalSettingsByStoreId(storeId: string, terminalSettings: TerminalSettings, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/stores/{storeId}/terminalSettings"
.replace('{' + 'storeId' + '}', encodeURIComponent(String(storeId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalSettings = ObjectSerializer.serialize(terminalSettings, "TerminalSettings");
const response = await getJsonResponse<TerminalSettings, TerminalSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
}

View File

@@ -0,0 +1,86 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { Logo } from '../../typings/management/models';
import { TerminalSettings } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalSettingsTerminalLevelApi extends Service {
/**
* @summary Get the terminal logo
* @param terminalId The unique identifier of the payment terminal.
*/
public async getTerminalLogo(terminalId: string, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/terminals/{terminalId}/terminalLogos"
.replace('{' + 'terminalId' + '}', encodeURIComponent(String(terminalId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Logo>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Get terminal settings
* @param terminalId The unique identifier of the payment terminal.
*/
public async getTerminalSettings(terminalId: string, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/terminals/{terminalId}/terminalSettings"
.replace('{' + 'terminalId' + '}', encodeURIComponent(String(terminalId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, TerminalSettings>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
/**
* @summary Update the logo
* @param terminalId The unique identifier of the payment terminal.
* @param logo
*/
public async updateLogo(terminalId: string, logo: Logo, requestOptions?: IRequest.Options): Promise<Logo> {
const localVarPath = "/terminals/{terminalId}/terminalLogos"
.replace('{' + 'terminalId' + '}', encodeURIComponent(String(terminalId)));
const resource = new ManagementResource(this, localVarPath);
const request: Logo = ObjectSerializer.serialize(logo, "Logo");
const response = await getJsonResponse<Logo, Logo>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Logo");
}
/**
* @summary Update terminal settings
* @param terminalId The unique identifier of the payment terminal.
* @param terminalSettings
*/
public async updateTerminalSettings(terminalId: string, terminalSettings: TerminalSettings, requestOptions?: IRequest.Options): Promise<TerminalSettings> {
const localVarPath = "/terminals/{terminalId}/terminalSettings"
.replace('{' + 'terminalId' + '}', encodeURIComponent(String(terminalId)));
const resource = new ManagementResource(this, localVarPath);
const request: TerminalSettings = ObjectSerializer.serialize(terminalSettings, "TerminalSettings");
const response = await getJsonResponse<TerminalSettings, TerminalSettings>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "TerminalSettings");
}
}

View File

@@ -0,0 +1,41 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { ListTerminalsResponse } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class TerminalsTerminalLevelApi extends Service {
/**
* @summary Get a list of terminals
* @param searchQuery Returns terminals with an ID that contains the specified string. If present, other query parameters are ignored.
* @param countries Returns terminals located in the countries specified by their [two-letter country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
* @param merchantIds Returns terminals that belong to the merchant accounts specified by their unique merchant account ID.
* @param storeIds Returns terminals that are assigned to the [stores](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/stores) specified by their unique store ID.
* @param brandModels Returns terminals of the [models](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/companies/{companyId}/terminalModels) specified in the format *brand.model*.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 20 items on a page.
*/
public async listTerminals(requestOptions?: IRequest.Options): Promise<ListTerminalsResponse> {
const localVarPath = "/terminals";
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListTerminalsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListTerminalsResponse");
}
}

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CompanyUser } from '../../typings/management/models';
import { CreateCompanyUserRequest } from '../../typings/management/models';
import { CreateCompanyUserResponse } from '../../typings/management/models';
import { ListCompanyUsersResponse } from '../../typings/management/models';
import { UpdateCompanyUserRequest } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class UsersCompanyLevelApi extends Service {
/**
* @summary Get a list of users
* @param companyId The unique identifier of the company account.
* @param pageNumber The number of the page to return.
* @param pageSize The number of items to have on a page. Maximum value is **100**. The default is **10** items on a page.
*/
public async listUsers(companyId: string, requestOptions?: IRequest.Options): Promise<ListCompanyUsersResponse> {
const localVarPath = "/companies/{companyId}/users"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListCompanyUsersResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListCompanyUsersResponse");
}
/**
* @summary Get user details
* @param companyId The unique identifier of the company account.
* @param userId The unique identifier of the user.
*/
public async getUserDetails(companyId: string, userId: string, requestOptions?: IRequest.Options): Promise<CompanyUser> {
const localVarPath = "/companies/{companyId}/users/{userId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, CompanyUser>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "CompanyUser");
}
/**
* @summary Update user details
* @param companyId The unique identifier of the company account.
* @param userId The unique identifier of the user.
* @param updateCompanyUserRequest
*/
public async updateUserDetails(companyId: string, userId: string, updateCompanyUserRequest: UpdateCompanyUserRequest, requestOptions?: IRequest.Options): Promise<CompanyUser> {
const localVarPath = "/companies/{companyId}/users/{userId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateCompanyUserRequest = ObjectSerializer.serialize(updateCompanyUserRequest, "UpdateCompanyUserRequest");
const response = await getJsonResponse<UpdateCompanyUserRequest, CompanyUser>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "CompanyUser");
}
/**
* @summary Create a new user
* @param companyId The unique identifier of the company account.
* @param createCompanyUserRequest
*/
public async createNewUser(companyId: string, createCompanyUserRequest: CreateCompanyUserRequest, requestOptions?: IRequest.Options): Promise<CreateCompanyUserResponse> {
const localVarPath = "/companies/{companyId}/users"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateCompanyUserRequest = ObjectSerializer.serialize(createCompanyUserRequest, "CreateCompanyUserRequest");
const response = await getJsonResponse<CreateCompanyUserRequest, CreateCompanyUserResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CreateCompanyUserResponse");
}
}

View File

@@ -0,0 +1,95 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CreateMerchantUserRequest } from '../../typings/management/models';
import { CreateUserResponse } from '../../typings/management/models';
import { ListMerchantUsersResponse } from '../../typings/management/models';
import { UpdateMerchantUserRequest } from '../../typings/management/models';
import { User } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class UsersMerchantLevelApi extends Service {
/**
* @summary Get a list of users
* @param merchantId Unique identifier of the merchant.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page. Maximum value is **100**. The default is **10** items on a page.
*/
public async listUsers(merchantId: string, requestOptions?: IRequest.Options): Promise<ListMerchantUsersResponse> {
const localVarPath = "/merchants/{merchantId}/users"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListMerchantUsersResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListMerchantUsersResponse");
}
/**
* @summary Get user details
* @param merchantId Unique identifier of the merchant.
* @param userId Unique identifier of the user.
*/
public async getUserDetails(merchantId: string, userId: string, requestOptions?: IRequest.Options): Promise<User> {
const localVarPath = "/merchants/{merchantId}/users/{userId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, User>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "User");
}
/**
* @summary Update a user
* @param merchantId Unique identifier of the merchant.
* @param userId Unique identifier of the user.
* @param updateMerchantUserRequest
*/
public async updateUser(merchantId: string, userId: string, updateMerchantUserRequest: UpdateMerchantUserRequest, requestOptions?: IRequest.Options): Promise<User> {
const localVarPath = "/merchants/{merchantId}/users/{userId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateMerchantUserRequest = ObjectSerializer.serialize(updateMerchantUserRequest, "UpdateMerchantUserRequest");
const response = await getJsonResponse<UpdateMerchantUserRequest, User>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "User");
}
/**
* @summary Create a new user
* @param merchantId Unique identifier of the merchant.
* @param createMerchantUserRequest
*/
public async createNewUser(merchantId: string, createMerchantUserRequest: CreateMerchantUserRequest, requestOptions?: IRequest.Options): Promise<CreateUserResponse> {
const localVarPath = "/merchants/{merchantId}/users"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateMerchantUserRequest = ObjectSerializer.serialize(createMerchantUserRequest, "CreateMerchantUserRequest");
const response = await getJsonResponse<CreateMerchantUserRequest, CreateUserResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "CreateUserResponse");
}
}

View File

@@ -0,0 +1,149 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CreateCompanyWebhookRequest } from '../../typings/management/models';
import { GenerateHmacKeyResponse } from '../../typings/management/models';
import { ListWebhooksResponse } from '../../typings/management/models';
import { TestCompanyWebhookRequest } from '../../typings/management/models';
import { TestWebhookResponse } from '../../typings/management/models';
import { UpdateCompanyWebhookRequest } from '../../typings/management/models';
import { Webhook } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class WebhooksCompanyLevelApi extends Service {
/**
* @summary Remove a webhook
* @param companyId The unique identifier of the company account.
* @param webhookId Unique identifier of the webhook configuration.
*/
public async removeWebhook(companyId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/companies/{companyId}/webhooks/{webhookId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary List all webhooks
* @param companyId Unique identifier of the [company account](https://docs.adyen.com/account/account-structure#company-account).
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listAllWebhooks(companyId: string, requestOptions?: IRequest.Options): Promise<ListWebhooksResponse> {
const localVarPath = "/companies/{companyId}/webhooks"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListWebhooksResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListWebhooksResponse");
}
/**
* @summary Get a webhook
* @param companyId Unique identifier of the [company account](https://docs.adyen.com/account/account-structure#company-account).
* @param webhookId Unique identifier of the webhook configuration.
*/
public async getWebhook(companyId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/companies/{companyId}/webhooks/{webhookId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Webhook>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Update a webhook
* @param companyId The unique identifier of the company account.
* @param webhookId Unique identifier of the webhook configuration.
* @param updateCompanyWebhookRequest
*/
public async updateWebhook(companyId: string, webhookId: string, updateCompanyWebhookRequest: UpdateCompanyWebhookRequest, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/companies/{companyId}/webhooks/{webhookId}"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateCompanyWebhookRequest = ObjectSerializer.serialize(updateCompanyWebhookRequest, "UpdateCompanyWebhookRequest");
const response = await getJsonResponse<UpdateCompanyWebhookRequest, Webhook>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Set up a webhook
* @param companyId Unique identifier of the [company account](https://docs.adyen.com/account/account-structure#company-account).
* @param createCompanyWebhookRequest
*/
public async setUpWebhook(companyId: string, createCompanyWebhookRequest: CreateCompanyWebhookRequest, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/companies/{companyId}/webhooks"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateCompanyWebhookRequest = ObjectSerializer.serialize(createCompanyWebhookRequest, "CreateCompanyWebhookRequest");
const response = await getJsonResponse<CreateCompanyWebhookRequest, Webhook>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Generate an HMAC key
* @param companyId The unique identifier of the company account.
* @param webhookId Unique identifier of the webhook configuration.
*/
public async generateHmacKey(companyId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<GenerateHmacKeyResponse> {
const localVarPath = "/companies/{companyId}/webhooks/{webhookId}/generateHmac"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateHmacKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateHmacKeyResponse");
}
/**
* @summary Test a webhook
* @param companyId The unique identifier of the company account.
* @param webhookId Unique identifier of the webhook configuration.
* @param testCompanyWebhookRequest
*/
public async testWebhook(companyId: string, webhookId: string, testCompanyWebhookRequest: TestCompanyWebhookRequest, requestOptions?: IRequest.Options): Promise<TestWebhookResponse> {
const localVarPath = "/companies/{companyId}/webhooks/{webhookId}/test"
.replace('{' + 'companyId' + '}', encodeURIComponent(String(companyId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const request: TestCompanyWebhookRequest = ObjectSerializer.serialize(testCompanyWebhookRequest, "TestCompanyWebhookRequest");
const response = await getJsonResponse<TestCompanyWebhookRequest, TestWebhookResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TestWebhookResponse");
}
}

View File

@@ -0,0 +1,149 @@
/*
* The version of the OpenAPI document: v1
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
/* tslint:disable:no-unused-locals */
import { CreateMerchantWebhookRequest } from '../../typings/management/models';
import { GenerateHmacKeyResponse } from '../../typings/management/models';
import { ListWebhooksResponse } from '../../typings/management/models';
import { TestWebhookRequest } from '../../typings/management/models';
import { TestWebhookResponse } from '../../typings/management/models';
import { UpdateMerchantWebhookRequest } from '../../typings/management/models';
import { Webhook } from '../../typings/management/models';
import { IRequest } from "../../typings/requestOptions";
import ManagementResource from "../resource/management/managementResource";
import { ObjectSerializer } from "../../typings/management/models";
export default class WebhooksMerchantLevelApi extends Service {
/**
* @summary Remove a webhook
* @param merchantId The unique identifier of the merchant account.
* @param webhookId Unique identifier of the webhook configuration.
*/
public async removeWebhook(merchantId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<void> {
const localVarPath = "/merchants/{merchantId}/webhooks/{webhookId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}
/**
* @summary List all webhooks
* @param merchantId The unique identifier of the merchant account.
* @param pageNumber The number of the page to fetch.
* @param pageSize The number of items to have on a page, maximum 100. The default is 10 items on a page.
*/
public async listAllWebhooks(merchantId: string, requestOptions?: IRequest.Options): Promise<ListWebhooksResponse> {
const localVarPath = "/merchants/{merchantId}/webhooks"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, ListWebhooksResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "ListWebhooksResponse");
}
/**
* @summary Get a webhook
* @param merchantId The unique identifier of the merchant account.
* @param webhookId Unique identifier of the webhook configuration.
*/
public async getWebhook(merchantId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/merchants/{merchantId}/webhooks/{webhookId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, Webhook>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Update a webhook
* @param merchantId The unique identifier of the merchant account.
* @param webhookId Unique identifier of the webhook configuration.
* @param updateMerchantWebhookRequest
*/
public async updateWebhook(merchantId: string, webhookId: string, updateMerchantWebhookRequest: UpdateMerchantWebhookRequest, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/merchants/{merchantId}/webhooks/{webhookId}"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const request: UpdateMerchantWebhookRequest = ObjectSerializer.serialize(updateMerchantWebhookRequest, "UpdateMerchantWebhookRequest");
const response = await getJsonResponse<UpdateMerchantWebhookRequest, Webhook>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Set up a webhook
* @param merchantId The unique identifier of the merchant account.
* @param createMerchantWebhookRequest
*/
public async setUpWebhook(merchantId: string, createMerchantWebhookRequest: CreateMerchantWebhookRequest, requestOptions?: IRequest.Options): Promise<Webhook> {
const localVarPath = "/merchants/{merchantId}/webhooks"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)));
const resource = new ManagementResource(this, localVarPath);
const request: CreateMerchantWebhookRequest = ObjectSerializer.serialize(createMerchantWebhookRequest, "CreateMerchantWebhookRequest");
const response = await getJsonResponse<CreateMerchantWebhookRequest, Webhook>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "Webhook");
}
/**
* @summary Generate an HMAC key
* @param merchantId The unique identifier of the merchant account.
* @param webhookId
*/
public async generateHmacKey(merchantId: string, webhookId: string, requestOptions?: IRequest.Options): Promise<GenerateHmacKeyResponse> {
const localVarPath = "/merchants/{merchantId}/webhooks/{webhookId}/generateHmac"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const response = await getJsonResponse<string, GenerateHmacKeyResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "GenerateHmacKeyResponse");
}
/**
* @summary Test a webhook
* @param merchantId The unique identifier of the merchant account.
* @param webhookId Unique identifier of the webhook configuration.
* @param testWebhookRequest
*/
public async testWebhook(merchantId: string, webhookId: string, testWebhookRequest: TestWebhookRequest, requestOptions?: IRequest.Options): Promise<TestWebhookResponse> {
const localVarPath = "/merchants/{merchantId}/webhooks/{webhookId}/test"
.replace('{' + 'merchantId' + '}', encodeURIComponent(String(merchantId)))
.replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
const resource = new ManagementResource(this, localVarPath);
const request: TestWebhookRequest = ObjectSerializer.serialize(testWebhookRequest, "TestWebhookRequest");
const response = await getJsonResponse<TestWebhookRequest, TestWebhookResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "TestWebhookResponse");
}
}

View File

@@ -1,10 +1,6 @@
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import Disable from "./resource/recurring/disable";
import ListRecurringDetails from "./resource/recurring/listRecurringDetails";
import ScheduleAccountUpdater from "./resource/recurring/scheduleAccountUpdater";
import NotifyShopper from "./resource/recurring/notifyShopper";
import {
RecurringDetailsRequest,
RecurringDetailsResult,
@@ -13,50 +9,79 @@ import {
ScheduleAccountUpdaterRequest,
ScheduleAccountUpdaterResult,
NotifyShopperRequest,
NotifyShopperResult
NotifyShopperResult,
CreatePermitRequest,
CreatePermitResult,
DisablePermitRequest,
DisablePermitResult, ObjectSerializer
} from "../typings/recurring/models";
import RecurringResource from "./resource/RecurringResource";
class Recurring extends Service {
private readonly _listRecurringDetails: ListRecurringDetails;
private readonly _disable: Disable;
private readonly _scheduleAccountUpdater: ScheduleAccountUpdater;
private readonly _notifyShopper: NotifyShopper;
private readonly _listRecurringDetails: RecurringResource;
private readonly _disable: RecurringResource;
private readonly _scheduleAccountUpdater: RecurringResource;
private readonly _notifyShopper: RecurringResource;
private readonly _createPermit: RecurringResource;
private readonly _disablePermit: RecurringResource;
public constructor(client: Client) {
super(client);
this._listRecurringDetails = new ListRecurringDetails(this);
this._disable = new Disable(this);
this._scheduleAccountUpdater = new ScheduleAccountUpdater(this);
this._notifyShopper = new NotifyShopper(this);
this._listRecurringDetails = new RecurringResource(this, "/listRecurringDetails");
this._disable = new RecurringResource(this, "/disable");
this._scheduleAccountUpdater = new RecurringResource(this, "/scheduleAccountUpdater");
this._notifyShopper = new RecurringResource(this, "/notifyShopper");
this._createPermit = new RecurringResource(this, "/createPermit");
this._disablePermit = new RecurringResource(this, "/disablePermit")
}
public listRecurringDetails(request: RecurringDetailsRequest): Promise<RecurringDetailsResult> {
public listRecurringDetails(recurringDetailsRequest: RecurringDetailsRequest): Promise<RecurringDetailsResult> {
const request: RecurringDetailsRequest = ObjectSerializer.serialize(recurringDetailsRequest, "RecurringDetailsRequest");
return getJsonResponse<RecurringDetailsRequest, RecurringDetailsResult>(
this._listRecurringDetails,
request,
);
}
public disable(request: DisableRequest): Promise<DisableResult> {
public disable(disableRequest: DisableRequest): Promise<DisableResult> {
const request: DisableRequest = ObjectSerializer.serialize(disableRequest, "DisableRequest");
return getJsonResponse<DisableRequest, DisableResult>(
this._disable,
request,
);
}
public scheduleAccountUpdater(request: ScheduleAccountUpdaterRequest): Promise<ScheduleAccountUpdaterResult> {
public scheduleAccountUpdater(scheduleAccountUpdaterRequest: ScheduleAccountUpdaterRequest): Promise<ScheduleAccountUpdaterResult> {
const request: ScheduleAccountUpdaterRequest = ObjectSerializer.serialize(scheduleAccountUpdaterRequest, "ScheduleAccountUpdaterRequest");
return getJsonResponse<ScheduleAccountUpdaterRequest, ScheduleAccountUpdaterResult>(
this._scheduleAccountUpdater,
request,
);
}
public notifyShopper(request: NotifyShopperRequest): Promise<NotifyShopperResult> {
public notifyShopper(notifyShopperRequest: NotifyShopperRequest): Promise<NotifyShopperResult> {
const request: NotifyShopperRequest = ObjectSerializer.serialize(notifyShopperRequest, "NotifyShopperRequest");
return getJsonResponse<NotifyShopperRequest, NotifyShopperResult>(
this._notifyShopper,
request
);
}
public createPermit(createPermitRequest: CreatePermitRequest): Promise<CreatePermitResult>{
const request: CreatePermitRequest = ObjectSerializer.serialize(createPermitRequest, "CreatePermitRequest");
return getJsonResponse<CreatePermitRequest, CreatePermitResult>(
this._createPermit,
request
);
}
public disablePermit(disablePermitRequest: DisablePermitRequest): Promise<DisablePermitResult>{
const request: DisablePermitRequest = ObjectSerializer.serialize(disablePermitRequest, "DisablePermitRequest");
return getJsonResponse<DisablePermitRequest, DisablePermitResult>(
this._disablePermit,
request
);
}
}
export default Recurring;

View File

@@ -0,0 +1,14 @@
import Client from "../../client";
import Service from "../../service";
import Resource from "../resource";
class RecurringResource extends Resource {
public constructor(service: Service, endpoint: string) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}${endpoint}` ,
);
}
}
export default RecurringResource;

View File

@@ -0,0 +1,14 @@
import Client from "../../client";
import Service from "../../service";
import Resource from "../resource";
class TransfersResource extends Resource {
public constructor(service: Service, endpoint: string) {
super(
service,
`${service.client.config.transfersEndpoint}/${Client.TRANSFERS_API_VERSION}${endpoint}`
);
}
}
export default TransfersResource;

View File

@@ -0,0 +1,14 @@
import Client from "../../client";
import Service from "../../service";
import Resource from "../resource";
class DataProtectionResource extends Resource {
public constructor(service: Service, endpoint: string) {
super(
service,
`${service.client.config.dataProtectionEndpoint}/${Client.DATA_PROTECTION_API_VERSION}${endpoint}`
);
}
}
export default DataProtectionResource;

View File

@@ -0,0 +1,14 @@
import Client from "../../client";
import Service from "../../service";
import Resource from "../resource";
class LegalEntityManagementResource extends Resource {
public constructor(service: Service, endpoint: string) {
super(
service,
`${service.client.config.legalEntityManagementEndpoint}/${Client.LEGAL_ENTITY_MANAGEMENT_API_VERSION}${endpoint}`
);
}
}
export default LegalEntityManagementResource;

View File

@@ -1,33 +0,0 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
class Disable extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/disable`,
);
}
}
export default Disable;

View File

@@ -1,33 +0,0 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
class ListRecurringDetails extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/listRecurringDetails`,
);
}
}
export default ListRecurringDetails;

View File

@@ -1,33 +0,0 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
class NotifyShopper extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/notifyShopper`,
);
}
}
export default NotifyShopper;

View File

@@ -1,33 +0,0 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
* Adyen NodeJS API Library
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Client from "../../../client";
import Service from "../../../service";
import Resource from "../../resource";
class ScheduleAccountUpdater extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Recurring/${Client.RECURRING_API_VERSION}/scheduleAccountUpdater`,
);
}
}
export default ScheduleAccountUpdater;

View File

@@ -62,15 +62,19 @@ class TerminalLocalAPI extends ApiKeyAuthenticatedService {
securedPaymentRequest
);
const terminalApiSecuredResponse: TerminalApiSecuredResponse =
ObjectSerializer.deserialize(jsonResponse, "TerminalApiSecuredResponse");
// Catch an empty jsonResponse (i.e. Abort Request)
if(!jsonResponse) {
return new TerminalApiResponse();
} else {
const terminalApiSecuredResponse: TerminalApiSecuredResponse =
ObjectSerializer.deserialize(jsonResponse, "TerminalApiSecuredResponse");
const response = this.nexoCrypto.decrypt(
terminalApiSecuredResponse.SaleToPOIResponse,
securityKey,
);
return ObjectSerializer.deserialize(JSON.parse(response), "TerminalApiResponse");
const response = this.nexoCrypto.decrypt(
terminalApiSecuredResponse.SaleToPOIResponse,
securityKey,
);
return ObjectSerializer.deserialize(JSON.parse(response), "TerminalApiResponse");
}
}
}

47
src/services/transfers.ts Normal file
View File

@@ -0,0 +1,47 @@
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { TransferInfo, Transfer, Transaction, TransactionSearchResponse, ObjectSerializer } from "../typings/transfer/models";
import TransfersResource from "./resource/TransfersResource";
class Transfers extends Service {
private readonly _transfersResource;
private readonly _listTransactionsResource;
public constructor(client: Client) {
super(client);
this._transfersResource = new TransfersResource(this, "/transfers");
this._listTransactionsResource = new TransfersResource(this, "/transactions");
}
public async transfers(request: TransferInfo) : Promise<Transfer> {
const response = await getJsonResponse<TransferInfo, Transfer>(
this._transfersResource,
request,
{method: "POST"}
);
return ObjectSerializer.deserialize(response, "Transfer");
}
public async getTransaction(id: string): Promise<Transaction> {
const resource = new TransfersResource(this, `/transactions/${id}`);
const response = await getJsonResponse<string, Transaction>(
resource,
"",
{ method: "GET"}
);
return ObjectSerializer.deserialize(response, "Transaction");
}
public async listTransactions(): Promise<TransactionSearchResponse> {
const response = await getJsonResponse<string, TransactionSearchResponse>(
this._listTransactionsResource,
"",
{ method: "GET"}
);
return ObjectSerializer.deserialize(response, "TransactionSearchResponse");
}
}
export default Transfers;

View File

@@ -29,7 +29,7 @@ export class AccountHolder {
*/
'id': string;
/**
* The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/legalEntities__resParam_id) associated with the account holder. Adyen performs a verification process against the legal entity of the account holder. For more information on how to create a legal entity, refer to [Onboard and verify account holders](https://docs.adyen.com/issuing/kyc-verification).
* The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/#/legalentity/latest/post/legalEntities__resParam_id) associated with the account holder. Adyen performs a verification process against the legal entity of the account holder.
*/
'legalEntityId': string;
/**
@@ -41,7 +41,7 @@ export class AccountHolder {
*/
'reference'?: string;
/**
* The status of the account holder. Possible values: * **Active**: The account holder is active. This is the default status when creating an account holder. * **Suspended**: The account holder is temporarily suspended. You can set the account back to active or close it permanently. * **Closed**: The account holder is permanently deactivated. This action cannot be undone.
* The status of the account holder. Possible values: * **active**: The account holder is active. This is the default status when creating an account holder. * **inactive**: The account holder is temporarily inactive due to missing KYC details. You can set the account back to active by providing the missing KYC details. * **suspended**: The account holder is permanently deactivated by Adyen. This action cannot be undone. * **closed**: The account holder is permanently deactivated by you. This action cannot be undone.
*/
'status'?: AccountHolder.StatusEnum;
/**

View File

@@ -7,7 +7,6 @@
* Do not edit this class manually.
*/
import { CapabilityProblem } from './capabilityProblem';
import { JSONObject } from './jSONObject';
export class AccountHolderCapability {
@@ -27,7 +26,7 @@ export class AccountHolderCapability {
/**
* Contains verification errors and the actions that you can take to resolve them.
*/
'problems'?: Array<CapabilityProblem>;
'problems'?: Array<any>;
/**
* Indicates whether the capability is requested. To check whether the account holder is permitted to use the capability, refer to the `allowed` field.
*/
@@ -68,7 +67,7 @@ export class AccountHolderCapability {
{
"name": "problems",
"baseName": "problems",
"type": "Array<CapabilityProblem>"
"type": "Array<any>"
},
{
"name": "requested",

View File

@@ -25,7 +25,7 @@ export class AccountHolderInfo {
*/
'description'?: string;
/**
* The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/legalEntities__resParam_id) associated with the account holder. Adyen performs a verification process against the legal entity of the account holder. For more information on how to create a legal entity, refer to [Onboard and verify account holders](https://docs.adyen.com/issuing/kyc-verification).
* The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/#/legalentity/latest/post/legalEntities__resParam_id) associated with the account holder. Adyen performs a verification process against the legal entity of the account holder.
*/
'legalEntityId': string;
/**

View File

@@ -0,0 +1,30 @@
/*
* The version of the OpenAPI document: v2
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
export class BankAccount {
/**
* The [International Bank Account Number](https://en.wikipedia.org/wiki/International_Bank_Account_Number) (IBAN).
*/
'iban': string;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "iban",
"baseName": "iban",
"type": "string"
} ];
static getAttributeTypeMap() {
return BankAccount.attributeTypeMap;
}
}

View File

@@ -1,38 +0,0 @@
/*
* The version of the OpenAPI document: v2
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import { CapabilityProblemEntity } from './capabilityProblemEntity';
import { VerificationError } from './verificationError';
export class CapabilityProblem {
'entity'?: CapabilityProblemEntity;
/**
* Contains information about the verification error.
*/
'verificationErrors'?: Array<VerificationError>;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "entity",
"baseName": "entity",
"type": "CapabilityProblemEntity"
},
{
"name": "verificationErrors",
"baseName": "verificationErrors",
"type": "Array<VerificationError>"
} ];
static getAttributeTypeMap() {
return CapabilityProblem.attributeTypeMap;
}
}

View File

@@ -1,53 +0,0 @@
/*
* The version of the OpenAPI document: v2
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import { CapabilityProblemEntityRecursive } from './capabilityProblemEntityRecursive';
export class CapabilityProblemEntity {
/**
* The ID of the entity.
*/
'id'?: string;
'owner'?: CapabilityProblemEntityRecursive;
/**
* Type of entity. Possible values: **LegalEntity**, **BankAccount**, **Document**.
*/
'type'?: CapabilityProblemEntity.TypeEnum;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "id",
"baseName": "id",
"type": "string"
},
{
"name": "owner",
"baseName": "owner",
"type": "CapabilityProblemEntityRecursive"
},
{
"name": "type",
"baseName": "type",
"type": "CapabilityProblemEntity.TypeEnum"
} ];
static getAttributeTypeMap() {
return CapabilityProblemEntity.attributeTypeMap;
}
}
export namespace CapabilityProblemEntity {
export enum TypeEnum {
BankAccount = <any> 'BankAccount',
Document = <any> 'Document',
LegalEntity = <any> 'LegalEntity'
}
}

View File

@@ -27,7 +27,7 @@ export class Card {
*/
'brandVariant': string;
/**
* The name of the card holder. Maximum length: 26 characters.
* The name of the cardholder. Maximum length: 26 characters.
*/
'cardholderName': string;
'configuration'?: CardConfiguration;

View File

@@ -22,7 +22,7 @@ export class CardInfo {
*/
'brandVariant': string;
/**
* The name of the card holder. Maximum length: 26 characters.
* The name of the cardholder. Maximum length: 26 characters.
*/
'cardholderName': string;
'configuration'?: CardConfiguration;

View File

@@ -0,0 +1,48 @@
/*
* The version of the OpenAPI document: v2
* Contact: developer-experience@adyen.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
export class CronSweepSchedule {
/**
* A [cron expression](https://en.wikipedia.org/wiki/Cron#CRON_expression) that is used to set the sweep schedule. The schedule uses the time zone of the balance account. For example, **30 17 * * MON** schedules a sweep every Monday at 17:30. The expression must have five values separated by a single space in the following order: * Minute: **0-59** * Hour: **0-23** * Day of the month: **1-31** * Month: **1-12** or **JAN-DEC** * Day of the week: **0-7** (0 and 7 are Sunday) or **MON-SUN**. The following non-standard characters are supported: **&ast;**, **L**, **#**, **W** and **_/_**. See [crontab guru](https://crontab.guru/) for more examples.
*/
'cronExpression': string;
/**
* The schedule type. Possible values: * **cron**: push out funds based on a cron expression. * **daily**: push out funds daily at 07:00 AM CET. * **weekly**: push out funds every Monday at 07:00 AM CET. * **monthly**: push out funds every first of the month at 07:00 AM CET. * **balance**: pull in funds instantly if the balance is less than or equal to the `triggerAmount`. You can only use this for sweeps of `type` **pull** and when the source is a `merchantAccount` or `transferInstrument`.
*/
'type'?: CronSweepSchedule.TypeEnum;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "cronExpression",
"baseName": "cronExpression",
"type": "string"
},
{
"name": "type",
"baseName": "type",
"type": "CronSweepSchedule.TypeEnum"
} ];
static getAttributeTypeMap() {
return CronSweepSchedule.attributeTypeMap;
}
}
export namespace CronSweepSchedule {
export enum TypeEnum {
Daily = <any> 'daily',
Weekly = <any> 'weekly',
Monthly = <any> 'monthly',
Balance = <any> 'balance',
Cron = <any> 'cron'
}
}

View File

@@ -12,7 +12,7 @@ import { Name } from './name';
import { PhoneNumber } from './phoneNumber';
export class DeliveryContact {
'address'?: Address2;
'address': Address2;
/**
* The email address of the contact.
*/
@@ -21,7 +21,7 @@ export class DeliveryContact {
* The full phone number of the contact provided as a single string. It will be handled as a landline phone. **Examples:** \"0031 6 11 22 33 44\", \"+316/1122-3344\", \"(0031) 611223344\"
*/
'fullPhoneNumber'?: string;
'name'?: Name;
'name': Name;
'phoneNumber'?: PhoneNumber;
/**
* The URL of the contact\'s website.

View File

@@ -14,7 +14,7 @@ export class EntryModesRestriction {
*/
'operation': string;
/**
* List of point-of-sale entry modes. Possible values: **manual**, **chip**, **magstripe**, **contactless**, **cof**, **token**, **server**, **barcode**, **ocr**.
* List of point-of-sale entry modes. Possible values: **barcode**, **chip**, **cof**, **contactless**, **magstripe**, **manual**, **ocr**, **server**.
*/
'value'?: Array<EntryModesRestriction.ValueEnum>;
@@ -47,7 +47,6 @@ export namespace EntryModesRestriction {
Manual = <any> 'manual',
Ocr = <any> 'ocr',
Server = <any> 'server',
Token = <any> 'token',
Unknown = <any> 'unknown'
}
}

View File

@@ -22,16 +22,15 @@ export * from './balanceAccountInfo';
export * from './balanceAccountUpdateRequest';
export * from './balancePlatform';
export * from './balanceSweepConfigurationsResponse';
export * from './bankAccount';
export * from './brandVariantsRestriction';
export * from './bulkAddress';
export * from './capabilityProblem';
export * from './capabilityProblemEntity';
export * from './capabilityProblemEntityRecursive';
export * from './card';
export * from './cardConfiguration';
export * from './cardInfo';
export * from './contactDetails';
export * from './countriesRestriction';
export * from './cronSweepSchedule';
export * from './deliveryContact';
export * from './differentCurrenciesRestriction';
export * from './duration';
@@ -90,16 +89,15 @@ import { BalanceAccountInfo } from './balanceAccountInfo';
import { BalanceAccountUpdateRequest } from './balanceAccountUpdateRequest';
import { BalancePlatform } from './balancePlatform';
import { BalanceSweepConfigurationsResponse } from './balanceSweepConfigurationsResponse';
import { BankAccount } from './bankAccount';
import { BrandVariantsRestriction } from './brandVariantsRestriction';
import { BulkAddress } from './bulkAddress';
import { CapabilityProblem } from './capabilityProblem';
import { CapabilityProblemEntity } from './capabilityProblemEntity';
import { CapabilityProblemEntityRecursive } from './capabilityProblemEntityRecursive';
import { Card } from './card';
import { CardConfiguration } from './cardConfiguration';
import { CardInfo } from './cardInfo';
import { ContactDetails } from './contactDetails';
import { CountriesRestriction } from './countriesRestriction';
import { CronSweepSchedule } from './cronSweepSchedule';
import { DeliveryContact } from './deliveryContact';
import { DifferentCurrenciesRestriction } from './differentCurrenciesRestriction';
import { Duration } from './duration';
@@ -162,10 +160,9 @@ let enumsMap: {[index: string]: any} = {
"AccountHolderCapability.VerificationStatusEnum": AccountHolderCapability.VerificationStatusEnum,
"BalanceAccount.StatusEnum": BalanceAccount.StatusEnum,
"BalanceAccountUpdateRequest.StatusEnum": BalanceAccountUpdateRequest.StatusEnum,
"CapabilityProblemEntity.TypeEnum": CapabilityProblemEntity.TypeEnum,
"CapabilityProblemEntityRecursive.TypeEnum": CapabilityProblemEntityRecursive.TypeEnum,
"Card.FormFactorEnum": Card.FormFactorEnum,
"CardInfo.FormFactorEnum": CardInfo.FormFactorEnum,
"CronSweepSchedule.TypeEnum": CronSweepSchedule.TypeEnum,
"Duration.UnitEnum": Duration.UnitEnum,
"EntryModesRestriction.ValueEnum": EntryModesRestriction.ValueEnum,
"PaymentInstrument.StatusEnum": PaymentInstrument.StatusEnum,
@@ -209,16 +206,15 @@ let typeMap: {[index: string]: any} = {
"BalanceAccountUpdateRequest": BalanceAccountUpdateRequest,
"BalancePlatform": BalancePlatform,
"BalanceSweepConfigurationsResponse": BalanceSweepConfigurationsResponse,
"BankAccount": BankAccount,
"BrandVariantsRestriction": BrandVariantsRestriction,
"BulkAddress": BulkAddress,
"CapabilityProblem": CapabilityProblem,
"CapabilityProblemEntity": CapabilityProblemEntity,
"CapabilityProblemEntityRecursive": CapabilityProblemEntityRecursive,
"Card": Card,
"CardConfiguration": CardConfiguration,
"CardInfo": CardInfo,
"ContactDetails": ContactDetails,
"CountriesRestriction": CountriesRestriction,
"CronSweepSchedule": CronSweepSchedule,
"DeliveryContact": DeliveryContact,
"DifferentCurrenciesRestriction": DifferentCurrenciesRestriction,
"Duration": Duration,

View File

@@ -7,6 +7,7 @@
* Do not edit this class manually.
*/
import { BankAccount } from './bankAccount';
import { Card } from './card';
export class PaymentInstrument {
@@ -14,6 +15,7 @@ export class PaymentInstrument {
* The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/v1/post/balanceAccounts__resParam_id) associated with the payment instrument.
*/
'balanceAccountId': string;
'bankAccount'?: BankAccount;
'card'?: Card;
/**
* Your description for the payment instrument, maximum 300 characters.
@@ -36,7 +38,7 @@ export class PaymentInstrument {
*/
'reference'?: string;
/**
* The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **active** by default. However, there can be exceptions based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **inactive**. Possible values: * **active**: The payment instrument is active and can be used to make payments. * **inactive**: The payment instrument is inactive and cannot be used to make payments. * **suspended**: The payment instrument is suspended, either because it was stolen or lost. * **closed**: The payment instrument is permanently closed. This action cannot be undone.
* The status of the payment instrument. If a status is not specified when creating a payment instrument, it is set to **active** by default. However, there can be exceptions for cards based on the `card.formFactor` and the `issuingCountryCode`. For example, when issuing physical cards in the US, the default status is **inactive**. Possible values: * **active**: The payment instrument is active and can be used to make payments. * **inactive**: The payment instrument is inactive and cannot be used to make payments. * **suspended**: The payment instrument is suspended, either because it was stolen or lost. * **closed**: The payment instrument is permanently closed. This action cannot be undone.
*/
'status'?: PaymentInstrument.StatusEnum;
/**
@@ -44,7 +46,7 @@ export class PaymentInstrument {
*/
'statusReason'?: PaymentInstrument.StatusReasonEnum;
/**
* Type of payment instrument. Possible value: **card**.
* Type of payment instrument. Possible value: **card**, **bankAccount**.
*/
'type': PaymentInstrument.TypeEnum;
@@ -56,6 +58,11 @@ export class PaymentInstrument {
"baseName": "balanceAccountId",
"type": "string"
},
{
"name": "bankAccount",
"baseName": "bankAccount",
"type": "BankAccount"
},
{
"name": "card",
"baseName": "card",
@@ -125,6 +132,7 @@ export namespace PaymentInstrument {
SuspectedFraud = <any> 'suspectedFraud'
}
export enum TypeEnum {
BankAccount = <any> 'bankAccount',
Card = <any> 'card'
}
}

Some files were not shown because too many files have changed in this diff Show More