mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
Release 12.2.0 (#1083)
* 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> * Add renovate.json (#1042) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @types/jest to v27.5.2 (#1043) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * 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> * Update dependency eslint to v8.27.0 (#1047) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @typescript-eslint/parser to v5.43.0 (#1046) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Changed name of Value to BarcodeValue corresponding to docs(and API) (#1051) * Update actions/setup-node action to v3 (#1053) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * 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> * 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> * add dataProtection service to library (#1063) * add dataProtection service to library * add missing import * fix mock class for unit test * fix: add balancePlatform to services index (#1068) * Delete dependabot.yml (#1059) * Update dependency eslint to v8.28.0 (#1057) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency typescript to v4.9.3 (#1050) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency ts-loader to v9 (#1055) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * update .npmignore (#1072) * 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> * Add banner to README (#1074) * Update dependency typescript to v4.9.4 (#1073) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * add basic auth option to the client (#1076) * 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) * PW-7502: Bind QueryString type to URLSearchParams (#1077) * chore(deps): update dependency @types/node to v14.18.36 (#1044) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency nock to v13.3.0 (#1081) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * update unit tests to test uniform error handling over APIs (#1079) Co-authored-by: jillingk <93914435+jillingk@users.noreply.github.com> * Remove LGTM badges from README (#1080) * 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> * [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> * Update package.json (#1084) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Eoin Falconer <eoin.falconer@hotmail.com> Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com> Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com> Co-authored-by: Michael Paul <michael@michaelpaul.com.br>
This commit is contained in:
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
@@ -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"
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -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.
|
||||
|
||||
4
.github/workflows/coveralls.yml
vendored
4
.github/workflows/coveralls.yml
vendored
@@ -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
|
||||
|
||||
|
||||
4
.github/workflows/nodejs.yml
vendored
4
.github/workflows/nodejs.yml
vendored
@@ -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
|
||||
|
||||
4
.github/workflows/npmpublish.yml
vendored
4
.github/workflows/npmpublish.yml
vendored
@@ -9,8 +9,8 @@ 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: 14
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
2
.github/workflows/sonarcloud.yml
vendored
2
.github/workflows/sonarcloud.yml
vendored
@@ -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
|
||||
|
||||
13
.npmignore
13
.npmignore
@@ -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__/
|
||||
|
||||
42
Makefile
42
Makefile
@@ -1,18 +1,24 @@
|
||||
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 legalEntityManagement balancePlatform platformsAccount platformsFund platformsNotificationConfiguration platformsHostedOnboardingPage transfer
|
||||
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
|
||||
@@ -21,28 +27,48 @@ 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)
|
||||
|
||||
136
README.md
136
README.md
@@ -1,3 +1,6 @@
|
||||
|
||||

|
||||
|
||||
# Adyen Node.js API Library
|
||||

|
||||
[](https://coveralls.io/github/Adyen/adyen-node-api-library?branch=main)
|
||||
@@ -5,39 +8,38 @@
|
||||

|
||||
[](https://www.npmjs.com/package/@adyen/api-library)
|
||||
[](https://sonarcloud.io/dashboard?id=Adyen_adyen-node-api-library)
|
||||
[](https://lgtm.com/projects/g/Adyen/adyen-node-api-library/alerts/)
|
||||
[](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/v52/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**
|
||||
* [Legal Entity Management API](https://docs.adyen.com/api-explorer/#/legalentity/v2/overview): Manage legal entities that contain information required for verification. Current supported version: **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/v68/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**
|
||||
* [Platforms Notifications Webhooks](https://docs.adyen.com/api-explorer/#/NotificationService/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**
|
||||
* [Transfers API](https://docs.adyen.com/api-explorer/transfers/3/overview) The Transfers API provides endpoints that you can use to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. **v3**
|
||||
|
||||
|
||||
| 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
|
||||
|
||||
@@ -56,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`:
|
||||
|
||||
18
package.json
18
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@adyen/api-library",
|
||||
"version": "12.1.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.41.0",
|
||||
"@typescript-eslint/parser": "5.41.0",
|
||||
"@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.26.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",
|
||||
"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.8.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
6
renovate.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
@@ -50,7 +50,8 @@ export const createClient = (apiKey = process.env.ADYEN_API_KEY): Client => {
|
||||
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_VERSION_TEST;
|
||||
config.transfersEndpoint = Client.TRANSFERS_API_ENDPOINT_TEST;
|
||||
config.dataProtectionEndpoint = Client.DATA_PROTECTION_API_ENDPOINT_TEST;
|
||||
|
||||
return new Client({ config });
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
11
src/__tests__/client.spec.ts
Normal file
11
src/__tests__/client.spec.ts
Normal 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"
|
||||
});
|
||||
});
|
||||
});
|
||||
59
src/__tests__/dataProtection.spec.ts
Normal file
59
src/__tests__/dataProtection.spec.ts
Normal 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();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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`)
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createClient } from "../__mocks__/base";
|
||||
import { transfersSuccess, getTransactionSuccess, listTransactionsSuccess } from "../__mocks__/transfers/responses";
|
||||
import Client from "../client";
|
||||
import { Transfers } from "../services";
|
||||
import { TransferInfo, Transfer, Transaction, TransactionSearchResponse, IbanAccountIdentification} from "../typings/transfer/models";
|
||||
import { transfer} from "../typings";
|
||||
|
||||
let client: Client;
|
||||
let transferService: Transfers;
|
||||
@@ -26,9 +26,9 @@ describe("Transfers", (): void => {
|
||||
test("should transfer fund", async (): Promise<void> => {
|
||||
scope.post("/transfers")
|
||||
.reply(200, transfersSuccess);
|
||||
const request = new TransferInfo();
|
||||
const request = new transfer.TransferInfo();
|
||||
request.amount = { currency: "EUR", value: 1000};
|
||||
request.category = TransferInfo.CategoryEnum.Bank;
|
||||
request.category = transfer.TransferInfo.CategoryEnum.Bank;
|
||||
request.counterparty = {
|
||||
balanceAccountId: "123",
|
||||
transferInstrumentId: "transfer_id",
|
||||
@@ -38,26 +38,26 @@ describe("Transfers", (): void => {
|
||||
},
|
||||
accountIdentification: {
|
||||
iban: "NLRABO12321",
|
||||
type: IbanAccountIdentification.TypeEnum.Iban
|
||||
type: transfer.IbanAccountIdentification.TypeEnum.Iban
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
const response: Transfer = await transferService.transfers(request);
|
||||
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: Transaction = await transferService.getTransaction("123");
|
||||
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: TransactionSearchResponse = await transferService.listTransactions();
|
||||
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");
|
||||
|
||||
@@ -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 }
|
||||
@@ -68,9 +72,12 @@ class Client {
|
||||
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_VERSION_TEST = "https://balanceplatform-api-test.adyen.com/btl";
|
||||
public static TRANSFERS_API_VERSION_LIVE = "https://balanceplatform-api-live.adyen.com/btl";
|
||||
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;
|
||||
@@ -87,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) {
|
||||
@@ -116,7 +125,8 @@ class Client {
|
||||
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_VERSION_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;
|
||||
@@ -128,7 +138,8 @@ class Client {
|
||||
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_VERSION_LIVE;
|
||||
this.config.transfersEndpoint = Client.TRANSFERS_API_ENDPOINT_LIVE;
|
||||
this.config.dataProtectionEndpoint = Client.DATA_PROTECTION_API_ENDPOINT_LIVE;
|
||||
|
||||
if (liveEndpointUrlPrefix) {
|
||||
this.config.endpoint =
|
||||
@@ -164,4 +175,4 @@ class Client {
|
||||
}
|
||||
}
|
||||
|
||||
export default Client;
|
||||
export default Client;
|
||||
|
||||
@@ -41,6 +41,7 @@ interface ConfigConstructor {
|
||||
balancePlatformEndpoint?: string;
|
||||
legalEntityManagementEndpoint?: string;
|
||||
transfersEndpoint?: string;
|
||||
dataProtectionEndpoint?: string;
|
||||
}
|
||||
|
||||
class Config {
|
||||
@@ -72,6 +73,7 @@ class Config {
|
||||
public balancePlatformEndpoint?: string;
|
||||
public legalEntityManagementEndpoint?: string;
|
||||
public transfersEndpoint?: string;
|
||||
public dataProtectionEndpoint?: string;
|
||||
|
||||
public constructor(options: ConfigConstructor = {}) {
|
||||
if (options.username) this.username = options.username;
|
||||
@@ -98,6 +100,7 @@ class Config {
|
||||
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) {
|
||||
|
||||
25
src/services/dataProtection.ts
Normal file
25
src/services/dataProtection.ts
Normal 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;
|
||||
@@ -11,3 +11,5 @@ export { default as TerminalManagement} from "./terminalManagement";
|
||||
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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
95
src/services/management/aPICredentialsCompanyLevelApi.ts
Normal file
95
src/services/management/aPICredentialsCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
95
src/services/management/aPICredentialsMerchantLevelApi.ts
Normal file
95
src/services/management/aPICredentialsMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
38
src/services/management/aPIKeyCompanyLevelApi.ts
Normal file
38
src/services/management/aPIKeyCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
38
src/services/management/aPIKeyMerchantLevelApi.ts
Normal file
38
src/services/management/aPIKeyMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
70
src/services/management/accountCompanyLevelApi.ts
Normal file
70
src/services/management/accountCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
85
src/services/management/accountMerchantLevelApi.ts
Normal file
85
src/services/management/accountMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
160
src/services/management/accountStoreLevelApi.ts
Normal file
160
src/services/management/accountStoreLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
95
src/services/management/allowedOriginsCompanyLevelApi.ts
Normal file
95
src/services/management/allowedOriginsCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
95
src/services/management/allowedOriginsMerchantLevelApi.ts
Normal file
95
src/services/management/allowedOriginsMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
38
src/services/management/clientKeyCompanyLevelApi.ts
Normal file
38
src/services/management/clientKeyCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
38
src/services/management/clientKeyMerchantLevelApi.ts
Normal file
38
src/services/management/clientKeyMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
94
src/services/management/myAPICredentialApi.ts
Normal file
94
src/services/management/myAPICredentialApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
132
src/services/management/paymentMethodsMerchantLevelApi.ts
Normal file
132
src/services/management/paymentMethodsMerchantLevelApi.ts
Normal 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" }
|
||||
);
|
||||
}
|
||||
}
|
||||
108
src/services/management/payoutSettingsMerchantLevelApi.ts
Normal file
108
src/services/management/payoutSettingsMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
94
src/services/management/terminalActionsCompanyLevelApi.ts
Normal file
94
src/services/management/terminalActionsCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
37
src/services/management/terminalActionsTerminalLevelApi.ts
Normal file
37
src/services/management/terminalActionsTerminalLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
202
src/services/management/terminalOrdersCompanyLevelApi.ts
Normal file
202
src/services/management/terminalOrdersCompanyLevelApi.ts
Normal 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 `/terminalModels`](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");
|
||||
}
|
||||
}
|
||||
202
src/services/management/terminalOrdersMerchantLevelApi.ts
Normal file
202
src/services/management/terminalOrdersMerchantLevelApi.ts
Normal 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 `/terminalModels`](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");
|
||||
}
|
||||
}
|
||||
88
src/services/management/terminalSettingsCompanyLevelApi.ts
Normal file
88
src/services/management/terminalSettingsCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
88
src/services/management/terminalSettingsMerchantLevelApi.ts
Normal file
88
src/services/management/terminalSettingsMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
162
src/services/management/terminalSettingsStoreLevelApi.ts
Normal file
162
src/services/management/terminalSettingsStoreLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
86
src/services/management/terminalSettingsTerminalLevelApi.ts
Normal file
86
src/services/management/terminalSettingsTerminalLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
41
src/services/management/terminalsTerminalLevelApi.ts
Normal file
41
src/services/management/terminalsTerminalLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
95
src/services/management/usersCompanyLevelApi.ts
Normal file
95
src/services/management/usersCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
95
src/services/management/usersMerchantLevelApi.ts
Normal file
95
src/services/management/usersMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
149
src/services/management/webhooksCompanyLevelApi.ts
Normal file
149
src/services/management/webhooksCompanyLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
149
src/services/management/webhooksMerchantLevelApi.ts
Normal file
149
src/services/management/webhooksMerchantLevelApi.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
14
src/services/resource/RecurringResource.ts
Normal file
14
src/services/resource/RecurringResource.ts
Normal 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;
|
||||
14
src/services/resource/dataProtectionresource.ts
Normal file
14
src/services/resource/dataProtectionresource.ts
Normal 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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
154
src/typings/dataProtection/models.ts
Normal file
154
src/typings/dataProtection/models.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export * from './serviceError';
|
||||
export * from './subjectErasureByPspReferenceRequest';
|
||||
export * from './subjectErasureResponse';
|
||||
|
||||
|
||||
import { ServiceError } from './serviceError';
|
||||
import { SubjectErasureByPspReferenceRequest } from './subjectErasureByPspReferenceRequest';
|
||||
import { SubjectErasureResponse } from './subjectErasureResponse';
|
||||
|
||||
/* tslint:disable:no-unused-variable */
|
||||
let primitives = [
|
||||
"string",
|
||||
"boolean",
|
||||
"double",
|
||||
"integer",
|
||||
"long",
|
||||
"float",
|
||||
"number",
|
||||
"any"
|
||||
];
|
||||
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
"SubjectErasureResponse.ResultEnum": SubjectErasureResponse.ResultEnum,
|
||||
}
|
||||
|
||||
let typeMap: {[index: string]: any} = {
|
||||
"ServiceError": ServiceError,
|
||||
"SubjectErasureByPspReferenceRequest": SubjectErasureByPspReferenceRequest,
|
||||
"SubjectErasureResponse": SubjectErasureResponse,
|
||||
}
|
||||
|
||||
export class ObjectSerializer {
|
||||
public static findCorrectType(data: any, expectedType: string) {
|
||||
if (data == undefined) {
|
||||
return expectedType;
|
||||
} else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
||||
return expectedType;
|
||||
} else if (expectedType === "Date") {
|
||||
return expectedType;
|
||||
} else {
|
||||
if (enumsMap[expectedType]) {
|
||||
return expectedType;
|
||||
}
|
||||
|
||||
if (!typeMap[expectedType]) {
|
||||
return expectedType; // w/e we don't know the type
|
||||
}
|
||||
|
||||
// Check the discriminator
|
||||
let discriminatorProperty = typeMap[expectedType].discriminator;
|
||||
if (discriminatorProperty == null) {
|
||||
return expectedType; // the type does not have a discriminator. use it.
|
||||
} else {
|
||||
if (data[discriminatorProperty]) {
|
||||
var discriminatorType = data[discriminatorProperty];
|
||||
if(typeMap[discriminatorType]){
|
||||
return discriminatorType; // use the type given in the discriminator
|
||||
} else {
|
||||
return expectedType; // discriminator did not map to a type
|
||||
}
|
||||
} else {
|
||||
return expectedType; // discriminator was not present (or an empty string)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static serialize(data: any, type: string) {
|
||||
if (data == undefined) {
|
||||
return data;
|
||||
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
||||
return data;
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData: any[] = [];
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
let datum = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(datum, subType));
|
||||
}
|
||||
return transformedData;
|
||||
} else if (type === "Date") {
|
||||
return data.toISOString();
|
||||
} else if (type === "SaleToAcquirerData") {
|
||||
const dataString = JSON.stringify(data);
|
||||
return Buffer.from(dataString).toString("base64");
|
||||
} else {
|
||||
if (enumsMap[type]) {
|
||||
return data;
|
||||
}
|
||||
if (!typeMap[type]) { // in case we dont know the type
|
||||
return data;
|
||||
}
|
||||
|
||||
// Get the actual type of this object
|
||||
type = this.findCorrectType(data, type);
|
||||
|
||||
// get the map for the correct type.
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
let instance: {[index: string]: any} = {};
|
||||
for (let index = 0; index < attributeTypes.length; index++) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static deserialize(data: any, type: string) {
|
||||
// polymorphism may change the actual type.
|
||||
type = ObjectSerializer.findCorrectType(data, type);
|
||||
if (data == undefined) {
|
||||
return data;
|
||||
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
||||
return data;
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData: any[] = [];
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
let datum = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(datum, subType));
|
||||
}
|
||||
return transformedData;
|
||||
} else if (type === "Date") {
|
||||
return new Date(data);
|
||||
} else {
|
||||
if (enumsMap[type]) {// is Enum
|
||||
return data;
|
||||
}
|
||||
|
||||
if (!typeMap[type]) { // dont know the type
|
||||
return data;
|
||||
}
|
||||
let instance = new typeMap[type]();
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
for (let index = 0; index < attributeTypes.length; index++) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
66
src/typings/dataProtection/serviceError.ts
Normal file
66
src/typings/dataProtection/serviceError.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class ServiceError {
|
||||
/**
|
||||
* The error code mapped to the error message.
|
||||
*/
|
||||
'errorCode'?: string;
|
||||
/**
|
||||
* The category of the error.
|
||||
*/
|
||||
'errorType'?: string;
|
||||
/**
|
||||
* A short explanation of the issue.
|
||||
*/
|
||||
'message'?: string;
|
||||
/**
|
||||
* The PSP reference of the payment.
|
||||
*/
|
||||
'pspReference'?: string;
|
||||
/**
|
||||
* The HTTP response status.
|
||||
*/
|
||||
'status'?: number;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "errorCode",
|
||||
"baseName": "errorCode",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "errorType",
|
||||
"baseName": "errorType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"baseName": "message",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "pspReference",
|
||||
"baseName": "pspReference",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "number"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ServiceError.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class SubjectErasureByPspReferenceRequest {
|
||||
/**
|
||||
* Set this to **true** if you want to delete shopper-related data, even if the shopper has an existing recurring transaction. This only deletes the shopper-related data for the specific payment, but does not cancel the existing recurring transaction.
|
||||
*/
|
||||
'forceErasure'?: boolean;
|
||||
/**
|
||||
* Your merchant account
|
||||
*/
|
||||
'merchantAccount'?: string;
|
||||
/**
|
||||
* The PSP reference of the payment. We will delete all shopper-related data for this payment.
|
||||
*/
|
||||
'pspReference'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "forceErasure",
|
||||
"baseName": "forceErasure",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "merchantAccount",
|
||||
"baseName": "merchantAccount",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "pspReference",
|
||||
"baseName": "pspReference",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return SubjectErasureByPspReferenceRequest.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
38
src/typings/dataProtection/subjectErasureResponse.ts
Normal file
38
src/typings/dataProtection/subjectErasureResponse.ts
Normal 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.
|
||||
*/
|
||||
|
||||
|
||||
export class SubjectErasureResponse {
|
||||
/**
|
||||
* The result of this operation.
|
||||
*/
|
||||
'result'?: SubjectErasureResponse.ResultEnum;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "result",
|
||||
"baseName": "result",
|
||||
"type": "SubjectErasureResponse.ResultEnum"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return SubjectErasureResponse.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace SubjectErasureResponse {
|
||||
export enum ResultEnum {
|
||||
ActiveRecurringTokenExists = <any> 'ACTIVE_RECURRING_TOKEN_EXISTS',
|
||||
AlreadyProcessed = <any> 'ALREADY_PROCESSED',
|
||||
PaymentNotFound = <any> 'PAYMENT_NOT_FOUND',
|
||||
Success = <any> 'SUCCESS'
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,11 @@
|
||||
/// <reference path="platformsFund.ts" />
|
||||
/// <reference path="platformsNotificationConfiguration.ts" />
|
||||
|
||||
export * as balancePlatform from './balancePlatform/models';
|
||||
export * as binlookup from './binlookup/models';
|
||||
export * as checkout from './checkout/models';
|
||||
export * as notification from './notification/models';
|
||||
export * as payments from './payments/models';
|
||||
export * as payouts from './payouts/models';
|
||||
export * as platformsNotifications from './platformsNotifications/models';
|
||||
export * as platformsAccount from './platformsAccount/models';
|
||||
@@ -24,3 +26,4 @@ export * as terminalManagement from './terminalManagement/models';
|
||||
export * as management from './management/models';
|
||||
export * as legalEntityManagement from './legalEntityManagement/models';
|
||||
export * as transfer from './transfer/models';
|
||||
export * as dataProtection from './dataProtection/models';
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
export class ApplePayInfo {
|
||||
/**
|
||||
* The list of merchant domains. For more information, see [Apple Pay documentation](https://docs.adyen.com/payment-methods/apple-pay/enable-apple-pay#register-merchant-domain).
|
||||
* The list of merchant domains. Maximum: 99 domains per request. For more information, see [Apple Pay documentation](https://docs.adyen.com/payment-methods/apple-pay/web-drop-in?tab=adyen-certificate-live_1#going-live).
|
||||
*/
|
||||
'domains': Array<string>;
|
||||
'domains'?: Array<string>;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export class CompanyUser {
|
||||
/**
|
||||
* The username for this user.
|
||||
*/
|
||||
'username': string;
|
||||
'username'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export class Configuration {
|
||||
/**
|
||||
* Funding source. Possible values: * **Credit** * **Debit**
|
||||
*/
|
||||
'sources'?: Configuration.SourcesEnum;
|
||||
'sources'?: Array<string>;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
@@ -39,7 +39,7 @@ export class Configuration {
|
||||
{
|
||||
"name": "sources",
|
||||
"baseName": "sources",
|
||||
"type": "Configuration.SourcesEnum"
|
||||
"type": "Array<string>"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
@@ -47,7 +47,3 @@ export class Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Configuration {
|
||||
export enum SourcesEnum {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ export class CreateCompanyUserRequest {
|
||||
/**
|
||||
* The email address of the user.
|
||||
*/
|
||||
'email': string;
|
||||
'name': Name;
|
||||
'email'?: string;
|
||||
'name'?: Name;
|
||||
/**
|
||||
* The list of [roles](https://docs.adyen.com/account/user-roles) for this user.
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ export class CreateCompanyUserRequest {
|
||||
/**
|
||||
* The username for this user. Allowed length: 255 alphanumeric characters.
|
||||
*/
|
||||
'username': string;
|
||||
'username'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export class CreateCompanyUserResponse {
|
||||
/**
|
||||
* The username for this user.
|
||||
*/
|
||||
'username': string;
|
||||
'username'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ export class CreateMerchantRequest {
|
||||
* Your reference for the merchant account. To make this reference the unique identifier of the merchant account, your Adyen contact can set up a template on your company account. The template can have 6 to 255 characters with upper- and lower-case letters, underscores, and numbers. When your company account has a template, then the `reference` is required and must be unique within the company account.
|
||||
*/
|
||||
'reference'?: string;
|
||||
/**
|
||||
* List of sales channels that the merchant will process payments with
|
||||
*/
|
||||
'salesChannels'?: Array<string>;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
@@ -66,6 +70,11 @@ export class CreateMerchantRequest {
|
||||
"name": "reference",
|
||||
"baseName": "reference",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "salesChannels",
|
||||
"baseName": "salesChannels",
|
||||
"type": "Array<string>"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
|
||||
@@ -17,8 +17,8 @@ export class CreateMerchantUserRequest {
|
||||
/**
|
||||
* The email address of the user.
|
||||
*/
|
||||
'email': string;
|
||||
'name': Name;
|
||||
'email'?: string;
|
||||
'name'?: Name;
|
||||
/**
|
||||
* The list of [roles](https://docs.adyen.com/account/user-roles) for this user.
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ export class CreateMerchantUserRequest {
|
||||
/**
|
||||
* The username for this user. Allowed length: 255 alphanumeric characters.
|
||||
*/
|
||||
'username': string;
|
||||
'username'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ export class CreateUserResponse {
|
||||
/**
|
||||
* The username for this user.
|
||||
*/
|
||||
'username': string;
|
||||
'username'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
30
src/typings/management/googlePayInfo.ts
Normal file
30
src/typings/management/googlePayInfo.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class GooglePayInfo {
|
||||
/**
|
||||
* Google Pay [Merchant ID](https://support.google.com/paymentscenter/answer/7163092?hl=en). Character length and limitations: 16 alphanumeric characters or 20 numeric characters.
|
||||
*/
|
||||
'merchantId'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "merchantId",
|
||||
"baseName": "merchantId",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return GooglePayInfo.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
48
src/typings/management/key.ts
Normal file
48
src/typings/management/key.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class Key {
|
||||
/**
|
||||
* Identifier
|
||||
*/
|
||||
'identifier'?: string;
|
||||
/**
|
||||
* Passphrase
|
||||
*/
|
||||
'passphrase'?: string;
|
||||
/**
|
||||
* Version number
|
||||
*/
|
||||
'version'?: number;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "identifier",
|
||||
"baseName": "identifier",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "passphrase",
|
||||
"baseName": "passphrase",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"baseName": "version",
|
||||
"type": "number"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Key.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class KlarnaInfo {
|
||||
/**
|
||||
* The region of operation. For example, **NA**, **EU**, **CH**, **AU**.
|
||||
*/
|
||||
'region': KlarnaInfo.RegionEnum;
|
||||
'region'?: KlarnaInfo.RegionEnum;
|
||||
/**
|
||||
* The email address of merchant support.
|
||||
*/
|
||||
|
||||
52
src/typings/management/mealVoucherFRInfo.ts
Normal file
52
src/typings/management/mealVoucherFRInfo.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class MealVoucherFRInfo {
|
||||
/**
|
||||
* Meal Voucher conecsId. Format: digits only
|
||||
*/
|
||||
'conecsId': string;
|
||||
/**
|
||||
* Meal Voucher siret. Format: 14 digits.
|
||||
*/
|
||||
'siret': string;
|
||||
/**
|
||||
* The list of additional payment methods
|
||||
*/
|
||||
'subTypes'?: MealVoucherFRInfo.SubTypesEnum;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "conecsId",
|
||||
"baseName": "conecsId",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "siret",
|
||||
"baseName": "siret",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "subTypes",
|
||||
"baseName": "subTypes",
|
||||
"type": "MealVoucherFRInfo.SubTypesEnum"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return MealVoucherFRInfo.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace MealVoucherFRInfo {
|
||||
export enum SubTypesEnum {
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ export * from './generateApiKeyResponse';
|
||||
export * from './generateClientKeyResponse';
|
||||
export * from './generateHmacKeyResponse';
|
||||
export * from './giroPayInfo';
|
||||
export * from './googlePayInfo';
|
||||
export * from './gratuity';
|
||||
export * from './hardware';
|
||||
export * from './idName';
|
||||
@@ -65,6 +66,7 @@ export * from './installAndroidCertificateDetails';
|
||||
export * from './invalidField';
|
||||
export * from './jSONObject';
|
||||
export * from './jSONPath';
|
||||
export * from './key';
|
||||
export * from './klarnaInfo';
|
||||
export * from './links';
|
||||
export * from './linksElement';
|
||||
@@ -80,6 +82,7 @@ export * from './listTerminalsResponse';
|
||||
export * from './listWebhooksResponse';
|
||||
export * from './logo';
|
||||
export * from './meApiCredential';
|
||||
export * from './mealVoucherFRInfo';
|
||||
export * from './merchant';
|
||||
export * from './merchantLinks';
|
||||
export * from './minorUnitsMonetaryValue';
|
||||
@@ -87,10 +90,12 @@ export * from './modelFile';
|
||||
export * from './name';
|
||||
export * from './name2';
|
||||
export * from './nexo';
|
||||
export * from './notificationUrl';
|
||||
export * from './offlineProcessing';
|
||||
export * from './opi';
|
||||
export * from './orderItem';
|
||||
export * from './paginationLinks';
|
||||
export * from './passcodes';
|
||||
export * from './payPalInfo';
|
||||
export * from './paymentMethod';
|
||||
export * from './paymentMethodResponse';
|
||||
@@ -112,6 +117,7 @@ export * from './shippingLocationsResponse';
|
||||
export * from './shopperStatement';
|
||||
export * from './signature';
|
||||
export * from './sofortInfo';
|
||||
export * from './standalone';
|
||||
export * from './store';
|
||||
export * from './storeCreationRequest';
|
||||
export * from './storeCreationWithMerchantCodeRequest';
|
||||
@@ -200,6 +206,7 @@ import { GenerateApiKeyResponse } from './generateApiKeyResponse';
|
||||
import { GenerateClientKeyResponse } from './generateClientKeyResponse';
|
||||
import { GenerateHmacKeyResponse } from './generateHmacKeyResponse';
|
||||
import { GiroPayInfo } from './giroPayInfo';
|
||||
import { GooglePayInfo } from './googlePayInfo';
|
||||
import { Gratuity } from './gratuity';
|
||||
import { Hardware } from './hardware';
|
||||
import { IdName } from './idName';
|
||||
@@ -208,6 +215,7 @@ import { InstallAndroidCertificateDetails } from './installAndroidCertificateDet
|
||||
import { InvalidField } from './invalidField';
|
||||
import { JSONObject } from './jSONObject';
|
||||
import { JSONPath } from './jSONPath';
|
||||
import { Key } from './key';
|
||||
import { KlarnaInfo } from './klarnaInfo';
|
||||
import { Links } from './links';
|
||||
import { LinksElement } from './linksElement';
|
||||
@@ -223,6 +231,7 @@ import { ListTerminalsResponse } from './listTerminalsResponse';
|
||||
import { ListWebhooksResponse } from './listWebhooksResponse';
|
||||
import { Logo } from './logo';
|
||||
import { MeApiCredential } from './meApiCredential';
|
||||
import { MealVoucherFRInfo } from './mealVoucherFRInfo';
|
||||
import { Merchant } from './merchant';
|
||||
import { MerchantLinks } from './merchantLinks';
|
||||
import { MinorUnitsMonetaryValue } from './minorUnitsMonetaryValue';
|
||||
@@ -230,10 +239,12 @@ import { ModelFile } from './modelFile';
|
||||
import { Name } from './name';
|
||||
import { Name2 } from './name2';
|
||||
import { Nexo } from './nexo';
|
||||
import { NotificationUrl } from './notificationUrl';
|
||||
import { OfflineProcessing } from './offlineProcessing';
|
||||
import { Opi } from './opi';
|
||||
import { OrderItem } from './orderItem';
|
||||
import { PaginationLinks } from './paginationLinks';
|
||||
import { Passcodes } from './passcodes';
|
||||
import { PayPalInfo } from './payPalInfo';
|
||||
import { PaymentMethod } from './paymentMethod';
|
||||
import { PaymentMethodResponse } from './paymentMethodResponse';
|
||||
@@ -255,6 +266,7 @@ import { ShippingLocationsResponse } from './shippingLocationsResponse';
|
||||
import { ShopperStatement } from './shopperStatement';
|
||||
import { Signature } from './signature';
|
||||
import { SofortInfo } from './sofortInfo';
|
||||
import { Standalone } from './standalone';
|
||||
import { Store } from './store';
|
||||
import { StoreCreationRequest } from './storeCreationRequest';
|
||||
import { StoreCreationWithMerchantCodeRequest } from './storeCreationWithMerchantCodeRequest';
|
||||
@@ -306,7 +318,6 @@ let primitives = [
|
||||
];
|
||||
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
"Configuration.SourcesEnum": Configuration.SourcesEnum,
|
||||
"Connectivity.SimcardStatusEnum": Connectivity.SimcardStatusEnum,
|
||||
"CreateCompanyWebhookRequest.CommunicationFormatEnum": CreateCompanyWebhookRequest.CommunicationFormatEnum,
|
||||
"CreateCompanyWebhookRequest.FilterMerchantAccountTypeEnum": CreateCompanyWebhookRequest.FilterMerchantAccountTypeEnum,
|
||||
@@ -318,7 +329,9 @@ let enumsMap: {[index: string]: any} = {
|
||||
"InstallAndroidAppDetails.TypeEnum": InstallAndroidAppDetails.TypeEnum,
|
||||
"InstallAndroidCertificateDetails.TypeEnum": InstallAndroidCertificateDetails.TypeEnum,
|
||||
"KlarnaInfo.RegionEnum": KlarnaInfo.RegionEnum,
|
||||
"MealVoucherFRInfo.SubTypesEnum": MealVoucherFRInfo.SubTypesEnum,
|
||||
"PaymentMethod.VerificationStatusEnum": PaymentMethod.VerificationStatusEnum,
|
||||
"PaymentMethodResponse.TypesWithErrorsEnum": PaymentMethodResponse.TypesWithErrorsEnum,
|
||||
"PaymentMethodSetupInfo.ShopperInteractionEnum": PaymentMethodSetupInfo.ShopperInteractionEnum,
|
||||
"PaymentMethodSetupInfo.TypeEnum": PaymentMethodSetupInfo.TypeEnum,
|
||||
"PayoutSettings.PriorityEnum": PayoutSettings.PriorityEnum,
|
||||
@@ -392,6 +405,7 @@ let typeMap: {[index: string]: any} = {
|
||||
"GenerateClientKeyResponse": GenerateClientKeyResponse,
|
||||
"GenerateHmacKeyResponse": GenerateHmacKeyResponse,
|
||||
"GiroPayInfo": GiroPayInfo,
|
||||
"GooglePayInfo": GooglePayInfo,
|
||||
"Gratuity": Gratuity,
|
||||
"Hardware": Hardware,
|
||||
"IdName": IdName,
|
||||
@@ -400,6 +414,7 @@ let typeMap: {[index: string]: any} = {
|
||||
"InvalidField": InvalidField,
|
||||
"JSONObject": JSONObject,
|
||||
"JSONPath": JSONPath,
|
||||
"Key": Key,
|
||||
"KlarnaInfo": KlarnaInfo,
|
||||
"Links": Links,
|
||||
"LinksElement": LinksElement,
|
||||
@@ -415,6 +430,7 @@ let typeMap: {[index: string]: any} = {
|
||||
"ListWebhooksResponse": ListWebhooksResponse,
|
||||
"Logo": Logo,
|
||||
"MeApiCredential": MeApiCredential,
|
||||
"MealVoucherFRInfo": MealVoucherFRInfo,
|
||||
"Merchant": Merchant,
|
||||
"MerchantLinks": MerchantLinks,
|
||||
"MinorUnitsMonetaryValue": MinorUnitsMonetaryValue,
|
||||
@@ -422,10 +438,12 @@ let typeMap: {[index: string]: any} = {
|
||||
"Name": Name,
|
||||
"Name2": Name2,
|
||||
"Nexo": Nexo,
|
||||
"NotificationUrl": NotificationUrl,
|
||||
"OfflineProcessing": OfflineProcessing,
|
||||
"Opi": Opi,
|
||||
"OrderItem": OrderItem,
|
||||
"PaginationLinks": PaginationLinks,
|
||||
"Passcodes": Passcodes,
|
||||
"PayPalInfo": PayPalInfo,
|
||||
"PaymentMethod": PaymentMethod,
|
||||
"PaymentMethodResponse": PaymentMethodResponse,
|
||||
@@ -447,6 +465,7 @@ let typeMap: {[index: string]: any} = {
|
||||
"ShopperStatement": ShopperStatement,
|
||||
"Signature": Signature,
|
||||
"SofortInfo": SofortInfo,
|
||||
"Standalone": Standalone,
|
||||
"Store": Store,
|
||||
"StoreCreationRequest": StoreCreationRequest,
|
||||
"StoreCreationWithMerchantCodeRequest": StoreCreationWithMerchantCodeRequest,
|
||||
|
||||
@@ -8,8 +8,12 @@
|
||||
*/
|
||||
|
||||
import { EventUrl } from './eventUrl';
|
||||
import { Key } from './key';
|
||||
import { NotificationUrl } from './notificationUrl';
|
||||
|
||||
export class Nexo {
|
||||
'displayUrls'?: NotificationUrl;
|
||||
'encryptionKey'?: Key;
|
||||
'eventUrls'?: EventUrl;
|
||||
/**
|
||||
* @deprecated One or more URLs to send event messages to when using Terminal API.
|
||||
@@ -19,6 +23,16 @@ export class Nexo {
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "displayUrls",
|
||||
"baseName": "displayUrls",
|
||||
"type": "NotificationUrl"
|
||||
},
|
||||
{
|
||||
"name": "encryptionKey",
|
||||
"baseName": "encryptionKey",
|
||||
"type": "Key"
|
||||
},
|
||||
{
|
||||
"name": "eventUrls",
|
||||
"baseName": "eventUrls",
|
||||
|
||||
40
src/typings/management/notificationUrl.ts
Normal file
40
src/typings/management/notificationUrl.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 { Url } from './url';
|
||||
|
||||
export class NotificationUrl {
|
||||
/**
|
||||
* One or more local URLs to send notifications to when using Terminal API.
|
||||
*/
|
||||
'localUrls'?: Array<Url>;
|
||||
/**
|
||||
* One or more public URLs to send notifications to when using Terminal API.
|
||||
*/
|
||||
'publicUrls'?: Array<Url>;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "localUrls",
|
||||
"baseName": "localUrls",
|
||||
"type": "Array<Url>"
|
||||
},
|
||||
{
|
||||
"name": "publicUrls",
|
||||
"baseName": "publicUrls",
|
||||
"type": "Array<Url>"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return NotificationUrl.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
57
src/typings/management/passcodes.ts
Normal file
57
src/typings/management/passcodes.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class Passcodes {
|
||||
/**
|
||||
* The pin code used to enter the admin menu
|
||||
*/
|
||||
'adminMenuPin'?: string;
|
||||
/**
|
||||
* Allows merchant to create a dedicated PIN for standalone refund functionality
|
||||
*/
|
||||
'refundPin'?: string;
|
||||
/**
|
||||
* Passcode to unlock screen after sleep
|
||||
*/
|
||||
'screenLockPin'?: string;
|
||||
/**
|
||||
* The PIN code used to enter the transaction menu
|
||||
*/
|
||||
'txMenuPin'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "adminMenuPin",
|
||||
"baseName": "adminMenuPin",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "refundPin",
|
||||
"baseName": "refundPin",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "screenLockPin",
|
||||
"baseName": "screenLockPin",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "txMenuPin",
|
||||
"baseName": "txMenuPin",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Passcodes.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ import { ApplePayInfo } from './applePayInfo';
|
||||
import { BcmcInfo } from './bcmcInfo';
|
||||
import { CartesBancairesInfo } from './cartesBancairesInfo';
|
||||
import { GiroPayInfo } from './giroPayInfo';
|
||||
import { GooglePayInfo } from './googlePayInfo';
|
||||
import { KlarnaInfo } from './klarnaInfo';
|
||||
import { MealVoucherFRInfo } from './mealVoucherFRInfo';
|
||||
import { PayPalInfo } from './payPalInfo';
|
||||
import { SofortInfo } from './sofortInfo';
|
||||
import { SwishInfo } from './swishInfo';
|
||||
@@ -37,17 +39,27 @@ export class PaymentMethod {
|
||||
*/
|
||||
'currencies'?: Array<string>;
|
||||
/**
|
||||
* The list of custom routing flags to route payment to the intended acquirer.
|
||||
*/
|
||||
'customRoutingFlags'?: Array<string>;
|
||||
/**
|
||||
* Indicates whether the payment method is enabled (**true**) or disabled (**false**).
|
||||
*/
|
||||
'enabled'?: boolean;
|
||||
'giroPay'?: GiroPayInfo;
|
||||
'googlePay'?: GooglePayInfo;
|
||||
/**
|
||||
* The identifier of the resource.
|
||||
*/
|
||||
'id': string;
|
||||
'klarna'?: KlarnaInfo;
|
||||
'mealVoucherFR'?: MealVoucherFRInfo;
|
||||
'paypal'?: PayPalInfo;
|
||||
/**
|
||||
* Your reference for the payment method. Supported characters a-z, A-Z, 0-9.
|
||||
*/
|
||||
'reference'?: string;
|
||||
/**
|
||||
* The sales channel.
|
||||
*/
|
||||
'shopperInteraction'?: string;
|
||||
@@ -104,6 +116,11 @@ export class PaymentMethod {
|
||||
"baseName": "currencies",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "customRoutingFlags",
|
||||
"baseName": "customRoutingFlags",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "enabled",
|
||||
"baseName": "enabled",
|
||||
@@ -114,6 +131,11 @@ export class PaymentMethod {
|
||||
"baseName": "giroPay",
|
||||
"type": "GiroPayInfo"
|
||||
},
|
||||
{
|
||||
"name": "googlePay",
|
||||
"baseName": "googlePay",
|
||||
"type": "GooglePayInfo"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
@@ -124,11 +146,21 @@ export class PaymentMethod {
|
||||
"baseName": "klarna",
|
||||
"type": "KlarnaInfo"
|
||||
},
|
||||
{
|
||||
"name": "mealVoucherFR",
|
||||
"baseName": "mealVoucher_FR",
|
||||
"type": "MealVoucherFRInfo"
|
||||
},
|
||||
{
|
||||
"name": "paypal",
|
||||
"baseName": "paypal",
|
||||
"type": "PayPalInfo"
|
||||
},
|
||||
{
|
||||
"name": "reference",
|
||||
"baseName": "reference",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "shopperInteraction",
|
||||
"baseName": "shopperInteraction",
|
||||
|
||||
@@ -24,6 +24,10 @@ export class PaymentMethodResponse {
|
||||
* Total number of pages.
|
||||
*/
|
||||
'pagesTotal': number;
|
||||
/**
|
||||
* Payment method types with errors.
|
||||
*/
|
||||
'typesWithErrors'?: Array<PaymentMethodResponse.TypesWithErrorsEnum>;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
@@ -47,6 +51,11 @@ export class PaymentMethodResponse {
|
||||
"name": "pagesTotal",
|
||||
"baseName": "pagesTotal",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "typesWithErrors",
|
||||
"baseName": "typesWithErrors",
|
||||
"type": "Array<PaymentMethodResponse.TypesWithErrorsEnum>"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
@@ -54,3 +63,50 @@ export class PaymentMethodResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PaymentMethodResponse {
|
||||
export enum TypesWithErrorsEnum {
|
||||
Alipay = <any> 'alipay',
|
||||
Amex = <any> 'amex',
|
||||
Applepay = <any> 'applepay',
|
||||
Bcmc = <any> 'bcmc',
|
||||
Blik = <any> 'blik',
|
||||
Cartebancaire = <any> 'cartebancaire',
|
||||
Cup = <any> 'cup',
|
||||
Diners = <any> 'diners',
|
||||
DirectEbanking = <any> 'directEbanking',
|
||||
DirectdebitGb = <any> 'directdebit_GB',
|
||||
Discover = <any> 'discover',
|
||||
EbankingFi = <any> 'ebanking_FI',
|
||||
EftposAustralia = <any> 'eftpos_australia',
|
||||
Elo = <any> 'elo',
|
||||
Elocredit = <any> 'elocredit',
|
||||
Elodebit = <any> 'elodebit',
|
||||
Girocard = <any> 'girocard',
|
||||
Giropay = <any> 'giropay',
|
||||
Googlepay = <any> 'googlepay',
|
||||
Hiper = <any> 'hiper',
|
||||
Hipercard = <any> 'hipercard',
|
||||
Ideal = <any> 'ideal',
|
||||
InteracCard = <any> 'interac_card',
|
||||
Jcb = <any> 'jcb',
|
||||
Klarna = <any> 'klarna',
|
||||
KlarnaAccount = <any> 'klarna_account',
|
||||
KlarnaPaynow = <any> 'klarna_paynow',
|
||||
Maestro = <any> 'maestro',
|
||||
Mbway = <any> 'mbway',
|
||||
Mc = <any> 'mc',
|
||||
Mcdebit = <any> 'mcdebit',
|
||||
MealVoucherFr = <any> 'mealVoucher_FR',
|
||||
Mobilepay = <any> 'mobilepay',
|
||||
Multibanco = <any> 'multibanco',
|
||||
Paypal = <any> 'paypal',
|
||||
Payshop = <any> 'payshop',
|
||||
Swish = <any> 'swish',
|
||||
Trustly = <any> 'trustly',
|
||||
Visa = <any> 'visa',
|
||||
Visadebit = <any> 'visadebit',
|
||||
Vpay = <any> 'vpay',
|
||||
Wechatpay = <any> 'wechatpay',
|
||||
WechatpayPos = <any> 'wechatpay_pos'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ import { ApplePayInfo } from './applePayInfo';
|
||||
import { BcmcInfo } from './bcmcInfo';
|
||||
import { CartesBancairesInfo } from './cartesBancairesInfo';
|
||||
import { GiroPayInfo } from './giroPayInfo';
|
||||
import { GooglePayInfo } from './googlePayInfo';
|
||||
import { KlarnaInfo } from './klarnaInfo';
|
||||
import { MealVoucherFRInfo } from './mealVoucherFRInfo';
|
||||
import { PayPalInfo } from './payPalInfo';
|
||||
import { SofortInfo } from './sofortInfo';
|
||||
import { SwishInfo } from './swishInfo';
|
||||
@@ -32,10 +34,20 @@ export class PaymentMethodSetupInfo {
|
||||
* The list of currencies that a payment method supports. By default, all currencies supported by the payment method.
|
||||
*/
|
||||
'currencies'?: Array<string>;
|
||||
/**
|
||||
* The list of custom routing flags to route payment to the intended acquirer.
|
||||
*/
|
||||
'customRoutingFlags'?: Array<string>;
|
||||
'giroPay'?: GiroPayInfo;
|
||||
'googlePay'?: GooglePayInfo;
|
||||
'klarna'?: KlarnaInfo;
|
||||
'mealVoucherFR'?: MealVoucherFRInfo;
|
||||
'paypal'?: PayPalInfo;
|
||||
/**
|
||||
* Your reference for the payment method. Supported characters a-z, A-Z, 0-9.
|
||||
*/
|
||||
'reference'?: string;
|
||||
/**
|
||||
* The sales channel. Required if the merchant account does not have a sales channel. When you provide this field, it overrides the default sales channel set on the merchant account. Possible values: **eCommerce**, **pos**, **contAuth**, and **moto**.
|
||||
*/
|
||||
'shopperInteraction'?: PaymentMethodSetupInfo.ShopperInteractionEnum;
|
||||
@@ -48,7 +60,7 @@ export class PaymentMethodSetupInfo {
|
||||
/**
|
||||
* Payment method [variant](https://docs.adyen.com/development-resources/paymentmethodvariant#management-api).
|
||||
*/
|
||||
'type': PaymentMethodSetupInfo.TypeEnum;
|
||||
'type'?: PaymentMethodSetupInfo.TypeEnum;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
@@ -83,21 +95,41 @@ export class PaymentMethodSetupInfo {
|
||||
"baseName": "currencies",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "customRoutingFlags",
|
||||
"baseName": "customRoutingFlags",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "giroPay",
|
||||
"baseName": "giroPay",
|
||||
"type": "GiroPayInfo"
|
||||
},
|
||||
{
|
||||
"name": "googlePay",
|
||||
"baseName": "googlePay",
|
||||
"type": "GooglePayInfo"
|
||||
},
|
||||
{
|
||||
"name": "klarna",
|
||||
"baseName": "klarna",
|
||||
"type": "KlarnaInfo"
|
||||
},
|
||||
{
|
||||
"name": "mealVoucherFR",
|
||||
"baseName": "mealVoucher_FR",
|
||||
"type": "MealVoucherFRInfo"
|
||||
},
|
||||
{
|
||||
"name": "paypal",
|
||||
"baseName": "paypal",
|
||||
"type": "PayPalInfo"
|
||||
},
|
||||
{
|
||||
"name": "reference",
|
||||
"baseName": "reference",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "shopperInteraction",
|
||||
"baseName": "shopperInteraction",
|
||||
@@ -150,8 +182,14 @@ export namespace PaymentMethodSetupInfo {
|
||||
Discover = <any> 'discover',
|
||||
EbankingFi = <any> 'ebanking_FI',
|
||||
EftposAustralia = <any> 'eftpos_australia',
|
||||
Elo = <any> 'elo',
|
||||
Elocredit = <any> 'elocredit',
|
||||
Elodebit = <any> 'elodebit',
|
||||
Girocard = <any> 'girocard',
|
||||
Giropay = <any> 'giropay',
|
||||
Googlepay = <any> 'googlepay',
|
||||
Hiper = <any> 'hiper',
|
||||
Hipercard = <any> 'hipercard',
|
||||
Ideal = <any> 'ideal',
|
||||
InteracCard = <any> 'interac_card',
|
||||
Jcb = <any> 'jcb',
|
||||
@@ -161,6 +199,8 @@ export namespace PaymentMethodSetupInfo {
|
||||
Maestro = <any> 'maestro',
|
||||
Mbway = <any> 'mbway',
|
||||
Mc = <any> 'mc',
|
||||
Mcdebit = <any> 'mcdebit',
|
||||
MealVoucherFr = <any> 'mealVoucher_FR',
|
||||
Mobilepay = <any> 'mobilepay',
|
||||
Multibanco = <any> 'multibanco',
|
||||
Paypal = <any> 'paypal',
|
||||
@@ -168,6 +208,8 @@ export namespace PaymentMethodSetupInfo {
|
||||
Swish = <any> 'swish',
|
||||
Trustly = <any> 'trustly',
|
||||
Visa = <any> 'visa',
|
||||
Visadebit = <any> 'visadebit',
|
||||
Vpay = <any> 'vpay',
|
||||
Wechatpay = <any> 'wechatpay',
|
||||
WechatpayPos = <any> 'wechatpay_pos'
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export class ShopperStatement {
|
||||
/**
|
||||
* The name you want to be shown on the shopper\'s bank or credit card statement. Maximum length: 22 characters; can\'t be all numbers.
|
||||
*/
|
||||
'doingBusinessAsName': string;
|
||||
'doingBusinessAsName'?: string;
|
||||
/**
|
||||
* The type of shopperstatement you want to use: fixed, append or dynamic
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,10 @@ export class Signature {
|
||||
*/
|
||||
'deviceName'?: string;
|
||||
/**
|
||||
* Slogan shown on the start screen of the device.
|
||||
*/
|
||||
'deviceSlogan'?: string;
|
||||
/**
|
||||
* Skip asking for a signature. This is possible because all global card schemes (American Express, Diners, Discover, JCB, MasterCard, VISA, and UnionPay) regard a signature as optional.
|
||||
*/
|
||||
'skipSignature'?: boolean;
|
||||
@@ -35,6 +39,11 @@ export class Signature {
|
||||
"baseName": "deviceName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "deviceSlogan",
|
||||
"baseName": "deviceSlogan",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "skipSignature",
|
||||
"baseName": "skipSignature",
|
||||
|
||||
39
src/typings/management/standalone.ts
Normal file
39
src/typings/management/standalone.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
export class Standalone {
|
||||
/**
|
||||
* The default currency that will be used when the device is in standalone mode (ISO 4217 - 3 letter code).
|
||||
*/
|
||||
'currencyCode'?: string;
|
||||
/**
|
||||
* Enable standalone mode.
|
||||
*/
|
||||
'enableStandalone'?: boolean;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "currencyCode",
|
||||
"baseName": "currencyCode",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "enableStandalone",
|
||||
"baseName": "enableStandalone",
|
||||
"type": "boolean"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Standalone.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export class SwishInfo {
|
||||
/**
|
||||
* Swish number. Format: 10 digits without spaces. For example, **1231111111**.
|
||||
*/
|
||||
'swishNumber': string;
|
||||
'swishNumber'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
|
||||
@@ -14,9 +14,11 @@ import { Hardware } from './hardware';
|
||||
import { Nexo } from './nexo';
|
||||
import { OfflineProcessing } from './offlineProcessing';
|
||||
import { Opi } from './opi';
|
||||
import { Passcodes } from './passcodes';
|
||||
import { ReceiptOptions } from './receiptOptions';
|
||||
import { ReceiptPrinting } from './receiptPrinting';
|
||||
import { Signature } from './signature';
|
||||
import { Standalone } from './standalone';
|
||||
import { Surcharge } from './surcharge';
|
||||
import { Timeouts } from './timeouts';
|
||||
import { WifiProfiles } from './wifiProfiles';
|
||||
@@ -32,9 +34,11 @@ export class TerminalSettings {
|
||||
'nexo'?: Nexo;
|
||||
'offlineProcessing'?: OfflineProcessing;
|
||||
'opi'?: Opi;
|
||||
'passcodes'?: Passcodes;
|
||||
'receiptOptions'?: ReceiptOptions;
|
||||
'receiptPrinting'?: ReceiptPrinting;
|
||||
'signature'?: Signature;
|
||||
'standalone'?: Standalone;
|
||||
'surcharge'?: Surcharge;
|
||||
'timeouts'?: Timeouts;
|
||||
'wifiProfiles'?: WifiProfiles;
|
||||
@@ -77,6 +81,11 @@ export class TerminalSettings {
|
||||
"baseName": "opi",
|
||||
"type": "Opi"
|
||||
},
|
||||
{
|
||||
"name": "passcodes",
|
||||
"baseName": "passcodes",
|
||||
"type": "Passcodes"
|
||||
},
|
||||
{
|
||||
"name": "receiptOptions",
|
||||
"baseName": "receiptOptions",
|
||||
@@ -92,6 +101,11 @@ export class TerminalSettings {
|
||||
"baseName": "signature",
|
||||
"type": "Signature"
|
||||
},
|
||||
{
|
||||
"name": "standalone",
|
||||
"baseName": "standalone",
|
||||
"type": "Standalone"
|
||||
},
|
||||
{
|
||||
"name": "surcharge",
|
||||
"baseName": "surcharge",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user