Skip to content

Commit

Permalink
Update all services (#1424)
Browse files Browse the repository at this point in the history
* [reformat][adyen-sdk-automation] automated change

* style(fmt): code formatted

* Update transferRoute.ts

* removed obsolete classicCheckout SDK tests

---------

Co-authored-by: AdyenAutomationBot <Adyen Automation plugins_dev@adyen.com>
Co-authored-by: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 11, 2024
1 parent fd0f0f4 commit e14be7d
Show file tree
Hide file tree
Showing 49 changed files with 943 additions and 1,620 deletions.
84 changes: 42 additions & 42 deletions src/__tests__/checkout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {createClient} from "../__mocks__/base";
import {paymentMethodsSuccess} from "../__mocks__/checkout/paymentMethodsSuccess";
import {paymentsSuccess} from "../__mocks__/checkout/paymentsSuccess";
import {paymentDetailsSuccess} from "../__mocks__/checkout/paymentsDetailsSuccess";
import {paymentSessionSuccess} from "../__mocks__/checkout/paymentSessionSucess";
// import {paymentSessionSuccess} from "../__mocks__/checkout/paymentSessionSucess";
import {originKeysSuccess} from "../__mocks__/checkout/originkeysSuccess";
import {paymentsResultMultibancoSuccess} from "../__mocks__/checkout/paymentsResultMultibancoSuccess";
import {paymentsResultSuccess} from "../__mocks__/checkout/paymentsResultSucess";
// import {paymentsResultSuccess} from "../__mocks__/checkout/paymentsResultSucess";
import {sessionsSuccess} from "../__mocks__/checkout/sessionsSuccess";
import Client from "../client";
import {CheckoutAPI} from "../services";
Expand Down Expand Up @@ -54,17 +54,17 @@ export function createPaymentsCheckoutRequest(): checkout.PaymentRequest {
};
}

function createPaymentSessionRequest(): checkout.PaymentSetupRequest {
return {
amount: createAmountObject("USD", 1000),
countryCode: "NL",
merchantAccount,
reference,
returnUrl: "https://your-company.com/...",
channel: checkout.PaymentSetupRequest.ChannelEnum.Web,
sdkVersion: "3.7.0"
};
}
// function createPaymentSessionRequest(): checkout.PaymentSetupRequest {
// return {
// amount: createAmountObject("USD", 1000),
// countryCode: "NL",
// merchantAccount,
// reference,
// returnUrl: "https://your-company.com/...",
// channel: checkout.PaymentSetupRequest.ChannelEnum.Web,
// sdkVersion: "3.7.0"
// };
// }

function createUpdatePaymentLinkRequest(): checkout.UpdatePaymentLinkRequest {
return {
Expand Down Expand Up @@ -195,19 +195,19 @@ describe("Checkout", (): void => {
.matchHeader("Idempotency-Key", "testKey");
await checkoutService.PaymentsApi.paymentsDetails(createPaymentsDetailsRequest(), {idempotencyKey: "testKey"});

scope.post("/paymentSession")
.reply(200, paymentSessionSuccess)
.matchHeader("Idempotency-Key", "testKey");
const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
await checkoutService.ClassicCheckoutSDKApi.paymentSession(paymentSessionRequest, {idempotencyKey: "testKey"});
// scope.post("/paymentSession")
// .reply(200, paymentSessionSuccess)
// .matchHeader("Idempotency-Key", "testKey");
// const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
// await checkoutService.ClassicCheckoutSDKApi.paymentSession(paymentSessionRequest, {idempotencyKey: "testKey"});

scope.post("/payments/result")
.reply(200, paymentsResultSuccess)
.matchHeader("Idempotency-Key", "testKey");
const paymentResultRequest: checkout.PaymentVerificationRequest = {
payload: "This is a test payload",
};
await checkoutService.ClassicCheckoutSDKApi.verifyPaymentResult(paymentResultRequest, {idempotencyKey: "testKey"});
// scope.post("/payments/result")
// .reply(200, paymentsResultSuccess)
// .matchHeader("Idempotency-Key", "testKey");
// const paymentResultRequest: checkout.PaymentVerificationRequest = {
// payload: "This is a test payload",
// };
// await checkoutService.ClassicCheckoutSDKApi.verifyPaymentResult(paymentResultRequest, {idempotencyKey: "testKey"});

const orderRequest: checkout.CreateOrderRequest = {
amount: createAmountObject("USD", 1000),
Expand Down Expand Up @@ -355,23 +355,23 @@ describe("Checkout", (): void => {
expect(paymentsResponse.resultCode).toEqual("Authorised");
});

test("should have payment session success", async (): Promise<void> => {
scope.post("/paymentSession")
.reply(200, paymentSessionSuccess);
const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
const paymentSessionResponse = await checkoutService.ClassicCheckoutSDKApi.paymentSession(paymentSessionRequest);
expect(paymentSessionResponse.paymentSession).not.toBeUndefined();
});

test("should have payments result", async (): Promise<void> => {
scope.post("/payments/result")
.reply(200, paymentsResultSuccess);
const paymentResultRequest: checkout.PaymentVerificationRequest = {
payload: "This is a test payload",
};
const paymentResultResponse = await checkoutService.ClassicCheckoutSDKApi.verifyPaymentResult(paymentResultRequest);
expect(paymentResultResponse.resultCode).toEqual("Authorised");
});
// test("should have payment session success", async (): Promise<void> => {
// scope.post("/paymentSession")
// .reply(200, paymentSessionSuccess);
// const paymentSessionRequest: checkout.PaymentSetupRequest = createPaymentSessionRequest();
// const paymentSessionResponse = await checkoutService.ClassicCheckoutSDKApi.paymentSession(paymentSessionRequest);
// expect(paymentSessionResponse.paymentSession).not.toBeUndefined();
// });

// test("should have payments result", async (): Promise<void> => {
// scope.post("/payments/result")
// .reply(200, paymentsResultSuccess);
// const paymentResultRequest: checkout.PaymentVerificationRequest = {
// payload: "This is a test payload",
// };
// const paymentResultResponse = await checkoutService.ClassicCheckoutSDKApi.verifyPaymentResult(paymentResultRequest);
// expect(paymentResultResponse.resultCode).toEqual("Authorised");
// });

test("should have missing identifier on live", async (): Promise<void> => {
client.setEnvironment("LIVE");
Expand Down
72 changes: 0 additions & 72 deletions src/services/checkout/classicCheckoutSDKApi.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/services/checkout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Do not edit this class manually.
*/

import { ClassicCheckoutSDKApi } from "./classicCheckoutSDKApi";
import { DonationsApi } from "./donationsApi";
import { ModificationsApi } from "./modificationsApi";
import { OrdersApi } from "./ordersApi";
Expand All @@ -25,10 +24,6 @@ export default class CheckoutAPI extends Service {
super(client);
}

public get ClassicCheckoutSDKApi() {
return new ClassicCheckoutSDKApi(this.client);
}

public get DonationsApi() {
return new DonationsApi(this.client);
}
Expand Down
28 changes: 28 additions & 0 deletions src/services/legalEntityManagement/termsOfServiceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
AcceptTermsOfServiceRequest,
AcceptTermsOfServiceResponse,
CalculateTermsOfServiceStatusResponse,
GetAcceptedTermsOfServiceDocumentResponse,
GetTermsOfServiceAcceptanceInfosResponse,
GetTermsOfServiceDocumentRequest,
GetTermsOfServiceDocumentResponse,
Expand Down Expand Up @@ -54,6 +55,33 @@ export class TermsOfServiceApi extends Service {
return ObjectSerializer.deserialize(response, "AcceptTermsOfServiceResponse");
}

/**
* @summary Get accepted Terms of Service document
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorship, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
* @param termsofserviceacceptancereference {@link string } An Adyen-generated reference for the accepted Terms of Service.
* @param requestOptions {@link IRequest.Options }
* @param termsOfServiceDocumentFormat {@link string } The format of the Terms of Service document. Possible values: **JSON**, **PDF**, or **TXT**
* @return {@link GetAcceptedTermsOfServiceDocumentResponse }
*/
public async getAcceptedTermsOfServiceDocument(id: string, termsofserviceacceptancereference: string, termsOfServiceDocumentFormat?: string, requestOptions?: IRequest.Options): Promise<GetAcceptedTermsOfServiceDocumentResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/acceptedTermsOfServiceDocument/{termsofserviceacceptancereference}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)))
.replace("{" + "termsofserviceacceptancereference" + "}", encodeURIComponent(String(termsofserviceacceptancereference)));
const resource = new Resource(this, endpoint);
const hasDefinedQueryParams = termsOfServiceDocumentFormat;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
if(termsOfServiceDocumentFormat) requestOptions.params["termsOfServiceDocumentFormat"] = termsOfServiceDocumentFormat;
}
const response = await getJsonResponse<string, GetAcceptedTermsOfServiceDocumentResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "GetAcceptedTermsOfServiceDocumentResponse");
}

/**
* @summary Get Terms of Service document
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorships, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
Expand Down
46 changes: 0 additions & 46 deletions src/typings/checkout/avs.ts

This file was deleted.

102 changes: 0 additions & 102 deletions src/typings/checkout/bankAccount.ts

This file was deleted.

Loading

0 comments on commit e14be7d

Please sign in to comment.