mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
Merge branch 'develop' into fix/metadata
This commit is contained in:
5
Makefile
5
Makefile
@@ -1,10 +1,11 @@
|
||||
generator:=typescript-node
|
||||
openapi-generator-cli:=docker run --user $(shell id -u):$(shell id -g) --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
|
||||
services:=checkout storedValue terminalManagement payments recurring payouts management balancePlatform platformsAccount platformsFund platformsNotificationConfiguration platformsHostedOnboardingPage
|
||||
services:=binlookup checkout storedValue terminalManagement payments recurring payouts management balancePlatform platformsAccount platformsFund platformsNotificationConfiguration platformsHostedOnboardingPage
|
||||
|
||||
# Generate models (for each service)
|
||||
models: $(services)
|
||||
|
||||
binlookup: spec=BinLookupService-v52
|
||||
checkout: spec=CheckoutService-v69
|
||||
storedValue: spec=StoredValueService-v46
|
||||
terminalManagement: spec=TfmAPIService-v1
|
||||
@@ -42,4 +43,4 @@ clean:
|
||||
git checkout src/typings
|
||||
git clean -f -d src/typings
|
||||
|
||||
.PHONY: templates models $(services)
|
||||
.PHONY: templates models $(services)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@types/jest": "27.5.0",
|
||||
"@types/nock": "11.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.33.1",
|
||||
"@typescript-eslint/parser": "5.33.0",
|
||||
"@typescript-eslint/parser": "5.33.1",
|
||||
"acorn": "^8.0.1",
|
||||
"coveralls": "3.1.1",
|
||||
"dotenv": "^16.0.0",
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
/*
|
||||
* ######
|
||||
* ######
|
||||
* ############ ####( ###### #####. ###### ############ ############
|
||||
* ############# #####( ###### #####. ###### ############# #############
|
||||
* ###### #####( ###### #####. ###### ##### ###### ##### ######
|
||||
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
|
||||
* ###### ###### #####( ###### #####. ###### ##### ##### ######
|
||||
* ############# ############# ############# ############# ##### ######
|
||||
* ############ ############ ############# ############ ##### ######
|
||||
* ######
|
||||
* #############
|
||||
* ############
|
||||
* Adyen NodeJS API Library
|
||||
* Copyright (c) 2020 Adyen B.V.
|
||||
* This file is open source and available under the MIT license.
|
||||
* See the LICENSE file for more info.
|
||||
*/
|
||||
|
||||
import nock from "nock";
|
||||
import { createClient } from "../__mocks__/base";
|
||||
import Payout from "../services/payout";
|
||||
import Client from "../client";
|
||||
import StoreDetailRequest = IPayouts.StoreDetailRequest;
|
||||
import {
|
||||
ModifyRequest,
|
||||
PayoutRequest,
|
||||
Recurring,
|
||||
StoreDetailAndSubmitRequest,
|
||||
StoreDetailRequest,
|
||||
SubmitRequest
|
||||
} from "../typings/payouts/models";
|
||||
import { ApiConstants } from "../constants/apiConstants";
|
||||
|
||||
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
|
||||
@@ -50,13 +38,13 @@ const amountAndReference = {
|
||||
};
|
||||
|
||||
const defaultData = {
|
||||
dateOfBirth: (new Date()).toISOString(),
|
||||
dateOfBirth: new Date(),
|
||||
nationality: "NL",
|
||||
shopperEmail: "johndoe@email.com",
|
||||
shopperReference: "shopperReference",
|
||||
};
|
||||
|
||||
const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): IPayouts.StoreDetailRequest => ({
|
||||
const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): StoreDetailRequest => ({
|
||||
...defaultData,
|
||||
card: {
|
||||
cvc: "737",
|
||||
@@ -65,29 +53,29 @@ const mockStoreDetailRequest = (merchantAccount: string = process.env.ADYEN_MERC
|
||||
number: "4111111111111111",
|
||||
holderName: "John Smith"
|
||||
},
|
||||
entityType: "Company",
|
||||
entityType: StoreDetailRequest.EntityTypeEnum.Company,
|
||||
recurring: {
|
||||
contract: "PAYOUT"
|
||||
contract: Recurring.ContractEnum.Payout,
|
||||
},
|
||||
merchantAccount,
|
||||
});
|
||||
|
||||
const mockSubmitRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): IPayouts.SubmitRequest => ({
|
||||
const mockSubmitRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): SubmitRequest => ({
|
||||
selectedRecurringDetailReference: "LATEST",
|
||||
recurring: {
|
||||
contract: "PAYOUT"
|
||||
contract: Recurring.ContractEnum.Payout
|
||||
},
|
||||
...defaultData,
|
||||
...amountAndReference,
|
||||
merchantAccount,
|
||||
});
|
||||
|
||||
const mockStoreDetailAndSubmitRequest = (merchantAccount?: string): IPayouts.StoreDetailAndSubmitRequest => ({
|
||||
const mockStoreDetailAndSubmitRequest = (merchantAccount?: string): StoreDetailAndSubmitRequest => ({
|
||||
...amountAndReference,
|
||||
...(mockStoreDetailRequest(merchantAccount)),
|
||||
});
|
||||
});
|
||||
|
||||
const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): IPayouts.PayoutRequest => ({
|
||||
const mockPayoutRequest = (merchantAccount: string = process.env.ADYEN_MERCHANT!): PayoutRequest => ({
|
||||
...amountAndReference,
|
||||
...defaultData,
|
||||
card: {
|
||||
@@ -124,7 +112,7 @@ describe("PayoutTest", function (): void {
|
||||
test.each([isCI, true])("should succeed on store detail and submit third party, isMock: %p", async function (isMock): Promise<void> {
|
||||
!isMock && nock.restore();
|
||||
payout = new Payout(clientStore);
|
||||
const request: IPayouts.StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest();
|
||||
const request: StoreDetailAndSubmitRequest = mockStoreDetailAndSubmitRequest();
|
||||
scope.post("/storeDetailAndSubmitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
|
||||
|
||||
const result = await payout.storeDetailAndSubmitThirdParty(request);
|
||||
@@ -158,7 +146,7 @@ describe("PayoutTest", function (): void {
|
||||
response: "[payout-confirm-received]"
|
||||
});
|
||||
|
||||
const request: IPayouts.ModifyRequest = {
|
||||
const request: ModifyRequest = {
|
||||
merchantAccount: process.env.ADYEN_MERCHANT!,
|
||||
originalReference: storeResult.pspReference
|
||||
};
|
||||
@@ -173,7 +161,7 @@ describe("PayoutTest", function (): void {
|
||||
payout = new Payout(clientStore);
|
||||
scope.post("/submitThirdParty").reply(200, storeDetailAndSubmitThirdParty);
|
||||
|
||||
const request: IPayouts.SubmitRequest = mockSubmitRequest();
|
||||
const request: SubmitRequest = mockSubmitRequest();
|
||||
const result = await payout.submitThirdparty(request);
|
||||
|
||||
expect(result.resultCode).toEqual("[payout-submit-received]");
|
||||
@@ -193,7 +181,7 @@ describe("PayoutTest", function (): void {
|
||||
const storeResult = await payout.storeDetail(storeRequest);
|
||||
|
||||
payout = new Payout(clientReview);
|
||||
const request: IPayouts.ModifyRequest = {
|
||||
const request: ModifyRequest = {
|
||||
merchantAccount: process.env.ADYEN_MERCHANT!,
|
||||
originalReference: storeResult.pspReference
|
||||
};
|
||||
@@ -221,4 +209,4 @@ describe("PayoutTest", function (): void {
|
||||
expect(result.resultCode).toEqual("Received");
|
||||
expect(result.pspReference).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* ######
|
||||
* ######
|
||||
* ############ ####( ###### #####. ###### ############ ############
|
||||
* ############# #####( ###### #####. ###### ############# #############
|
||||
* ###### #####( ###### #####. ###### ##### ###### ##### ######
|
||||
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
|
||||
* ###### ###### #####( ###### #####. ###### ##### ##### ######
|
||||
* ############# ############# ############# ############# ##### ######
|
||||
* ############ ############ ############# ############ ##### ######
|
||||
* ######
|
||||
* #############
|
||||
* ############
|
||||
* Adyen NodeJS API Library
|
||||
* Copyright (c) 2020 Adyen B.V.
|
||||
* This file is open source and available under the MIT license.
|
||||
* See the LICENSE file for more info.
|
||||
*/
|
||||
import Client from "../client";
|
||||
import Service from "../service";
|
||||
import DeclineThirdParty from "./resource/payout/declineThirdParty";
|
||||
@@ -25,6 +7,18 @@ import ConfirmThirdParty from "./resource/payout/confirmThirdParty";
|
||||
import PayoutResource from "./resource/payout/payout";
|
||||
import StoreDetailAndSubmitThirdParty from "./resource/payout/storeDetailAndSubmitThirdParty";
|
||||
import getJsonResponse from "../helpers/getJsonResponse";
|
||||
import {
|
||||
ModifyRequest,
|
||||
ModifyResponse,
|
||||
PayoutRequest,
|
||||
PayoutResponse,
|
||||
StoreDetailAndSubmitRequest,
|
||||
StoreDetailAndSubmitResponse,
|
||||
StoreDetailRequest,
|
||||
StoreDetailResponse,
|
||||
SubmitRequest,
|
||||
SubmitResponse
|
||||
} from "../typings/payouts/models";
|
||||
|
||||
class Payout extends Service {
|
||||
private readonly _storeDetailAndSubmitThirdParty: StoreDetailAndSubmitThirdParty;
|
||||
@@ -45,47 +39,47 @@ class Payout extends Service {
|
||||
this._payout = new PayoutResource(this);
|
||||
}
|
||||
|
||||
public storeDetailAndSubmitThirdParty(request: IPayouts.StoreDetailAndSubmitRequest): Promise<IPayouts.StoreDetailAndSubmitResponse> {
|
||||
return getJsonResponse<IPayouts.StoreDetailAndSubmitRequest, IPayouts.StoreDetailAndSubmitResponse>(
|
||||
public storeDetailAndSubmitThirdParty(request: StoreDetailAndSubmitRequest): Promise<StoreDetailAndSubmitResponse> {
|
||||
return getJsonResponse<StoreDetailAndSubmitRequest, StoreDetailAndSubmitResponse>(
|
||||
this._storeDetailAndSubmitThirdParty,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
public confirmThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
|
||||
return getJsonResponse<IPayouts.ModifyRequest, IPayouts.ModifyResponse>(
|
||||
public confirmThirdParty(request: ModifyRequest): Promise<ModifyResponse> {
|
||||
return getJsonResponse<ModifyRequest, ModifyResponse>(
|
||||
this._confirmThirdParty,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
public declineThirdParty(request: IPayouts.ModifyRequest): Promise<IPayouts.ModifyResponse> {
|
||||
return getJsonResponse<IPayouts.ModifyRequest, IPayouts.ModifyResponse>(
|
||||
public declineThirdParty(request: ModifyRequest): Promise<ModifyResponse> {
|
||||
return getJsonResponse<ModifyRequest, ModifyResponse>(
|
||||
this._declineThirdParty,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
public storeDetail(request: IPayouts.StoreDetailRequest): Promise<IPayouts.StoreDetailResponse> {
|
||||
return getJsonResponse<IPayouts.StoreDetailRequest, IPayouts.StoreDetailResponse>(
|
||||
public storeDetail(request: StoreDetailRequest): Promise<StoreDetailResponse> {
|
||||
return getJsonResponse<StoreDetailRequest, StoreDetailResponse>(
|
||||
this._storeDetail,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
public submitThirdparty(request: IPayouts.SubmitRequest): Promise<IPayouts.SubmitResponse> {
|
||||
return getJsonResponse<IPayouts.SubmitRequest, IPayouts.SubmitResponse>(
|
||||
public submitThirdparty(request: SubmitRequest): Promise<SubmitResponse> {
|
||||
return getJsonResponse<SubmitRequest, SubmitResponse>(
|
||||
this._submitThirdParty,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
public payout(request: IPayouts.PayoutRequest): Promise<IPayouts.PayoutResponse> {
|
||||
return getJsonResponse<IPayouts.PayoutRequest, IPayouts.PayoutResponse>(
|
||||
public payout(request: PayoutRequest): Promise<PayoutResponse> {
|
||||
return getJsonResponse<PayoutRequest, PayoutResponse>(
|
||||
this._payout,
|
||||
request
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Payout;
|
||||
export default Payout;
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
/// <reference path="enums/vatCategory.ts" />
|
||||
/// <reference path="nexo.ts" />
|
||||
/// <reference path="notification/notification.ts" />
|
||||
/// <reference path="payouts.ts" />
|
||||
/// <reference path="requestOptions.ts" />
|
||||
/// <reference path="platformsFund.ts" />
|
||||
/// <reference path="platformsNotificationConfiguration.ts" />
|
||||
|
||||
export * as checkout from './checkout/models';
|
||||
export * as notification from './notification/models';
|
||||
export * as payouts from './payouts/models';
|
||||
export * as platformsNotifications from './platformsNotifications/models';
|
||||
export * as platformsAccount from './platformsAccount/models';
|
||||
export * as platformsHostedOnboardingPage from './platformsHostedOnboardingPage/models';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
48
yarn.lock
48
yarn.lock
@@ -907,24 +907,16 @@
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/parser@5.33.0":
|
||||
version "5.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.33.0.tgz#26ec3235b74f0667414613727cb98f9b69dc5383"
|
||||
integrity sha512-cgM5cJrWmrDV2KpvlcSkelTBASAs1mgqq+IUGKJvFxWrapHpaRy5EXPQz9YaKF3nZ8KY18ILTiVpUtbIac86/w==
|
||||
"@typescript-eslint/parser@5.33.1":
|
||||
version "5.33.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.33.1.tgz#e4b253105b4d2a4362cfaa4e184e2d226c440ff3"
|
||||
integrity sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "5.33.0"
|
||||
"@typescript-eslint/types" "5.33.0"
|
||||
"@typescript-eslint/typescript-estree" "5.33.0"
|
||||
"@typescript-eslint/scope-manager" "5.33.1"
|
||||
"@typescript-eslint/types" "5.33.1"
|
||||
"@typescript-eslint/typescript-estree" "5.33.1"
|
||||
debug "^4.3.4"
|
||||
|
||||
"@typescript-eslint/scope-manager@5.33.0":
|
||||
version "5.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.33.0.tgz#509d7fa540a2c58f66bdcfcf278a3fa79002e18d"
|
||||
integrity sha512-/Jta8yMNpXYpRDl8EwF/M8It2A9sFJTubDo0ATZefGXmOqlaBffEw0ZbkbQ7TNDK6q55NPHFshGBPAZvZkE8Pw==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.33.0"
|
||||
"@typescript-eslint/visitor-keys" "5.33.0"
|
||||
|
||||
"@typescript-eslint/scope-manager@5.33.1":
|
||||
version "5.33.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz#8d31553e1b874210018ca069b3d192c6d23bc493"
|
||||
@@ -942,29 +934,11 @@
|
||||
debug "^4.3.4"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/types@5.33.0":
|
||||
version "5.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.33.0.tgz#d41c584831805554b063791338b0220b613a275b"
|
||||
integrity sha512-nIMt96JngB4MYFYXpZ/3ZNU4GWPNdBbcB5w2rDOCpXOVUkhtNlG2mmm8uXhubhidRZdwMaMBap7Uk8SZMU/ppw==
|
||||
|
||||
"@typescript-eslint/types@5.33.1":
|
||||
version "5.33.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.33.1.tgz#3faef41793d527a519e19ab2747c12d6f3741ff7"
|
||||
integrity sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.33.0":
|
||||
version "5.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.0.tgz#02d9c9ade6f4897c09e3508c27de53ad6bfa54cf"
|
||||
integrity sha512-tqq3MRLlggkJKJUrzM6wltk8NckKyyorCSGMq4eVkyL5sDYzJJcMgZATqmF8fLdsWrW7OjjIZ1m9v81vKcaqwQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.33.0"
|
||||
"@typescript-eslint/visitor-keys" "5.33.0"
|
||||
debug "^4.3.4"
|
||||
globby "^11.1.0"
|
||||
is-glob "^4.0.3"
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.33.1":
|
||||
version "5.33.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz#a573bd360790afdcba80844e962d8b2031984f34"
|
||||
@@ -990,14 +964,6 @@
|
||||
eslint-scope "^5.1.1"
|
||||
eslint-utils "^3.0.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.33.0":
|
||||
version "5.33.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.0.tgz#fbcbb074e460c11046e067bc3384b5d66b555484"
|
||||
integrity sha512-/XsqCzD4t+Y9p5wd9HZiptuGKBlaZO5showwqODii5C0nZawxWLF+Q6k5wYHBrQv96h6GYKyqqMHCSTqta8Kiw==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.33.0"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.33.1":
|
||||
version "5.33.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz#0155c7571c8cd08956580b880aea327d5c34a18b"
|
||||
|
||||
Reference in New Issue
Block a user