mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-04-13 23:51:21 +00:00
Compare commits
94 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5be7c38302 | ||
|
|
fabd41584e | ||
|
|
98a7741107 | ||
|
|
b06c2ccf1b | ||
|
|
158843ec69 | ||
|
|
4b2f875c7a | ||
|
|
675377448a | ||
|
|
3e1042b4ce | ||
|
|
d9afdd2fe9 | ||
|
|
cb2c7d9872 | ||
|
|
30caa5a3c2 | ||
|
|
93f25fd687 | ||
|
|
5e09e336bc | ||
|
|
1dff362706 | ||
|
|
76e6904b89 | ||
|
|
d2819aa9e2 | ||
|
|
409f1fd405 | ||
|
|
b81e4a4e41 | ||
|
|
5594ff573c | ||
|
|
fff61d8eb7 | ||
|
|
15eddcbac2 | ||
|
|
0288acd7a3 | ||
|
|
98b55e9438 | ||
|
|
fae77fc1ca | ||
|
|
36f5d7e920 | ||
|
|
ff993a2e8d | ||
|
|
e5f60ecfed | ||
|
|
0d95a73f41 | ||
|
|
5ebf1966f2 | ||
|
|
63e6e1979c | ||
|
|
7231957e37 | ||
|
|
074a9d708d | ||
|
|
c0d6257573 | ||
|
|
8e3cb93756 | ||
|
|
427427619d | ||
|
|
2463523aaf | ||
|
|
0128f5f89a | ||
|
|
3799f21851 | ||
|
|
1bd4829b7a | ||
|
|
eb6577bb7c | ||
|
|
b7e14948ad | ||
|
|
b70dc70070 | ||
|
|
97f9a5a3bc | ||
|
|
68822e485a | ||
|
|
1ff792277a | ||
|
|
097a6c423b | ||
|
|
842fe1a50b | ||
|
|
11728b3db5 | ||
|
|
c171f7b674 | ||
|
|
431297593f | ||
|
|
0af9e8b589 | ||
|
|
71fd431c46 | ||
|
|
170685f6c4 | ||
|
|
f6a1716714 | ||
|
|
b3dc185851 | ||
|
|
57e3dccb11 | ||
|
|
9a194e7752 | ||
|
|
7e76d1b4c8 | ||
|
|
e5b8b70ecd | ||
|
|
90f0e664b9 | ||
|
|
f87c525cf8 | ||
|
|
61ef73c0d1 | ||
|
|
d89f0974a5 | ||
|
|
282fc30e28 | ||
|
|
8c635a7855 | ||
|
|
edbdd6cc7d | ||
|
|
2f5408d436 | ||
|
|
3ea6181d91 | ||
|
|
5d02fc148b | ||
|
|
8acd312ab0 | ||
|
|
f1e3848439 | ||
|
|
dd56326255 | ||
|
|
0d6406694b | ||
|
|
5742a463ae | ||
|
|
7c49bc466b | ||
|
|
ffa63e8204 | ||
|
|
91f38e0272 | ||
|
|
7cd93d6512 | ||
|
|
0facfe2419 | ||
|
|
37f6085d24 | ||
|
|
437c062788 | ||
|
|
780fb5bbf1 | ||
|
|
db6716a85a | ||
|
|
9e6c216aae | ||
|
|
7d3b2731f6 | ||
|
|
b1fd794054 | ||
|
|
af80b86594 | ||
|
|
fc5010078b | ||
|
|
5385ca5bb6 | ||
|
|
87f87d0181 | ||
|
|
42b71d41a2 | ||
|
|
ec0e711fd8 | ||
|
|
a61f51d43b | ||
|
|
5b8c2b2ff8 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @KadoBOT @msilvagarcia @cyattilakiss @rkewlani @Aleffio @rikterbeek
|
||||
12
.release-it.json
Normal file
12
.release-it.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"git": {
|
||||
"tagName": "v${version}",
|
||||
"changelog": "npx auto-changelog --stdout --commit-limit false -u"
|
||||
},
|
||||
"github": {
|
||||
"release": true
|
||||
},
|
||||
"hooks": {
|
||||
"after:bump": "npx auto-changelog -p"
|
||||
}
|
||||
}
|
||||
19
.sonarcloud.properties
Normal file
19
.sonarcloud.properties
Normal file
@@ -0,0 +1,19 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright Contributors to the ODPi Egeria project.
|
||||
|
||||
# Path to sources
|
||||
#sonar.sources=.
|
||||
sonar.exclusions=src/__mocks__/*
|
||||
sonar.exclusions=src/typings/*
|
||||
#sonar.inclusions=
|
||||
|
||||
# Path to tests
|
||||
#sonar.tests=
|
||||
#sonar.test.exclusions=
|
||||
#sonar.test.inclusions=
|
||||
|
||||
# Source encoding
|
||||
#sonar.sourceEncoding=UTF-8
|
||||
|
||||
# Exclusions for copy-paste detection
|
||||
#sonar.cpd.exclusions=
|
||||
@@ -4,6 +4,7 @@
|
||||
[](https://www.npmjs.com/package/@adyen/api-library)
|
||||

|
||||
[](https://www.npmjs.com/package/@adyen/api-library)
|
||||
[](https://sonarcloud.io/dashboard?id=Adyen_adyen-node-api-library)
|
||||
|
||||
The Adyen API Library for NodeJS enables you to work with Adyen APIs and Hosted Payment Pages.
|
||||
|
||||
@@ -92,7 +93,3 @@ If you have any problems, questions or suggestions, create an issue here or send
|
||||
## Licence
|
||||
|
||||
MIT license. For more information, see the LICENSE file.
|
||||
|
||||
## Other
|
||||
|
||||
You can find examples inside the `examples` folder in this repo.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
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
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
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;
|
||||
10141
package-lock.json
generated
Normal file
10141
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
package.json
42
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@adyen/api-library",
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.7",
|
||||
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs and Hosted Payment Pages.",
|
||||
"main": "dist/lib/src/index.js",
|
||||
"types": "dist/lib/src/index.d.ts",
|
||||
@@ -32,34 +32,36 @@
|
||||
"test": "jest",
|
||||
"preversion": "npm test",
|
||||
"version": "npm run build && git add -A dist",
|
||||
"postversion": "git push && git push --tags && rm -rf build/temp"
|
||||
"postversion": "git push && git push --tags && rm -rf build/temp",
|
||||
"release": "release-it --no-npm.publish"
|
||||
},
|
||||
"author": "Ricardo Ambrogi",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.5.5",
|
||||
"@babel/core": "7.6.4",
|
||||
"@babel/plugin-proposal-class-properties": "7.5.5",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.5.5",
|
||||
"@babel/plugin-transform-runtime": "7.5.5",
|
||||
"@babel/preset-env": "7.5.5",
|
||||
"@babel/preset-typescript": "7.3.3",
|
||||
"@babel/runtime": "7.5.5",
|
||||
"@types/jest": "24.0.17",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.6.2",
|
||||
"@babel/plugin-transform-runtime": "7.6.2",
|
||||
"@babel/preset-env": "7.6.3",
|
||||
"@babel/preset-typescript": "7.6.0",
|
||||
"@babel/runtime": "7.6.3",
|
||||
"@types/jest": "24.0.21",
|
||||
"@types/nock": "10.0.3",
|
||||
"@types/node": "11.13.18",
|
||||
"@typescript-eslint/eslint-plugin": "2.0.0",
|
||||
"@typescript-eslint/parser": "2.0.0",
|
||||
"@types/node": "11.15.0",
|
||||
"@typescript-eslint/eslint-plugin": "2.6.0",
|
||||
"@typescript-eslint/parser": "2.6.0",
|
||||
"babel-loader": "8.0.6",
|
||||
"coveralls": "3.0.6",
|
||||
"eslint": "6.2.0",
|
||||
"coveralls": "3.0.7",
|
||||
"eslint": "6.6.0",
|
||||
"jest": "24.9.0",
|
||||
"nock": "11.0.0",
|
||||
"ts-loader": "6.0.4",
|
||||
"typescript": "3.5.3",
|
||||
"webpack": "4.39.2",
|
||||
"webpack-cli": "3.3.7"
|
||||
"nock": "11.6.0",
|
||||
"release-it": "12.4.3",
|
||||
"ts-loader": "6.2.1",
|
||||
"typescript": "3.6.4",
|
||||
"webpack": "4.41.2",
|
||||
"webpack-cli": "3.3.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"https-proxy-agent": "2.2.2"
|
||||
"https-proxy-agent": "3.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ describe("HMAC Validator", function (): void {
|
||||
});
|
||||
it("should get correct data with escaped characters", function (): void {
|
||||
const hmacValidator = new HmacValidator();
|
||||
const dataToSign = hmacValidator.getDataToSign({currencyCode: "EUR", merchantAccount: "ACC:\\"});
|
||||
expect(dataToSign).toEqual("currencyCode:merchantAccount:EUR:ACC\\:\\\\");
|
||||
const dataToSign = hmacValidator.getDataToSign({currencyCode: "EUR", merchantAccount: "ACC:\\", sessionValidity: "2019-09-21T11:45:24.637Z"});
|
||||
expect(dataToSign).toEqual("currencyCode:merchantAccount:sessionValidity:EUR:ACC\\:\\\\:2019-09-21T11\\:45\\:24.637Z");
|
||||
});
|
||||
it("should encrypt correctly", function (): void {
|
||||
const data = "countryCode:currencyCode:merchantAccount:merchantReference:paymentAmount:sessionValidity:skinCode:NL:EUR:MagentoMerchantTest2:TEST-PAYMENT-2017-02-01-14\\:02\\:05:199:2017-02-02T14\\:02\\:05+01\\:00:PKz2KML1";
|
||||
|
||||
@@ -1,43 +1,51 @@
|
||||
import nock from "nock";
|
||||
import nock, {Interceptor} from "nock";
|
||||
import Client from "../client";
|
||||
import Checkout from "../services/checkout";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
import {createPaymentsCheckoutRequest} from "./checkout.spec";
|
||||
import HttpClientException from "../httpClient/httpClientException";
|
||||
import {Environment} from "../typings/enums/environment";
|
||||
|
||||
beforeEach((): void => {
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
type errorType = "HttpClientException" | "ApiException";
|
||||
type testOptions = { errorType: errorType; errorMessageContains?: string; errorMessageEquals?: string };
|
||||
|
||||
const getResponse = async ({apiKey , environment }: { apiKey: string; environment: Environment}, cb: (scope: Interceptor) => testOptions) => {
|
||||
const client = new Client({ apiKey, environment });
|
||||
const checkout = new Checkout(client);
|
||||
|
||||
const scope = nock(`${client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}`)
|
||||
.post("/payments");
|
||||
const { errorMessageContains, errorMessageEquals, errorType } = cb(scope);
|
||||
const ErrorException = errorType === "ApiException" ? ApiException : HttpClientException;
|
||||
|
||||
try {
|
||||
await checkout.payments(createPaymentsCheckoutRequest());
|
||||
fail("request should fail");
|
||||
} catch (e) {
|
||||
expect(e instanceof ErrorException).toBeTruthy();
|
||||
if(errorMessageEquals) expect(e.message).toEqual(errorMessageEquals);
|
||||
if(errorMessageContains) expect(e.message.toLowerCase()).toContain(errorMessageContains);
|
||||
}
|
||||
};
|
||||
|
||||
describe("HTTP Client", function (): void {
|
||||
it("should return ApiException when no API Key is provided", async (): Promise<void> => {
|
||||
const client = new Client({apiKey: "", environment: "TEST"});
|
||||
const checkout = new Checkout(client);
|
||||
it.each`
|
||||
apiKey | environment | withError | args | errorType | contains | equals
|
||||
${""} | ${"TEST"} | ${true} | ${["mocked_error_response"]} | ${"ApiException"} | ${"x-api-key"} | ${""}
|
||||
${"MOCKED_API_KEY"} | ${"TEST"} | ${true} | ${["some_error"]} | ${"ApiException"} | ${""} | ${"some_error"}
|
||||
${"API_KEY"} | ${"TEST"} | ${false} | ${[401, { status: 401, message: "Invalid Request", errorCode: "171", errorType: "validationError"}]} | ${"HttpClientException"} | ${""} | ${"HTTP Exception: 401. null: Invalid Request"}
|
||||
${"API_KEY"} | ${"TEST"} | ${false} | ${[401, {}]} | ${"HttpClientException"} | ${""} | ${"HTTP Exception: 401. null"}
|
||||
${"API_KEY"} | ${"TEST"} | ${false} | ${[401, "fail"]} | ${"HttpClientException"} | ${""} | ${"HTTP Exception: 401. null"}
|
||||
`("Should return $errorType, $contains, $equals", async ({ apiKey, environment, withError, args, errorType, contains, equals }) => {
|
||||
await getResponse({ apiKey, environment }, (scope) => {
|
||||
if (withError) scope.replyWithError(args[0]);
|
||||
else scope.reply(args[0], args[1]);
|
||||
|
||||
nock(`${client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}`)
|
||||
.post("/payments")
|
||||
.replyWithError("error");
|
||||
|
||||
try {
|
||||
await checkout.payments(createPaymentsCheckoutRequest());
|
||||
} catch (e) {
|
||||
expect(e instanceof ApiException);
|
||||
expect(e.message).toContain("x-api-key");
|
||||
}
|
||||
});
|
||||
|
||||
it("should return ApiException on request error", async (): Promise<void> => {
|
||||
const client = new Client({apiKey: "API_KEY", environment: "TEST"});
|
||||
const checkout = new Checkout(client);
|
||||
|
||||
nock(`${client.config.checkoutEndpoint}/${Client.CHECKOUT_API_VERSION}`)
|
||||
.post("/payments")
|
||||
.replyWithError({message: "error_message", statusCode: 500});
|
||||
|
||||
try {
|
||||
await checkout.payments(createPaymentsCheckoutRequest());
|
||||
} catch (e) {
|
||||
expect(e instanceof ApiException);
|
||||
expect(e.message).toEqual("error_message");
|
||||
}
|
||||
return { errorType, errorMessageContains: contains, errorMessageEquals: equals };
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -4,62 +4,82 @@ 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";
|
||||
import {Notification, NotificationEnum, NotificationRequestItem} from "../typings/notification";
|
||||
|
||||
describe("Notification Test", function (): void {
|
||||
it("should return authorisation success", function (): void {
|
||||
const notificationRequest = new NotificationRequest(authorisationTrue);
|
||||
const notificationRequest = new NotificationRequest(authorisationTrue as unknown as Notification);
|
||||
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");
|
||||
if (notificationRequest.notificationItems) {
|
||||
const notificationRequestItem: NotificationRequestItem = notificationRequest.notificationItems[0];
|
||||
expect(NotificationEnum.EVENT_CODE_AUTHORISATION).toEqual(notificationRequestItem.eventCode);
|
||||
expect(notificationRequestItem.success === "true").toBeTruthy();
|
||||
expect(notificationRequestItem.pspReference).toEqual("123456789");
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
|
||||
it("should return capture success", function (): void {
|
||||
const notificationRequest = new NotificationRequest(captureTrue);
|
||||
const notificationRequest = new NotificationRequest(captureTrue as unknown as Notification);
|
||||
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");
|
||||
if (notificationRequest.notificationItems) {
|
||||
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");
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
|
||||
it("should return capture fail", function (): void {
|
||||
const notificationRequest = new NotificationRequest(captureFalse);
|
||||
const notificationRequest = new NotificationRequest(captureFalse as unknown as Notification);
|
||||
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");
|
||||
if (notificationRequest.notificationItems) {
|
||||
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");
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
|
||||
it("should return refund success", function (): void {
|
||||
const notificationRequest = new NotificationRequest(refundTrue);
|
||||
const notificationRequest = new NotificationRequest(refundTrue as unknown as Notification);
|
||||
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();
|
||||
if (notificationRequest.notificationItems) {
|
||||
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();
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
|
||||
it("should return refund fail", function (): void {
|
||||
const notificationRequest = new NotificationRequest(refundFalse);
|
||||
const notificationRequest = new NotificationRequest(refundFalse as unknown as Notification);
|
||||
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();
|
||||
if (notificationRequest.notificationItems) {
|
||||
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();
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@ import {asyncRes} from "../__mocks__/terminalApi/async";
|
||||
import {syncRes} from "../__mocks__/terminalApi/sync";
|
||||
import Client from "../client";
|
||||
import TerminalCloudAPI from "../services/terminalCloudAPI";
|
||||
import {Convert, TerminalApiRequest, TerminalApiResponse} from "../typings/terminal";
|
||||
import {Convert, TerminalApiResponse} from "../typings/terminal";
|
||||
|
||||
|
||||
let client: Client;
|
||||
@@ -21,7 +21,7 @@ describe("Terminal Cloud API", (): void => {
|
||||
it("should make an async payment request", async (): Promise<void> => {
|
||||
scope.post("/async").reply(200, asyncRes);
|
||||
|
||||
const terminalAPIPaymentRequest: TerminalApiRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
|
||||
|
||||
const requestResponse: string = await terminalCloudAPI.async(terminalAPIPaymentRequest);
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("Terminal Cloud API", (): void => {
|
||||
const response = Convert.toTerminalApiResponse(syncRes);
|
||||
scope.post("/sync").reply(200, response);
|
||||
|
||||
const terminalAPIPaymentRequest: TerminalApiRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
|
||||
const terminalAPIResponse: TerminalApiResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
|
||||
|
||||
expect(terminalAPIResponse).toEqual(response);
|
||||
|
||||
@@ -3,7 +3,7 @@ import {createMockClientFromResponse, createTerminalAPIPaymentRequest} from "../
|
||||
import {localEncRes, localSecuredRes, wrongEncRes} from "../__mocks__/terminalApi/local";
|
||||
import Client from "../client";
|
||||
import TerminalLocalAPI from "../services/terminalLocalAPI";
|
||||
import {Convert, SecurityKey, TerminalApiRequest, TerminalApiResponse} from "../typings/terminal";
|
||||
import {Convert, SecurityKey, TerminalApiResponse} from "../typings/terminal";
|
||||
import NexoCryptoException from "../services/exception/nexoCryptoException";
|
||||
|
||||
let client: Client;
|
||||
@@ -22,7 +22,7 @@ describe("Terminal Local API", (): void => {
|
||||
const response = Convert.toTerminalApiResponse(localSecuredRes);
|
||||
|
||||
scope.post("/").reply(200, securedResponse);
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
|
||||
|
||||
const securityKey: SecurityKey = {
|
||||
adyenCryptoVersion: 1,
|
||||
@@ -41,7 +41,7 @@ describe("Terminal Local API", (): void => {
|
||||
const securedResponse = Convert.toTerminalApiSecuredResponse(wrongEncRes);
|
||||
|
||||
scope.post("/").reply(200, securedResponse);
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest() as TerminalApiRequest;
|
||||
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
|
||||
|
||||
const securityKey: SecurityKey = {
|
||||
adyenCryptoVersion: 1,
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
import Resource from "../services/resource";
|
||||
import { RequestOptions } from "../typings/requestOptions";
|
||||
import HttpClientException from "../httpClient/httpClientException";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
|
||||
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>;
|
||||
@@ -29,11 +31,11 @@ async function getJsonResponse<T, R>(
|
||||
resource: Resource,
|
||||
jsonRequest: T | string,
|
||||
requestOptions: RequestOptions = {},
|
||||
): Promise<R | string> {
|
||||
): Promise<R | string | HttpClientException | ApiException> {
|
||||
const request = typeof jsonRequest === "string" ? jsonRequest : JSON.stringify(jsonRequest);
|
||||
const response = await resource.request(request, requestOptions);
|
||||
try {
|
||||
return JSON.parse(response);
|
||||
return typeof response === "string" ? JSON.parse(response) : response;
|
||||
} catch (e) {
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import ClientInterface from "../typings/httpClient/clientInterface";
|
||||
import HttpClientException from "./httpClientException";
|
||||
import checkServerIdentity from "../helpers/checkServerIdentity";
|
||||
import {ApiError} from "../typings/apiError";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
|
||||
class HttpURLConnectionClient implements ClientInterface {
|
||||
private static CHARSET = "utf-8";
|
||||
@@ -50,7 +51,7 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
public request(
|
||||
endpoint: string, json: string, config: Config, isApiRequired: boolean,
|
||||
requestOptions: RequestOptions,
|
||||
): Promise<string> {
|
||||
): Promise<string | HttpClientException | ApiException> {
|
||||
requestOptions.headers = {};
|
||||
requestOptions.timeout = config.connectionTimeoutMillis;
|
||||
|
||||
@@ -60,7 +61,11 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
|
||||
const apiKey = config.apiKey;
|
||||
|
||||
if (isApiRequired || apiKey) {
|
||||
if (isApiRequired && !apiKey) {
|
||||
return Promise.reject(new ApiException("Invalid X-API-Key was used", 401));
|
||||
}
|
||||
|
||||
if (apiKey) {
|
||||
requestOptions.headers[API_KEY] = apiKey;
|
||||
} else {
|
||||
const authString = `${config.username}:${config.password}`;
|
||||
@@ -75,7 +80,7 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
return this.doPostRequest(httpConnection, json);
|
||||
}
|
||||
|
||||
public post(endpoint: string, postParameters: [string, string][], config: Config): Promise<string> {
|
||||
public post(endpoint: string, postParameters: [string, string][], config: Config): Promise<HttpClientException | string> {
|
||||
const postQuery: string = this.getQuery(postParameters);
|
||||
const connectionRequest: ClientRequest = this.createRequest(endpoint, {}, config.applicationName);
|
||||
return this.doPostRequest(connectionRequest, postQuery);
|
||||
@@ -99,8 +104,7 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
|
||||
if (this.proxy && this.proxy.host) {
|
||||
const { host, port, ...options } = this.proxy;
|
||||
const agent = new HttpsProxyAgent({ host, port: port || 443, ...options });
|
||||
requestOptions.agent = agent;
|
||||
requestOptions.agent = new HttpsProxyAgent({ host, port: port || 443, ...options });
|
||||
} else {
|
||||
requestOptions.agent = new Agent(this.agentOptions);
|
||||
}
|
||||
@@ -117,23 +121,44 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
return params.map(([key, value]): string => `${key}=${value}`).join("&");
|
||||
}
|
||||
|
||||
private doPostRequest(connectionRequest: ClientRequest, json: string): Promise<string> {
|
||||
private doPostRequest(connectionRequest: ClientRequest, json: string): Promise<HttpClientException | string> {
|
||||
return new Promise((resolve, reject): void => {
|
||||
connectionRequest.flushHeaders();
|
||||
|
||||
connectionRequest.on("response", (res: IncomingMessage): void => {
|
||||
let resData = "";
|
||||
const getException = (): HttpClientException => new HttpClientException(
|
||||
`HTTP Exception: ${res.statusCode}. ${res.statusMessage}`,
|
||||
res.statusCode,
|
||||
undefined,
|
||||
res.headers,
|
||||
res,
|
||||
);
|
||||
let exception: HttpClientException | Error = getException();
|
||||
|
||||
res.on("data", (data): void => {
|
||||
if (res.statusCode && res.statusCode !== 200) {
|
||||
const formattedData: ApiError = JSON.parse(data.toString());
|
||||
const exception = new HttpClientException(
|
||||
`HTTP Exception: ${formattedData.status}. ${res.statusMessage}: ${formattedData.message}`,
|
||||
formattedData.status,
|
||||
formattedData.errorCode,
|
||||
res.headers,
|
||||
res,
|
||||
);
|
||||
return reject(exception);
|
||||
try {
|
||||
const formattedData: ApiError = JSON.parse(data.toString() as string);
|
||||
const isApiError = "status" in formattedData;
|
||||
const isRequestError = "errors" in formattedData;
|
||||
|
||||
if (isApiError) {
|
||||
exception = new HttpClientException(
|
||||
`HTTP Exception: ${formattedData.status}. ${res.statusMessage}: ${formattedData.message}`,
|
||||
formattedData.status,
|
||||
formattedData.errorCode,
|
||||
res.headers,
|
||||
res,
|
||||
);
|
||||
} else if (isRequestError) {
|
||||
exception = new Error(data);
|
||||
}
|
||||
} catch (e) {
|
||||
reject(exception);
|
||||
} finally {
|
||||
reject(exception);
|
||||
}
|
||||
}
|
||||
|
||||
resData += data;
|
||||
@@ -152,13 +177,13 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
connectionRequest.on("timeout", (): void => {
|
||||
connectionRequest.abort();
|
||||
});
|
||||
connectionRequest.on("error", reject);
|
||||
connectionRequest.on("error", (e) => reject(new ApiException(e.message)));
|
||||
connectionRequest.write(Buffer.from(json));
|
||||
connectionRequest.end();
|
||||
});
|
||||
}
|
||||
|
||||
private installCertificateVerifier(terminalCertificatePath: string): void {
|
||||
private installCertificateVerifier(terminalCertificatePath: string): void | Promise<HttpClientException> {
|
||||
try {
|
||||
const certificateInput = fs.readFileSync(terminalCertificatePath);
|
||||
|
||||
@@ -168,7 +193,7 @@ class HttpURLConnectionClient implements ClientInterface {
|
||||
};
|
||||
|
||||
} catch (e) {
|
||||
throw new HttpClientException(`Error loading certificate from path: ${e.message}`);
|
||||
return Promise.reject(new HttpClientException(`Error loading certificate from path: ${e.message}`));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class NotificationRequest {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.notificationItemContainers.map((container): NotificationRequestItem => container.notificationRequestItem);
|
||||
return this.notificationItemContainers.map((container): NotificationRequestItem => container.NotificationRequestItem);
|
||||
}
|
||||
|
||||
public live: string;
|
||||
|
||||
@@ -27,7 +27,7 @@ class ApiException implements Error {
|
||||
public readonly message: string;
|
||||
public readonly name: string;
|
||||
|
||||
public constructor(message: string, statusCode: number) {
|
||||
public constructor(message: string, statusCode = 500) {
|
||||
this.name = "ApiException";
|
||||
this.message = message;
|
||||
this.statusCode = statusCode;
|
||||
|
||||
@@ -23,6 +23,7 @@ import Config from "../config";
|
||||
import ClientInterface from "../typings/httpClient/clientInterface";
|
||||
import Service from "../service";
|
||||
import { RequestOptions } from "../typings/requestOptions";
|
||||
import HttpClientException from "../httpClient/httpClientException";
|
||||
import ApiException from "./exception/apiException";
|
||||
|
||||
abstract class Resource {
|
||||
@@ -34,28 +35,16 @@ abstract class Resource {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
public request(json: string, requestOptions?: RequestOptions): Promise<string> {
|
||||
public request(json: string, requestOptions?: RequestOptions): Promise<string | HttpClientException | ApiException> {
|
||||
const clientInterface: ClientInterface = this.service.client.httpClient;
|
||||
const config: Config = this.service.client.config;
|
||||
|
||||
try {
|
||||
return clientInterface.request(
|
||||
this.endpoint,
|
||||
json, config,
|
||||
this.service.apiKeyRequired,
|
||||
requestOptions,
|
||||
);
|
||||
} catch (e) {
|
||||
const apiException: ApiException = new ApiException(e.message, e.statusCode);
|
||||
|
||||
try {
|
||||
apiException.error = e.responseBody;
|
||||
} catch (err) {
|
||||
throw new ApiException("Invalid response or an invalid X-API-Key key was used", err.statusCode);
|
||||
}
|
||||
|
||||
throw apiException;
|
||||
}
|
||||
return clientInterface.request(
|
||||
this.endpoint,
|
||||
json, config,
|
||||
this.service.apiKeyRequired,
|
||||
requestOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,4 @@ export interface ShopperInteractionDevice {
|
||||
os?: string;
|
||||
osVersion?: string;
|
||||
locale?: string;
|
||||
}
|
||||
}
|
||||
33
src/typings/binLookup/binDetail.ts
Normal file
33
src/typings/binLookup/binDetail.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Adyen BinLookup API
|
||||
* The BIN Lookup API provides endpoints for retrieving information, such as cost estimates, and 3D Secure supported version based on a given BIN.
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class BinDetail {
|
||||
/**
|
||||
* The country where the card was issued.
|
||||
*/
|
||||
'issuerCountry'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "issuerCountry",
|
||||
"baseName": "issuerCountry",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return BinDetail.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
64
src/typings/checkout/applicationInfo.ts
Normal file
64
src/typings/checkout/applicationInfo.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { CommonField } from './commonField';
|
||||
import { ExternalPlatform } from './externalPlatform';
|
||||
import { MerchantDevice } from './merchantDevice';
|
||||
import { ShopperInteractionDevice } from './shopperInteractionDevice';
|
||||
|
||||
export class ApplicationInfo {
|
||||
'adyenLibrary'?: CommonField;
|
||||
'adyenPaymentSource'?: CommonField;
|
||||
'externalPlatform'?: ExternalPlatform;
|
||||
'merchantApplication'?: CommonField;
|
||||
'merchantDevice'?: MerchantDevice;
|
||||
'shopperInteractionDevice'?: ShopperInteractionDevice;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "adyenLibrary",
|
||||
"baseName": "adyenLibrary",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "adyenPaymentSource",
|
||||
"baseName": "adyenPaymentSource",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "externalPlatform",
|
||||
"baseName": "externalPlatform",
|
||||
"type": "ExternalPlatform"
|
||||
},
|
||||
{
|
||||
"name": "merchantApplication",
|
||||
"baseName": "merchantApplication",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "merchantDevice",
|
||||
"baseName": "merchantDevice",
|
||||
"type": "MerchantDevice"
|
||||
},
|
||||
{
|
||||
"name": "shopperInteractionDevice",
|
||||
"baseName": "shopperInteractionDevice",
|
||||
"type": "ShopperInteractionDevice"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ApplicationInfo.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
42
src/typings/checkout/commonField.ts
Normal file
42
src/typings/checkout/commonField.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class CommonField {
|
||||
/**
|
||||
* Name of the field. For example, Name of External Platform.
|
||||
*/
|
||||
'name'?: string;
|
||||
/**
|
||||
* Version of the field. For example, Version of External Platform.
|
||||
*/
|
||||
'version'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"baseName": "version",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return CommonField.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
51
src/typings/checkout/externalPlatform.ts
Normal file
51
src/typings/checkout/externalPlatform.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class ExternalPlatform {
|
||||
/**
|
||||
* External platform integrator.
|
||||
*/
|
||||
'integrator'?: string;
|
||||
/**
|
||||
* Name of the field. For example, Name of External Platform.
|
||||
*/
|
||||
'name'?: string;
|
||||
/**
|
||||
* Version of the field. For example, Version of External Platform.
|
||||
*/
|
||||
'version'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "integrator",
|
||||
"baseName": "integrator",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"baseName": "version",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ExternalPlatform.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
51
src/typings/checkout/merchantDevice.ts
Normal file
51
src/typings/checkout/merchantDevice.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class MerchantDevice {
|
||||
/**
|
||||
* Operating system running on the merchant device.
|
||||
*/
|
||||
'os'?: string;
|
||||
/**
|
||||
* Version of the operating system on the merchant device.
|
||||
*/
|
||||
'osVersion'?: string;
|
||||
/**
|
||||
* Merchant device reference.
|
||||
*/
|
||||
'reference'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "os",
|
||||
"baseName": "os",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "osVersion",
|
||||
"baseName": "osVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "reference",
|
||||
"baseName": "reference",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return MerchantDevice.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* Adyen Checkout Service
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v46/payments ```
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v49/payments ```
|
||||
*
|
||||
* OpenAPI spec version: 46
|
||||
* OpenAPI spec version: 49
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
@@ -14,7 +12,11 @@
|
||||
import { PaymentMethodGroup } from './paymentMethodGroup';
|
||||
|
||||
|
||||
export interface PaymentMethod {
|
||||
export interface PaymentMethod {
|
||||
/**
|
||||
* List of possible brands. For example: visa, mc.
|
||||
*/
|
||||
brands?: Array<string>;
|
||||
/**
|
||||
* The configuration of the payment method.
|
||||
*/
|
||||
@@ -24,6 +26,10 @@ export interface PaymentMethod {
|
||||
*/
|
||||
details?: Array<InputDetail>;
|
||||
group?: PaymentMethodGroup;
|
||||
/**
|
||||
* All input details to be provided to complete the payment with this payment method.
|
||||
*/
|
||||
inputDetails?: Array<InputDetail>;
|
||||
/**
|
||||
* The displayable name of this payment method.
|
||||
*/
|
||||
|
||||
51
src/typings/checkout/shopperInteractionDevice.ts
Normal file
51
src/typings/checkout/shopperInteractionDevice.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class ShopperInteractionDevice {
|
||||
/**
|
||||
* Locale on the shopper interaction device.
|
||||
*/
|
||||
'locale'?: string;
|
||||
/**
|
||||
* Operating system running on the shopper interaction device.
|
||||
*/
|
||||
'os'?: string;
|
||||
/**
|
||||
* Version of the operating system on the shopper interaction device.
|
||||
*/
|
||||
'osVersion'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "locale",
|
||||
"baseName": "locale",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "os",
|
||||
"baseName": "os",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "osVersion",
|
||||
"baseName": "osVersion",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ShopperInteractionDevice.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
114
src/typings/checkout/storedPaymentMethod.ts
Normal file
114
src/typings/checkout/storedPaymentMethod.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Adyen Checkout API
|
||||
* Adyen Checkout API provides a simple and flexible way to initiate and authorise online payments. You can use the same integration for payments made with cards (including One-Click and 3D Secure), mobile wallets, and local payment methods (e.g. iDEAL and Sofort). This API reference provides information on available endpoints and how to interact with them. To learn more about the API, visit [Checkout documentation](https://docs.adyen.com/checkout). ## Authentication Each request to the Checkout API must be signed with an API key. For this, obtain an API Key from your Customer Area, as described in [How to get the API key](https://docs.adyen.com/user-management/how-to-get-the-api-key). Then set this key to the `X-API-Key` header value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: Your_Checkout_API_key\" \\ ... ``` Note that when going live, you need to generate a new API Key to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Checkout API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://checkout-test.adyen.com/v50/payments ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class StoredPaymentMethod {
|
||||
/**
|
||||
* The brand of the card.
|
||||
*/
|
||||
'brand'?: string;
|
||||
/**
|
||||
* The month the card expires.
|
||||
*/
|
||||
'expiryMonth'?: string;
|
||||
/**
|
||||
* The year the card expires.
|
||||
*/
|
||||
'expiryYear'?: string;
|
||||
/**
|
||||
* The unique payment method code.
|
||||
*/
|
||||
'holderName'?: string;
|
||||
/**
|
||||
* A unique identifier of this stored payment method.
|
||||
*/
|
||||
'id'?: string;
|
||||
/**
|
||||
* The last four digits of the PAN.
|
||||
*/
|
||||
'lastFour'?: string;
|
||||
/**
|
||||
* The display name of the stored payment method.
|
||||
*/
|
||||
'name'?: string;
|
||||
/**
|
||||
* The shopper’s email address.
|
||||
*/
|
||||
'shopperEmail'?: string;
|
||||
/**
|
||||
* The supported shopper interactions for this stored payment method.
|
||||
*/
|
||||
'supportedShopperInteractions'?: Array<string>;
|
||||
/**
|
||||
* The type of payment method.
|
||||
*/
|
||||
'type'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "brand",
|
||||
"baseName": "brand",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "expiryMonth",
|
||||
"baseName": "expiryMonth",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "expiryYear",
|
||||
"baseName": "expiryYear",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "holderName",
|
||||
"baseName": "holderName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "lastFour",
|
||||
"baseName": "lastFour",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "shopperEmail",
|
||||
"baseName": "shopperEmail",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "supportedShopperInteractions",
|
||||
"baseName": "supportedShopperInteractions",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"baseName": "type",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return StoredPaymentMethod.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ export interface ThreeDS2RequestData {
|
||||
*/
|
||||
deviceChannel: string;
|
||||
deviceRenderOptions?: DeviceRenderOptions;
|
||||
/**
|
||||
* Required for [authentication-only integration](https://docs.adyen.com/checkout/3d-secure/native-3ds2/authentication-only). The merchant name that the issuer presents to the shopper if they get a challenge. We recommend to use the same value that you will use in the authorization. Maximum length is 40 characters.
|
||||
* Optional for a [full 3D Secure 2 integration](https://docs.adyen.com/checkout/3d-secure/native-3ds2/api-integration). Use this field if you are enrolled for 3D Secure 2 with us and want to override the merchant name already configured on your account.
|
||||
*/
|
||||
merchantName?: string;
|
||||
/**
|
||||
* The `messageVersion` value indicating the 3D Secure 2 protocol version.
|
||||
*/
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
import Config from "../../config";
|
||||
import { RequestOptions } from "../requestOptions";
|
||||
import { AgentOptions } from "https";
|
||||
import HttpClientException from "../../httpClient/httpClientException";
|
||||
import ApiException from "../../services/exception/apiException";
|
||||
|
||||
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>;
|
||||
): Promise<string | HttpClientException | ApiException>;
|
||||
post(endpoint: string, postParameters: [string, string][], config: Config): Promise<HttpClientException | string>;
|
||||
proxy?: AgentOptions;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface Notification {
|
||||
}
|
||||
|
||||
export interface NotificationItem {
|
||||
notificationRequestItem: NotificationRequestItem;
|
||||
NotificationRequestItem: NotificationRequestItem;
|
||||
}
|
||||
|
||||
export interface NotificationRequestItem {
|
||||
@@ -206,7 +206,7 @@ const typeMap: any = {
|
||||
{ json: "notificationItems", js: "notificationItems", typ: a(r("NotificationItem")) },
|
||||
], false),
|
||||
"NotificationItem": o([
|
||||
{ json: "NotificationRequestItem", js: "notificationRequestItem", typ: r("NotificationRequestItem") },
|
||||
{ json: "NotificationRequestItem", js: "NotificationRequestItem", typ: r("NotificationRequestItem") },
|
||||
], false),
|
||||
"NotificationRequestItem": o([
|
||||
{ json: "additionalData", js: "additionalData", typ: u(undefined, m("any")) },
|
||||
@@ -226,4 +226,4 @@ const typeMap: any = {
|
||||
{ json: "currency", js: "currency", typ: "" },
|
||||
{ json: "value", js: "value", typ: 0 },
|
||||
], false),
|
||||
};
|
||||
};
|
||||
64
src/typings/payments/applicationInfo.ts
Normal file
64
src/typings/payments/applicationInfo.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Adyen Payment API
|
||||
* A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. To learn more about the API, visit [Classic integration](https://docs.adyen.com/classic-integration). ## Authentication To connect to the Payments API, you must use your basic authentication credentials. For this, create your web service user, as described in [How to get the WS user password](https://docs.adyen.com/user-management/how-to-get-the-web-service-ws-user-password). Then use its credentials to authenticate your request, for example: ``` curl -U \"ws@Company.YourCompany\":\"YourWsPassword\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate new web service user credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Payments API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/Payment/v50/authorise ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { CommonField } from './commonField';
|
||||
import { ExternalPlatform } from './externalPlatform';
|
||||
import { MerchantDevice } from './merchantDevice';
|
||||
import { ShopperInteractionDevice } from './shopperInteractionDevice';
|
||||
|
||||
export class ApplicationInfo {
|
||||
'adyenLibrary'?: CommonField;
|
||||
'adyenPaymentSource'?: CommonField;
|
||||
'externalPlatform'?: ExternalPlatform;
|
||||
'merchantApplication'?: CommonField;
|
||||
'merchantDevice'?: MerchantDevice;
|
||||
'shopperInteractionDevice'?: ShopperInteractionDevice;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "adyenLibrary",
|
||||
"baseName": "adyenLibrary",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "adyenPaymentSource",
|
||||
"baseName": "adyenPaymentSource",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "externalPlatform",
|
||||
"baseName": "externalPlatform",
|
||||
"type": "ExternalPlatform"
|
||||
},
|
||||
{
|
||||
"name": "merchantApplication",
|
||||
"baseName": "merchantApplication",
|
||||
"type": "CommonField"
|
||||
},
|
||||
{
|
||||
"name": "merchantDevice",
|
||||
"baseName": "merchantDevice",
|
||||
"type": "MerchantDevice"
|
||||
},
|
||||
{
|
||||
"name": "shopperInteractionDevice",
|
||||
"baseName": "shopperInteractionDevice",
|
||||
"type": "ShopperInteractionDevice"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ApplicationInfo.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
42
src/typings/payments/commonField.ts
Normal file
42
src/typings/payments/commonField.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Adyen Payment API
|
||||
* A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. To learn more about the API, visit [Classic integration](https://docs.adyen.com/classic-integration). ## Authentication To connect to the Payments API, you must use your basic authentication credentials. For this, create your web service user, as described in [How to get the WS user password](https://docs.adyen.com/user-management/how-to-get-the-web-service-ws-user-password). Then use its credentials to authenticate your request, for example: ``` curl -U \"ws@Company.YourCompany\":\"YourWsPassword\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate new web service user credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Payments API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/Payment/v50/authorise ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class CommonField {
|
||||
/**
|
||||
* Name of the field. For example, Name of External Platform.
|
||||
*/
|
||||
'name'?: string;
|
||||
/**
|
||||
* Version of the field. For example, Version of External Platform.
|
||||
*/
|
||||
'version'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"baseName": "version",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return CommonField.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
51
src/typings/payments/externalPlatform.ts
Normal file
51
src/typings/payments/externalPlatform.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Payment API
|
||||
* A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. To learn more about the API, visit [Classic integration](https://docs.adyen.com/classic-integration). ## Authentication To connect to the Payments API, you must use your basic authentication credentials. For this, create your web service user, as described in [How to get the WS user password](https://docs.adyen.com/user-management/how-to-get-the-web-service-ws-user-password). Then use its credentials to authenticate your request, for example: ``` curl -U \"ws@Company.YourCompany\":\"YourWsPassword\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate new web service user credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Payments API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/Payment/v50/authorise ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class ExternalPlatform {
|
||||
/**
|
||||
* External platform integrator.
|
||||
*/
|
||||
'integrator'?: string;
|
||||
/**
|
||||
* Name of the field. For example, Name of External Platform.
|
||||
*/
|
||||
'name'?: string;
|
||||
/**
|
||||
* Version of the field. For example, Version of External Platform.
|
||||
*/
|
||||
'version'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "integrator",
|
||||
"baseName": "integrator",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"baseName": "version",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ExternalPlatform.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
51
src/typings/payments/merchantDevice.ts
Normal file
51
src/typings/payments/merchantDevice.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Payment API
|
||||
* A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. To learn more about the API, visit [Classic integration](https://docs.adyen.com/classic-integration). ## Authentication To connect to the Payments API, you must use your basic authentication credentials. For this, create your web service user, as described in [How to get the WS user password](https://docs.adyen.com/user-management/how-to-get-the-web-service-ws-user-password). Then use its credentials to authenticate your request, for example: ``` curl -U \"ws@Company.YourCompany\":\"YourWsPassword\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate new web service user credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Payments API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/Payment/v50/authorise ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class MerchantDevice {
|
||||
/**
|
||||
* Operating system running on the merchant device.
|
||||
*/
|
||||
'os'?: string;
|
||||
/**
|
||||
* Version of the operating system on the merchant device.
|
||||
*/
|
||||
'osVersion'?: string;
|
||||
/**
|
||||
* Merchant device reference.
|
||||
*/
|
||||
'reference'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "os",
|
||||
"baseName": "os",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "osVersion",
|
||||
"baseName": "osVersion",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "reference",
|
||||
"baseName": "reference",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return MerchantDevice.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
51
src/typings/payments/shopperInteractionDevice.ts
Normal file
51
src/typings/payments/shopperInteractionDevice.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Adyen Payment API
|
||||
* A set of API endpoints that allow you to initiate, settle, and modify payments on the Adyen payments platform. You can use the API to accept card payments (including One-Click and 3D Secure), bank transfers, ewallets, and many other payment methods. To learn more about the API, visit [Classic integration](https://docs.adyen.com/classic-integration). ## Authentication To connect to the Payments API, you must use your basic authentication credentials. For this, create your web service user, as described in [How to get the WS user password](https://docs.adyen.com/user-management/how-to-get-the-web-service-ws-user-password). Then use its credentials to authenticate your request, for example: ``` curl -U \"ws@Company.YourCompany\":\"YourWsPassword\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate new web service user credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning Payments API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/Payment/v50/authorise ```
|
||||
*
|
||||
* The version of the OpenAPI document: 50
|
||||
* Contact: support@adyen.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export class ShopperInteractionDevice {
|
||||
/**
|
||||
* Locale on the shopper interaction device.
|
||||
*/
|
||||
'locale'?: string;
|
||||
/**
|
||||
* Operating system running on the shopper interaction device.
|
||||
*/
|
||||
'os'?: string;
|
||||
/**
|
||||
* Version of the operating system on the shopper interaction device.
|
||||
*/
|
||||
'osVersion'?: string;
|
||||
|
||||
static discriminator: string | undefined = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "locale",
|
||||
"baseName": "locale",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "os",
|
||||
"baseName": "os",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "osVersion",
|
||||
"baseName": "osVersion",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ShopperInteractionDevice.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5529,4 +5529,4 @@ const typeMap: any = {
|
||||
"PrinterReceipt",
|
||||
"PrinterVoucher",
|
||||
],
|
||||
};
|
||||
};
|
||||
@@ -42,7 +42,7 @@ class HmacValidator {
|
||||
const keys: string[] = [];
|
||||
const values: string[] = [];
|
||||
const replacer = (str: string): string =>
|
||||
str.replace("\\", "\\\\").replace(":", "\\:");
|
||||
str.replace(/\\/g, "\\\\").replace(/:/g, "\\:");
|
||||
Object.entries(notificationRequestItem).sort().forEach(([key, value]): void => {
|
||||
keys.push(replacer(key));
|
||||
values.push(replacer(value));
|
||||
@@ -53,4 +53,4 @@ class HmacValidator {
|
||||
}
|
||||
}
|
||||
|
||||
export default HmacValidator;
|
||||
export default HmacValidator;
|
||||
|
||||
Reference in New Issue
Block a user