Skip to content

Commit 7df995e

Browse files
authored
Merge pull request #843 from Adyen/develop
Release 10.2.0
2 parents 1b697c9 + 0cd8da6 commit 7df995e

File tree

12 files changed

+855
-597
lines changed

12 files changed

+855
-597
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @zaiddreakh @maassenbas @AlexandrosMor @peterojo @wboereboom
1+
* @zaiddreakh @maassenbas @AlexandrosMor @peterojo @wboereboom @michaelpaul

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adyen Node.js API Library
22
![Node.js CI](https://github.com/Adyen/adyen-node-api-library/workflows/Node.js%20CI/badge.svg)
3-
[![Coverage Status](https://coveralls.io/repos/github/Adyen/adyen-node-api-library/badge.svg?branch=master)](https://coveralls.io/github/Adyen/adyen-node-api-library?branch=master)
3+
[![Coverage Status](https://coveralls.io/repos/github/Adyen/adyen-node-api-library/badge.svg?branch=main)](https://coveralls.io/github/Adyen/adyen-node-api-library?branch=main)
44
[![Downloads](https://img.shields.io/npm/dm/@adyen/api-library.svg)](https://www.npmjs.com/package/@adyen/api-library)
55
![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@adyen/api-library.svg)
66
[![Version](https://img.shields.io/npm/v/@adyen/api-library.svg)](https://www.npmjs.com/package/@adyen/api-library)

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adyen/api-library",
3-
"version": "10.1.0",
3+
"version": "10.2.0",
44
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",
@@ -35,25 +35,25 @@
3535
"author": "Ricardo Ambrogi",
3636
"license": "MIT",
3737
"devDependencies": {
38-
"@types/jest": "27.0.2",
38+
"@types/jest": "27.4.0",
3939
"@types/nock": "11.1.0",
4040
"@typescript-eslint/eslint-plugin": "4.33.0",
4141
"@typescript-eslint/parser": "4.33.0",
4242
"acorn": "^8.0.1",
4343
"coveralls": "3.1.1",
44-
"dotenv": "^10.0.0",
44+
"dotenv": "^15.0.0",
4545
"eslint": "7.32.0",
4646
"jest": "^27.0.6",
4747
"jest-ts-auto-mock": "^2.0.0",
4848
"kind-of": "^6.0.3",
4949
"minimist": ">=1.2.3",
50-
"nock": "13.2.0",
51-
"release-it": "14.11.6",
50+
"nock": "13.2.2",
51+
"release-it": "14.12.4",
5252
"ts-auto-mock": "^3.3.5",
5353
"ts-jest": "^27.0.4",
5454
"ts-loader": "8.0.10",
5555
"ttypescript": "^1.5.10",
56-
"typescript": "4.4.4"
56+
"typescript": "4.5.5"
5757
},
5858
"dependencies": {
5959
"https-proxy-agent": "5.0.0"

src/__mocks__/recurring/listRecurringDetailsSuccess.ts

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,64 @@
1818
*/
1919

2020
export const listRecurringDetailsSuccess = {
21-
creationDate: "2017-03-01T10:53:11.000",
22-
details: [
21+
"creationDate": "2017-03-01T11:53:11+01:00",
22+
"details": [
2323
{
24-
additionalData: {
25-
cardBin: "411111",
26-
},
27-
alias: "cardAlias",
28-
aliasType: "Default",
29-
card: {
30-
expiryMonth: "8",
31-
expiryYear: "2018",
32-
holderName: "Holder",
33-
number: "1111",
34-
},
35-
contractTypes: [
36-
"ONECLICK",
37-
],
38-
creationDate: "2017-03-01T10:53:11.000",
39-
firstPspReference: "8524888762135795",
40-
paymentMethodVariant: "visa",
41-
recurringDetailReference: "recurringReference",
42-
variant: "visa",
24+
"RecurringDetail": {
25+
"acquirer": "TestPmmAcquirer",
26+
"acquirerAccount": "TestPmmAcquirerAccount",
27+
"additionalData": {
28+
"cardBin": "411111"
29+
},
30+
"alias": "cardAlias",
31+
"aliasType": "Default",
32+
"card": {
33+
"expiryMonth": "8",
34+
"expiryYear": "2018",
35+
"holderName": "Holder",
36+
"number": "1111"
37+
},
38+
"contractTypes": [
39+
"ONECLICK"
40+
],
41+
"creationDate": "2017-03-07T09:43:33+01:00",
42+
"firstPspReference": "8524888762135795",
43+
"paymentMethodVariant": "visa",
44+
"recurringDetailReference": "recurringReference",
45+
"variant": "visa"
46+
}
4347
},
4448
{
45-
billingAddress: {
46-
city: "City",
47-
country: "NL",
48-
houseNumberOrName: "1",
49-
postalCode: "2312aa",
50-
stateOrProvince: "NA",
51-
street: "Street",
52-
},
53-
contractTypes: [
54-
"RECURRING",
55-
],
56-
creationDate: "2017-03-01T10:53:11.000",
57-
firstPspReference: "8515076181707110",
58-
paymentMethodVariant: "paypal",
59-
recurringDetailReference: "8315076181982020",
60-
tokenDetails: {
61-
tokenData: {
62-
"BillingAgreementId": "B-7MA42752FE774625C",
63-
"EmailId": "[email protected]",
64-
"PayPal.PayerId": "H95EPL8B2KFE6",
49+
"RecurringDetail": {
50+
"acquirer": "PayPalSandbox",
51+
"acquirerAccount": "TestPmmAcquirerAccount",
52+
"billingAddress": {
53+
"city": "City",
54+
"country": "NL",
55+
"houseNumberOrName": "1",
56+
"postalCode": "2312aa",
57+
"stateOrProvince": "NA",
58+
"street": "Street"
6559
},
66-
tokenDataType: "PayPal",
67-
},
68-
variant: "paypal",
69-
},
60+
"contractTypes": [
61+
"RECURRING"
62+
],
63+
"creationDate": "2017-10-10T08:50:02+02:00",
64+
"firstPspReference": "8515076181707110",
65+
"paymentMethodVariant": "paypal",
66+
"recurringDetailReference": "8315076181982020",
67+
"tokenDetails": {
68+
"tokenData": {
69+
"EmailId": "[email protected]",
70+
"PayPal.PayerId": "H95EPL8B2KFE6",
71+
"BillingAgreementId": "B-7MA42752FE774625C"
72+
},
73+
"tokenDataType": "PayPal"
74+
},
75+
"variant": "paypal"
76+
}
77+
}
7078
],
79+
"shopperReference": "test-123",
80+
"invalidOneclickContracts": "false"
7181
};

src/__mocks__/terminalApi/sync.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,24 @@ export const syncRefund = {
365365
}
366366
}
367367
};
368+
369+
export const syncResEventNotification = {
370+
SaleToPOIRequest: {
371+
EventNotification: {
372+
EventToNotify: "Reject",
373+
EventDetails: "message=Did+not+receive+a+response+from+the+POI.",
374+
RejectedMessage: "ewoi...0KfQo=",
375+
TimeStamp: "2020-03-31T10:28:39.515Z"
376+
},
377+
MessageHeader: {
378+
DeviceID: "666568147",
379+
MessageCategory: "Event",
380+
MessageClass: "Event",
381+
MessageType: "Notification",
382+
POIID: "P400Plus-123456789",
383+
ProtocolVersion: "3.0",
384+
SaleID: "saleid-4c32759faaa7",
385+
ServiceID: "31122609"
386+
}
387+
}
388+
};

src/__tests__/recurring.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,15 @@ afterEach(() => {
6666
});
6767

6868
describe("Recurring", (): void => {
69-
test.each([false, true])("should test have recurring details list, isMock: %p", async (isMock): Promise<void> => {
70-
!isMock && nock.restore();
69+
test("should list recurring details ", async (): Promise<void> => {
7170
scope.post("/listRecurringDetails")
7271
.reply(200, listRecurringDetailsSuccess);
73-
7472
const request = createRecurringDetailsRequest();
75-
try {
76-
const result = await recurring.listRecurringDetails(request);
77-
expect(result).toBeTruthy();
78-
} catch (e: any) {
79-
fail(e.message);
80-
}
73+
74+
const result = await recurring.listRecurringDetails(request);
75+
76+
expect(result).toBeTruthy();
77+
expect(result.details?.[0].RecurringDetail.recurringDetailReference).toBe('recurringReference');
8178
});
8279

8380
test.each([isCI, true])("should disable, isMock: %p", async (isMock): Promise<void> => {

src/__tests__/terminalCloudAPI.spec.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
* #############
1313
* ############
1414
* Adyen NodeJS API Library
15-
* Copyright (c) 2021 Adyen B.V.
15+
* Copyright (c) 2022 Adyen N.V.
1616
* This file is open source and available under the MIT license.
1717
* See the LICENSE file for more info.
1818
*/
1919

2020
import nock from "nock";
2121
import { createClient, createTerminalAPIPaymentRequest, createTerminalAPIRefundRequest } from "../__mocks__/base";
2222
import { asyncRes } from "../__mocks__/terminalApi/async";
23-
import { syncRefund, syncRes } from "../__mocks__/terminalApi/sync";
23+
import { syncRefund, syncRes, syncResEventNotification } from "../__mocks__/terminalApi/sync";
2424
import Client from "../client";
2525
import TerminalCloudAPI from "../services/terminalCloudAPI";
2626
import { TerminalApiResponse } from "../typings/terminal/models";
@@ -68,6 +68,17 @@ describe("Terminal Cloud API", (): void => {
6868
expect(terminalAPIResponse.SaleToPOIResponse?.MessageHeader).toBeDefined();
6969
});
7070

71+
test.each([isCI, true])("should return event notification if response contains it, isMock: %p", async (isMock): Promise<void> => {
72+
!isMock && nock.restore();
73+
74+
const terminalAPIPaymentRequest = createTerminalAPIPaymentRequest();
75+
scope.post("/sync").reply(200, syncResEventNotification);
76+
77+
const terminalAPIResponse = await terminalCloudAPI.sync(terminalAPIPaymentRequest);
78+
79+
expect(terminalAPIResponse.SaleToPOIRequest?.EventNotification).toBeDefined();
80+
});
81+
7182
test.each([isCI, true])("should make an async refund request, isMock: %p", async (isMock): Promise<void> => {
7283
!isMock && nock.restore();
7384
scope.post("/sync").reply(200, syncRes);

src/typings/recurring/models.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export * from './recurringDetailsResult';
3333
export * from './scheduleAccountUpdaterRequest';
3434
export * from './scheduleAccountUpdaterResult';
3535
export * from './serviceError';
36+
export * from './recurringDetailContainer';
3637

3738
import * as fs from 'fs';
3839
import {Address} from './address';
@@ -51,6 +52,7 @@ import {RecurringDetailsResult} from './recurringDetailsResult';
5152
import {ScheduleAccountUpdaterRequest} from './scheduleAccountUpdaterRequest';
5253
import {ScheduleAccountUpdaterResult} from './scheduleAccountUpdaterResult';
5354
import {ServiceError} from './serviceError';
55+
import {RecurringDetailContainer} from "./recurringDetailContainer";
5456

5557
export interface RequestDetailedFile {
5658
value: Buffer;
@@ -94,6 +96,7 @@ let typeMap: {[index: string]: any} = {
9496
"RecurringDetail": RecurringDetail,
9597
"RecurringDetailsRequest": RecurringDetailsRequest,
9698
"RecurringDetailsResult": RecurringDetailsResult,
99+
'RecurringDetailContainer': RecurringDetailContainer,
97100
"ScheduleAccountUpdaterRequest": ScheduleAccountUpdaterRequest,
98101
"ScheduleAccountUpdaterResult": ScheduleAccountUpdaterResult,
99102
"ServiceError": ServiceError,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Adyen Recurring API
3+
* The Recurring APIs allow you to manage and remove your tokens or saved payment details. Tokens should be created with validation during a payment request. For more information, refer to our [Tokenization documentation](https://docs.adyen.com/online-payments/tokenization). ## Authentication To connect to the Recurring 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/development-resources/api-credentials). Then use its credentials to authenticate your request, for example: ``` curl -U \"[email protected]\":\"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 Recurring 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/Recurring/v49/disable ```
4+
*
5+
* The version of the OpenAPI document: 49
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
import {RecurringDetail} from "./recurringDetail";
14+
15+
export class RecurringDetailContainer {
16+
'RecurringDetail': RecurringDetail;
17+
18+
static discriminator: string | undefined = undefined;
19+
20+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
21+
{
22+
"name": "RecurringDetail",
23+
"baseName": "RecurringDetail",
24+
"type": "RecurringDetail"
25+
}
26+
];
27+
28+
static getAttributeTypeMap() {
29+
return RecurringDetail.attributeTypeMap;
30+
}
31+
}
32+

src/typings/recurring/recurringDetailsResult.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Do not edit the class manually.
1111
*/
1212

13-
import {RecurringDetail} from './recurringDetail';
13+
import {RecurringDetailContainer} from './recurringDetailContainer';
1414

1515
export class RecurringDetailsResult {
1616
/**
@@ -20,7 +20,7 @@ export class RecurringDetailsResult {
2020
/**
2121
* Payment details stored for recurring payments.
2222
*/
23-
'details'?: Array<RecurringDetail>;
23+
'details'?: Array<RecurringDetailContainer>;
2424
/**
2525
* The most recent email for this shopper (if available).
2626
*/
@@ -41,7 +41,7 @@ export class RecurringDetailsResult {
4141
{
4242
"name": "details",
4343
"baseName": "details",
44-
"type": "Array<RecurringDetail>"
44+
"type": "Array<RecurringDetailContainer>"
4545
},
4646
{
4747
"name": "lastKnownShopperEmail",

0 commit comments

Comments
 (0)