Skip to content

Commit f596898

Browse files
AdyenAutomationBotAdyenAutomationBotwboereboom
authored
Update all services (#1316)
* [reformat][adyen-sdk-automation] automated change * style(fmt): code formatted * update tests to use new function signatures (#1317) --------- Co-authored-by: AdyenAutomationBot <Adyen Automation plugins_dev@adyen.com> Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
1 parent d40ee1a commit f596898

File tree

147 files changed

+4619
-1971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+4619
-1971
lines changed

src/__mocks__/management/invalidUserCreated422.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export const invalidUserCreated422 = {
1212
}
1313
],
1414
"errorCode": "31_007"
15-
}
15+
};

src/__tests__/balanceControl.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ describe("Balance Control", (): void => {
7272
}
7373
}
7474
});
75-
})
75+
});

src/__tests__/balancePlatform.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe("Balance Platform", (): void => {
173173
offset: "10"
174174
}
175175
};
176-
const response: balancePlatform.PaginatedBalanceAccountsResponse = await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", requestOptions);
176+
const response: balancePlatform.PaginatedBalanceAccountsResponse = await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", undefined, undefined, requestOptions);
177177

178178
expect(response.balanceAccounts[0].id).toBe("BA32272223222B59K6ZXHBFN6");
179179
});
@@ -236,7 +236,7 @@ describe("Balance Platform", (): void => {
236236
]
237237
});
238238

239-
const response: balancePlatform.BalanceSweepConfigurationsResponse = await balancePlatformService.BalanceAccountsApi.getAllSweepsForBalanceAccount(balanceAccountId, {
239+
const response: balancePlatform.BalanceSweepConfigurationsResponse = await balancePlatformService.BalanceAccountsApi.getAllSweepsForBalanceAccount(balanceAccountId, undefined, undefined, {
240240
params: {
241241
"limit": "5",
242242
"offset": "10"
@@ -459,7 +459,7 @@ describe("Balance Platform", (): void => {
459459
]
460460
});
461461

462-
const response: balancePlatform.PaginatedPaymentInstrumentsResponse = await balancePlatformService.BalanceAccountsApi.getAllPaymentInstrumentsForBalanceAccount(balanceAccountId, {
462+
const response: balancePlatform.PaginatedPaymentInstrumentsResponse = await balancePlatformService.BalanceAccountsApi.getPaymentInstrumentsLinkedToBalanceAccount(balanceAccountId, undefined, undefined, undefined, {
463463
params: {
464464
limit: "3",
465465
offset: "6",

src/__tests__/disputes.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@ describe("Disputes", (): void => {
187187
const response: SupplyDefenseDocumentResponse = await disputesService.supplyDefenseDocument(request);
188188
expect(response.disputeServiceResult.success).toEqual(true);
189189
});
190-
})
190+
});

src/__tests__/legalEntityManagement.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ afterEach(() => {
4141

4242
describe("Legal Entity Management", (): void => {
4343

44-
const id = "123456789"
44+
const id = "123456789";
4545

4646
describe("LegalEntities", (): void => {
4747
it("should support POST /legalEntities", async (): Promise<void> => {
@@ -251,7 +251,7 @@ describe("Legal Entity Management", (): void => {
251251

252252
expect(response.id).toBe(id);
253253
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
254-
expect(response.owner).toEqual({id : "123456789", type : "passport" })
254+
expect(response.owner).toEqual({id : "123456789", type : "passport" });
255255
});
256256

257257
it("should support GET /documents/{id}", async (): Promise<void> => {
@@ -262,7 +262,7 @@ describe("Legal Entity Management", (): void => {
262262

263263
expect(response.id).toBe(id);
264264
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
265-
expect(response.owner).toEqual({id : "123456789", type : "passport" })
265+
expect(response.owner).toEqual({id : "123456789", type : "passport" });
266266
});
267267

268268
it("should support PATCH /documents/{id}", async (): Promise<void> => {
@@ -289,7 +289,7 @@ describe("Legal Entity Management", (): void => {
289289

290290
expect(response.id).toBe(id);
291291
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
292-
expect(response.owner).toEqual({id : "123456789", type : "passport" })
292+
expect(response.owner).toEqual({id : "123456789", type : "passport" });
293293
});
294294

295295
it("should support DELETE /documents/{id}", async (): Promise<void> => {
@@ -314,7 +314,7 @@ describe("Legal Entity Management", (): void => {
314314
});
315315

316316
it("should support GET /themes", async (): Promise<void> => {
317-
scope.get(`/themes`)
317+
scope.get("/themes")
318318
.reply(200, onboardingThemes);
319319

320320
const response: models.OnboardingThemes = await legalEntityManagement.HostedOnboardingApi.listHostedOnboardingPageThemes();

src/__tests__/management.spec.ts

Lines changed: 11 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,7 @@ describe("Management", (): void => {
201201
scope.get("/merchants?pageNumber=1&pageSize=1")
202202
.reply(200, responses.listMerchantResponse);
203203

204-
const response: management.ListMerchantResponse = await managementService.AccountMerchantLevelApi.listMerchantAccounts({
205-
params: {
206-
"pageNumber": "1",
207-
"pageSize": "1"
208-
}
209-
});
204+
const response: management.ListMerchantResponse = await managementService.AccountMerchantLevelApi.listMerchantAccounts(1,1);
210205

211206
expect(response).toBeTruthy();
212207
});
@@ -280,12 +275,7 @@ describe("Management", (): void => {
280275
scope.get(`/merchants/${merchantId}/apiCredentials?pageNumber=1&pageSize=1`)
281276
.reply(200, responses.listMerchantApiCredentialsResponse);
282277

283-
const response: management.ListMerchantApiCredentialsResponse = await managementService.APICredentialsMerchantLevelApi.listApiCredentials(merchantId, {
284-
params: {
285-
"pageNumber": "1",
286-
"pageSize": "1"
287-
}
288-
});
278+
const response: management.ListMerchantApiCredentialsResponse = await managementService.APICredentialsMerchantLevelApi.listApiCredentials(merchantId, 1,1,);
289279

290280
expect(response).toBeTruthy();
291281
});
@@ -345,15 +335,7 @@ describe("Management", (): void => {
345335
scope.get(`/merchants/${merchantId}/paymentMethodSettings?storeId=1&businessLineId=1&pageNumber=1&pageSize=1`)
346336
.reply(200, responses.paymentMethodResponse);
347337

348-
const response: management.PaymentMethodResponse = await managementService.PaymentMethodsMerchantLevelApi.getAllPaymentMethods(merchantId, {
349-
params: {
350-
"storeId": "1",
351-
"businessLineId": "1",
352-
"pageSize": "1",
353-
"pageNumber": "1"
354-
}
355-
});
356-
338+
const response: management.PaymentMethodResponse = await managementService.PaymentMethodsMerchantLevelApi.getAllPaymentMethods(merchantId,"1","1",1,1);
357339
expect(response).toBeTruthy();
358340
});
359341

@@ -438,11 +420,7 @@ describe("Management", (): void => {
438420
scope.get(`/merchants/${merchantId}/billingEntities?name=bill`)
439421
.reply(200, responses.billingEntitiesResponse);
440422

441-
const response: management.BillingEntitiesResponse = await managementService.TerminalOrdersMerchantLevelApi.listBillingEntities(merchantId, {
442-
params: {
443-
"name": "bill"
444-
}
445-
});
423+
const response: management.BillingEntitiesResponse = await managementService.TerminalOrdersMerchantLevelApi.listBillingEntities(merchantId, "bill");
446424

447425
expect(response).toBeTruthy();
448426
});
@@ -451,14 +429,7 @@ describe("Management", (): void => {
451429
scope.get(`/merchants/${merchantId}/shippingLocations?name=1&offset=1&limit=1`)
452430
.reply(200, responses.shippingLocationsResponse);
453431

454-
const response: management.ShippingLocationsResponse = await managementService.TerminalOrdersMerchantLevelApi.listShippingLocations(merchantId, {
455-
params: {
456-
"name": "1",
457-
"offset": "1",
458-
"limit": "1"
459-
}
460-
});
461-
432+
const response: management.ShippingLocationsResponse = await managementService.TerminalOrdersMerchantLevelApi.listShippingLocations(merchantId, "1", 1, 1);
462433
expect(response).toBeTruthy();
463434
});
464435

@@ -484,7 +455,7 @@ describe("Management", (): void => {
484455
scope.get(`/merchants/${merchantId}/terminalOrders?customerOrderReference=1&status=1&offset=1&limit=1`)
485456
.reply(200, responses.terminalOrdersResponse);
486457

487-
const response: management.TerminalOrdersResponse = await managementService.TerminalOrdersMerchantLevelApi.listOrders(merchantId, {
458+
const response: management.TerminalOrdersResponse = await managementService.TerminalOrdersMerchantLevelApi.listOrders(merchantId, undefined, undefined, undefined, undefined, {
488459
params: {
489460
"customerOrderReference": "1",
490461
"status": "1",
@@ -536,15 +507,7 @@ describe("Management", (): void => {
536507
scope.get(`/merchants/${merchantId}/terminalProducts?country=1&terminalModelId=1&offset=1&limit=1`)
537508
.reply(200, responses.terminalProductsResponse);
538509

539-
const response: management.TerminalProductsResponse = await managementService.TerminalOrdersMerchantLevelApi.listTerminalProducts(merchantId, {
540-
params: {
541-
"country": "1",
542-
"terminalModelId": "1",
543-
"offset": "1",
544-
"limit": "1"
545-
}
546-
});
547-
510+
const response: management.TerminalProductsResponse = await managementService.TerminalOrdersMerchantLevelApi.listTerminalProducts(merchantId, "1", "1", 1, 1);
548511
expect(response).toBeTruthy();
549512
});
550513
});
@@ -554,11 +517,7 @@ describe("Management", (): void => {
554517
scope.get(`/merchants/${merchantId}/terminalLogos?model=1`)
555518
.reply(200, responses.logo);
556519

557-
const response: management.Logo = await managementService.TerminalSettingsMerchantLevelApi.getTerminalLogo(merchantId, {
558-
params: {
559-
"model": "1"
560-
}
561-
});
520+
const response: management.Logo = await managementService.TerminalSettingsMerchantLevelApi.getTerminalLogo(merchantId, "1");
562521

563522
expect(response).toBeTruthy();
564523
});
@@ -567,12 +526,7 @@ describe("Management", (): void => {
567526
scope.patch(`/merchants/${merchantId}/terminalLogos?model=1`)
568527
.reply(200, responses.logo);
569528

570-
const response: management.Logo = await managementService.TerminalSettingsMerchantLevelApi.updateTerminalLogo(merchantId, requests.logo, {
571-
params: {
572-
"model": "1"
573-
}
574-
});
575-
529+
const response: management.Logo = await managementService.TerminalSettingsMerchantLevelApi.updateTerminalLogo(merchantId, requests.logo, "1");
576530
expect(response).toBeTruthy();
577531
});
578532

@@ -600,12 +554,7 @@ describe("Management", (): void => {
600554
scope.get(`/merchants/${merchantId}/users?pageNumber=1&pageSize=1`)
601555
.reply(200, responses.listMerchantUsersResponse);
602556

603-
const response: management.ListMerchantUsersResponse = await managementService.UsersMerchantLevelApi.listUsers(merchantId, {
604-
params: {
605-
"pageNumber": "1",
606-
"pageSize": "1"
607-
}
608-
});
557+
const response: management.ListMerchantUsersResponse = await managementService.UsersMerchantLevelApi.listUsers(merchantId, 1,1,);
609558

610559
expect(response).toBeTruthy();
611560
});
@@ -660,13 +609,7 @@ describe("Management", (): void => {
660609
scope.get(`/merchants/${merchantId}/webhooks?pageNumber=1&pageSize=1`)
661610
.reply(200, responses.listWebhooksResponse);
662611

663-
const response: management.ListWebhooksResponse = await managementService.WebhooksMerchantLevelApi.listAllWebhooks(merchantId, {
664-
params: {
665-
"pageNumber": "1",
666-
"pageSize": "1"
667-
}
668-
});
669-
612+
const response: management.ListWebhooksResponse = await managementService.WebhooksMerchantLevelApi.listAllWebhooks(merchantId, 1,1,);
670613
expect(response).toBeTruthy();
671614
});
672615

src/__tests__/notification.spec.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ describe("Notification Test", function (): void {
124124
}, "environment": "test", "type": "balancePlatform.accountHolder.created"
125125
};
126126
const jsonString = JSON.stringify(json);
127-
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
127+
const bankingWebhookHandler = new BankingWebhookHandler(jsonString);
128128
const accountHolderNotificationRequest: AccountHolderNotificationRequest = bankingWebhookHandler.getAccountHolderNotificationRequest();
129129
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
130-
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(true)
131-
expect(accountHolderNotificationRequest.environment).toEqual("test")
130+
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(true);
131+
expect(accountHolderNotificationRequest.environment).toEqual("test");
132132
});
133133

134134
it("should verify the banking hmac", function (): void {
135135
const jsonString = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}";
136-
const isValid = hmacValidator.validateBankingHMAC("9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=", "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F", jsonString)
137-
expect(isValid).toBe(true)
136+
const isValid = hmacValidator.validateBankingHMAC("9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=", "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F", jsonString);
137+
expect(isValid).toBe(true);
138138
});
139139

140140
it("should deserialize Management Webhooks", function (): void {
@@ -151,12 +151,12 @@ describe("Notification Test", function (): void {
151151
"type": "paymentMethod.created"
152152
};
153153
const jsonString = JSON.stringify(json);
154-
let managementWebhookHandler = new ManagementWebhookHandler(jsonString);
154+
const managementWebhookHandler = new ManagementWebhookHandler(jsonString);
155155
const paymentMethodCreatedNotificationRequest: PaymentMethodCreatedNotificationRequest = managementWebhookHandler.getPaymentMethodCreatedNotificationRequest();
156156
const genericWebhook = managementWebhookHandler.getGenericWebhook();
157-
expect(genericWebhook instanceof PaymentMethodCreatedNotificationRequest).toBe(true)
158-
expect(genericWebhook instanceof MerchantUpdatedNotificationRequest).toBe(false)
159-
expect(paymentMethodCreatedNotificationRequest.type).toEqual(PaymentMethodCreatedNotificationRequest.TypeEnum.PaymentMethodCreated)
157+
expect(genericWebhook instanceof PaymentMethodCreatedNotificationRequest).toBe(true);
158+
expect(genericWebhook instanceof MerchantUpdatedNotificationRequest).toBe(false);
159+
expect(paymentMethodCreatedNotificationRequest.type).toEqual(PaymentMethodCreatedNotificationRequest.TypeEnum.PaymentMethodCreated);
160160
});
161161

162162
it("should deserialize Banking Authentication Webhook", function (): void {
@@ -202,12 +202,12 @@ describe("Notification Test", function (): void {
202202
"type": "balancePlatform.authentication.created"
203203
};
204204
const jsonString = JSON.stringify(json);
205-
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
205+
const bankingWebhookHandler = new BankingWebhookHandler(jsonString);
206206
const accountHolderNotificationRequest: TransferNotificationRequest = bankingWebhookHandler.getTransferNotificationRequest();
207207
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
208-
expect(accountHolderNotificationRequest.type).toEqual(AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated)
209-
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(false)
210-
expect(genericWebhook instanceof AuthenticationNotificationRequest).toBe(true)
208+
expect(accountHolderNotificationRequest.type).toEqual(AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated);
209+
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(false);
210+
expect(genericWebhook instanceof AuthenticationNotificationRequest).toBe(true);
211211
});
212212

213213
it("should deserialize Management v3 Webhooks", function (): void {
@@ -225,12 +225,12 @@ describe("Notification Test", function (): void {
225225
}
226226
};
227227
const jsonString = JSON.stringify(json);
228-
let managementWebhookHandler = new ManagementWebhookHandler(jsonString);
228+
const managementWebhookHandler = new ManagementWebhookHandler(jsonString);
229229
const paymentMethodRequestRemoved: PaymentMethodRequestRemovedNotificationRequest = managementWebhookHandler.getPaymentMethodRequestRemovedNotificationRequest();
230230
const genericWebhook = managementWebhookHandler.getGenericWebhook();
231-
expect(genericWebhook instanceof PaymentMethodRequestRemovedNotificationRequest).toBe(true)
232-
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false)
233-
expect(paymentMethodRequestRemoved.type).toEqual(PaymentMethodRequestRemovedNotificationRequest.TypeEnum.PaymentMethodRequestRemoved)
231+
expect(genericWebhook instanceof PaymentMethodRequestRemovedNotificationRequest).toBe(true);
232+
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false);
233+
expect(paymentMethodRequestRemoved.type).toEqual(PaymentMethodRequestRemovedNotificationRequest.TypeEnum.PaymentMethodRequestRemoved);
234234
});
235235

236236
it("should deserialize Transaction v4 Webhooks", function (): void {
@@ -265,11 +265,11 @@ describe("Notification Test", function (): void {
265265
"environment": "test"
266266
};
267267
const jsonString = JSON.stringify(json);
268-
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
268+
const bankingWebhookHandler = new BankingWebhookHandler(jsonString);
269269
const transactionCreated: TransactionNotificationRequestV4 = bankingWebhookHandler.getTransactionNotificationRequest();
270270
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
271-
expect(genericWebhook instanceof TransactionNotificationRequestV4).toBe(true)
272-
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false)
273-
expect(transactionCreated.type).toEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated)
271+
expect(genericWebhook instanceof TransactionNotificationRequestV4).toBe(true);
272+
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false);
273+
expect(transactionCreated.type).toEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated);
274274
});
275275
});

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Client {
5151
} else {
5252
this.config = new Config();
5353
}
54-
this.liveEndpointUrlPrefix = options.liveEndpointUrlPrefix ?? '';
54+
this.liveEndpointUrlPrefix = options.liveEndpointUrlPrefix ?? "";
5555

5656
const environment = options.environment ?? this.config.environment;
5757
if (environment) {

src/httpClient/httpURLConnectionClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class HttpURLConnectionClient implements ClientInterface {
198198
if (terminalCertificatePath == "unencrypted"){
199199
this.agentOptions = {
200200
rejectUnauthorized: false
201-
}
201+
};
202202
} else {
203203
const certificateInput = fs.readFileSync(terminalCertificatePath);
204204
this.agentOptions = {

0 commit comments

Comments
 (0)