Skip to content

Commit

Permalink
Merge pull request #1269 from Adyen/automation/release
Browse files Browse the repository at this point in the history
Release v15.0.0
  • Loading branch information
AdyenAutomationBot committed Nov 8, 2023
2 parents ddbb4b4 + dbf4201 commit d043dfd
Show file tree
Hide file tree
Showing 210 changed files with 948 additions and 691 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-g
openapi-generator-jar:=build/openapi-generator-cli.jar
openapi-generator-cli:=java -jar $(openapi-generator-jar)

services:=acsWebhooks balanceControl balancePlatform binLookup checkout configurationWebhooks dataProtection disputes legalEntityManagement management managementWebhooks payment payout recurring reportWebhooks storedValue terminalManagement transfers transferWebhooks
services:=acsWebhooks balanceControl balancePlatform binLookup checkout configurationWebhooks dataProtection disputes legalEntityManagement management managementWebhooks payment payout recurring reportWebhooks storedValue terminalManagement transfers transferWebhooks transactionWebhooks

# Generate models (for each service)
models: $(services)

balanceControl: spec=BalanceControlService-v1
balancePlatform: spec=BalancePlatformService-v2
binLookup: spec=BinLookupService-v54
checkout: spec=CheckoutService-v70
checkout: spec=CheckoutService-v71
dataProtection: spec=DataProtectionService-v1
disputes: spec=DisputeService-v30
storedValue: spec=StoredValueService-v46
Expand All @@ -32,6 +32,7 @@ acsWebhooks: spec=BalancePlatformAcsNotification-v1
configurationWebhooks: spec=BalancePlatformConfigurationNotification-v1
reportWebhooks: spec=BalancePlatformReportNotification-v1
transferWebhooks: spec=BalancePlatformTransferNotification-v4
transactionWebhooks: spec=BalancePlatformTransactionNotification-v4
# ManagementWebhooks
managementWebhooks: spec=ManagementNotificationService-v3

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This library supports the following:
| API name | API version | Description | API object |
|------------------------------------------------------------------------------------------------------------|:-----------:|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BIN Lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | v54 | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [BinLookup](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/binLookupApi.ts) |
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | v70 | Our latest integration for accepting online payments. | [CheckoutAPI](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/checkout/index.ts) |
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/71/overview) | v71 | Our latest integration for accepting online payments. | [CheckoutAPI](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/checkout/index.ts) |
| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | v2 | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | [BalancePlatform](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/balancePlatform/index.ts) |
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | v1 | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | [DataProtection](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/dataProtectionApi.ts) |
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | v3 | Manage legal entities that contain information required for verification. | [LegalEntityManagement](https://github.com/Adyen/adyen-node-api-library/blob/main/src/services/legalEntityManagement/index.ts) |
Expand Down Expand Up @@ -48,6 +48,7 @@ The library supports all webhooks under the following model directories:
| [Report Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | [ReportNotification](src/typings/reportWebhooks) | **v1** |
| [Management Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/3/overview) | Adyen uses webhooks to inform your system about events that happen with your Adyen company and merchant accounts, stores, payment terminals, and payment methods when using Management API. | [ManagementWebhooks](src/typings/managementWebhooks) | **v3** |
| [Notification Webhooks](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | [Notification](src/typings/notification) | **v1** |
| [Transaction Webhooks](https://docs.adyen.com/api-explorer/transaction-webhooks/4/overview) | Adyen sends webhooks to inform your system about incoming and outgoing transfers in your platform. You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | [TransactionWebhooks](src/typings/transactionWebhooks) | **v4** |

For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adyen/api-library",
"version": "15.0.0-beta",
"version": "15.0.0",
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand Down
16 changes: 8 additions & 8 deletions src/__tests__/checkout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function createUpdatePaymentLinkRequest(): checkout.UpdatePaymentLinkRequest {
"status": checkout.UpdatePaymentLinkRequest.StatusEnum.Expired
};
}
function getPaymentLinkSuccess(expiresAt: string): checkout.PaymentLinkResponse {
function getPaymentLinkSuccess(expiresAt: Date): checkout.PaymentLinkResponse {
return {
amount: createAmountObject("USD", 1000),
expiresAt,
Expand Down Expand Up @@ -130,7 +130,7 @@ beforeEach((): void => {
nock.activate();
}
client = createClient();
scope = nock("https://checkout-test.adyen.com/v70");
scope = nock("https://checkout-test.adyen.com/v71");
checkoutService = new CheckoutAPI(client);
});

Expand All @@ -152,8 +152,8 @@ describe("Checkout", (): void => {
.matchHeader("Idempotency-Key", "testKey");
await checkoutService.PaymentsApi.paymentMethods(paymentMethodsRequest, {idempotencyKey: "testKey"});

const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const expiresAt = "2020-12-18T10:15:30+01:00";
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(new Date(expiresAt));
scope.post("/paymentLinks")
.reply(200, paymentLinkSuccess)
.matchHeader("Idempotency-Key", "testKey");
Expand Down Expand Up @@ -292,7 +292,7 @@ describe("Checkout", (): void => {

test("should have valid payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(new Date(expiresAt));

scope.post("/paymentLinks").reply(200, paymentLinkSuccess);

Expand All @@ -302,7 +302,7 @@ describe("Checkout", (): void => {

test("should get payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(new Date(expiresAt));

scope.post("/paymentLinks").reply(200, paymentLinkSuccess);

Expand All @@ -315,7 +315,7 @@ describe("Checkout", (): void => {

test("should patch payment link", async (): Promise<void> => {
const expiresAt = "2019-12-17T10:05:29Z";
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(expiresAt);
const paymentLinkSuccess: checkout.PaymentLinkResponse = getPaymentLinkSuccess(new Date(expiresAt));

scope.post("/paymentLinks").reply(200, paymentLinkSuccess);

Expand Down Expand Up @@ -387,7 +387,7 @@ describe("Checkout", (): void => {
};

nock(`https://checkout-test.adyen.com`)
.post(`/v70/originKeys`)
.post(`/v71/originKeys`)
.reply(200, originKeysSuccess);

const originKeysResponse = await checkoutUtility.UtilityApi.originKeys(originKeysRequest);
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/modification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ beforeEach((): void => {
}
client = createClient();
checkoutAPI = new CheckoutAPI(client);
scope = nock("https://checkout-test.adyen.com/v70");
scope = nock("https://checkout-test.adyen.com/v71");
});

afterEach(() => {
Expand Down
41 changes: 41 additions & 0 deletions src/__tests__/notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {AuthenticationNotificationRequest} from "../typings/acsWebhooks/authenti
import {TransferNotificationRequest} from "../typings/transferWebhooks/transferNotificationRequest";
import { PaymentMethodRequestRemovedNotificationRequest } from "../typings/managementWebhooks/paymentMethodRequestRemovedNotificationRequest";
import { PaymentMethodScheduledForRemovalNotificationRequest } from "../typings/managementWebhooks/paymentMethodScheduledForRemovalNotificationRequest";
import { TransactionNotificationRequestV4 } from "../typings/transactionWebhooks/transactionNotificationRequestV4";

describe("Notification Test", function (): void {

Expand Down Expand Up @@ -231,4 +232,44 @@ describe("Notification Test", function (): void {
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false)
expect(paymentMethodRequestRemoved.type).toEqual(PaymentMethodRequestRemovedNotificationRequest.TypeEnum.PaymentMethodRequestRemoved)
});

it("should deserialize Transaction v4 Webhooks", function (): void {
const json = {
"data": {
"id": "EVJN42272224222B5JB8BRC84N686ZEUR",
"amount": {
"value": 7000,
"currency": "EUR"
},
"status": "booked",
"transfer": {
"id": "JN4227222422265",
"reference": "Split_item_1",
},
"valueDate": "2023-03-01T00:00:00+02:00",
"bookingDate": "2023-02-28T13:30:20+02:00",
"creationDate": "2023-02-28T13:30:05+02:00",
"accountHolder": {
"id": "AH00000000000000000000001",
"description": "Your description for the account holder",
"reference": "Your reference for the account holder"
},
"balanceAccount": {
"id": "BA00000000000000000000001",
"description": "Your description for the balance account",
"reference": "Your reference for the balance account"
},
"balancePlatform": "YOUR_BALANCE_PLATFORM"
},
"type": "balancePlatform.transaction.created",
"environment": "test"
};
const jsonString = JSON.stringify(json);
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const transactionCreated: TransactionNotificationRequestV4 = bankingWebhookHandler.getTransactionNotificationRequest();
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
expect(genericWebhook instanceof TransactionNotificationRequestV4).toBe(true)
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false)
expect(transactionCreated.type).toEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated)
});
});
16 changes: 11 additions & 5 deletions src/notification/bankingWebhookHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
import {configurationWebhooks} from "../typings";
import {acsWebhooks} from "../typings"
import {reportWebhooks} from "../typings";
import {transferWebhooks} from "../typings";
import {configurationWebhooks, acsWebhooks, reportWebhooks, transferWebhooks, transactionWebhooks} from "../typings";

class BankingWebhookHandler {
private readonly payload: string;
Expand All @@ -24,7 +21,8 @@ class BankingWebhookHandler {
| configurationWebhooks.SweepConfigurationNotificationRequest
| configurationWebhooks.CardOrderNotificationRequest
| reportWebhooks.ReportNotificationRequest
| transferWebhooks.TransferNotificationRequest {
| transferWebhooks.TransferNotificationRequest
| transactionWebhooks.TransactionNotificationRequestV4 {
const type = this.payload['type'];

if(Object.values(acsWebhooks.AuthenticationNotificationRequest.TypeEnum).includes(type)){
Expand Down Expand Up @@ -59,6 +57,10 @@ class BankingWebhookHandler {
return this.getTransferNotificationRequest();
}

if(Object.values(transactionWebhooks.TransactionNotificationRequestV4.TypeEnum).includes(type)){
return this.getTransactionNotificationRequest();
}

throw new Error("Could not parse the json payload: " + this.payload)
}

Expand Down Expand Up @@ -93,6 +95,10 @@ class BankingWebhookHandler {
public getTransferNotificationRequest(): transferWebhooks.TransferNotificationRequest {
return transferWebhooks.ObjectSerializer.deserialize(this.payload, "TransferNotificationRequest");
}

public getTransactionNotificationRequest(): transactionWebhooks.TransactionNotificationRequestV4 {
return transactionWebhooks.ObjectSerializer.deserialize(this.payload, "TransactionNotificationRequestV4");
}
}

export default BankingWebhookHandler;
4 changes: 2 additions & 2 deletions src/services/checkout/classicCheckoutSDKApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v70
* The version of the OpenAPI document: v71
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -20,7 +20,7 @@ import { ObjectSerializer } from "../../typings/checkout/models";

export class ClassicCheckoutSDKApi extends Service {

private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v70";
private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v71";
private baseUrl: string;

public constructor(client: Client){
Expand Down
2 changes: 1 addition & 1 deletion src/services/checkout/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v70
* The version of the OpenAPI document: v71
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
4 changes: 2 additions & 2 deletions src/services/checkout/modificationsApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v70
* The version of the OpenAPI document: v71
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -28,7 +28,7 @@ import { ObjectSerializer } from "../../typings/checkout/models";

export class ModificationsApi extends Service {

private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v70";
private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v71";
private baseUrl: string;

public constructor(client: Client){
Expand Down
4 changes: 2 additions & 2 deletions src/services/checkout/ordersApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v70
* The version of the OpenAPI document: v71
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -22,7 +22,7 @@ import { ObjectSerializer } from "../../typings/checkout/models";

export class OrdersApi extends Service {

private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v70";
private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v71";
private baseUrl: string;

public constructor(client: Client){
Expand Down
4 changes: 2 additions & 2 deletions src/services/checkout/paymentLinksApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* The version of the OpenAPI document: v70
* The version of the OpenAPI document: v71
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand All @@ -19,7 +19,7 @@ import { ObjectSerializer } from "../../typings/checkout/models";

export class PaymentLinksApi extends Service {

private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v70";
private readonly API_BASEPATH: string = "https://checkout-test.adyen.com/v71";
private baseUrl: string;

public constructor(client: Client){
Expand Down

0 comments on commit d043dfd

Please sign in to comment.