Initial commit

This commit is contained in:
Rik ter Beek
2019-07-04 14:24:23 +02:00
committed by Ricardo Ambrogi
commit d1d331d90d
231 changed files with 19099 additions and 0 deletions

22
.babelrc Executable file
View File

@@ -0,0 +1,22 @@
{
"presets": [
"@babel/env",
[
"@babel/preset-typescript",
{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-runtime"]
}
}
}

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
/src/typings/**/*.ts
/examples

29
.eslintrc.json Normal file
View File

@@ -0,0 +1,29 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
},
"project": "./tsconfig.json"
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"quotes": ["error", "double"],
"semi": ["error", "always"]
},
"overrides": [
{
"files": ["*.ts"],
"rules": {
"no-dupe-class-members": "off"
}
}
]
}

17
.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
.src/main/test
.vagrant
Vagrantfile
build
node_modules
.idea
dist
.DS_Store
.bash_history
.config/
.docker/
.npm/
.ssh/
.viminfo
local/
coverage/
package-lock.json

10
.npmignore Normal file
View File

@@ -0,0 +1,10 @@
src/
.babelrc
.eslintignore
.eslintrc.json
.gitignore
.travis.yml
tsconfig.json
jest.config.js
tslint.json
webpack.config.js

12
.travis.yml Normal file
View File

@@ -0,0 +1,12 @@
language: node_js
node_js:
- stable
before_install:
- rm -rf package-lock.json node_modules
cache:
directories:
- "node_modules"
script:
- npm run lint:fix
- npm run lint
- npm run test

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Adyen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

94
README.md Normal file
View File

@@ -0,0 +1,94 @@
# Adyen Node.js API Library
[![Build Status](https://travis-ci.com/Adyen/adyen-node-api-library.svg?token=DH2YULmDqk5ustZBswwf&branch=develop)](https://travis-ci.com/Adyen/adyen-node-api-library)
The Adyen API Library for NodeJS enables you to work with Adyen APIs and Hosted Payment Pages.
## Integration
The Library supports all APIs under the following services:
* [x] checkout
* [x] checkout utility
* [x] payments
* [x] modifications
* [x] payouts
* [x] recurring
* [x] notifications
* [x] BIN lookup
## Requirements
* Node 8.1.1 or higher
## Installation
You can use NPM to add our library to your project
### NPM
```bash
npm install --save adyen-node-api-library
```
## Documentation
* https://docs.adyen.com/developers/development-resources/libraries
* https://docs.adyen.com/developers/checkout/api-integration
## HTTP Client Configuration
By default, NodeJS [https](https://nodejs.org/api/https.html) will be used to submit requests to the API. But you can change that by injecting your own HttpClient on your client instance. In the example below, we use `axios`:
```javascript
const {Client, Config} = require('adyen-node-api-library');
const axios = require("axios");
...
const config = new Config();
const client = new Client({
config,
httpClient: {
async request(endpoint, json, config, isApiKeyRequired, requestOptions) {
const response = await axios({
method: 'POST',
url: endpoint,
data: JSON.parse(json),
headers: {
"X-API-Key": config.apiKey,
"Content-type": "application/json"
},
});
return response.data;
}
}
});
...
```
## Proxy configuration
You can configure a proxy connection by injecting your own HttpURLConnectionClient on your client instance and changing the `proxy` setter value.
Example:
```javascript
const {HttpURLConnectionClient, Client, Config} = require('adyen-node-api-library');
...
const config = new Config();
const client = new Client({ config });
const httpClient = new HttpURLConnectionClient();
httpClient.proxy = { host: "http://google.com", port: 8888, };
client.setEnvironment('TEST');
client.httpClient = httpClient;
...
```
## Support
If you have any problems, questions or suggestions, create an issue here or send your inquiry to support@adyen.com.
## Licence
MIT license. For more information, see the LICENSE file.
## Other
You can find examples inside the `examples` folder in this repo.

View File

@@ -0,0 +1,24 @@
const TerminalAPI = require("./terminalApi");
const terminalAPI = new TerminalAPI();
const asyncPayment = async () => {
console.log("Starting transaction...");
const sentRequest = await terminalAPI.paymentRequestAsync();
console.log("Request sent. Waiting to retrieve status...");
setTimeout(async () => {
console.log("Retrieving status...");
const statusResponse = await terminalAPI.transactionStatusRequestSync(sentRequest);
const {TransactionStatusResponse} = statusResponse.SaleToPOIResponse;
if (TransactionStatusResponse && TransactionStatusResponse.Response.Result === 'Success') {
console.log("Response [result:%s data:%s]",
statusResponse.SaleToPOIResponse.TransactionStatusResponse.RepeatedMessageResponse.RepeatedResponseMessageBody.PaymentResponse.Response.Result,
statusResponse.SaleToPOIResponse.TransactionStatusResponse.RepeatedMessageResponse.RepeatedResponseMessageBody.PaymentResponse.Response.AdditionalResponse
);
} else {
console.log("Response [result:%s]", statusResponse.SaleToPOIResponse.TransactionStatusResponse.Response.Result)
}
}, 10000);
}

View File

@@ -0,0 +1,12 @@
const TerminalAPI = require("./terminalApi");
const terminalAPI = new TerminalAPI();
const localPayment = async () => {
const paymentsResponse = await terminalAPI.paymentRequestLocal();
console.log("Response [result:%s data:%s]",
paymentsResponse.SaleToPOIResponse.PaymentResponse.Response.Result,
paymentsResponse.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse
);
};

13
examples/payments/sync.js Normal file
View File

@@ -0,0 +1,13 @@
const TerminalAPI = require("./terminalApi");
const terminalAPI = new TerminalAPI();
const syncPayment = async () => {
console.log("Starting transaction...");
const paymentsResponse = await terminalAPI.paymentRequestSync();
console.log("Response [result:%s data:%s]",
paymentsResponse.SaleToPOIResponse.PaymentResponse.Response.Result,
paymentsResponse.SaleToPOIResponse.PaymentResponse.Response.AdditionalResponse
);
};

View File

@@ -0,0 +1,135 @@
const {Client, Config, TerminalCloudAPI, TerminalLocalAPI} = require("../../src");
class TerminalApi {
terminalCloudAPI;
terminalLocalAPI;
constructor() {
const merchantAccount = "[MERCHANT ACCOUNT]";
const xApiKey = "[X_API_KEY]";
const config = new Config();
config.merchantAccount = merchantAccount;
config.apiKey = xApiKey; // alternatively you can authenticate with your username + password
// config.username = "[USERNAME]"
// config.password = "[PASSWORD]"
const client = new Client({config});
client.setEnvironment("[LIVE | TEST]");
this.terminalCloudAPI = new TerminalCloudAPI(client);
const localConfig = new Config();
localConfig.merchantAccount = merchantAccount;
localConfig.apiKey = xApiKey; // or username + password
localConfig.terminalApiLocalEndpoint = "[PROTOCOL]//[TERMINAL_IP]:[PORT]";
const localClient = new Client({config: localConfig});
this.terminalLocalAPI = new TerminalLocalAPI(localClient);
}
async paymentRequestLocal() {
const paymentsRequest = this.createPaymentRequest();
const securityKey = {
keyVersion: 1,
adyenCryptoVersion: 1,
keyIdentifier: "[CRYPTO_KEY_IDENTIFIER]",
passphrase: "[CRYPTO_KEY_PASSPHRASE]"
};
return this.terminalLocalAPI.request(paymentsRequest, securityKey);
}
paymentRequestSync() {
const paymentsRequest = this.createPaymentRequest();
console.log(`Payment [poiId:${paymentsRequest.SaleToPOIRequest.MessageHeader.POIID} serviceId:${paymentsRequest.SaleToPOIRequest.MessageHeader.ServiceID} saleId:${paymentsRequest.SaleToPOIRequest.MessageHeader.SaleID} amount:${paymentsRequest.SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.RequestedAmount} ${paymentsRequest.SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.Currency}]`)
return this.terminalCloudAPI.sync(paymentsRequest);
}
async paymentRequestAsync() {
const paymentsRequest = this.createPaymentRequest();
console.log(`Payment [poiId:${paymentsRequest.SaleToPOIRequest.MessageHeader.POIID} serviceId:${paymentsRequest.SaleToPOIRequest.MessageHeader.ServiceID} saleId:${paymentsRequest.SaleToPOIRequest.MessageHeader.SaleID} amount:${paymentsRequest.SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.RequestedAmount} ${paymentsRequest.SaleToPOIRequest.PaymentRequest.PaymentTransaction.AmountsReq.Currency}]`);
const response = await this.terminalCloudAPI.async(paymentsRequest);
return response === "ok" ? paymentsRequest : undefined;
}
createPaymentRequest() {
const saleToPOIRequest = {};
const messageHeader = this.createMessageHeader("Payment");
saleToPOIRequest.MessageHeader = messageHeader;
const paymentRequest = {};
const saleData = {};
const transactionIdentification = {};
transactionIdentification.TransactionID = "[TRANSACTION_ID]";
transactionIdentification.TimeStamp = new Date().toISOString();
saleData.SaleTransactionID = transactionIdentification;
const paymentTransation = {};
const amountsReq = {};
amountsReq.Currency = "EUR";
amountsReq.RequestedAmount = 1;
paymentTransation.AmountsReq = amountsReq;
paymentRequest.SaleData = saleData;
paymentRequest.PaymentTransaction = paymentTransation;
saleToPOIRequest.PaymentRequest = paymentRequest;
const terminalApiRequest = {};
terminalApiRequest.SaleToPOIRequest = saleToPOIRequest;
return terminalApiRequest;
}
createMessageHeader(messageCategoryType) {
const id = new Date().getTime() % 1000000000;
const messageHeader = {};
messageHeader.ProtocolVersion = "3.0";
messageHeader.MessageClass = "Service";
messageHeader.MessageCategory = messageCategoryType;
messageHeader.MessageType = "Request";
messageHeader.SaleID = id.toString();
messageHeader.ServiceID = id.toString();
messageHeader.POIID = "[POI_ID]";
return messageHeader;
}
createTransactionStatusRequest(paymentRequest) {
const saleToPOIRequest = {};
const messageHeader = this.createMessageHeader("TransactionStatus");
saleToPOIRequest.MessageHeader = messageHeader;
const transactionStatusRequest = {};
const messageReference = {};
messageReference.MessageCategory = "Payment";
messageReference.SaleID = paymentRequest.SaleToPOIRequest.MessageHeader.SaleID;
messageReference.ServiceID = paymentRequest.SaleToPOIRequest.MessageHeader.ServiceID;
transactionStatusRequest.MessageReference = messageReference;
saleToPOIRequest.TransactionStatusRequest = transactionStatusRequest;
const terminalAPIRequest = {};
terminalAPIRequest.SaleToPOIRequest = saleToPOIRequest;
return terminalAPIRequest;
}
transactionStatusRequestSync(terminalAPIRequest) {
const transactionStatusRequest = this.createTransactionStatusRequest(terminalAPIRequest);
return this.terminalCloudAPI.sync(transactionStatusRequest);
}
}
module.exports = TerminalApi;

36
jest.config.js Normal file
View File

@@ -0,0 +1,36 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Node API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
module.exports = {
moduleFileExtensions: [
"ts",
"js"
],
coveragePathIgnorePatterns: [
"<rootDir>/src/typings"
],
unmockedModulePathPatterns: [
"/dist"
],
testMatch: [
"**/__tests__/*.ts"
]
};

53
package.json Normal file
View File

@@ -0,0 +1,53 @@
{
"name": "adyen-node-api-library",
"version": "1.0.0",
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs and Hosted Payment Pages.",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
"module": "dist/lib-esm/index.js",
"engines": {
"node": ">=8.1.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Adyen/adyen-node-api-library.git"
},
"keywords": [
"adyen",
"api",
"nodejs"
],
"bugs": {
"url": "https://github.com/Adyen/adyen-node-api-library/issues"
},
"homepage": "https://github.com/Adyen/adyen-node-api-library#readme",
"scripts": {
"clean": "rm -rf ./dist",
"build": "npm run clean && tsc && tsc -m es6 --outDir dist/lib-esm && webpack",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "eslint --fix 'src/**/*.ts'",
"test": "jest"
},
"author": "Ricardo Ambrogi",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.1.6",
"@babel/preset-typescript": "^7.1.0",
"@babel/runtime": "^7.3.4",
"@types/jest": "^23.3.5",
"@types/node": "^11.13.7",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"babel-loader": "^8.0.4",
"eslint": "^5.12.1",
"jest": "^24.0.0",
"ts-loader": "^5.4.5",
"typescript": "^3.4.5",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.3"
}
}

120
src/__mocks__/base.ts Normal file
View File

@@ -0,0 +1,120 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 Config from "../config";
import HttpURLConnectionClient from "../httpClient/httpURLConnectionClient";
import {
AmountsReq,
MessageCategoryType,
MessageClassType,
MessageHeader,
MessageType,
PaymentRequest,
PaymentTransaction,
SaleData,
SaleToPoiRequest,
TerminalApiRequest,
TransactionIdentification,
} from "../typings/terminal";
import HttpClientException from "../httpClient/httpClientException";
jest.mock("../httpClient/httpURLConnectionClient");
interface Options { code: number }
export const createMockClientFromResponse = (response: string, { code }: Options = {code: 200}): Client => {
const httpURLConnectionClient: HttpURLConnectionClient = new HttpURLConnectionClient();
// @ts-ignore
httpURLConnectionClient.request.mockImplementation(
(endpoint: string, json: string, config: Config, isApiRequired: boolean): Promise<string> => {
if (
typeof endpoint === "string" &&
typeof json === "string" &&
config instanceof Config &&
(isApiRequired ? typeof isApiRequired === "boolean" : true) &&
code >= 200 && code < 300
) {
return Promise.resolve(response);
} else {
return Promise.reject(new HttpClientException(response, code));
}
}
);
const config: Config = new Config();
config.terminalApiCloudEndpoint = Client.TERMINAL_API_ENDPOINT_TEST;
config.hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00";
config.endpoint = Client.ENDPOINT_TEST;
config.checkoutEndpoint = Client.CHECKOUT_ENDPOINT_TEST;
const client: Client = new Client({ config });
client.httpClient = httpURLConnectionClient;
return client;
};
export const createTerminalAPIPaymentRequest = (): TerminalApiRequest => {
const messageHeader: MessageHeader = {
messageCategory: MessageCategoryType.Payment,
messageClass: MessageClassType.Service,
messageType: MessageType.Request,
poiid: "P400Plus-123456789",
protocolVersion: "3.0",
saleId: "001",
serviceId: "001",
};
const timestamp = new Date().toISOString();
const transactionIdentification: TransactionIdentification = {
timeStamp: timestamp,
transactionId: "001",
};
const saleData: SaleData = {
saleTransactionId: transactionIdentification,
};
const amountsReq: AmountsReq = {
currency: "EUR",
requestedAmount: 1,
};
const paymentTransaction: PaymentTransaction = {
amountsReq: amountsReq,
};
const paymentRequest: PaymentRequest = {
paymentTransaction: paymentTransaction,
saleData: saleData,
};
const saleToPOIRequest: SaleToPoiRequest = {
messageHeader: messageHeader,
paymentRequest: paymentRequest,
};
const terminalApiRequest: TerminalApiRequest = {
saleToPoiRequest: saleToPOIRequest,
};
return terminalApiRequest;
};

View File

@@ -0,0 +1,986 @@
/* tslint:disable */
export const paymentMethodsSuccess = JSON.stringify({
paymentMethods: [
{
name: "AliPay",
type: "alipay",
},
{
name: "AliPay",
type: "alipay_wap",
},
{
details: [
{
key: "additionalData.card.encrypted.json",
type: "cardToken",
},
],
name: "Credit Card",
type: "scheme",
},
{
name: "Credit Card via AsiaPay",
type: "asiapay",
},
{
name: "BancNet",
type: "bancnet",
},
{
name: "Bank Transfer (BE)",
type: "bankTransfer_BE",
},
{
name: "Bank Transfer (DE)",
type: "bankTransfer_DE",
},
{
name: "Bank Transfer (DK)",
type: "bankTransfer_DK",
},
{
name: "Bank Transfer (GB)",
type: "bankTransfer_GB",
},
{
name: "SEPA Bank Transfer",
type: "bankTransfer_IBAN",
},
{
name: "Bank Transfer (NL)",
type: "bankTransfer_NL",
},
{
name: "Bank Transfer (NO)",
type: "bankTransfer_NO",
},
{
name: "Bank Transfer (PL)",
type: "bankTransfer_PL",
},
{
name: "Bank Transfer (SE)",
type: "bankTransfer_SE",
},
{
name: "Russian Bank Transfer",
type: "bank_ru",
},
{
details: [
{
key: "additionalData.card.encrypted.json",
type: "cardToken",
},
],
name: "Bancontact card",
type: "bcmc",
},
{
name: "Boleto Bancario via HSBC",
type: "boletobancario_hsbc",
},
{
name: "Boleto Bancario via Itau",
type: "boletobancario_itau",
},
{
name: "Boleto Bancario via Santander",
type: "boletobancario_santander",
},
{
name: "c_cash",
type: "c_cash",
},
{
name: "CashU",
type: "cashu",
},
{
name: "Paiement en 3 fois par Cartes Bancaires",
type: "cofinoga_3xcb",
},
{
name: "DineroMail",
type: "dineromail",
},
{
name: "Online bank transfer.",
type: "directEbanking",
},
{
name: "Direct Debit Brazil - Banco do Brazil",
type: "directdebit_BR_bancodobrasil",
},
{
name: "Direct Debit Brazil - Bradesco",
type: "directdebit_BR_bradesco",
},
{
name: "Direct Debit Brazil - Caixa Economica Federal",
type: "directdebit_BR_caixa",
},
{
name: "Direct Debit Brazil - HSBC",
type: "directdebit_BR_hsbc",
},
{
name: "Direct Debit Brazil - Itau",
type: "directdebit_BR_itau",
},
{
name: "Direct Debit Brazil - Santander",
type: "directdebit_BR_santander",
},
{
name: "Eenmalige machtiging",
type: "directdebit_NL",
},
{
details: [
{
items: [
{
id: "11",
name: "Bank transfer / postal",
},
{
id: "74",
name: "Banki Spółdzielcze",
},
{
id: "73",
name: "BLIK",
},
{
id: "32",
name: "BNP Paribas",
},
{
id: "16",
name: "Credit Agricole",
},
{
id: "83",
name: "EnveloBank",
},
{
id: "55",
name: "erata - dotpay installment",
},
{
id: "93",
name: "eSKOK",
},
{
id: "56",
name: "eurobank płatności online",
},
{
id: "76",
name: "Getin Bank PBL",
},
{
id: "81",
name: "Idea Cloud",
},
{
id: "7",
name: "ING Corporate customers",
},
{
id: "35",
name: "Kantor Polski",
},
{
id: "44",
name: "Millennium - Płatności Internetowe",
},
{
id: "10",
name: "Millennium Corporate customers",
},
{
id: "68",
name: "mRaty",
},
{
id: "1",
name: "mTransfer",
},
{
id: "80",
name: "Noble Pay",
},
{
id: "50",
name: "Pay Way Toyota Bank",
},
{
id: "45",
name: "Pay with Alior Bank",
},
{
id: "65",
name: "Paylink Idea Bank",
},
{
id: "36",
name: "Pekao24Przelew",
},
{
id: "70",
name: "Pocztowy24",
},
{
id: "6",
name: "Przelew24",
},
{
id: "46",
name: "Płacę z Citi Handlowy",
},
{
id: "38",
name: "Płacę z ING",
},
{
id: "2",
name: "Płacę z Inteligo",
},
{
id: "4",
name: "Płacę z iPKO",
},
{
id: "72",
name: "Płacę z Orange",
},
{
id: "66",
name: "Płacę z PBS",
},
{
id: "75",
name: "Płacę z Plus Bank",
},
{
id: "51",
name: "Płać z BOŚ",
},
{
id: "48",
name: "R-Przelew",
},
{
id: "88",
name: "Raiffeisen",
},
{
id: "52",
name: "SkyCash",
},
{
id: "58",
name: "Szybkie Platnosci Internetowe z Deutsche Bank PBC",
},
{
id: "60",
name: "T-Mobile usługi bankowe",
},
{
id: "21",
name: "VIA - Moje Rachunki",
},
{
id: "84",
name: "Volkswagen Bank direct",
},
{
id: "31",
name: "Zaplac w Zabce i we Freshmarket",
},
{
id: "24",
name: "mPay",
},
],
key: "issuer",
type: "select",
},
],
name: "Local Polish Payment Methods",
type: "dotpay",
},
{
name: "Finnish E-Banking",
type: "ebanking_FI",
},
{
name: "Lastschrift (ELV)",
type: "elv",
},
{
details: [
{
items: [
{
id: "550",
name: "?eská spo?itelna",
},
{
id: "231",
name: "POP Pankki",
},
{
id: "551",
name: "Kb",
},
{
id: "232",
name: "Aktia",
},
{
id: "552",
name: "Raiffeisen",
},
{
id: "750",
name: "Swedbank",
},
{
id: "211",
name: "Nordea",
},
{
id: "233",
name: "Säästöpankki",
},
{
id: "553",
name: "Csob",
},
{
id: "751",
name: "SEB",
},
{
id: "234",
name: "S-Pankki",
},
{
id: "554",
name: "Moneta",
},
{
id: "752",
name: "Nordea",
},
{
id: "235",
name: "OmaSP",
},
{
id: "213",
name: "Op-Pohjola",
},
{
id: "555",
name: "UniCredit",
},
{
id: "753",
name: "LHV",
},
{
id: "556",
name: "Fio",
},
{
id: "557",
name: "mBank",
},
{
id: "216",
name: "Handelsbanken",
},
{
id: "260",
name: "Länsförsäkringar",
},
{
id: "240",
name: "BankDeposit",
},
{
id: "265",
name: "Sparbanken",
},
{
id: "640",
name: "BankDeposit",
},
{
id: "200",
name: "Ålandsbanken",
},
{
id: "720",
name: "Swedbank",
},
{
id: "940",
name: "Swedbank",
},
{
id: "204",
name: "Danske Bank",
},
{
id: "721",
name: "SEB",
},
{
id: "941",
name: "SEB",
},
{
id: "722",
name: "DNB",
},
{
id: "942",
name: "Citadele",
},
{
id: "205",
name: "Handelsbanken",
},
{
id: "723",
name: "Šiaulių Bankas",
},
{
id: "943",
name: "DNB",
},
{
id: "206",
name: "Nordea",
},
{
id: "724",
name: "Nordea",
},
{
id: "207",
name: "SEB",
},
{
id: "208",
name: "Skandiabanken",
},
{
id: "209",
name: "Swedbank",
},
],
key: "issuer",
type: "select",
},
],
name: "Bank Payment",
type: "entercash",
},
{
name: "Nationale Entertainment Card",
type: "entertainmentcard",
},
{
name: "Gall & Gall",
type: "gallgall",
},
{
name: "Generic GiftCard",
type: "genericgiftcard",
},
{
details: [
{
key: "bic",
type: "text",
},
],
name: "GiroPay",
type: "giropay",
},
{
name: "Globe GCash",
type: "globegcash",
},
{
name: "Hunkemoller Lingerie Card",
type: "hmlingerie",
},
{
details: [
{
items: [
{
id: "1121",
name: "Test Issuer",
},
{
id: "1154",
name: "Test Issuer 5",
},
{
id: "1153",
name: "Test Issuer 4",
},
{
id: "1152",
name: "Test Issuer 3",
},
{
id: "1151",
name: "Test Issuer 2",
},
{
id: "1162",
name: "Test Issuer Cancelled",
},
{
id: "1161",
name: "Test Issuer Pending",
},
{
id: "1160",
name: "Test Issuer Refused",
},
{
id: "1159",
name: "Test Issuer 10",
},
{
id: "1158",
name: "Test Issuer 9",
},
{
id: "1157",
name: "Test Issuer 8",
},
{
id: "1156",
name: "Test Issuer 7",
},
{
id: "1155",
name: "Test Issuer 6",
},
],
key: "idealIssuer",
type: "select",
},
],
name: "iDEAL",
type: "ideal",
},
{
name: "Phone Payment",
type: "ivr",
},
{
name: "Landline phone",
type: "ivrLandline",
},
{
name: "Mobile phone",
type: "ivrMobile",
},
{
details: [
{
details: [
{
key: "firstName",
type: "text",
},
{
key: "infix",
optional: "true",
type: "text",
},
{
key: "lastName",
type: "text",
},
{
items: [
{
id: "M",
name: "MALE",
},
{
id: "F",
name: "FEMALE",
},
],
key: "gender",
type: "radio",
},
{
key: "dateOfBirth",
type: "date",
},
{
key: "telephoneNumber",
type: "tel",
},
{
key: "socialSecurityNumber",
optional: "true",
type: "text",
},
{
key: "shopperEmail",
type: "emailAddress",
},
],
key: "personalDetails",
type: "fieldSet",
},
{
details: [
{
key: "street",
type: "text",
},
{
key: "houseNumberOrName",
type: "text",
},
{
key: "city",
type: "text",
},
{
key: "postalCode",
type: "text",
},
{
key: "stateOrProvince",
optional: "true",
type: "text",
},
{
items: [
{
id: "SE",
name: "SWEDEN",
},
{
id: "NO",
name: "NORWAY",
},
{
id: "FI",
name: "FINLAND",
},
{
id: "DK",
name: "DENMARK",
},
{
id: "AT",
name: "AUSTRIA",
},
{
id: "DE",
name: "GERMANY",
},
{
id: "NL",
name: "NETHERLANDS",
},
],
key: "country",
type: "select",
},
],
key: "billingAddress",
type: "address",
},
{
key: "separateDeliveryAddress",
optional: "true",
type: "boolean",
value: "false",
},
{
details: [
{
key: "street",
type: "text",
},
{
key: "houseNumberOrName",
type: "text",
},
{
key: "city",
type: "text",
},
{
key: "postalCode",
type: "text",
},
{
key: "stateOrProvince",
optional: "true",
type: "text",
},
{
items: [
{
id: "SE",
name: "SWEDEN",
},
{
id: "NO",
name: "NORWAY",
},
{
id: "FI",
name: "FINLAND",
},
{
id: "DK",
name: "DENMARK",
},
{
id: "AT",
name: "AUSTRIA",
},
{
id: "DE",
name: "GERMANY",
},
{
id: "NL",
name: "NETHERLANDS",
},
],
key: "country",
type: "select",
},
],
key: "deliveryAddress",
optional: "true",
type: "address",
},
],
name: "Pay later with Klarna.",
type: "klarna",
},
{
name: "Multibanco",
type: "multibanco",
},
{
name: "Russian Online Payments",
type: "online_RU",
},
{
name: "Invoice",
type: "openinvoice",
},
{
name: "PayPal",
type: "paypal",
},
{
name: "Paysafecard",
type: "paysafecard",
},
{
name: "POLi",
type: "poli",
},
{
details: [
{
items: [
{
id: "+7",
name: "RU",
},
{
id: "+9955",
name: "GE",
},
{
id: "+507",
name: "PA",
},
{
id: "+44",
name: "GB",
},
{
id: "+992",
name: "TJ",
},
{
id: "+370",
name: "LT",
},
{
id: "+972",
name: "IL",
},
{
id: "+996",
name: "KG",
},
{
id: "+380",
name: "UA",
},
{
id: "+84",
name: "VN",
},
{
id: "+90",
name: "TR",
},
{
id: "+994",
name: "AZ",
},
{
id: "+374",
name: "AM",
},
{
id: "+371",
name: "LV",
},
{
id: "+91",
name: "IN",
},
{
id: "+66",
name: "TH",
},
{
id: "+373",
name: "MD",
},
{
id: "+1",
name: "US",
},
{
id: "+81",
name: "JP",
},
{
id: "+998",
name: "UZ",
},
{
id: "+77",
name: "KZ",
},
{
id: "+375",
name: "BY",
},
{
id: "+372",
name: "EE",
},
{
id: "+40",
name: "RO",
},
{
id: "+82",
name: "KR",
},
],
key: "qiwiwallet.telephoneNumberPrefix",
type: "select",
},
{
key: "qiwiwallet.telephoneNumber",
type: "text",
},
],
name: "Qiwi Wallet",
type: "qiwiwallet",
},
{
name: "RatePay Invoice",
type: "ratepay",
},
{
name: "SafetyPay",
type: "safetypay",
},
{
details: [
{
key: "sepa.ownerName",
type: "text",
},
{
key: "sepa.ibanNumber",
type: "text",
},
],
name: "SEPA Direct Debit",
type: "sepadirectdebit",
},
{
name: "Premium SMS",
type: "sms",
},
{
name: "TenPay",
type: "tenpay",
},
{
name: "Russian Cash Terminal Payments",
type: "terminal_RU",
},
{
name: "Trustly Direct bank e-Payments",
type: "trustly",
},
{
name: "Online Banking by Trustpay",
type: "trustpay",
},
{
name: "UnionPay",
type: "unionpay",
},
{
name: "Russian Wallet Payments",
type: "wallet_RU",
},
{
name: "Webshop Giftcard",
type: "webshopgiftcard",
},
{
name: "Your Gift",
type: "yourgift",
},
],
});

View File

@@ -0,0 +1,7 @@
/* tslint:disable */
export const paymentSessionError = JSON.stringify({
status: 422,
errorCode: "14_012",
message: "The provided SDK token could not be parsed.",
errorType: "validation",
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
export const paymentMethodsError = JSON.stringify({
errorCode: "901",
errorType: "security",
message: "Invalid Merchant Account",
status: 403,
});

View File

@@ -0,0 +1,7 @@
/* tslint:disable */
export const paymentDetailsError = JSON.stringify({
status: 422,
errorCode: "101",
message: "Invalid card number",
errorType: "validation",
});

View File

@@ -0,0 +1,9 @@
/* tslint:disable */
export const paymentDetailsSuccess = JSON.stringify({
pspReference: "8515232733321252",
resultCode: "Authorised",
additionalData: {
liabilityShift: "true",
refusalReasonRaw: "AUTHORISED",
},
});

View File

@@ -0,0 +1,7 @@
/* tslint:disable */
export const paymentsError = JSON.stringify({
status: 422,
errorCode: "130",
message: "Reference Missing",
errorType: "validation",
});

View File

@@ -0,0 +1,7 @@
/* tslint:disable */
export const paymentsResultError = JSON.stringify({
status: 422,
errorCode: "14_018",
message: "Invalid payload provided",
errorType: "validation",
});

View File

@@ -0,0 +1,15 @@
/* tslint:disable */
export const paymentsResultMultibancoSuccess = JSON.stringify({
additionalData: {
"cvcResult": "0",
"avsResult": "0",
"comprafacil.deadline": "3",
"comprafacil.reference": "123 123 123",
"paymentMethod": "multibanco",
"paymentMethodVariant": "multibanco",
"comprafacil.entity": "12345",
"comprafacil.amount": "101.01",
},
pspReference: "8111111111111111",
resultCode: "Received",
});

View File

@@ -0,0 +1,5 @@
/* tslint:disable */
export const paymentsResultSuccess = JSON.stringify({
pspReference: "8535253563623704",
resultCode: "Authorised",
});

View File

@@ -0,0 +1,98 @@
/* tslint:disable */
export const paymentsSuccess = JSON.stringify({
additionalData: {
expiryDate: "8/2018",
fraudResultType: "GREEN",
cardBin: "411111",
cardSummary: "1111",
fraudManualReview: "false",
aliasType: "Default",
alias: "H167852639363479",
cardPaymentMethod: "visa",
cardIssuingCountry: "NL",
},
fraudResult: {
accountScore: 0,
results: [
{
FraudCheckResult: {
accountScore: 0,
checkId: 2,
name: "CardChunkUsage",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 3,
name: "PaymentDetailUsage",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 4,
name: "HolderNameUsage",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 1,
name: "PaymentDetailRefCheck",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 13,
name: "IssuerRefCheck",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 15,
name: "IssuingCountryReferral",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 27,
name: "PmOwnerRefCheck",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 10,
name: "HolderNameContainsNumber",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 11,
name: "HolderNameIsOneWord",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 82,
name: "CustomFieldCheck",
},
},
{
FraudCheckResult: {
accountScore: 0,
checkId: 25,
name: "CVCAuthResultCheck",
},
},
],
},
pspReference: "8535296650153317",
resultCode: "Authorised",
});

View File

@@ -0,0 +1,7 @@
export const originKeysSuccess = JSON.stringify({
originKeys: {
"https://www.your-domain1.com": "pub.v2.7814286629520534.aHR0cHM6Ly93d3cueW91ci1kb21haW4xLmNvbQ.UEwIBmW9-c_uXo5wSEr2w8Hz8hVIpujXPHjpcEse3xI",
"https://www.your-domain2.com": "pub.v2.7814286629520534.aHR0cHM6Ly93d3cueW91ci1kb21haW4yLmNvbQ.EP6eXBJKk0t7-QIUl6e_b1qMuMHGepxG_SlUqxAYrfY",
"https://www.your-domain3.com": "pub.v2.7814286629520534.aHR0cHM6Ly93d3cueW91ci1kb21haW4zLmNvbQ.fUvflu-YIdZSsLEH8Qqmr7ksE4ag_NYiiMXK0s6aq_4",
},
});

View File

@@ -0,0 +1,36 @@
{
"live": "false",
"notificationItems": [
{
"NotificationRequestItem": {
"additionalData": {
"expiryDate": "12\/2012",
" NAME1 ": "VALUE1",
"authCode": "1234",
"cardSummary": "7777",
"totalFraudScore": "10",
"hmacSignature": "OzDjCMZIsdtDqrZ+cl\/FWC+WdESrorctXTzAzW33dXI=",
"NAME2": " VALUE2 ",
"fraudCheck-6-ShopperIpUsage": "10"
},
"amount": {
"currency": "EUR",
"value": 10100
},
"eventCode": "AUTHORISATION",
"eventDate": "2017-01-19T16:42:03+01:00",
"merchantAccountCode": "MagentoMerchantTest2",
"merchantReference": "8313842560770001",
"operations": [
"CANCEL",
"CAPTURE",
"REFUND"
],
"paymentMethod": "visa",
"pspReference": "123456789",
"reason": "1234:7777:12\/2012",
"success": "true"
}
}
]
}

View File

@@ -0,0 +1,25 @@
{
"live": "false",
"notificationItems": [
{
"NotificationRequestItem": {
"additionalData": {
"hmacSignature": "KujHNqpyCAMdGefj7lfQ8AeD0Jke9Zs2bVAqScQDWi4="
},
"amount": {
"currency": "USD",
"value": 23623
},
"eventCode": "CAPTURE",
"eventDate": "2017-01-25T18:08:19+01:00",
"merchantAccountCode": "MagentoMerchantTest2",
"merchantReference": "00000001",
"originalReference": "ORIGINAL_PSP",
"paymentMethod": "visa",
"pspReference": "PSP_REFERENCE",
"reason": "Insufficient balance on payment",
"success": "false"
}
}
]
}

View File

@@ -0,0 +1,25 @@
{
"live": "false",
"notificationItems": [
{
"NotificationRequestItem": {
"additionalData": {
"hmacSignature": "qvS6I3Gdi1jx+jSh7IopAgcHtMoxvXlNL7DYQ+j1hd0="
},
"amount": {
"currency": "USD",
"value": 23623
},
"eventCode": "CAPTURE",
"eventDate": "2017-01-25T18:08:19+01:00",
"merchantAccountCode": "MagentoMerchantTest2",
"merchantReference": "00000001",
"originalReference": "ORIGINAL_PSP",
"paymentMethod": "visa",
"pspReference": "PSP_REFERENCE",
"reason": "",
"success": "true"
}
}
]
}

View File

@@ -0,0 +1,25 @@
{
"live": "false",
"notificationItems": [
{
"NotificationRequestItem": {
"additionalData": {
"hmacSignature": "HZXziBYopfDIzDhk49iC\/\/yCfxmy\/z0xWuvvTxFNUSA="
},
"amount": {
"currency": "EUR",
"value": 1500
},
"eventCode": "REFUND",
"eventDate": "2017-02-17T11:04:07+01:00",
"merchantAccountCode": "MagentoMerchantTest2",
"merchantReference": "payment-2017-1-17-11-refund",
"originalReference": "ORIGINAL_PSP",
"paymentMethod": "visa",
"pspReference": "PSP_REFERENCE",
"reason": "Insufficient balance on payment",
"success": "false"
}
}
]
}

View File

@@ -0,0 +1,25 @@
{
"live": "false",
"notificationItems": [
{
"NotificationRequestItem": {
"additionalData": {
"hmacSignature": "KJFhURWP8Pv9m8k+7NGHNJAupBj6X6J\/VWAikFxeWhA="
},
"amount": {
"currency": "EUR",
"value": 1500
},
"eventCode": "REFUND",
"eventDate": "2017-02-17T11:11:44+01:00",
"merchantAccountCode": "MagentoMerchantTest2",
"merchantReference": "payment-2017-1-17-11-refund",
"originalReference": "ORIGINAL_PSP",
"paymentMethod": "visa",
"pspReference": "PSP_REFERENCE",
"reason": "",
"success": "true"
}
}
]
}

View File

@@ -0,0 +1,3 @@
export const disableSuccess = JSON.stringify({
response: "[detail-successfully-disabled]",
});

View File

@@ -0,0 +1,52 @@
export const listRecurringDetailsSuccess = JSON.stringify({
creationDate: new Date("2017-03-01T11:53:11+01:00"),
details: [
{
additionalData: {
cardBin: "411111",
},
alias: "cardAlias",
aliasType: "Default",
card: {
expiryMonth: "8",
expiryYear: "2018",
holderName: "Holder",
number: "1111",
},
contractTypes: [
"ONECLICK",
],
creationDate: new Date("2017-03-07T09:43:33+01:00"),
firstPspReference: "8524888762135795",
paymentMethodVariant: "visa",
recurringDetailReference: "recurringReference",
variant: "visa",
},
{
billingAddress: {
city: "City",
country: "NL",
houseNumberOrName: "1",
postalCode: "2312aa",
stateOrProvince: "NA",
street: "Street",
},
contractTypes: [
"RECURRING",
],
creationDate: new Date("2017-10-10T08:50:02+02:00"),
firstPspReference: "8515076181707110",
paymentMethodVariant: "paypal",
recurringDetailReference: "8315076181982020",
tokenDetails: {
tokenData: {
"BillingAgreementId": "B-7MA42752FE774625C",
"EmailId": "tedtest@test.nl",
"PayPal.PayerId": "H95EPL8B2KFE6",
},
tokenDataType: "PayPal",
},
variant: "paypal",
},
],
});

View File

@@ -0,0 +1 @@
export const asyncRes = "ok";

View File

@@ -0,0 +1,107 @@
export const localRes = JSON.stringify({
SaleToPOIResponse: {
MessageHeader: {
MessageCategory: "Payment",
MessageClass: "Service",
MessageType: "Response",
POIID: "P400Plus-275039202",
ProtocolVersion: "3.0",
SaleID: "325488592",
ServiceID: "325488592",
},
NexoBlob: `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`,
SecurityTrailer: {
AdyenCryptoVersion: 1,
Hmac: "l+5/pYiAbC0V9Xx78ELNDcLMaqTlqx2OyGha37i/g5g=",
KeyIdentifier: "CryptoKeyIdentifier12345",
KeyVersion: 1,
Nonce: "9iiJMpzKfYs3106ozIKNFQ==",
},
},
});

View File

@@ -0,0 +1,329 @@
export const syncRes = JSON.stringify({
SaleToPOIResponse: {
MessageHeader: {
MessageCategory: "Payment",
MessageClass: "Service",
MessageType: "Response",
POIID: "P400Plus-123456789",
ProtocolVersion: "3.0",
SaleID: "001",
ServiceID: "1234567890",
},
PaymentResponse: {
POIData: {
POIReconciliationID: "1000",
POITransactionID: {
TimeStamp: "2019-04-29T00:00:00.000Z",
TransactionID: "4r7i001556529591000.8515565295894301",
},
},
PaymentReceipt: [
{
DocumentQualifier: "CashierReceipt",
OutputContent: {
OutputFormat: "Text",
OutputText: [
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "key=header1",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "key=header2",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=MERCHANT%20COPY&key=merchantTitle",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Date&value=29%2f04%2f19&key=txdate",
},
{
EndOfLineFlag: true,
Text: "name=Time&value=10%3a19%3a51&key=txtime",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Card&value=%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a3511&key=pan",
},
{
EndOfLineFlag: true,
Text: "name=Pref.%20name&value=MCC%20351%20v1%202&key=preferredName",
},
{
EndOfLineFlag: true,
Text: "name=Card%20type&value=mc&key=cardType",
},
{
EndOfLineFlag: true,
Text: "name=Payment%20method&value=mc&key=paymentMethod",
},
{
EndOfLineFlag: true,
Text: "name=Payment%20variant&value=mc&key=paymentMethodVariant",
},
{
EndOfLineFlag: true,
Text: "name=Entry%20mode&value=Contactless%20swipe&key=posEntryMode",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=AID&value=A0000000041010&key=aid",
},
{
EndOfLineFlag: true,
Text: "name=MID&value=1000&key=mid",
},
{
EndOfLineFlag: true,
Text: "name=TID&value=P400Plus-275039202&key=tid",
},
{
EndOfLineFlag: true,
Text: "name=PTID&value=75039202&key=ptid",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Auth.%20code&value=123456&key=authCode",
},
{
EndOfLineFlag: true,
Text: "name=Tender&value=4r7i001556529591000&key=txRef",
},
{
EndOfLineFlag: true,
Text: "name=Reference&value=003&key=mref",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Type&value=GOODS_SERVICES&key=txtype",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=TOTAL&value=%e2%82%ac%c2%a01.00&key=totalAmount",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=APPROVED&key=approved",
},
],
},
RequiredSignatureFlag: false,
},
{
DocumentQualifier: "CustomerReceipt",
OutputContent: {
OutputFormat: "Text",
OutputText: [
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "key=header1",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "key=header2",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=CARDHOLDER%20COPY&key=cardholderHeader",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Date&value=29%2f04%2f19&key=txdate",
},
{
EndOfLineFlag: true,
Text: "name=Time&value=10%3a19%3a51&key=txtime",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Card&value=%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a%2a3511&key=pan",
},
{
EndOfLineFlag: true,
Text: "name=Pref.%20name&value=MCC%20351%20v1%202&key=preferredName",
},
{
EndOfLineFlag: true,
Text: "name=Card%20type&value=mc&key=cardType",
},
{
EndOfLineFlag: true,
Text: "name=Payment%20method&value=mc&key=paymentMethod",
},
{
EndOfLineFlag: true,
Text: "name=Payment%20variant&value=mc&key=paymentMethodVariant",
},
{
EndOfLineFlag: true,
Text: "name=Entry%20mode&value=Contactless%20swipe&key=posEntryMode",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=AID&value=A0000000041010&key=aid",
},
{
EndOfLineFlag: true,
Text: "name=MID&value=1000&key=mid",
},
{
EndOfLineFlag: true,
Text: "name=TID&value=P400Plus-275039202&key=tid",
},
{
EndOfLineFlag: true,
Text: "name=PTID&value=75039202&key=ptid",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Auth.%20code&value=123456&key=authCode",
},
{
EndOfLineFlag: true,
Text: "name=Tender&value=4r7i001556529591000&key=txRef",
},
{
EndOfLineFlag: true,
Text: "name=Reference&value=003&key=mref",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Type&value=GOODS_SERVICES&key=txtype",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=TOTAL&value=%e2%82%ac%c2%a01.00&key=totalAmount",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
CharacterStyle: "Bold",
EndOfLineFlag: true,
Text: "name=APPROVED&key=approved",
},
{
EndOfLineFlag: true,
Text: "key=filler",
},
{
EndOfLineFlag: true,
Text: "name=Please%20retain%20for%20your%20records&key=retain",
},
{
EndOfLineFlag: true,
Text: "name=Thank%20you&key=thanks",
},
],
},
RequiredSignatureFlag: false,
},
],
PaymentResult: {
AmountsResp: {
AuthorizedAmount: 1,
Currency: "EUR",
},
OnlineFlag: true,
PaymentAcquirerData: {
AcquirerPOIID: "P400Plus-123456789",
AcquirerTransactionID: {
TimeStamp: "2019-04-29T09:19:51.000Z",
TransactionID: "8515565295894301",
},
ApprovalCode: "123456",
MerchantID: "TestMerchant",
},
PaymentInstrumentData: {
CardData: {
EntryMode: [
"Tapped",
],
MaskedPan: "411111 **** 1111",
PaymentBrand: "mc",
SensitiveCardData: {
ExpiryDate: "1225",
},
},
PaymentInstrumentType: "Card",
},
},
Response: {
AdditionalResponse: `tid=75039202&AID=A0000000041010&transactionType=GOODS_SERVICES&backendGiftcardIndi
cator=false&expiryYear=2025&acquirerAccountCode=TestPmmAcquirerAccount&alias=M900978995070104&posOrigin
alAmountCurrency=EUR&giftcardIndicator=false&authorisedAmountValue=100&pspReference=8515565295894301&pa
ymentMethodVariant=mc&cardHolderName=N%2fA&refusalReasonRaw=APPROVED&authorisationMid=1000&expiryDate=1
2%2f2025&applicationPreferredName=MCC%20351%20v1%202&acquirerCode=TestPmmAcquirer&txtime=10%3a19%3a51&i
so8601TxDate=2019-04-29T09%3a19%3a51.0000000%2b0000&cardType=mc&posOriginalAmountValue=100&offline=fals
e&aliasType=Default&txdate=29-04-2019&paymentMethod=mc&cvcResult=0%20Unknown&avsResult=0%20Unknown&mid=
1000&merchantReference=003&transactionReferenceNumber=8515565295894301&expiryMonth=12&cardSummary=3511&
posTotalAmountValue=100&posAuthAmountCurrency=EUR&cardHolderVerificationMethodResults=3F0300&authCode=1
23456&shopperCountry=NL&posEntryMode=CLESS_SWIPE&cardScheme=mc&cardBin=541333&posAuthAmountValue=100`,
Result: "Success",
},
SaleData: {
SaleTransactionID: {
TimeStamp: "2019-04-29T00:00:00.000Z",
TransactionID: "001",
},
},
},
},
});

View File

@@ -0,0 +1,116 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import { createMockClientFromResponse } from "../__mocks__/base";
import BinLookup from "../service/binLookup";
import {CostEstimateRequest, ThreeDSAvailabilityRequest, ThreeDSAvailabilityResponse} from "../typings/binLookup";
const threeDSAvailabilitySuccess = {
dsPublicKeys: [{
brand: "visa",
directoryServerId: "F013371337",
publicKey: "eyJrdHkiOiJSU0EiLCJlIjoiQVFBQiIsIm4iOiI4VFBxZkFOWk4xSUEzcHFuMkdhUVZjZ1g4LUpWZ1Y0M2diWURtYmdTY0N5SkVSN3lPWEJqQmQyaTBEcVFBQWpVUVBXVUxZU1FsRFRKYm91bVB1aXVoeVMxUHN2NTM4UHBRRnEySkNaSERkaV85WThVZG9hbmlrU095c2NHQWtBVmJJWHA5cnVOSm1wTTBwZ0s5VGxJSWVHYlE3ZEJaR01OQVJLQXRKeTY3dVlvbVpXV0ZBbWpwM2d4SDVzNzdCR2xkaE9RUVlQTFdybDdyS0pLQlUwNm1tZlktUDNpazk5MmtPUTNEak02bHR2WmNvLThET2RCR0RKYmdWRGFmb29LUnVNd2NUTXhDdTRWYWpyNmQyZkppVXlqNUYzcVBrYng4WDl6a1c3UmlxVno2SU1qdE54NzZicmg3aU9Vd2JiWmoxYWF6VG1GQ2xEb0dyY2JxOV80Nnc9PSJ9"
}],
threeDS1Supported: true,
threeDS2CardRangeDetails: [{
brandCode: "visa",
endRange: "411111111111",
startRange: "411111111111",
threeDS2Version: "2.1.0",
threeDSMethodURL: "https://pal-test.adyen.com/threeds2simulator/acs/startMethod.shtml"
}],
threeDS2supported: true
};
describe("Bin Lookup", function (): void {
it("should succeed on get 3ds availability", async function (): Promise<void> {
const client = createMockClientFromResponse(JSON.stringify(threeDSAvailabilitySuccess));
const binLookup = new BinLookup(client);
const threeDSAvailabilityRequest: ThreeDSAvailabilityRequest = {
merchantAccount: client.config.merchantAccount,
brands: ["randomBrand"],
cardNumber: "4111111111111111"
};
const {
dsPublicKeys,
threeDS2CardRangeDetails,
threeDS1Supported
}: ThreeDSAvailabilityResponse = await binLookup.get3dsAvailability(threeDSAvailabilityRequest);
expect(dsPublicKeys[0].brand).toEqual("visa");
expect(threeDS2CardRangeDetails[0].brandCode).toEqual("visa");
expect(threeDS1Supported).toEqual(true);
});
it("should have invalid merchant", async function (): Promise<void> {
const client = createMockClientFromResponse(JSON.stringify({
status: 403,
errorCode: "901",
message: "Invalid Merchant Account",
errorType: "security"
}), {code: 403});
const binLookup = new BinLookup(client);
const threeDSAvailabilityRequest: ThreeDSAvailabilityRequest = {
merchantAccount: undefined,
cardNumber: "4111111111111",
brands: []
};
try {
await binLookup.get3dsAvailability(threeDSAvailabilityRequest);
fail("Expected request to fail");
} catch (e) {
expect(e.statusCode).toEqual(403);
expect(JSON.parse(e.message).errorCode).toEqual("901");
}
});
it("should succeed on get cost estimate", async function (): Promise<void> {
const client = createMockClientFromResponse(JSON.stringify({
cardBin: {summary: "1111"},
resultCode: "Unsupported",
surchargeType: "ZERO"
}));
const binLookup = new BinLookup(client);
const costEstimateRequest: CostEstimateRequest = {
amount: { currency: "EUR", value: 1000 },
assumptions: {
assumeLevel3Data: true,
assume3DSecureAuthenticated: true
},
cardNumber: "411111111111",
merchantAccount: client.config.merchantAccount,
merchantDetails: {
countryCode: "NL",
mcc: "7411",
enrolledIn3DSecure: true
},
shopperInteraction: "Ecommerce"
};
const {cardBin, resultCode, surchargeType} = await binLookup.getCostEstimate(costEstimateRequest);
expect(cardBin.summary).toEqual("1111");
expect(resultCode).toEqual("Unsupported");
expect(surchargeType).toEqual("ZERO");
});
});

View File

@@ -0,0 +1,267 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import { createMockClientFromResponse } from "../__mocks__/base";
import {paymentMethodsError} from "../__mocks__/checkout/paymentmethodsErrorForbidden403";
import {paymentMethodsSuccess} from "../__mocks__/checkout/paymentMethodsSuccess";
import {paymentsError} from "../__mocks__/checkout/paymentsErrorInvalidData422";
import {paymentsSuccess} from "../__mocks__/checkout/paymentsSuccess";
import {paymentDetailsError} from "../__mocks__/checkout/paymentsDetailsErrorInvalidData422";
import {paymentDetailsSuccess} from "../__mocks__/checkout/paymentsDetailsSuccess";
import {paymentSessionError} from "../__mocks__/checkout/paymentSessionErrorInvalidData422";
import {paymentSessionSuccess} from "../__mocks__/checkout/paymentSessionSucess";
import {paymentsResultError} from "../__mocks__/checkout/paymentsResultErrorInvalidDataPayload422";
import {paymentsResultMultibancoSuccess} from "../__mocks__/checkout/paymentsResultMultibancoSuccess";
import {paymentsResultSuccess} from "../__mocks__/checkout/paymentsResultSucess";
import Client from "../client";
import { TYPE_SCHEME } from "../typings/constants/apiConstants";
import Checkout from "../service/checkout";
import {
Amount,
DetailsRequest,
PaymentMethodsRequest,
PaymentRequest,
PaymentResponse,
PaymentSetupRequest, PaymentVerificationRequest
} from "../typings/checkout";
function createAmountObject(currency: string, value: number): Amount {
return {
currency,
value,
};
}
function createPaymentsDetailsRequest(): DetailsRequest {
return {
details: {
MD: "mdValue",
PaRes: "paResValue",
},
paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
};
}
function createPaymentsCheckoutRequest(): PaymentRequest {
const paymentMethodDetails = {
cvc: "737",
expiryMonth: "10",
expiryYear: "2018",
holderName: "John Smith",
number: "4111111111111111",
type: TYPE_SCHEME,
};
return {
amount: createAmountObject("USD", 1000),
merchantAccount: "MagentoMerchantTest",
paymentMethod: paymentMethodDetails,
reference: "Your order number",
returnUrl: "https://your-company.com/...",
};
}
function createPaymentSessionRequest(): PaymentSetupRequest {
return {
amount: createAmountObject("USD", 1000),
countryCode: "NL",
merchantAccount: "MagentoMerchantTest",
reference: "Your order number",
returnUrl: "https://your-company.com/...",
};
}
describe("Checkout", (): void => {
it("should make a payment", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentsSuccess);
const checkout: Checkout = new Checkout(client);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: PaymentResponse = await checkout.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toEqual("8535296650153317");
});
it("should not make a payment", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentsError);
const checkout: Checkout = new Checkout(client);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: PaymentResponse = await checkout.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toBeUndefined();
});
it("should have valid payment methods", async (): Promise<void> => {
const client = createMockClientFromResponse(paymentMethodsSuccess);
const checkout: Checkout = new Checkout(client);
const paymentMethodsRequest: PaymentMethodsRequest = {
merchantAccount: "MagentoMerchantTest",
};
const paymentMethodsResponse = await checkout.paymentMethods(paymentMethodsRequest);
expect(paymentMethodsResponse.paymentMethods.length).toEqual(65);
expect(paymentMethodsResponse.paymentMethods[0].name).toEqual("AliPay");
});
it("should not have valid payment methods", async (): Promise<void> => {
const client = createMockClientFromResponse(paymentMethodsError);
const checkout: Checkout = new Checkout(client);
const paymentMethodsRequest: PaymentMethodsRequest = {
merchantAccount: "MagentoMerchantTest",
};
const paymentMethodsResponse = await checkout.paymentMethods(paymentMethodsRequest);
expect(paymentMethodsResponse.paymentMethods).toBeUndefined();
});
it("should have payment details", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentDetailsSuccess);
const checkout: Checkout = new Checkout(client);
const paymentsResponse = await checkout.paymentsDetails(createPaymentsDetailsRequest());
expect(paymentsResponse.resultCode).toEqual("Authorised");
});
it("should not have payment details", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentDetailsError);
const checkout: Checkout = new Checkout(client);
const paymentsResponse = await checkout.paymentsDetails(createPaymentsDetailsRequest());
expect(paymentsResponse.resultCode).toBeUndefined();
});
it("should have payment session success", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentSessionSuccess);
const checkout: Checkout = new Checkout(client);
const paymentSessionRequest: PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkout.paymentSession(paymentSessionRequest);
expect(paymentSessionResponse.paymentSession).not.toBeUndefined();
});
it("should not have payment session success", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentSessionError);
const checkout: Checkout = new Checkout(client);
const paymentSessionRequest: PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkout.paymentSession(paymentSessionRequest);
expect(paymentSessionResponse.paymentSession).toBeUndefined();
});
it("should have payments result", async (): Promise<void> => {
const client = createMockClientFromResponse(paymentsResultSuccess);
const checkout = new Checkout(client);
const paymentResultRequest: PaymentVerificationRequest = {
payload: "This is a test payload",
};
const paymentResultResponse = await checkout.paymentResult(paymentResultRequest);
expect(paymentResultResponse.resultCode).toEqual("Authorised");
});
it("should not have payments result", async (): Promise<void> => {
const client = createMockClientFromResponse(paymentsResultError);
const checkout = new Checkout(client);
const paymentResultRequest: PaymentVerificationRequest = {
payload: "This is a test payload",
};
const paymentResultResponse = await checkout.paymentResult(paymentResultRequest);
expect(paymentResultResponse.resultCode).toBeUndefined();
});
it("should have missing identifier on live", async (): Promise<void> => {
const client = createMockClientFromResponse(paymentsResultError);
client.setEnvironment("TEST");
try {
new Checkout(client);
} catch (e) {
expect(e.message).toEqual("Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.");
}
});
it("should have custom payment details", async (): Promise<void> => {
const paymentsRequest = createPaymentsCheckoutRequest();
expect(JSON.parse("{\n"
+ " \"amount\": {\n"
+ " \"value\": 1000,\n"
+ " \"currency\": \"USD\"\n"
+ " },\n"
+ " \"merchantAccount\": \"MagentoMerchantTest\",\n"
+ " \"paymentMethod\": {\n"
+ " \"type\": \"scheme\",\n"
+ " \"number\": \"4111111111111111\",\n"
+ " \"expiryMonth\": \"10\",\n"
+ " \"expiryYear\": \"2018\",\n"
+ " \"holderName\": \"John Smith\",\n"
+ " \"cvc\": \"737\"\n"
+ " },\n"
+ " \"reference\": \"Your order number\",\n"
+ " \"returnUrl\": \"https://your-company.com/...\"\n"
+ "}")).toEqual(paymentsRequest);
paymentsRequest.paymentMethod = {
testKey: "testValue",
type: "testType",
};
expect(JSON.parse("{\n"
+ " \"amount\": {\n"
+ " \"value\": 1000,\n"
+ " \"currency\": \"USD\"\n"
+ " },\n"
+ " \"merchantAccount\": \"MagentoMerchantTest\",\n"
+ " \"paymentMethod\": {\n"
+ " \"testKey\": \"testValue\",\n"
+ " \"type\": \"testType\"\n"
+ " },\n"
+ " \"reference\": \"Your order number\",\n"
+ " \"returnUrl\": \"https://your-company.com/...\"\n"
+ "}")).toEqual(JSON.parse(JSON.stringify(paymentsRequest)));
});
it("should succeed on multibanco payment", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(paymentsResultMultibancoSuccess);
const checkout: Checkout = new Checkout(client);
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
const paymentsResponse: PaymentResponse = await checkout.payments(paymentsRequest);
expect(paymentsResponse.pspReference).toEqual("8111111111111111");
expect(paymentsResponse.additionalData["comprafacil.amount"]).toEqual("101.01");
expect(paymentsResponse.additionalData["comprafacil.deadline"]).toEqual("3");
expect(paymentsResponse.additionalData["comprafacil.entity"]).toEqual("12345");
});
it("should return sepa payment method details", async (): Promise<void> => {
const defaultPaymentMethods = {
sepaIbanNumber: "DE87123456781234567890",
sepaOwnerName: "A. Schneider",
type: "sepadirectdebit",
};
const paymentsRequest = createPaymentsCheckoutRequest();
paymentsRequest.paymentMethod = defaultPaymentMethods;
expect(JSON.parse("{\n"
+ " \"amount\": {\n"
+ " \"value\": 1000,\n"
+ " \"currency\": \"USD\"\n"
+ " },\n"
+ " \"merchantAccount\": \"MagentoMerchantTest\",\n"
+ " \"paymentMethod\": {\n"
+ " \"type\": \"sepadirectdebit\",\n"
+ " \"sepaOwnerName\": \"A. Schneider\",\n"
+ " \"sepaIbanNumber\": \"DE87123456781234567890\"\n"
+ " },\n"
+ " \"reference\": \"Your order number\",\n"
+ " \"returnUrl\": \"https://your-company.com/...\"\n"
+ "}")).toEqual(JSON.parse(JSON.stringify(paymentsRequest)));
});
});

View File

@@ -0,0 +1,17 @@
import { createMockClientFromResponse } from "../__mocks__/base";
import {originKeysSuccess} from "../__mocks__/checkoutUtility/originkeysSuccess";
import CheckoutUtility from "../service/checkoutUtility";
import {CheckoutUtilityRequest} from "../typings/checkoutUtility";
describe("Checkout Utility", (): void => {
it("should get origin keys", async (): Promise<void> => {
const client = createMockClientFromResponse(originKeysSuccess);
const checkoutUtility = new CheckoutUtility(client);
const originKeysRequest: CheckoutUtilityRequest = {
originDomains: ["www.test.com", "https://www.your-domain2.com"],
};
const originKeysResponse = await checkoutUtility.originKeys(originKeysRequest);
expect(originKeysResponse.originKeys["https://www.your-domain1.com"])
.toEqual("pub.v2.7814286629520534.aHR0cHM6Ly93d3cueW91ci1kb21haW4xLmNvbQ.UEwIBmW9-c_uXo5wSEr2w8Hz8hVIpujXPHjpcEse3xI");
});
});

View File

@@ -0,0 +1,65 @@
import authorisationTrue from "../__mocks__/notification/authorisationTrue.json";
import captureTrue from "../__mocks__/notification/captureTrue.json";
import captureFalse from "../__mocks__/notification/captureFalse.json";
import refundTrue from "../__mocks__/notification/refundTrue.json";
import refundFalse from "../__mocks__/notification/refundFalse.json";
import NotificationRequest from "../notification/notificationRequest";
import {NotificationEnum, NotificationRequestItem} from "../typings/notification";
describe("Notification Test", function (): void {
it("should return authorisation success", function (): void {
const notificationRequest = new NotificationRequest(authorisationTrue);
expect(notificationRequest.notificationItems).toHaveLength(1);
const notificationRequestItem: NotificationRequestItem = notificationRequest.notificationItems[0];
expect(NotificationEnum.EVENT_CODE_AUTHORISATION).toEqual(notificationRequestItem.eventCode);
expect(notificationRequestItem.success === "true").toBeTruthy();
expect(notificationRequestItem.pspReference).toEqual("123456789");
});
it("should return capture success", function (): void {
const notificationRequest = new NotificationRequest(captureTrue);
expect(notificationRequest.notificationItems).toHaveLength(1);
const notificationRequestItem = notificationRequest.notificationItems[0];
expect(NotificationEnum.EVENT_CODE_CAPTURE).toEqual(notificationRequestItem.eventCode);
expect(notificationRequestItem.success === "true").toBeTruthy();
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
});
it("should return capture fail", function (): void {
const notificationRequest = new NotificationRequest(captureFalse);
expect(notificationRequest.notificationItems).toHaveLength(1);
const notificationRequestItem = notificationRequest.notificationItems[0];
expect(NotificationEnum.EVENT_CODE_CAPTURE).toEqual(notificationRequestItem.eventCode);
expect(notificationRequestItem.success === "true").toBeFalsy();
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
});
it("should return refund success", function (): void {
const notificationRequest = new NotificationRequest(refundTrue);
expect(notificationRequest.notificationItems).toHaveLength(1);
const notificationRequestItem = notificationRequest.notificationItems[0];
expect(NotificationEnum.EVENT_CODE_REFUND).toEqual(notificationRequestItem.eventCode);
expect(notificationRequestItem.success === "true").toBeTruthy();
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
expect(notificationRequestItem.eventDate).toBeDefined();
});
it("should return refund fail", function (): void {
const notificationRequest = new NotificationRequest(refundFalse);
expect(notificationRequest.notificationItems).toHaveLength(1);
const notificationRequestItem = notificationRequest.notificationItems[0];
expect(NotificationEnum.EVENT_CODE_REFUND).toEqual(notificationRequestItem.eventCode);
expect(notificationRequestItem.success === "true").toBeFalsy();
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
expect(notificationRequestItem.eventDate).toBeDefined();
});
});

View File

@@ -0,0 +1,139 @@
import { createMockClientFromResponse } from "../__mocks__/base";
import Payout from "../service/payout";
import {
ModifyRequest,
StoreDetailAndSubmitRequest,
StoreDetailRequest, SubmitRequest
} from "../typings/payout";
import { FRAUD_MANUAL_REVIEW, FRAUD_RESULT_TYPE } from "../typings/constants/apiConstants";
const storeDetailAndSubmitThirdParty = JSON.stringify({
additionalData: {
fraudResultType: "GREEN",
fraudManualReview: "false",
},
pspReference: "8515131751004933",
resultCode: "[payout-submit-received]"
});
const storeDetail = JSON.stringify({
pspReference: "8515136787207087",
recurringDetailReference: "8415088571022720",
resultCode: "Success"
});
const amountAndReference = {
amount: {
value: 1000,
currency: "USD"
},
reference: "randomReference",
};
const defaultData = {
dateOfBirth: new Date(),
nationality: "NL",
shopperEmail: "johndoe@email.com",
shopperReference: "shopperReference",
};
const mockStoreDetailRequest = (merchantAccount: string): StoreDetailRequest => ({
...defaultData,
entityType: "NaturalPerson",
recurring: {
contract: "ONECLICK"
},
merchantAccount,
});
const mockSubmitRequest = (merchantAccount: string): SubmitRequest => ({
selectedRecurringDetailReference: "LATEST",
recurring: {
contract: "ONECLICK"
},
...defaultData,
...amountAndReference,
merchantAccount,
});
const mockStoreDetailAndSubmitRequest = (merchantAccount: string): StoreDetailAndSubmitRequest => ({
...amountAndReference,
...(mockStoreDetailRequest(merchantAccount)),
});
describe("PayoutTest", function (): void {
it("should succeed on store detail and submit third party", async function (): Promise<void> {
const client = createMockClientFromResponse(storeDetailAndSubmitThirdParty);
const payout = new Payout(client);
const request: StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest(client.config.merchantAccount);
const result = await payout.storeDetail(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toEqual("8515131751004933");
expect(result.additionalData[FRAUD_RESULT_TYPE]).toEqual("GREEN");
expect(result.additionalData[FRAUD_MANUAL_REVIEW]).toEqual("false");
});
it("should succeed on store detail", async function (): Promise<void> {
const client = createMockClientFromResponse(storeDetail);
const payout = new Payout(client);
const request: StoreDetailRequest = mockStoreDetailRequest(client.config.merchantAccount);
const result = await payout.storeDetail(request);
expect("Success").toEqual(result.resultCode);
expect("8515136787207087").toEqual(result.pspReference);
expect("8415088571022720").toEqual(result.recurringDetailReference);
});
it("should succeed on confirm third party", async function (): Promise<void> {
const client = createMockClientFromResponse(JSON.stringify({
pspReference: "8815131762537886",
response: "[payout-confirm-received]"
}));
const payout = new Payout(client);
const request: ModifyRequest = {
merchantAccount: client.config.merchantAccount,
originalReference: "reference"
};
const result = await payout.confirmThirdParty(request);
expect(result.response).toEqual("[payout-confirm-received]");
expect(result.pspReference).toEqual("8815131762537886");
});
it("should succeed on submit third party", async function (): Promise<void> {
const client = createMockClientFromResponse(storeDetailAndSubmitThirdParty);
const payout = new Payout(client);
const request: SubmitRequest = mockSubmitRequest(client.config.merchantAccount);
const result = await payout.submitThirdparty(request);
expect(result.resultCode).toEqual("[payout-submit-received]");
expect(result.pspReference).toEqual("8515131751004933");
expect(result.additionalData[FRAUD_RESULT_TYPE]).toEqual("GREEN");
expect(result.additionalData[FRAUD_MANUAL_REVIEW]).toEqual("false");
});
it("should succeed on decline third party", async function (): Promise<void> {
const client = createMockClientFromResponse(JSON.stringify({
pspReference: "8815131762537886",
response: "[payout-confirm-received]"
}));
const payout = new Payout(client);
const request: ModifyRequest = {
merchantAccount: client.config.merchantAccount,
originalReference: "reference"
};
const result = await payout.declineThirdParty(request);
expect(result.response).toEqual("[payout-confirm-received]");
expect(result.pspReference).toEqual("8815131762537886");
});
});

View File

@@ -0,0 +1,40 @@
import { createMockClientFromResponse } from "../__mocks__/base";
import { disableSuccess } from "../__mocks__/recurring/disableSuccess";
import { listRecurringDetailsSuccess } from "../__mocks__/recurring/listRecurringDetailsSuccess";
import Recurring from "../service/recurring";
import { DisableRequest, RecurringDetailsRequest } from "../typings/recurring";
const createRecurringDetailsRequest = (): RecurringDetailsRequest => {
return {
merchantAccount: "MerchantAccount",
recurring: {contract: "ONECLICK"},
shopperReference: "test-123",
};
};
describe("Recurring", (): void => {
it("should test have recurring details list", async (): Promise<void> => {
const client = createMockClientFromResponse(listRecurringDetailsSuccess);
const recurring = new Recurring(client);
const request = createRecurringDetailsRequest();
const result = await recurring.listRecurringDetails(request);
expect(result.details).toHaveLength(2);
const [recurringDetail] = result.details;
expect(recurringDetail.recurringDetailReference).toEqual("recurringReference");
expect(recurringDetail.alias).toEqual("cardAlias");
expect(recurringDetail.card.number).toEqual("1111");
});
it("should disable", async (): Promise<void> => {
const client = createMockClientFromResponse(disableSuccess);
const recurring = new Recurring(client);
const request: DisableRequest = {
merchantAccount: "MerchantAccount",
recurringDetailReference: "reference",
shopperReference: "test-123",
};
const result = await recurring.disable(request);
expect(result.response).toEqual("[detail-successfully-disabled]");
});
});

View File

@@ -0,0 +1,69 @@
import {createMockClientFromResponse, createTerminalAPIPaymentRequest} from "../__mocks__/base";
import {asyncRes} from "../__mocks__/terminalApi/async";
import {syncRes} from "../__mocks__/terminalApi/sync";
import Client from "../client";
import TerminalCloudAPI from "../service/terminalCloudAPI";
import {MessageHeader, SaleToPoiResponse, TerminalApiRequest, TerminalApiResponse} from "../typings/terminal";
describe("Terminal Cloud API", (): void => {
it("should make an async payment request", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(asyncRes);
const terminalCloudAPI: TerminalCloudAPI = new TerminalCloudAPI(client);
const terminalAPIPaymentRequest: TerminalApiRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
const requestResponse: string = await terminalCloudAPI.async(terminalAPIPaymentRequest);
expect(requestResponse).toEqual("ok");
});
it("should make a sync payment request", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(syncRes);
const terminalCloudAPI: TerminalCloudAPI = new TerminalCloudAPI(client);
const terminalAPIPaymentRequest: TerminalApiRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
const terminalAPIResponse: TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
const saleToPoiResponse: SaleToPoiResponse = terminalAPIResponse.saleToPoiResponse;
const messageHeader: MessageHeader = saleToPoiResponse.messageHeader;
expect(messageHeader.messageType).toEqual("Response");
expect(messageHeader.messageClass).toEqual("Service");
expect(messageHeader.messageCategory).toEqual("Payment");
expect(messageHeader.protocolVersion).toEqual("3.0");
expect(messageHeader.saleId).toEqual("001");
expect(messageHeader.serviceId).toEqual("1234567890");
expect(messageHeader.poiid).toEqual("P400Plus-123456789");
const response = saleToPoiResponse.paymentResponse.response;
expect(response.result).toEqual("Success");
expect(response.additionalResponse).toBeTruthy();
const poiData = saleToPoiResponse.paymentResponse.poiData;
expect(poiData.poiReconciliationId).toEqual("1000");
expect(poiData.poiTransactionId.transactionId).toEqual("4r7i001556529591000.8515565295894301");
expect(poiData.poiTransactionId.timeStamp).toEqual("2019-04-29T00:00:00.000Z");
const saleData = saleToPoiResponse.paymentResponse.saleData;
expect(saleData.saleTransactionId.transactionId).toEqual("001");
expect(saleData.saleTransactionId.timeStamp).toEqual("2019-04-29T00:00:00.000Z");
expect(saleToPoiResponse.paymentResponse.paymentReceipt.length).toBeGreaterThan(0);
saleToPoiResponse.paymentResponse.paymentReceipt.forEach((receipt): void => {
expect(receipt.outputContent.outputFormat).toEqual("Text");
expect(receipt.outputContent.outputText.length).toBeGreaterThan(0);
receipt.outputContent.outputText.forEach((outputText): void => {
expect(outputText.text).toBeTruthy();
});
});
const {paymentResult} = saleToPoiResponse.paymentResponse;
expect(paymentResult.onlineFlag).toBeTruthy();
expect(paymentResult.paymentAcquirerData.acquirerPoiid).toEqual("P400Plus-123456789");
expect(paymentResult.paymentAcquirerData.approvalCode).toEqual("123456");
expect(paymentResult.paymentAcquirerData.merchantId).toEqual("TestMerchant");
expect(paymentResult.paymentInstrumentData.cardData.paymentBrand).toEqual("mc");
expect(paymentResult.paymentInstrumentData.cardData.maskedPan).toEqual("411111 **** 1111");
expect(paymentResult.paymentInstrumentData.paymentInstrumentType).toEqual("Card");
expect(paymentResult.amountsResp.currency).toEqual("EUR");
expect(paymentResult.amountsResp.authorizedAmount).toEqual(1);
});
});

View File

@@ -0,0 +1,67 @@
import {createMockClientFromResponse, createTerminalAPIPaymentRequest} from "../__mocks__/base";
import {localRes} from "../__mocks__/terminalApi/local";
import Client from "../client";
import TerminalLocalAPI from "../service/terminalLocalAPI";
import {SecurityKey, TerminalApiRequest, TerminalApiResponse} from "../typings/terminal";
describe("Terminal Local API", (): void => {
it("should make a local payment", async (): Promise<void> => {
const client: Client = createMockClientFromResponse(localRes);
const terminalLocalAPI: TerminalLocalAPI = new TerminalLocalAPI(client);
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
const securityKey: SecurityKey = {
adyenCryptoVersion: 1,
keyIdentifier: "CryptoKeyIdentifier12345",
keyVersion: 1,
passphrase: "p@ssw0rd123456",
};
const terminalApiResponse: TerminalApiResponse =
await terminalLocalAPI.request(terminalAPIPaymentRequest, securityKey);
const saleToPoiResponse = terminalApiResponse.saleToPoiResponse;
const messageHeader = saleToPoiResponse.messageHeader;
expect(messageHeader.messageType).toEqual("Response");
expect(messageHeader.messageClass).toEqual("Service");
expect(messageHeader.messageCategory).toEqual("Payment");
expect(messageHeader.protocolVersion).toEqual("3.0");
expect(messageHeader.saleId).toEqual("325488592");
expect(messageHeader.serviceId).toEqual("325488592");
expect(messageHeader.poiid).toEqual("P400Plus-275039202");
const response = saleToPoiResponse.paymentResponse.response;
expect(response.result).toEqual("Success");
expect(response.additionalResponse).toBeTruthy();
const poiData = saleToPoiResponse.paymentResponse.poiData;
expect(poiData.poiReconciliationId).toEqual("1000");
expect(poiData.poiTransactionId.transactionId).toEqual("4r7i001557325515012.8815573255107661");
expect(poiData.poiTransactionId.timeStamp).toEqual("2019-05-08T14:25:15.000Z");
const saleData = saleToPoiResponse.paymentResponse.saleData;
expect(saleData.saleTransactionId.transactionId).toEqual("999");
expect(saleData.saleTransactionId.timeStamp).toEqual("2019-05-08T14:24:48.598Z");
expect(saleToPoiResponse.paymentResponse.paymentReceipt.length).toBeGreaterThan(0);
saleToPoiResponse.paymentResponse.paymentReceipt.forEach((receipt): void => {
expect(receipt.outputContent.outputFormat).toEqual("Text");
expect(receipt.outputContent.outputText.length).toBeGreaterThan(0);
receipt.outputContent.outputText.forEach((outputText): void => {
expect(outputText.text).toBeTruthy();
});
});
const paymentResult = saleToPoiResponse.paymentResponse.paymentResult;
expect(paymentResult.onlineFlag).toBeTruthy();
expect(paymentResult.paymentAcquirerData.acquirerPoiid).toEqual("P400Plus-275039202");
expect(paymentResult.paymentAcquirerData.approvalCode).toEqual("123456");
expect(paymentResult.paymentAcquirerData.merchantId).toEqual("TestMerchantRenatoTest");
expect(paymentResult.paymentInstrumentData.cardData.paymentBrand).toEqual("mc");
expect(paymentResult.paymentInstrumentData.cardData.maskedPan).toEqual("541333 **** 0010");
expect(paymentResult.paymentInstrumentData.paymentInstrumentType).toEqual("Card");
expect(paymentResult.amountsResp.currency).toEqual("EUR");
expect(paymentResult.amountsResp.authorizedAmount).toEqual(1);
});
});

View File

@@ -0,0 +1,31 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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";
class ApiKeyAuthenticatedService extends Service {
protected constructor(client: Client) {
super(client);
this.apiKeyRequired = true;
}
}
export default ApiKeyAuthenticatedService;

157
src/client.ts Normal file
View File

@@ -0,0 +1,157 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Config from "./config";
import ClientInterface from "./httpClient/clientInterface";
import HttpURLConnectionClient from "./httpClient/httpURLConnectionClient";
import { Environment } from "./typings/enums/environment";
type ClientParametersOverload =
| { config: Config }
| { config: Config; 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 }
| { username: string; password: string; environment: Environment; applicationName: string; liveEndpointUrlPrefix: string; httpClient: ClientInterface }
| { apiKey: string; environment: Environment }
| { apiKey: string; environment: Environment; httpClient: ClientInterface }
| { apiKey: string; environment: Environment; liveEndpointUrlPrefix: string; httpClient: ClientInterface };
interface ClientParameters {
config?: Config;
username?: string;
password?: string;
environment?: Environment;
applicationName?: string;
liveEndpointUrlPrefix?: string;
apiKey?: string;
httpClient?: ClientInterface;
}
class Client {
public static ENDPOINT_TEST: string = "https://pal-test.adyen.com";
public static ENDPOINT_LIVE: string = "https://pal-live.adyen.com";
public static ENDPOINT_LIVE_SUFFIX: string = "-pal-live.adyenpayments.com";
public static HPP_TEST: string = "https://test.adyen.com/hpp";
public static HPP_LIVE: string = "https://live.adyen.com/hpp";
public static MARKETPAY_ENDPOINT_TEST: string = "https://cal-test.adyen.com/cal/services";
public static MARKETPAY_ENDPOINT_LIVE: string = "https://cal-live.adyen.com/cal/services";
public static API_VERSION: string = "v49";
public static RECURRING_API_VERSION: string = "v30";
public static MARKETPAY_ACCOUNT_API_VERSION: string = "v4";
public static MARKETPAY_FUND_API_VERSION: string = "v3";
public static MARKETPAY_NOTIFICATION_API_VERSION: string = "v1";
public static LIB_NAME: string = "adyen-node-api-library";
public static LIB_VERSION: string = "1.0.0";
public static CHECKOUT_ENDPOINT_TEST: string = "https://checkout-test.adyen.com/checkout";
public static CHECKOUT_ENDPOINT_LIVE_SUFFIX: string = "-checkout-live.adyenpayments.com/checkout";
public static CHECKOUT_API_VERSION: string = "v49";
public static BIN_LOOKUP_PAL_SUFFIX = "/pal/servlet/BinLookup/";
public static BIN_LOOKUP_API_VERSION = "v40";
public static CHECKOUT_UTILITY_API_VERSION: string = "v1";
public static TERMINAL_API_ENDPOINT_TEST: string = "https://terminal-api-test.adyen.com";
public static TERMINAL_API_ENDPOINT_LIVE: string = "https://terminal-api-live.adyen.com";
public static ENDPOINT_PROTOCOL: string = "https://";
private _httpClient: ClientInterface;
private _config: Config;
public constructor(clientParameters: ClientParametersOverload);
public constructor(options: ClientParameters) {
if (options.config) {
this._config = options.config;
} else {
this._config = new Config();
}
if (options.environment) {
this.setEnvironment(options.environment, options.liveEndpointUrlPrefix);
if (options.username && options.password && options.applicationName) {
this._config.username = options.username;
this._config.password = options.password;
this._config.applicationName = options.applicationName;
}
if (options.apiKey) {
this._config.apiKey = options.apiKey;
}
}
if (options.httpClient) {
this._httpClient = options.httpClient;
}
}
public setEnvironment(environment: Environment, liveEndpointUrlPrefix?: string): void {
this._config.environment = environment;
if (environment === "TEST") {
this._config.endpoint = Client.ENDPOINT_TEST;
this._config.marketPayEndpoint = Client.MARKETPAY_ENDPOINT_TEST;
this._config.hppEndpoint = Client.HPP_TEST;
this._config.checkoutEndpoint = Client.CHECKOUT_ENDPOINT_TEST;
this._config.terminalApiCloudEndpoint = Client.TERMINAL_API_ENDPOINT_TEST;
} else if (environment === "LIVE") {
this._config.endpoint = Client.ENDPOINT_LIVE;
this._config.marketPayEndpoint = Client.MARKETPAY_ENDPOINT_LIVE;
this._config.hppEndpoint = Client.HPP_LIVE;
if (liveEndpointUrlPrefix) {
this._config.endpoint =
`${Client.ENDPOINT_PROTOCOL}${liveEndpointUrlPrefix}${Client.ENDPOINT_LIVE_SUFFIX}`;
this._config.checkoutEndpoint =
`${Client.ENDPOINT_PROTOCOL}${liveEndpointUrlPrefix}${Client.CHECKOUT_ENDPOINT_LIVE_SUFFIX}`;
} else {
this._config.endpoint = Client.ENDPOINT_LIVE;
this._config.checkoutEndpoint = undefined;
}
}
}
public get httpClient(): ClientInterface {
if (!this._httpClient) {
this._httpClient = new HttpURLConnectionClient();
}
return this._httpClient;
}
public set httpClient(httpClient: ClientInterface) {
this._httpClient = httpClient;
}
public get config(): Config {
return this._config;
}
public set config(config: Config) {
this._config = config;
}
public setApplicationName(applicationName: string): void {
this.config.applicationName = applicationName;
}
public setTimeouts(connectionTimeoutMillis: number, readTimeoutMillis: number): void {
this.config.connectionTimeoutMillis = connectionTimeoutMillis;
this.config.readTimeoutMillis = readTimeoutMillis;
}
}
export default Client;

226
src/config.ts Normal file
View File

@@ -0,0 +1,226 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import { Environment } from "./typings/enums/environment";
interface ConfigConstructor {
username?: string;
password?: string;
merchantAccount?: string;
environment?: Environment;
endpoint?: string;
marketPayEndpoint?: string;
applicationName?: string;
apiKey?: string;
connectionTimeoutMillis?: number;
readTimeoutMillis?: number;
certificatePath?: string;
hppEndpoint?: string;
skinCode?: string;
hmacKey?: string;
checkoutEndpoint?: string;
terminalApiCloudEndpoint?: string;
terminalApiLocalEndpoint?: string;
}
class Config {
protected _username: string;
protected _password: string;
protected _merchantAccount: string;
protected _environment: Environment;
protected _endpoint: string;
protected _marketPayEndpoint: string;
protected _applicationName: string;
protected _apiKey: string;
protected _connectionTimeoutMillis: number;
protected _readTimeoutMillis: number;
protected _certificatePath: string;
protected _hppEndpoint: string;
protected _skinCode: string;
protected _hmacKey: string;
protected _checkoutEndpoint: string;
protected _terminalApiCloudEndpoint: string;
protected _terminalApiLocalEndpoint: string;
public constructor(options: ConfigConstructor = {}) {
this._username = options.username;
this._password = options.password;
this._merchantAccount = options.merchantAccount;
this._environment = options.environment;
this._endpoint = options.endpoint;
this._marketPayEndpoint = options.marketPayEndpoint;
this._applicationName = options.applicationName;
this._apiKey = options.apiKey;
this._connectionTimeoutMillis = options.connectionTimeoutMillis || 30000;
this._readTimeoutMillis = options.readTimeoutMillis || 3000;
this._certificatePath = options.certificatePath;
this._hppEndpoint = options.hppEndpoint;
this._skinCode = options.skinCode;
this._hmacKey = options.hmacKey;
this._checkoutEndpoint = options.checkoutEndpoint;
this._terminalApiCloudEndpoint = options.terminalApiCloudEndpoint;
this._terminalApiLocalEndpoint = options.terminalApiLocalEndpoint;
}
public get username(): string {
return this._username;
}
public set username(username: string) {
this._username = username;
}
public get password(): string {
return this._password;
}
public set password(password: string) {
this._password = password;
}
public get merchantAccount(): string {
return this._merchantAccount;
}
public set merchantAccount(merchantAccount: string) {
this._merchantAccount = merchantAccount;
}
public get environment(): Environment {
return this._environment;
}
public set environment(environment: Environment) {
this._environment = environment;
}
public get endpoint(): string {
return this._endpoint;
}
public set endpoint(endpoint: string) {
this._endpoint = endpoint;
}
public get marketPayEndpoint(): string {
return this._marketPayEndpoint;
}
public set marketPayEndpoint(marketPayEndpoint: string) {
this._marketPayEndpoint = marketPayEndpoint;
}
public get applicationName(): string {
return this._applicationName;
}
public set applicationName(applicationName: string) {
this._applicationName = applicationName;
}
public get apiKey(): string {
return this._apiKey;
}
public set apiKey(apiKey: string) {
this._apiKey = apiKey;
}
public get hppEndpoint(): string {
return this._hppEndpoint;
}
public set hppEndpoint(hppEndpoint: string) {
this._hppEndpoint = hppEndpoint;
}
public get skinCode(): string {
return this._skinCode;
}
public set skinCode(skinCode: string) {
this._skinCode = skinCode;
}
public get hmacKey(): string {
return this._hmacKey;
}
public set hmacKey(hmacKey: string) {
this._hmacKey = hmacKey;
}
public get checkoutEndpoint(): string {
if (!this._checkoutEndpoint) {
const message = "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.";
throw new Error(message);
}
return this._checkoutEndpoint;
}
public set checkoutEndpoint(checkoutEndpoint: string) {
this._checkoutEndpoint = checkoutEndpoint;
}
public get terminalApiCloudEndpoint(): string {
return this._terminalApiCloudEndpoint;
}
public set terminalApiCloudEndpoint(terminalApiCloudEndpoint: string) {
this._terminalApiCloudEndpoint = terminalApiCloudEndpoint;
}
public get terminalApiLocalEndpoint(): string {
return this._terminalApiLocalEndpoint;
}
public set terminalApiLocalEndpoint(terminalApiLocalEndpoint: string) {
this._terminalApiLocalEndpoint = terminalApiLocalEndpoint;
}
public get connectionTimeoutMillis(): number {
return this._connectionTimeoutMillis;
}
public set connectionTimeoutMillis(connectionTimeoutMillis: number) {
this._connectionTimeoutMillis = connectionTimeoutMillis;
}
public get readTimeoutMillis(): number {
return this._readTimeoutMillis;
}
public set readTimeoutMillis(readTimeoutMillis: number) {
this._readTimeoutMillis = readTimeoutMillis;
}
public set certificatePath(certificatePath: string) {
this._certificatePath = certificatePath;
}
public get certificatePath(): string {
return this._certificatePath;
}
}
export default Config;

View File

@@ -0,0 +1,42 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Resource from "../service/resource";
import { RequestOptions } from "../typings/requestOptions";
async function getJsonResponse<T>(resource: Resource, jsonRequest: T | string, requestOptions?: RequestOptions): Promise<string>;
async function getJsonResponse<T, R>(resource: Resource, jsonRequest: T | string, requestOptions?: RequestOptions): Promise<R>;
async function getJsonResponse<T, R>(
resource: Resource,
jsonRequest: T | string,
requestOptions: RequestOptions = {},
): Promise<R | string> {
const response = await resource.request(
typeof jsonRequest === "string" ? jsonRequest : JSON.stringify(jsonRequest),
requestOptions);
try {
return JSON.parse(response);
} catch (e) {
return response;
}
}
export default getJsonResponse;

View File

@@ -0,0 +1,33 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Config from "../config";
import { RequestOptions } from "../typings/requestOptions";
import { AgentOptions } from "https";
interface ClientInterface {
request(
endpoint: string, json: string, config: Config, isApiKeyRequired: boolean, requestOptions?: RequestOptions,
): Promise<string>;
post(endpoint: string, postParameters: [string, string][], config: Config): Promise<string>;
proxy?: AgentOptions;
}
export default ClientInterface;

View File

@@ -0,0 +1,72 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {IncomingHttpHeaders, IncomingMessage} from "http";
class HttpClientException implements Error {
private _code: number = 0;
private _responseHeaders: IncomingHttpHeaders;
private readonly _message: string;
private readonly _name: string;
private _responseBody: IncomingMessage;
public constructor(message: string, code?: number, responseHeaders?: IncomingHttpHeaders, responseBody?: IncomingMessage) {
this._name = "HttpClientException";
this._message = message;
this._code = code;
this._responseHeaders = responseHeaders;
this._responseBody = responseBody;
}
public get message(): string {
return this._message;
}
public get name(): string {
return this._name;
}
public get code(): number {
return this._code;
}
public set code(value: number) {
this._code = value;
}
public get responseHeaders(): IncomingHttpHeaders {
return this._responseHeaders;
}
public set responseHeaders(value: IncomingHttpHeaders) {
this._responseHeaders = value;
}
public get responseBody(): IncomingMessage {
return this._responseBody;
}
public set responseBody(value: IncomingMessage) {
this._responseBody = value;
}
}
export default HttpClientException;

View File

@@ -0,0 +1,181 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {ClientRequest, IncomingMessage} from "http";
import { Agent, AgentOptions, request as httpRequest } from "https";
import * as fs from "fs";
import {URL} from "url";
import Client from "../client";
import Config from "../config";
import {
ACCEPT_CHARSET,
API_KEY,
APPLICATION_JSON_TYPE,
CONTENT_TYPE,
IDEMPOTENCY_KEY,
METHOD_POST,
USER_AGENT,
} from "../typings/constants/apiConstants";
import { RequestOptions } from "../typings/requestOptions";
import ClientInterface from "./clientInterface";
import HttpClientException from "./httpClientException";
class HttpURLConnectionClient implements ClientInterface {
private static CHARSET: string = "utf-8";
private _proxy: AgentOptions;
private agentOptions: AgentOptions;
public request(
endpoint: string, json: string, config: Config, isApiRequired: boolean,
requestOptions: RequestOptions = {},
): Promise<string> {
requestOptions.headers = {};
requestOptions.timeout = config.connectionTimeoutMillis;
if (config.certificatePath) {
this.installCertificateVerifier(config.certificatePath);
}
const apiKey = config.apiKey;
if (isApiRequired || apiKey) {
requestOptions.headers[API_KEY] = apiKey;
} else {
const authString = `${config.username}:${config.password}`;
const authEncBytes = new Buffer(authString);
const authStringEnc = authEncBytes.toString();
requestOptions.headers.Authorization = `Basic ${authStringEnc}`;
}
requestOptions.headers[CONTENT_TYPE] = APPLICATION_JSON_TYPE;
const httpConnection: ClientRequest = this.createRequest(endpoint, config.applicationName, requestOptions);
return this.doPostRequest(httpConnection, json);
}
public post(endpoint: string, postParameters: [string, string][], config: Config): Promise<string> {
const postQuery: string = this.getQuery(postParameters);
const httpConnection: ClientRequest = this.createRequest(endpoint, config.applicationName, {});
return this.doPostRequest(httpConnection, postQuery);
}
public set proxy(agentOptions: AgentOptions) {
this._proxy = agentOptions;
}
private createRequest(endpoint: string, applicationName: string, requestOptions: RequestOptions): ClientRequest {
const url = new URL(endpoint);
requestOptions.hostname = url.hostname;
requestOptions.protocol = url.protocol;
requestOptions.port = url.port;
requestOptions.path = url.pathname;
if (this._proxy) {
this.agentOptions = {...this._proxy, ...this.agentOptions};
}
if (requestOptions && requestOptions.idempotencyKey) {
requestOptions.headers[IDEMPOTENCY_KEY] = requestOptions.idempotencyKey;
delete requestOptions.idempotencyKey;
}
requestOptions.agent = new Agent(this.agentOptions);
requestOptions.headers["Cache-Control"] = "no-cache";
requestOptions.method = METHOD_POST;
requestOptions.headers[ACCEPT_CHARSET] = HttpURLConnectionClient.CHARSET;
requestOptions.headers[USER_AGENT] = `${applicationName} ${Client.LIB_NAME}/${Client.LIB_VERSION}`;
return httpRequest(requestOptions);
}
private getQuery(params: [string, string][]): string {
return params.map(([key, value]): string => `${key}=${value}`).join("&");
}
private doPostRequest(httpConnection: ClientRequest, json: string): Promise<string> {
return new Promise((resolve, reject): void => {
httpConnection.flushHeaders();
httpConnection.on("response", (res: IncomingMessage): void => {
let resData = "";
if (res.statusCode && res.statusCode !== 200) {
const exception = new HttpClientException(
`HTTP Exception: ${res.statusCode}. ${res.statusMessage}`,
res.statusCode,
res.headers,
res,
);
reject(exception);
}
res.on("data", (data): void => {
resData += data;
});
res.on("end", (): void => {
if (!res.complete) {
reject(new Error("The connection was terminated while the message was still being sent"));
}
resolve(resData);
});
res.on("error", reject);
});
httpConnection.on("timeout", (): void => {
httpConnection.abort();
});
httpConnection.on("error", reject);
httpConnection.write(Buffer.from(json));
httpConnection.end();
});
}
private static setBasicAuthentication(httpConnection: ClientRequest, username: string, password: string): ClientRequest {
const authString = `${username}:${password}`;
const authEncBytes = new Buffer(authString);
const authStringEnc = authEncBytes.toString();
httpConnection.setHeader("Authorization", `Basic ${authStringEnc}`);
return httpConnection;
}
private installCertificateVerifier(terminalCertificatePath: string): void {
try {
const certificateInput = fs.readFileSync(terminalCertificatePath);
this.agentOptions = {
ca: certificateInput,
checkServerIdentity: (): undefined => {
return undefined;
},
};
} catch (e) {
throw new HttpClientException(`Error loading certificate from path: ${e.message}`);
}
}
}
export default HttpURLConnectionClient;

25
src/index.ts Normal file
View File

@@ -0,0 +1,25 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
export { default as Client } from "./client";
export { default as Config } from "./config";
export * from "./service/";
export { default as HttpURLConnectionClient } from "./httpClient/httpURLConnectionClient";

View File

@@ -0,0 +1,58 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {Convert, Notification, NotificationItem, NotificationRequestItem} from "../typings/notification";
class NotificationRequest {
public constructor(json: Notification) {
const notification = Convert.toNotification(JSON.stringify(json));
this._notificationItemContainers = notification.notificationItems;
this._live = notification.live;
}
public get notificationItemContainers(): NotificationItem[] {
return this._notificationItemContainers;
}
public set notificationItemContainers(value: NotificationItem[]) {
this._notificationItemContainers = value;
}
public get live(): string {
return this._live;
}
public set live(value: string) {
this._live = value;
}
public get notificationItems(): NotificationRequestItem[] {
if (!this._notificationItemContainers) {
return null;
}
return this._notificationItemContainers.map((container): NotificationRequestItem => container.notificationRequestItem);
}
private _live: string;
private _notificationItemContainers: NotificationItem[];
}
export default NotificationRequest;

View File

@@ -0,0 +1,40 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
class InvalidSecurityKeyException implements Error {
private readonly _message: string;
private readonly _name: string;
public constructor(message: string) {
this._message = message;
this._name = "InvalidSecurityKeyException";
}
public get message(): string {
return this._message;
}
public get name(): string {
return this._name;
}
}
export default InvalidSecurityKeyException;

128
src/security/nexoCrypto.ts Normal file
View File

@@ -0,0 +1,128 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {Cipher, createCipheriv, createDecipheriv, createHmac, randomBytes} from "crypto";
import NexoCryptoException from "../service/exception/nexoCryptoException";
import {NEXO_IV_LENGTH} from "../typings/constants/nexoConstants";
import {
MessageHeader,
NexoDerivedKey,
SaleToPoiSecuredMessage,
SecurityKey,
SecurityTrailer,
} from "../typings/terminal";
import InvalidSecurityKeyException from "./exception/invalidSecurityKeyException";
import NexoDerivedKeyGenerator from "./nexoDerivedKeyGenerator";
enum Modes {
ENCRYPT,
DECRYPT,
}
class NexoCrypto {
public static encrypt(
messageHeader: MessageHeader,
saleToPoiMessageJson: string,
securityKey: SecurityKey,
): SaleToPoiSecuredMessage {
const derivedKey: NexoDerivedKey = NexoDerivedKeyGenerator.deriveKeyMaterial(securityKey.passphrase);
const saleToPoiMessageByteArray = Buffer.from(saleToPoiMessageJson, "ascii");
const ivNonce = NexoCrypto.generateRandomIvNonce();
const encryptedSaleToPoiMessage = NexoCrypto.crypt(saleToPoiMessageByteArray, derivedKey, ivNonce, Modes.ENCRYPT);
const encryptedSaleToPoiMessageHmac = NexoCrypto.hmac(saleToPoiMessageByteArray, derivedKey);
const securityTrailer: SecurityTrailer = {
adyenCryptoVersion: securityKey.adyenCryptoVersion,
hmac: encryptedSaleToPoiMessageHmac.toString("base64"),
keyIdentifier: securityKey.keyIdentifier,
keyVersion: securityKey.keyVersion,
nonce: ivNonce.toString("base64"),
};
return {
messageHeader,
nexoBlob: encryptedSaleToPoiMessage.toString("base64"),
securityTrailer: securityTrailer,
};
}
public decrypt(saleToPoiSecureMessage: SaleToPoiSecuredMessage, securityKey: SecurityKey): string {
NexoCrypto.validateSecurityKey(securityKey);
const encryptedSaleToPoiMessageByteArray = Buffer.from(saleToPoiSecureMessage.nexoBlob, "base64");
const derivedKey = NexoDerivedKeyGenerator.deriveKeyMaterial(securityKey.passphrase);
const ivNonce = Buffer.from(saleToPoiSecureMessage.securityTrailer.nonce, "base64");
const decryptedSaleToPoiMessageByteArray =
NexoCrypto.crypt(encryptedSaleToPoiMessageByteArray, derivedKey, ivNonce, Modes.DECRYPT);
const receivedHmac = Buffer.from(saleToPoiSecureMessage.securityTrailer.hmac, "base64");
this.validateHmac(receivedHmac, decryptedSaleToPoiMessageByteArray, derivedKey);
return decryptedSaleToPoiMessageByteArray.toString("ascii");
}
private static validateSecurityKey(securityKey: SecurityKey): void {
const isValid = securityKey
&& securityKey.passphrase
&& securityKey.keyIdentifier
&& securityKey.keyVersion
&& securityKey.adyenCryptoVersion;
if (!isValid) {
throw new InvalidSecurityKeyException("Invalid Security Key");
}
}
private static crypt(bytes: Buffer, dk: NexoDerivedKey, ivNonce: Buffer, mode: Modes): Buffer {
const actualIV = Buffer.alloc(NEXO_IV_LENGTH);
for (let i = 0; i < NEXO_IV_LENGTH; i++) {
actualIV[i] = dk.iv[i] ^ ivNonce[i];
}
const cipher = mode === Modes.ENCRYPT
? createCipheriv("aes-256-cbc", dk.cipherKey, actualIV)
: createDecipheriv("aes-256-cbc", dk.cipherKey, actualIV);
let encrypted = (cipher as Cipher).update(bytes);
encrypted = Buffer.concat([encrypted, cipher.final()]);
return encrypted;
}
private static hmac(bytes: Buffer, derivedKey: NexoDerivedKey): Buffer {
const mac = createHmac("sha256", derivedKey.hmacKey);
return mac.update(bytes).digest();
}
private static generateRandomIvNonce(): Buffer {
return randomBytes(NEXO_IV_LENGTH);
}
private validateHmac(receivedHmac: Buffer, decryptedMessage: Buffer, derivedKey: NexoDerivedKey): void {
const hmac = NexoCrypto.hmac(decryptedMessage, derivedKey);
const isValid = hmac.every((item, index): boolean => item === receivedHmac[index]);
if (!isValid) {
throw new NexoCryptoException("Hmac validation failed");
}
}
}
export default NexoCrypto;

View File

@@ -0,0 +1,48 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {pbkdf2Sync} from "crypto";
import {NEXO_CIPHER_KEY_LENGTH, NEXO_HMAC_KEY_LENGTH, NEXO_IV_LENGTH} from "../typings/constants/nexoConstants";
import { NexoDerivedKey } from "../typings/terminal";
class NexoDerivedKeyGenerator {
public static deriveKeyMaterial(passphrase: string): NexoDerivedKey {
const pass = Buffer.from(passphrase, "binary");
const salt = Buffer.from("AdyenNexoV1Salt", "binary");
const iterations = 4000;
const keylen = NEXO_CIPHER_KEY_LENGTH + NEXO_HMAC_KEY_LENGTH + NEXO_IV_LENGTH;
const key = pbkdf2Sync(pass, salt, iterations, keylen * 8, "sha1");
return NexoDerivedKeyGenerator.readKeyData(key);
}
private static readKeyData(key: Buffer): NexoDerivedKey {
return {
cipherKey: key.slice(NEXO_HMAC_KEY_LENGTH, NEXO_HMAC_KEY_LENGTH + NEXO_CIPHER_KEY_LENGTH),
hmacKey: key.slice(0, NEXO_HMAC_KEY_LENGTH),
iv: key.slice(
NEXO_HMAC_KEY_LENGTH + NEXO_CIPHER_KEY_LENGTH,
NEXO_CIPHER_KEY_LENGTH + NEXO_HMAC_KEY_LENGTH + NEXO_IV_LENGTH,
),
};
}
}
export default NexoDerivedKeyGenerator;

49
src/service.ts Normal file
View File

@@ -0,0 +1,49 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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";
class Service {
protected _apiKeyRequired: boolean = false;
private _client: Client;
protected constructor(client: Client) {
this._client = client;
}
public get client(): Client {
return this._client;
}
public set client(client: Client) {
this._client = client;
}
public get apiKeyRequired(): boolean {
return this._apiKeyRequired;
}
public set apiKeyRequired(apiKeyRequired: boolean) {
this._apiKeyRequired = apiKeyRequired;
}
}
export default Service;

58
src/service/binLookup.ts Normal file
View File

@@ -0,0 +1,58 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import GetCostEstimate from "./resource/binLookup/getCostEstimate";
import Get3dsAvailability from "./resource/binLookup/get3dsAvailability";
import {
CostEstimateRequest,
CostEstimateResponse,
ThreeDSAvailabilityRequest,
ThreeDSAvailabilityResponse
} from "../typings/binLookup";
import getJsonResponse from "../helpers/getJsonResponse";
class BinLookup extends ApiKeyAuthenticatedService {
private readonly _get3dsAvailability: Get3dsAvailability;
private readonly _getCostEstimate: GetCostEstimate;
public constructor(client: Client) {
super(client);
this._get3dsAvailability = new Get3dsAvailability(this);
this._getCostEstimate = new GetCostEstimate(this);
}
public async get3dsAvailability(request: ThreeDSAvailabilityRequest): Promise<ThreeDSAvailabilityResponse> {
return await getJsonResponse<ThreeDSAvailabilityRequest, ThreeDSAvailabilityResponse>(
this._get3dsAvailability,
request
);
}
public async getCostEstimate(request: CostEstimateRequest): Promise<CostEstimateResponse> {
return await getJsonResponse<CostEstimateRequest, CostEstimateResponse>(
this._getCostEstimate,
request
);
}
}
export default BinLookup;

96
src/service/checkout.ts Normal file
View File

@@ -0,0 +1,96 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import {
DetailsRequest, PaymentMethodsRequest, PaymentMethodsResponse, PaymentRequest, PaymentResponse, PaymentSetupRequest,
PaymentSetupResponse, PaymentVerificationRequest, PaymentVerificationResponse,
} from "../typings/checkout";
import { RequestOptions } from "../typings/requestOptions";
import PaymentMethods from "./resource/checkout/paymentMethods";
import Payments from "./resource/checkout/payments";
import PaymentsDetails from "./resource/checkout/paymentsDetails";
import PaymentSession from "./resource/checkout/paymentSession";
import PaymentsResult from "./resource/checkout/paymentsResult";
class Checkout extends ApiKeyAuthenticatedService {
private readonly _payments: Payments;
private readonly _paymentMethods: PaymentMethods;
private readonly _paymentsDetails: PaymentsDetails;
private readonly _paymentSession: PaymentSession;
private readonly _paymentsResult: PaymentsResult;
public constructor(client: Client) {
super(client);
this._payments = new Payments(this);
this._paymentMethods = new PaymentMethods(this);
this._paymentsDetails = new PaymentsDetails(this);
this._paymentSession = new PaymentSession(this);
this._paymentsResult = new PaymentsResult(this);
}
public async payments(
paymentsRequest: PaymentRequest,
requestOptions?: RequestOptions,
): Promise<PaymentResponse> {
return getJsonResponse<PaymentRequest, PaymentResponse>(
this._payments,
paymentsRequest,
requestOptions,
);
}
public async paymentMethods(paymentMethodsRequest: PaymentMethodsRequest): Promise<PaymentMethodsResponse> {
return getJsonResponse<PaymentMethodsRequest, PaymentMethodsResponse>(
this._paymentMethods,
paymentMethodsRequest,
);
}
public async paymentsDetails(paymentsDetailsRequest: DetailsRequest): Promise<PaymentResponse> {
return getJsonResponse<DetailsRequest, PaymentResponse>(
this._paymentsDetails,
paymentsDetailsRequest,
);
}
public async paymentSession(
paymentSessionRequest: PaymentSetupRequest,
requestOptions?: RequestOptions,
): Promise<PaymentSetupResponse> {
return getJsonResponse<PaymentSetupRequest, PaymentSetupResponse>(
this._paymentSession,
paymentSessionRequest,
requestOptions,
);
}
public async paymentResult(paymentResultRequest: PaymentVerificationRequest): Promise<PaymentVerificationResponse> {
return getJsonResponse<PaymentVerificationRequest, PaymentVerificationResponse>(
this._paymentsResult,
paymentResultRequest,
);
}
}
export default Checkout;

View File

@@ -0,0 +1,44 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import { CheckoutUtilityRequest, CheckoutUtilityResponse } from "../typings/checkoutUtility";
import OriginKeys from "./resource/checkoutUtility/originKeys";
class CheckoutUtility extends ApiKeyAuthenticatedService {
private readonly _originKeys: OriginKeys;
public constructor(client: Client) {
super(client);
this._originKeys = new OriginKeys(this);
}
public async originKeys(originKeysRequest: CheckoutUtilityRequest): Promise<CheckoutUtilityResponse> {
return getJsonResponse<CheckoutUtilityRequest, CheckoutUtilityResponse>(
this._originKeys,
originKeysRequest,
);
}
}
export default CheckoutUtility;

View File

@@ -0,0 +1,61 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import { ApiError } from "../../typings/apiError";
class ApiException implements Error {
private _error: ApiError;
private _statusCode: number;
private readonly _message: string;
private readonly _name: string;
public constructor(message: string, statusCode: number) {
this._name = "ApiException";
this._message = message;
this._statusCode = statusCode;
}
public get error(): ApiError {
return this._error;
}
public set error(error: ApiError) {
this._error = error;
}
public get statusCode(): number {
return this._statusCode;
}
public set statusCode(statusCode: number) {
this._statusCode = statusCode;
}
public get message(): string {
return this._message;
}
public get name(): string {
return this._name;
}
}
export default ApiException;

View File

@@ -0,0 +1,40 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
class NexoCryptoException implements Error {
private readonly _message: string;
private readonly _name: string;
public constructor(message: string) {
this._name = "NexoCryptoException";
this._message = message;
}
public get message(): string {
return this._message;
}
public get name(): string {
return this._name;
}
}
export default NexoCryptoException;

29
src/service/index.ts Normal file
View File

@@ -0,0 +1,29 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
export { default as TerminalLocalAPI } from "./terminalLocalAPI";
export { default as TerminalCloudAPI } from "./terminalCloudAPI";
export { default as CheckoutAPI } from "./checkout";
export { default as CheckoutUtility } from "./checkoutUtility";
export { default as Recurring } from "./recurring";
export { default as Modification } from "./modification";
export { default as BinLookup } from "./binLookup";
export { default as Payout } from "./payout";

118
src/service/modification.ts Normal file
View File

@@ -0,0 +1,118 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { ModificationRequest, ModificationResult } from "../typings/payments";
import { RequestOptions } from "../typings/requestOptions";
import AdjustAuthorisation from "./resource/modification/adjustAuthorisation";
import Cancel from "./resource/modification/cancel";
import CancelOrRefund from "./resource/modification/cancelOrRefund";
import Capture from "./resource/modification/capture";
import Refund from "./resource/modification/refund";
import TechnicalCancel from "./resource/modification/technicalCancel";
class Modification extends Service {
private readonly _cancelOrRefund: CancelOrRefund;
private readonly _cancel: Cancel;
private readonly _capture: Capture;
private readonly _refund: Refund;
private readonly _adjustAuthorisation: AdjustAuthorisation;
private readonly _technicalCancel: TechnicalCancel;
public constructor(client: Client) {
super(client);
this._capture = new Capture(this);
this._cancelOrRefund = new CancelOrRefund(this);
this._cancel = new Cancel(this);
this._refund = new Refund(this);
this._adjustAuthorisation = new AdjustAuthorisation(this);
this._technicalCancel = new TechnicalCancel(this);
}
public async capture(
captureRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._capture,
captureRequest,
requestOptions,
);
}
public async cancelOrRefund(
cancelOrRefundRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._cancelOrRefund,
cancelOrRefundRequest,
requestOptions,
);
}
public async refund(
refundRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._refund,
refundRequest,
requestOptions,
);
}
public async cancel(
cancelRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._cancel,
cancelRequest,
requestOptions,
);
}
public async technicalCancel(
technicalCancelRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._technicalCancel,
technicalCancelRequest,
requestOptions,
);
}
public async adjustAuthorisation(
adjustAuthorisationRequest: ModificationRequest,
requestOptions?: RequestOptions,
): Promise<ModificationResult> {
return await getJsonResponse<ModificationRequest, ModificationResult>(
this._adjustAuthorisation,
adjustAuthorisationRequest,
requestOptions,
);
}
}
export default Modification;

89
src/service/payout.ts Normal file
View File

@@ -0,0 +1,89 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 DeclineThirdParty from "./resource/payout/declineThirdParty";
import StoreDetail from "./resource/payout/storeDetail";
import SubmitThirdParty from "./resource/payout/submitThirdParty";
import ConfirmThirdParty from "./resource/payout/confirmThirdParty";
import StoreDetailAndSubmitThirdParty from "./resource/payout/storeDetailAndSubmitThirdParty";
import {
ModifyRequest,
ModifyResponse,
StoreDetailAndSubmitRequest,
StoreDetailAndSubmitResponse, StoreDetailRequest, StoreDetailResponse, SubmitRequest, SubmitResponse
} from "../typings/payout";
import getJsonResponse from "../helpers/getJsonResponse";
class Payout extends Service {
private readonly _storeDetailAndSubmitThirdParty: StoreDetailAndSubmitThirdParty;
private readonly _confirmThirdParty: ConfirmThirdParty;
private readonly _declineThirdParty: DeclineThirdParty;
private readonly _storeDetail: StoreDetail;
private readonly _submitThirdParty: SubmitThirdParty;
public constructor(client: Client) {
super(client);
this._storeDetailAndSubmitThirdParty = new StoreDetailAndSubmitThirdParty(this);
this._confirmThirdParty = new ConfirmThirdParty(this);
this._declineThirdParty = new DeclineThirdParty(this);
this._storeDetail = new StoreDetail(this);
this._submitThirdParty = new SubmitThirdParty(this);
}
public async storeDetailAndSubmitThirdParty(request: StoreDetailAndSubmitRequest): Promise<StoreDetailAndSubmitResponse> {
return await getJsonResponse<StoreDetailAndSubmitRequest, StoreDetailAndSubmitResponse>(
this._storeDetailAndSubmitThirdParty,
request
);
}
public async confirmThirdParty(request: ModifyRequest): Promise<ModifyResponse> {
return await getJsonResponse<ModifyRequest, ModifyResponse>(
this._confirmThirdParty,
request
);
}
public async declineThirdParty(request: ModifyRequest): Promise<ModifyResponse> {
return await getJsonResponse<ModifyRequest, ModifyResponse>(
this._declineThirdParty,
request
);
}
public async storeDetail(request: StoreDetailRequest): Promise<StoreDetailResponse> {
return await getJsonResponse<StoreDetailRequest, StoreDetailResponse>(
this._storeDetail,
request
);
}
public async submitThirdparty(request: SubmitRequest): Promise<SubmitResponse> {
return await getJsonResponse<SubmitRequest, SubmitResponse>(
this._submitThirdParty,
request
);
}
}
export default Payout;

54
src/service/recurring.ts Normal file
View File

@@ -0,0 +1,54 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { DisableRequest, DisableResult, RecurringDetailsRequest, RecurringDetailsResult } from "../typings/recurring";
import Disable from "./resource/recurring/disable";
import ListRecurringDetails from "./resource/recurring/listRecurringDetails";
class Recurring extends Service {
private readonly _listRecurringDetails: ListRecurringDetails;
private readonly _disable: Disable;
public constructor(client: Client) {
super(client);
this._listRecurringDetails = new ListRecurringDetails(this);
this._disable = new Disable(this);
}
public async listRecurringDetails(request: RecurringDetailsRequest): Promise<RecurringDetailsResult> {
return await getJsonResponse<RecurringDetailsRequest, RecurringDetailsResult>(
this._listRecurringDetails,
request,
);
}
public async disable(request: DisableRequest): Promise<DisableResult> {
return await getJsonResponse<DisableRequest, DisableResult>(
this._disable,
request,
);
}
}
export default Recurring;

65
src/service/resource.ts Normal file
View File

@@ -0,0 +1,65 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Config from "../config";
import ClientInterface from "../httpClient/clientInterface";
import Service from "../service";
import { RequestOptions } from "../typings/requestOptions";
import ApiException from "./exception/apiException";
class Resource {
protected endpoint: string;
private service: Service;
public constructor(service: Service, endpoint: string) {
this.service = service;
this.endpoint = endpoint;
}
public async request(json: string, requestOptions?: RequestOptions): Promise<string> {
const clientInterface: ClientInterface = this.service.client.httpClient;
const config: Config = this.service.client.config;
let responseBody;
let apiException: ApiException;
try {
return await clientInterface.request(
this.endpoint,
json, config,
this.service.apiKeyRequired,
requestOptions,
);
} catch (e) {
responseBody = e.responseBody;
apiException = new ApiException(e.message, e.code);
}
try {
apiException.error = responseBody;
} catch (e) {
throw new ApiException("Invalid response or an invalid X-API-Key key was used", e.statusCode);
}
throw apiException;
}
}
export default Resource;

View File

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

View File

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

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 PaymentMethods extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentMethods`,
);
}
}
export default PaymentMethods;

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 PaymentSession extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/paymentSession`,
);
}
}
export default PaymentSession;

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 Payments extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments`,
);
}
}
export default Payments;

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 PaymentsDetails extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments/details`,
);
}
}
export default PaymentsDetails;

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 PaymentsResult extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}/payments/result`,
);
}
}
export default PaymentsResult;

View File

@@ -0,0 +1,35 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 OriginKeys extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.checkoutEndpoint}/${Client.CHECKOUT_UTILITY_API_VERSION}/originKeys`,
);
}
}
export default OriginKeys;

View File

@@ -0,0 +1,34 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 AdjustAuthorisation extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/adjustAuthorisation`,
);
}
}
export default AdjustAuthorisation;

View File

@@ -0,0 +1,34 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 Cancel extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/cancel`,
);
}
}
export default Cancel;

View File

@@ -0,0 +1,34 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 CancelOrRefund extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/cancelOrRefund`,
);
}
}
export default CancelOrRefund;

View File

@@ -0,0 +1,34 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 Capture extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/capture`,
);
}
}
export default Capture;

View File

@@ -0,0 +1,34 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 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 Refund extends Resource {
public constructor(service: Service) {
super(
service,
`${service.client.config.endpoint}/pal/servlet/Payment/${Client.API_VERSION}/refund`,
);
}
}
export default Refund;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Service from "../../../../service";
import Resource from "../../../resource";
class Async extends Resource {
public constructor(service: Service) {
super(service, service.client.config.terminalApiCloudEndpoint + "/async");
}
}
export default Async;

View File

@@ -0,0 +1,32 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Service from "../../../../service";
import Resource from "../../../resource";
class Sync extends Resource {
public constructor(service: Service) {
super(service, service.client.config.terminalApiCloudEndpoint + "/sync");
}
}
export default Sync;

View File

@@ -0,0 +1,31 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import Service from "../../../../service";
import Resource from "../../../resource";
class LocalRequest extends Resource {
public constructor(service: Service) {
super(service, service.client.config.terminalApiLocalEndpoint + ":8443/nexo/");
}
}
export default LocalRequest;

View File

@@ -0,0 +1,56 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import {Convert, TerminalApiRequest, TerminalApiResponse} from "../typings/terminal";
import Async from "./resource/terminal/cloud/async";
import Sync from "./resource/terminal/cloud/sync";
class TerminalCloudAPI extends ApiKeyAuthenticatedService {
private readonly terminalApiAsync: Async;
private readonly terminalApiSync: Sync;
public constructor(client: Client) {
super(client);
this.terminalApiAsync = new Async(this);
this.terminalApiSync = new Sync(this);
}
public async(terminalApiRequest: TerminalApiRequest): Promise<string> {
return getJsonResponse<TerminalApiRequest>(
this.terminalApiAsync,
Convert.terminalApiRequestToJson(terminalApiRequest),
);
}
public async sync(terminalApiRequest: TerminalApiRequest): Promise<TerminalApiResponse> {
const response = await getJsonResponse<TerminalApiRequest, TerminalApiResponse>(
this.terminalApiSync,
Convert.terminalApiRequestToJson(terminalApiRequest),
);
return Convert.toTerminalApiResponse(JSON.stringify(response));
}
}
export default TerminalCloudAPI;

View File

@@ -0,0 +1,75 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen NodeJS API Library
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import ApiKeyAuthenticatedService from "../apiKeyAuthenticatedService";
import Client from "../client";
import getJsonResponse from "../helpers/getJsonResponse";
import NexoCrypto from "../security/nexoCrypto";
import {
Convert,
SaleToPoiSecuredMessage,
SecurityKey,
TerminalApiRequest, TerminalApiResponse,
TerminalApiSecuredRequest,
} from "../typings/terminal";
import LocalRequest from "./resource/terminal/local/localRequest";
class TerminalLocalAPI extends ApiKeyAuthenticatedService {
private readonly localRequest: LocalRequest;
private nexoCrypto: NexoCrypto;
public constructor(client: Client) {
super(client);
this.localRequest = new LocalRequest(this);
this.nexoCrypto = new NexoCrypto();
}
public async request(
terminalApiRequest: TerminalApiRequest,
securityKey: SecurityKey,
): Promise<TerminalApiResponse> {
const saleToPoiSecuredMessage: SaleToPoiSecuredMessage = NexoCrypto.encrypt(
terminalApiRequest.saleToPoiRequest.messageHeader,
Convert.terminalApiRequestToJson(terminalApiRequest),
securityKey,
);
const securedPaymentRequest: TerminalApiSecuredRequest = {
saleToPoiRequest: saleToPoiSecuredMessage,
};
const jsonResponse = await getJsonResponse<TerminalApiSecuredRequest, TerminalApiResponse>(
this.localRequest,
Convert.terminalApiSecuredRequestToJson(securedPaymentRequest),
);
const terminalApiSecuredResponse = Convert.toTerminalApiSecuredResponse(JSON.stringify(jsonResponse));
const response = this.nexoCrypto.decrypt(
terminalApiSecuredResponse.saleToPoiResponse,
securityKey,
);
return Convert.toTerminalApiResponse(response);
}
}
export default TerminalLocalAPI;

4
src/typings/amount.ts Normal file
View File

@@ -0,0 +1,4 @@
export interface Amount {
currency: string;
value: number;
}

9
src/typings/apiError.ts Normal file
View File

@@ -0,0 +1,9 @@
// Generated using typescript-generator version 2.14.505 on 2019-06-04 08:51:10.
export interface ApiError {
status?: number;
errorCode?: string;
message?: string;
errorType?: string;
pspReference?: string;
}

View File

@@ -0,0 +1,41 @@
// Generated using typescript-generator version 2.14.505 on 2019-06-11 10:28:22.
import Client from "../client";
export class ApplicationInfo {
adyenLibrary?: CommonField;
adyenPaymentSource?: CommonField;
externalPlatform?: ExternalPlatform;
merchantApplication?: CommonField;
merchantDevice?: MerchantDevice;
paymentDetailsSource?: CommonField;
shopperInteractionDevice?: ShopperInteractionDevice;
constructor() {
this.adyenLibrary = {
name: Client.LIB_NAME,
version: Client.LIB_VERSION,
}
}
}
export interface CommonField {
name?: string;
version?: string;
}
export interface ExternalPlatform extends CommonField {
integrator?: string;
}
export interface MerchantDevice {
os?: string;
osVersion?: string;
reference?: string;
}
export interface ShopperInteractionDevice {
os?: string;
osVersion?: string;
locale?: string;
}

22
src/typings/binLookup/amount.ts Executable file
View File

@@ -0,0 +1,22 @@
/**
* Adyen BinLookup Service
* The BIN Lookup API provides endpoints for retrieving information, such as [cost estimates](https://docs.adyen.com/features/cost-estimation), and 3D Secure supported version based on a given [BIN](https://docs.adyen.com/payments-basics/payment-glossary#bankidentificationnumberbin).
*
* OpenAPI spec version: 40
* Contact: support@adyen.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Amount {
/**
* The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes).
*/
currency: string;
/**
* The payable amount that can be charged for the transaction. The transaction amount needs to be represented in minor units according to the [following table](https://docs.adyen.com/development-resources/currency-codes).
*/
value: number;
}

View File

@@ -0,0 +1,54 @@
/**
* Adyen BinLookup Service
* The BIN Lookup API provides endpoints for retrieving information, such as [cost estimates](https://docs.adyen.com/features/cost-estimation), and 3D Secure supported version based on a given [BIN](https://docs.adyen.com/payments-basics/payment-glossary#bankidentificationnumberbin).
*
* OpenAPI spec version: 40
* Contact: support@adyen.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface CardBin {
/**
* The first 6 digit of the card number. Enable this field via merchant account settings.
*/
bin?: string;
/**
* If true, it indicates a commercial card. Enable this field via merchant account settings.
*/
commercial?: boolean;
/**
* The card funding source. Valid values are: * CREDIT * DEBIT * PREPAID * PREPAID_RELOADABLE * DEFERRED_DEBIT * CHARGED > Enable this field via merchant account settings.
*/
fundingSource?: string;
/**
* Indicates availability of funds. Visa: * \"I\" (fast funds are supported) * \"N\" (otherwise) Mastercard: * \"I\" (product type is Prepaid or Debit, or issuing country is in CEE/HGEM list) * \"N\" (otherwise) > Returned when you verify a card BIN or estimate costs, and only if `payoutEligible` is different from \"N\" or \"U\".
*/
fundsAvailability?: string;
/**
* The issuing bank of the card.
*/
issuingBank?: string;
/**
* The country where the card was issued from.
*/
issuingCountry?: string;
/**
* The currency of the card.
*/
issuingCurrency?: string;
/**
* The payment method associated with the card (e.g. visa, mc, or amex).
*/
paymentMethod?: string;
/**
* Indicates whether a payout is eligible or not for this card. Visa: * \"Y\" * \"N\" Mastercard: * \"Y\" (domestic and cross-border) * \"D\" (only domestic) * \"N\" (no MoneySend) * \"U\" (unknown) > Returned when you verify a card BIN or estimate costs, and only if `payoutEligible` is different from \"N\" or \"U\".
*/
payoutEligible?: string;
/**
* The last four digits of the card number.
*/
summary?: string;
}

View File

@@ -0,0 +1,26 @@
/**
* Adyen BinLookup Service
* The BIN Lookup API provides endpoints for retrieving information, such as [cost estimates](https://docs.adyen.com/features/cost-estimation), and 3D Secure supported version based on a given [BIN](https://docs.adyen.com/payments-basics/payment-glossary#bankidentificationnumberbin).
*
* OpenAPI spec version: 40
* Contact: support@adyen.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface CostEstimateAssumptions {
/**
* If true, the cardholder is expected to successfully authorise via 3D Secure.
*/
assume3DSecureAuthenticated?: boolean;
/**
* If true, the transaction is expected to have valid Level 3 data.
*/
assumeLevel3Data?: boolean;
/**
* If not zero, the number of installments.
*/
installments?: number;
}

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