Skip to content

Commit 7b72a28

Browse files
authored
Release version 9.1.0 (#772)
Release v9.1.0
1 parent 1d5afb8 commit 7b72a28

29 files changed

+2116
-10768
lines changed

.eslintrc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,21 @@ module.exports = {
3737
},
3838
extends: [
3939
"eslint:recommended",
40-
"plugin:@typescript-eslint/eslint-recommended",
4140
"plugin:@typescript-eslint/recommended"
4241
],
4342
rules: {
4443
quotes: ["error", "double"],
4544
semi: ["error", "always"],
46-
"@typescript-eslint/no-non-null-assertion": 0
45+
"@typescript-eslint/no-non-null-assertion": 0,
46+
"@typescript-eslint/ban-types": [
47+
"error",
48+
{
49+
"extendDefaults": true,
50+
"types": {
51+
"{}": false
52+
}
53+
}
54+
]
4755
},
4856
overrides: [
4957
{

package-lock.json

Lines changed: 0 additions & 7984 deletions
This file was deleted.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adyen/api-library",
3-
"version": "9.0.0",
3+
"version": "9.1.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": "26.0.24",
38+
"@types/jest": "27.0.2",
3939
"@types/nock": "11.1.0",
40-
"@typescript-eslint/eslint-plugin": "2.34.0",
41-
"@typescript-eslint/parser": "2.34.0",
40+
"@typescript-eslint/eslint-plugin": "4.31.2",
41+
"@typescript-eslint/parser": "4.31.2",
4242
"acorn": "^8.0.1",
4343
"coveralls": "3.1.1",
4444
"dotenv": "^10.0.0",
45-
"eslint": "6.8.0",
46-
"jest": "25.5.4",
45+
"eslint": "7.32.0",
46+
"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.1.1",
51-
"release-it": "14.10.1",
52-
"ts-auto-mock": "^2.6.5",
53-
"ts-jest": "25.5.1",
50+
"nock": "13.1.3",
51+
"release-it": "14.11.6",
52+
"ts-auto-mock": "^3.3.5",
53+
"ts-jest": "^27.0.4",
5454
"ts-loader": "8.0.10",
5555
"ttypescript": "^1.5.10",
56-
"typescript": "3.9.10"
56+
"typescript": "4.4.3"
5757
},
5858
"dependencies": {
5959
"https-proxy-agent": "5.0.0"

src/__tests__/binLookup.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ describe("Bin Lookup", function (): void {
8787
test.each([false, true])("should succeed on get cost estimate. isMock: %p", async function (isMock): Promise<void> {
8888
!isMock && nock.restore();
8989
const expected = {
90+
cardBin: {
91+
bin: "",
92+
fundsAvailability: "I",
93+
issuingBank: "ADYEN TEST BANK",
94+
issuingCountry: "NL",
95+
paymentMethod: "visa",
96+
payoutEligible: "Y",
97+
summary: "",
98+
},
9099
costEstimateAmount: {
91100
currency: "EUR",
92101
value: 10
@@ -117,4 +126,4 @@ describe("Bin Lookup", function (): void {
117126

118127
expect(response).toEqual(expected);
119128
});
120-
});
129+
});

src/__tests__/checkServerIdentity.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
* See the LICENSE file for more info.
1818
*/
1919

20-
/* eslint-disable @typescript-eslint/camelcase */
21-
20+
/* eslint-disable @typescript-eslint/naming-convention */
2221
import checkServerIdentity from "../helpers/checkServerIdentity";
2322
import { PeerCertificate } from "tls";
2423

src/__tests__/checkout.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ describe("Checkout", (): void => {
184184

185185
test.each([false, true])("should have valid payment methods, isMock: %p", async (isMock): Promise<void> => {
186186
!isMock && nock.restore();
187-
const paymentMethodsRequest: PaymentMethodsRequest = {merchantAccount: "MagentoMerchantTest"};
187+
const paymentMethodsRequest: PaymentMethodsRequest = {merchantAccount};
188188

189189
scope.post("/paymentMethods")
190190
.reply(200, paymentMethodsSuccess);
@@ -271,7 +271,7 @@ describe("Checkout", (): void => {
271271
try {
272272
new Checkout(client);
273273
fail();
274-
} catch (e) {
274+
} catch (e: any) {
275275
expect(e.message).toEqual("Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.");
276276
}
277277
});

src/__tests__/hmacValidator.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const notificationRequestItem: { NotificationRequestItem: NotificationRequestIte
3232
merchantAccountCode: "merchantAccount",
3333
merchantReference: "reference",
3434
amount: {currency: "EUR", value: 1000},
35-
eventCode: NotificationRequestItem.EventCodeEnum.REPORTAVAILABLE,
35+
eventCode: NotificationRequestItem.EventCodeEnum.ReportAvailable,
3636
eventDate: "2019-09-21T11:45:24.637Z",
3737
paymentMethod: "VISA",
3838
reason: "reason",
@@ -92,7 +92,7 @@ describe("HMAC Validator", function (): void {
9292
merchantAccountCode: "merchantAccount",
9393
merchantReference: "reference",
9494
amount: {currency: "EUR", value: 1000},
95-
eventCode: NotificationRequestItem.EventCodeEnum.REPORTAVAILABLE,
95+
eventCode: NotificationRequestItem.EventCodeEnum.ReportAvailable,
9696
eventDate: "2019-09-21T11:45:24.637Z",
9797
paymentMethod: "VISA",
9898
reason: "reason",
@@ -101,7 +101,7 @@ describe("HMAC Validator", function (): void {
101101
};
102102
try {
103103
hmacValidator.validateHMAC(notificationRequestItemNoAdditionalData, key);
104-
} catch(error) {
104+
} catch(error: any) {
105105
expect(error.message).toEqual(`Missing ${ApiConstants.HMAC_SIGNATURE}`);
106106
}
107107
});

src/__tests__/httpClient.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const getResponse = async ({apiKey , environment }: { apiKey: string; environmen
4343
try {
4444
await checkout.payments(createPaymentsCheckoutRequest());
4545
fail("request should fail");
46-
} catch (e) {
46+
} catch (e: any) {
4747
expect(e instanceof ErrorException).toBeTruthy();
4848
if (errorMessageEquals) expect(e.message).toEqual(errorMessageEquals);
4949
if (errorMessageContains) expect(e.message.toLowerCase()).toContain(errorMessageContains);

src/__tests__/modification.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const createStandaloneCancelsResponse = (): StandalonePaymentCancelResource => {
103103

104104
const createCapturesRequest = (): CreatePaymentCaptureRequest => {
105105
return {
106+
reference: "reference",
106107
merchantAccount: process.env.ADYEN_MERCHANT!,
107108
amount: {
108109
currency: "EUR",
@@ -195,7 +196,7 @@ describe("Modification", (): void => {
195196
try {
196197
const result = await modification.amountUpdates(paymentPspReference, request);
197198
expect(result).toBeTruthy();
198-
} catch (e) {
199+
} catch (e: any) {
199200
fail(e.message);
200201
}
201202
});
@@ -209,7 +210,7 @@ describe("Modification", (): void => {
209210

210211
try {
211212
await modification.amountUpdates(invalidPaymentPspReference, request);
212-
} catch (e) {
213+
} catch (e: any) {
213214
expect(e.statusCode).toBe(422);
214215
expect(e.message).toContain("Original pspReference required for this operation");
215216
}
@@ -223,7 +224,7 @@ describe("Modification", (): void => {
223224
try {
224225
const result = await modification.cancels(paymentPspReference, request);
225226
expect(result).toBeTruthy();
226-
} catch (e) {
227+
} catch (e: any) {
227228
fail(e.message);
228229
}
229230
});
@@ -236,7 +237,7 @@ describe("Modification", (): void => {
236237
.reply(422, invalidModificationResult);
237238
try {
238239
await modification.cancels(invalidPaymentPspReference, request);
239-
} catch (e) {
240+
} catch (e: any) {
240241
expect(e.statusCode).toBe(422);
241242
expect(e.message).toContain("Original pspReference required for this operation");
242243
}
@@ -250,7 +251,7 @@ describe("Modification", (): void => {
250251
try {
251252
const result = await modification.cancelsStandalone(request);
252253
expect(result).toBeTruthy();
253-
} catch (e) {
254+
} catch (e: any) {
254255
fail(e.message);
255256
}
256257
});
@@ -263,7 +264,7 @@ describe("Modification", (): void => {
263264
try {
264265
const result = await modification.captures(paymentPspReference, request);
265266
expect(result).toBeTruthy();
266-
} catch (e) {
267+
} catch (e: any) {
267268
fail(e.message);
268269
}
269270
});
@@ -276,7 +277,7 @@ describe("Modification", (): void => {
276277
.reply(422, invalidModificationResult);
277278
try {
278279
await modification.captures(invalidPaymentPspReference, request);
279-
} catch (e) {
280+
} catch (e: any) {
280281
expect(e.statusCode).toBe(422);
281282
expect(e.message).toContain("Original pspReference required for this operation");
282283
}
@@ -290,7 +291,7 @@ describe("Modification", (): void => {
290291
try {
291292
const result = await modification.refunds(paymentPspReference, request);
292293
expect(result).toBeTruthy();
293-
} catch (e) {
294+
} catch (e: any) {
294295
fail(e.message);
295296
}
296297
});
@@ -303,7 +304,7 @@ describe("Modification", (): void => {
303304
.reply(422, invalidModificationResult);
304305
try {
305306
await modification.refunds(invalidPaymentPspReference, request);
306-
} catch (e) {
307+
} catch (e: any) {
307308
expect(e.statusCode).toBe(422);
308309
expect(e.message).toContain("Original pspReference required for this operation");
309310
}
@@ -317,7 +318,7 @@ describe("Modification", (): void => {
317318
try {
318319
const result = await modification.reversals(paymentPspReference, request);
319320
expect(result).toBeTruthy();
320-
} catch (e) {
321+
} catch (e: any) {
321322
fail(e.message);
322323
}
323324
});
@@ -330,7 +331,7 @@ describe("Modification", (): void => {
330331
.reply(422, invalidModificationResult);
331332
try {
332333
await modification.reversals(invalidPaymentPspReference, request);
333-
} catch (e) {
334+
} catch (e: any) {
334335
expect(e.statusCode).toBe(422);
335336
expect(e.message).toContain("Original pspReference required for this operation");
336337
}

src/__tests__/notification.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import refundTrue from "../__mocks__/notification/refundTrue.json";
2424
import refundFalse from "../__mocks__/notification/refundFalse.json";
2525
import NotificationRequest from "../notification/notificationRequest";
2626
import { Notification, NotificationRequestItem } from "../typings/notification/models";
27-
2827
import NotificationEnum = NotificationRequestItem.EventCodeEnum;
2928
import SuccessEnum = NotificationRequestItem.SuccessEnum;
3029

@@ -35,7 +34,7 @@ describe("Notification Test", function (): void {
3534

3635
if (notificationRequest.notificationItems) {
3736
const notificationRequestItem: NotificationRequestItem = notificationRequest.notificationItems[0];
38-
expect(NotificationEnum.AUTHORISATION).toEqual(notificationRequestItem.eventCode);
37+
expect(NotificationEnum.Authorisation).toEqual(notificationRequestItem.eventCode);
3938
expect(notificationRequestItem.success === SuccessEnum.True).toBeTruthy();
4039
expect(notificationRequestItem.pspReference).toEqual("123456789");
4140
} else {
@@ -49,7 +48,7 @@ describe("Notification Test", function (): void {
4948

5049
if (notificationRequest.notificationItems) {
5150
const notificationRequestItem = notificationRequest.notificationItems[0];
52-
expect(NotificationEnum.CAPTURE).toEqual(notificationRequestItem.eventCode);
51+
expect(NotificationEnum.Capture).toEqual(notificationRequestItem.eventCode);
5352
expect(notificationRequestItem.success === SuccessEnum.True).toBeTruthy();
5453
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
5554
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
@@ -64,7 +63,7 @@ describe("Notification Test", function (): void {
6463

6564
if (notificationRequest.notificationItems) {
6665
const notificationRequestItem = notificationRequest.notificationItems[0];
67-
expect(NotificationEnum.CAPTURE).toEqual(notificationRequestItem.eventCode);
66+
expect(NotificationEnum.Capture).toEqual(notificationRequestItem.eventCode);
6867
expect(notificationRequestItem.success === SuccessEnum.True).toBeFalsy();
6968
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
7069
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
@@ -79,7 +78,7 @@ describe("Notification Test", function (): void {
7978

8079
if (notificationRequest.notificationItems) {
8180
const notificationRequestItem = notificationRequest.notificationItems[0];
82-
expect(NotificationEnum.REFUND).toEqual(notificationRequestItem.eventCode);
81+
expect(NotificationEnum.Refund).toEqual(notificationRequestItem.eventCode);
8382
expect(notificationRequestItem.success === SuccessEnum.True).toBeTruthy();
8483
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
8584
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");
@@ -95,7 +94,7 @@ describe("Notification Test", function (): void {
9594

9695
if (notificationRequest.notificationItems) {
9796
const notificationRequestItem = notificationRequest.notificationItems[0];
98-
expect(NotificationEnum.REFUND).toEqual(notificationRequestItem.eventCode);
97+
expect(NotificationEnum.Refund).toEqual(notificationRequestItem.eventCode);
9998
expect(notificationRequestItem.success === SuccessEnum.True).toBeFalsy();
10099
expect(notificationRequestItem.pspReference).toEqual("PSP_REFERENCE");
101100
expect(notificationRequestItem.originalReference).toEqual("ORIGINAL_PSP");

0 commit comments

Comments
 (0)