Skip to content

Commit

Permalink
style(fmt): code formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
AdyenAutomationBot authored and AdyenAutomationBot committed Jan 26, 2024
1 parent 8e9c9b6 commit 828bf42
Show file tree
Hide file tree
Showing 80 changed files with 561 additions and 230 deletions.
2 changes: 1 addition & 1 deletion src/__mocks__/management/invalidUserCreated422.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const invalidUserCreated422 = {
}
],
"errorCode": "31_007"
}
};
2 changes: 1 addition & 1 deletion src/__tests__/balanceControl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ describe("Balance Control", (): void => {
}
}
});
})
});
2 changes: 1 addition & 1 deletion src/__tests__/disputes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ describe("Disputes", (): void => {
const response: SupplyDefenseDocumentResponse = await disputesService.supplyDefenseDocument(request);
expect(response.disputeServiceResult.success).toEqual(true);
});
})
});
10 changes: 5 additions & 5 deletions src/__tests__/legalEntityManagement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ afterEach(() => {

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

const id = "123456789"
const id = "123456789";

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

expect(response.id).toBe(id);
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
expect(response.owner).toEqual({id : "123456789", type : "passport" });
});

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

expect(response.id).toBe(id);
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
expect(response.owner).toEqual({id : "123456789", type : "passport" });
});

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

expect(response.id).toBe(id);
expect(response.type).toBe(Document.TypeEnum.DriversLicense);
expect(response.owner).toEqual({id : "123456789", type : "passport" })
expect(response.owner).toEqual({id : "123456789", type : "passport" });
});

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

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

const response: models.OnboardingThemes = await legalEntityManagement.HostedOnboardingApi.listHostedOnboardingPageThemes();
Expand Down
42 changes: 21 additions & 21 deletions src/__tests__/notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ describe("Notification Test", function (): void {
}, "environment": "test", "type": "balancePlatform.accountHolder.created"
};
const jsonString = JSON.stringify(json);
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const accountHolderNotificationRequest: AccountHolderNotificationRequest = bankingWebhookHandler.getAccountHolderNotificationRequest();
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(true)
expect(accountHolderNotificationRequest.environment).toEqual("test")
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(true);
expect(accountHolderNotificationRequest.environment).toEqual("test");
});

it("should verify the banking hmac", function (): void {
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\"}";
const isValid = hmacValidator.validateBankingHMAC("9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=", "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F", jsonString)
expect(isValid).toBe(true)
const isValid = hmacValidator.validateBankingHMAC("9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=", "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F", jsonString);
expect(isValid).toBe(true);
});

it("should deserialize Management Webhooks", function (): void {
Expand All @@ -151,12 +151,12 @@ describe("Notification Test", function (): void {
"type": "paymentMethod.created"
};
const jsonString = JSON.stringify(json);
let managementWebhookHandler = new ManagementWebhookHandler(jsonString);
const managementWebhookHandler = new ManagementWebhookHandler(jsonString);
const paymentMethodCreatedNotificationRequest: PaymentMethodCreatedNotificationRequest = managementWebhookHandler.getPaymentMethodCreatedNotificationRequest();
const genericWebhook = managementWebhookHandler.getGenericWebhook();
expect(genericWebhook instanceof PaymentMethodCreatedNotificationRequest).toBe(true)
expect(genericWebhook instanceof MerchantUpdatedNotificationRequest).toBe(false)
expect(paymentMethodCreatedNotificationRequest.type).toEqual(PaymentMethodCreatedNotificationRequest.TypeEnum.PaymentMethodCreated)
expect(genericWebhook instanceof PaymentMethodCreatedNotificationRequest).toBe(true);
expect(genericWebhook instanceof MerchantUpdatedNotificationRequest).toBe(false);
expect(paymentMethodCreatedNotificationRequest.type).toEqual(PaymentMethodCreatedNotificationRequest.TypeEnum.PaymentMethodCreated);
});

it("should deserialize Banking Authentication Webhook", function (): void {
Expand Down Expand Up @@ -202,12 +202,12 @@ describe("Notification Test", function (): void {
"type": "balancePlatform.authentication.created"
};
const jsonString = JSON.stringify(json);
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const accountHolderNotificationRequest: TransferNotificationRequest = bankingWebhookHandler.getTransferNotificationRequest();
const genericWebhook = bankingWebhookHandler.getGenericWebhook();
expect(accountHolderNotificationRequest.type).toEqual(AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated)
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(false)
expect(genericWebhook instanceof AuthenticationNotificationRequest).toBe(true)
expect(accountHolderNotificationRequest.type).toEqual(AuthenticationNotificationRequest.TypeEnum.BalancePlatformAuthenticationCreated);
expect(genericWebhook instanceof AccountHolderNotificationRequest).toBe(false);
expect(genericWebhook instanceof AuthenticationNotificationRequest).toBe(true);
});

it("should deserialize Management v3 Webhooks", function (): void {
Expand All @@ -225,12 +225,12 @@ describe("Notification Test", function (): void {
}
};
const jsonString = JSON.stringify(json);
let managementWebhookHandler = new ManagementWebhookHandler(jsonString);
const managementWebhookHandler = new ManagementWebhookHandler(jsonString);
const paymentMethodRequestRemoved: PaymentMethodRequestRemovedNotificationRequest = managementWebhookHandler.getPaymentMethodRequestRemovedNotificationRequest();
const genericWebhook = managementWebhookHandler.getGenericWebhook();
expect(genericWebhook instanceof PaymentMethodRequestRemovedNotificationRequest).toBe(true)
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false)
expect(paymentMethodRequestRemoved.type).toEqual(PaymentMethodRequestRemovedNotificationRequest.TypeEnum.PaymentMethodRequestRemoved)
expect(genericWebhook instanceof PaymentMethodRequestRemovedNotificationRequest).toBe(true);
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false);
expect(paymentMethodRequestRemoved.type).toEqual(PaymentMethodRequestRemovedNotificationRequest.TypeEnum.PaymentMethodRequestRemoved);
});

it("should deserialize Transaction v4 Webhooks", function (): void {
Expand Down Expand Up @@ -265,11 +265,11 @@ describe("Notification Test", function (): void {
"environment": "test"
};
const jsonString = JSON.stringify(json);
let bankingWebhookHandler = new BankingWebhookHandler(jsonString);
const 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)
expect(genericWebhook instanceof TransactionNotificationRequestV4).toBe(true);
expect(genericWebhook instanceof PaymentMethodScheduledForRemovalNotificationRequest).toBe(false);
expect(transactionCreated.type).toEqual(TransactionNotificationRequestV4.TypeEnum.BalancePlatformTransactionCreated);
});
});
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Client {
} else {
this.config = new Config();
}
this.liveEndpointUrlPrefix = options.liveEndpointUrlPrefix ?? '';
this.liveEndpointUrlPrefix = options.liveEndpointUrlPrefix ?? "";

const environment = options.environment ?? this.config.environment;
if (environment) {
Expand Down
2 changes: 1 addition & 1 deletion src/httpClient/httpURLConnectionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class HttpURLConnectionClient implements ClientInterface {
if (terminalCertificatePath == "unencrypted"){
this.agentOptions = {
rejectUnauthorized: false
}
};
} else {
const certificateInput = fs.readFileSync(terminalCertificatePath);
this.agentOptions = {
Expand Down
6 changes: 3 additions & 3 deletions src/notification/bankingWebhookHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BankingWebhookHandler {
private readonly payload: string;

public constructor(jsonPayload: string) {
this.payload = JSON.parse(jsonPayload)
this.payload = JSON.parse(jsonPayload);
}

// Return generic webhook type
Expand All @@ -23,7 +23,7 @@ class BankingWebhookHandler {
| reportWebhooks.ReportNotificationRequest
| transferWebhooks.TransferNotificationRequest
| transactionWebhooks.TransactionNotificationRequestV4 {
const type = this.payload['type'];
const type = this.payload["type"];

if(Object.values(acsWebhooks.AuthenticationNotificationRequest.TypeEnum).includes(type)){
return this.getAuthenticationNotificationRequest();
Expand Down Expand Up @@ -61,7 +61,7 @@ class BankingWebhookHandler {
return this.getTransactionNotificationRequest();
}

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

public getAuthenticationNotificationRequest(): acsWebhooks.AuthenticationNotificationRequest {
Expand Down
6 changes: 3 additions & 3 deletions src/notification/managementWebhookHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ManagementWebhookHandler {
private readonly payload: string;

public constructor(jsonPayload: string) {
this.payload = JSON.parse(jsonPayload)
this.payload = JSON.parse(jsonPayload);
}

// Return generic webhook type
Expand All @@ -19,7 +19,7 @@ class ManagementWebhookHandler {
| managementWebhooks.PaymentMethodCreatedNotificationRequest
| managementWebhooks.PaymentMethodRequestRemovedNotificationRequest
| managementWebhooks.PaymentMethodScheduledForRemovalNotificationRequest {
const type = this.payload['type'];
const type = this.payload["type"];
if(Object.values(managementWebhooks.MerchantCreatedNotificationRequest.TypeEnum).includes(type)){
return this.getMerchantCreatedNotificationRequest();
}
Expand All @@ -40,7 +40,7 @@ class ManagementWebhookHandler {
return this.getPaymentMethodScheduledForRemovalNotificationRequest();
}

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

public getMerchantCreatedNotificationRequest(): managementWebhooks.MerchantCreatedNotificationRequest {
Expand Down
4 changes: 2 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Service {
if (url.includes("pal-")) {
if (this.client.liveEndpointUrlPrefix === "")
{
throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client.")
throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client.");
}
return url.replace("https://pal-test.adyen.com/pal/servlet/",
`https://${this.client.liveEndpointUrlPrefix}-pal-live.adyenpayments.com/pal/servlet/`);
Expand All @@ -48,7 +48,7 @@ class Service {
if (url.includes("checkout-")) {
if (this.client.liveEndpointUrlPrefix === "")
{
throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client.")
throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client.");
}
return url.replace("https://checkout-test.adyen.com/",
`https://${this.client.liveEndpointUrlPrefix}-checkout-live.adyenpayments.com/checkout/`);
Expand Down
3 changes: 1 addition & 2 deletions src/services/balancePlatform/accountHoldersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
AccountHolderUpdateRequest,
GetTaxFormResponse,
PaginatedBalanceAccountsResponse,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down Expand Up @@ -103,7 +102,7 @@ export class AccountHoldersApi extends Service {
* @param year {@link number } The tax year in YYYY format for the tax form you want to retrieve
* @return {@link GetTaxFormResponse }
*/
public async getTaxForm(id: string, formType?: 'US1099k' | 'US1099nec', year?: number, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
public async getTaxForm(id: string, formType?: "US1099k" | "US1099nec", year?: number, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
const endpoint = `${this.baseUrl}/accountHolders/{id}/taxForms`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/balanceAccountsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
BalanceSweepConfigurationsResponse,
CreateSweepConfigurationV2,
PaginatedPaymentInstrumentsResponse,
RestServiceError,
SweepConfigurationV2,
UpdateSweepConfigurationV2,
ObjectSerializer
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/bankAccountValidationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Service from "../../service";
import Client from "../../client";
import {
BankAccountIdentificationValidationRequest,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/cardOrdersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Client from "../../client";
import {
PaginatedGetCardOrderItemResponse,
PaginatedGetCardOrderResponse,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/grantAccountsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Service from "../../service";
import Client from "../../client";
import {
CapitalGrantAccount,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/grantOffersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Client from "../../client";
import {
GrantOffer,
GrantOffers,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/networkTokensApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Service from "../../service";
import Client from "../../client";
import {
GetNetworkTokenResponse,
RestServiceError,
UpdateNetworkTokenRequest,
ObjectSerializer
} from "../../typings/balancePlatform/models";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/pINFunctionalityApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
PinChangeRequest,
PinChangeResponse,
PublicKeyResponse,
RestServiceError,
RevealPinRequest,
RevealPinResponse,
ObjectSerializer
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/paymentInstrumentGroupsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Client from "../../client";
import {
PaymentInstrumentGroup,
PaymentInstrumentGroupInfo,
RestServiceError,
TransactionRulesResponse,
ObjectSerializer
} from "../../typings/balancePlatform/models";
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/paymentInstrumentsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
PaymentInstrumentInfo,
PaymentInstrumentRevealInfo,
PaymentInstrumentUpdateRequest,
RestServiceError,
TransactionRulesResponse,
UpdatePaymentInstrument,
ObjectSerializer
Expand Down
1 change: 0 additions & 1 deletion src/services/balancePlatform/platformApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Client from "../../client";
import {
BalancePlatform,
PaginatedAccountHoldersResponse,
RestServiceError,
ObjectSerializer
} from "../../typings/balancePlatform/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
3 changes: 1 addition & 2 deletions src/services/balancePlatform/transactionRulesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import Client from "../../client";
import {
RestServiceError,
import {
TransactionRule,
TransactionRuleInfo,
TransactionRuleResponse,
Expand Down
3 changes: 1 addition & 2 deletions src/services/balancePlatform/transferRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import Client from "../../client";
import {
RestServiceError,
import {
TransferRouteRequest,
TransferRouteResponse,
ObjectSerializer
Expand Down
1 change: 0 additions & 1 deletion src/services/binLookupApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import getJsonResponse from "../helpers/getJsonResponse";
import Service from "../service";
import { CostEstimateRequest } from "../typings/binLookup/models";
import { CostEstimateResponse } from "../typings/binLookup/models";
import { ServiceError } from "../typings/binLookup/models";
import { ThreeDSAvailabilityRequest } from "../typings/binLookup/models";
import { ThreeDSAvailabilityResponse } from "../typings/binLookup/models";
import { IRequest } from "../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/checkout/classicCheckoutSDKApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
PaymentSetupResponse,
PaymentVerificationRequest,
PaymentVerificationResponse,
ServiceError,
ObjectSerializer
} from "../../typings/checkout/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/checkout/donationsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Client from "../../client";
import {
DonationPaymentRequest,
DonationPaymentResponse,
ServiceError,
ObjectSerializer
} from "../../typings/checkout/models";
import { IRequest } from "../../typings/requestOptions";
Expand Down
1 change: 0 additions & 1 deletion src/services/checkout/modificationsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
PaymentRefundResponse,
PaymentReversalRequest,
PaymentReversalResponse,
ServiceError,
StandalonePaymentCancelRequest,
StandalonePaymentCancelResponse,
ObjectSerializer
Expand Down
Loading

0 comments on commit 828bf42

Please sign in to comment.