Skip to content

Commit

Permalink
Checkout Automation PR and fix Classic Payments (#1239)
Browse files Browse the repository at this point in the history
* [create-pull-request] automated change

* checkout automation branch and fix the classic platforms

---------

Co-authored-by: Adyen Automation <[email protected]>
  • Loading branch information
jillingk and AdyenAutomationBot authored Aug 23, 2023
1 parent 68b3f98 commit 61fcdeb
Show file tree
Hide file tree
Showing 109 changed files with 655 additions and 9,461 deletions.
73 changes: 37 additions & 36 deletions src/__tests__/classicIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import nock from "nock";
import {createClient} from "../__mocks__/base";
import Client from "../client";
import ClassicIntegration from "../services/paymentApi";
import { payments } from "../typings";
import { payment } from "../typings";
import HttpClientException from "../httpClient/httpClientException";
import {PaymentResult} from "../typings/payment/paymentResult";

let client: Client;
let classicIntegration: ClassicIntegration;
Expand Down Expand Up @@ -35,7 +36,7 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: payments.PaymentRequest = {
const paymentRequest: payment.PaymentRequest = {
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
Expand All @@ -51,7 +52,7 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const paymentResult: payments.PaymentResult = await classicIntegration.authorise(paymentRequest);
const paymentResult: PaymentResult = await classicIntegration.authorise(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});

Expand All @@ -65,7 +66,7 @@ describe("Classic Integration", (): void => {
"errorType": "security"
}
);
const paymentRequest: payments.PaymentRequest = {
const paymentRequest: payment.PaymentRequest = {
"card": {
"number": "4111111111111111",
"expiryMonth": "03",
Expand Down Expand Up @@ -104,14 +105,14 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: payments.PaymentRequest3d = {
const paymentRequest: payment.PaymentRequest3d = {
"md": "31h..........vOXek7w",
"paResponse": "eNqtmF........wGVA4Ch",
"shopperIP": "61.294.12.12",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const paymentResult: payments.PaymentResult = await classicIntegration.authorise3d(paymentRequest);
const paymentResult: payment.PaymentResult = await classicIntegration.authorise3d(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});

Expand All @@ -127,7 +128,7 @@ describe("Classic Integration", (): void => {
"authCode": "011381"
}
);
const paymentRequest: payments.PaymentRequest3ds2 = {
const paymentRequest: payment.PaymentRequest3ds2 = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"amount": {
"value": 1500,
Expand All @@ -141,7 +142,7 @@ describe("Classic Integration", (): void => {
"threeDS2Token": "— - BINARY DATA - -"
};

const paymentResult: payments.PaymentResult = await classicIntegration.authorise3ds2(paymentRequest);
const paymentResult: payment.PaymentResult = await classicIntegration.authorise3ds2(paymentRequest);
expect(paymentResult.pspReference).toEqual("JVBXGSDM53RZNN82");
});

Expand All @@ -150,25 +151,25 @@ describe("Classic Integration", (): void => {
"threeDS2Result": { "authenticationValue": "THREEDS2RESULT"}
});

const getAuthenticationResultrequest: payments.AuthenticationResultRequest = {
const getAuthenticationResultrequest: payment.AuthenticationResultRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"pspReference": "9935272408535455"
};

const getAuthenticationResultResponse: payments.AuthenticationResultResponse = await classicIntegration.getAuthenticationResult(getAuthenticationResultrequest);
const getAuthenticationResultResponse: payment.AuthenticationResultResponse = await classicIntegration.getAuthenticationResult(getAuthenticationResultrequest);
expect(getAuthenticationResultResponse?.threeDS2Result?.authenticationValue).toEqual("THREEDS2RESULT");
});

test("Should retrieve 3DS2 result", async (): Promise<void> => {
scope.post("/retrieve3ds2Result").reply(200, {
"threeDS2Result": { "authenticationValue": "THREEDS2RESULT"}
});
const retrieve3ds2ResultRequest: payments.ThreeDS2ResultRequest = {
const retrieve3ds2ResultRequest: payment.ThreeDS2ResultRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"pspReference": "9935272408535455"
};

const retrieve3ds2ResultResponse: payments.ThreeDS2ResultResponse = await classicIntegration.retrieve3ds2Result(retrieve3ds2ResultRequest);
const retrieve3ds2ResultResponse: payment.ThreeDS2ResultResponse = await classicIntegration.retrieve3ds2Result(retrieve3ds2ResultRequest);
expect(retrieve3ds2ResultResponse?.threeDS2Result?.authenticationValue).toEqual("THREEDS2RESULT");
});

Expand All @@ -179,7 +180,7 @@ describe("Classic Integration", (): void => {
"response": "[capture-received]"
});

const modificationRequest: payments.CaptureRequest = {
const modificationRequest: payment.CaptureRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
Expand All @@ -189,8 +190,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.capture(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CaptureReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.capture(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.CaptureReceived);
});

test("Should successfully send Cancel request", async (): Promise<void> => {
Expand All @@ -200,14 +201,14 @@ describe("Classic Integration", (): void => {
"response": "[cancel-received]"
});

const modificationRequest: payments.CancelRequest = {
const modificationRequest: payment.CancelRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"reference": "YourModificationReference",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.cancel(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CancelReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.cancel(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.CancelReceived);
});

test("Should successfully send Refund request", async (): Promise<void> => {
Expand All @@ -217,7 +218,7 @@ describe("Classic Integration", (): void => {
"response": "[refund-received]"
});

const modificationRequest: payments.RefundRequest = {
const modificationRequest: payment.RefundRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
Expand All @@ -227,8 +228,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.refund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.RefundReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.refund(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.RefundReceived);
});

test("Should successfully send CancelOrRefund request", async (): Promise<void> => {
Expand All @@ -238,14 +239,14 @@ describe("Classic Integration", (): void => {
"response": "[cancelOrRefund-received]"
});

const modificationRequest: payments.CancelOrRefundRequest = {
const modificationRequest: payment.CancelOrRefundRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"reference": "YourModificationReference",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.cancelOrRefund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.CancelOrRefundReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.cancelOrRefund(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.CancelOrRefundReceived);
});

test("Should successfully send TechnicalCancel request", async (): Promise<void> => {
Expand All @@ -255,7 +256,7 @@ describe("Classic Integration", (): void => {
"response": "[technical-cancel-received]"
});

const modificationRequest: payments.TechnicalCancelRequest = {
const modificationRequest: payment.TechnicalCancelRequest = {
"originalMerchantReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
Expand All @@ -265,8 +266,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.technicalCancel(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.TechnicalCancelReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.technicalCancel(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.TechnicalCancelReceived);
});

test("Should successfully send AdjustAuthorisation request", async (): Promise<void> => {
Expand All @@ -276,7 +277,7 @@ describe("Classic Integration", (): void => {
"response": "[adjustAuthorisation-received]"
});

const modificationRequest: payments.AdjustAuthorisationRequest = {
const modificationRequest: payment.AdjustAuthorisationRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
Expand All @@ -286,8 +287,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.adjustAuthorisation(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.AdjustAuthorisationReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.adjustAuthorisation(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.AdjustAuthorisationReceived);
});

test("Should successfully send Donate request", async (): Promise<void> => {
Expand All @@ -297,7 +298,7 @@ describe("Classic Integration", (): void => {
"response": "[donation-received]"
});

const modificationRequest: payments.DonationRequest = {
const modificationRequest: payment.DonationRequest = {
"originalReference": "COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE",
"modificationAmount": {
"value": 500,
Expand All @@ -308,8 +309,8 @@ describe("Classic Integration", (): void => {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
};

const modificationResult: payments.ModificationResult = await classicIntegration.donate(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.DonationReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.donate(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.DonationReceived);
});

test("Should successfully send VoidPendingRefund request", async (): Promise<void> => {
Expand All @@ -319,13 +320,13 @@ describe("Classic Integration", (): void => {
"response": "[voidPendingRefund-received]"
});

const modificationRequest: payments.VoidPendingRefundRequest = {
const modificationRequest: payment.VoidPendingRefundRequest = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"tenderReference": "5Iw8001176969533005",
"uniqueTerminalId": "VX820-123456789"
};

const modificationResult: payments.ModificationResult = await classicIntegration.voidPendingRefund(modificationRequest);
expect(modificationResult.response).toEqual(payments.ModificationResult.ResponseEnum.VoidPendingRefundReceived);
const modificationResult: payment.ModificationResult = await classicIntegration.voidPendingRefund(modificationRequest);
expect(modificationResult.response).toEqual(payment.ModificationResult.ResponseEnum.VoidPendingRefundReceived);
});
});
2 changes: 2 additions & 0 deletions src/notification/bankingWebhookHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {configurationWebhooks} from "../typings";
import {reportWebhooks} from "../typings";
import {transferWebhooks} from "../typings";
import {TransferNotificationRequest} from "../typings/transferWebhooks/transferNotificationRequest";
import {CardOrderNotificationRequest} from "../typings/configurationWebhooks/cardOrderNotificationRequest";

class BankingWebhookHandler {
private readonly payload: string;
Expand All @@ -23,6 +24,7 @@ class BankingWebhookHandler {
| configurationWebhooks.SweepConfigurationNotificationRequest
| reportWebhooks.ReportNotificationRequest
| TransferNotificationRequest
| CardOrderNotificationRequest
| void {
const type = this.payload['type'];
if(Object.values(configurationWebhooks.AccountHolderNotificationRequest.TypeEnum).includes(type)){
Expand Down
1 change: 1 addition & 0 deletions src/services/legalEntityManagement/documentsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class DocumentsApi extends Service {

/**
* @summary Upload a document for verification checks
* @param xRequestedVerificationCode {@link string } Use a suberror code as your requested verification code. You can include one code at a time in your request header. Requested verification codes can only be used in your test environment.
* @param document {@link Document }
* @param requestOptions {@link IRequest.Options}
* @return {@link Document }
Expand Down
1 change: 1 addition & 0 deletions src/services/legalEntityManagement/legalEntitiesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class LegalEntitiesApi extends Service {

/**
* @summary Create a legal entity
* @param xRequestedVerificationCode {@link string } Use a suberror code as your requested verification code. You can include one code at a time in your request header. Requested verification codes can only be used in your test environment.
* @param legalEntityInfoRequiredType {@link LegalEntityInfoRequiredType }
* @param requestOptions {@link IRequest.Options}
* @return {@link LegalEntity }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class TransferInstrumentsApi extends Service {

/**
* @summary Create a transfer instrument
* @param xRequestedVerificationCode {@link string } Use a suberror code as your requested verification code. You can include one code at a time in your request header. Requested verification codes can only be used in your test environment.
* @param transferInstrumentInfo {@link TransferInstrumentInfo }
* @param requestOptions {@link IRequest.Options}
* @return {@link TransferInstrument }
Expand Down
5 changes: 3 additions & 2 deletions src/typings/balancePlatform/accountHolderCapability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { AccountSupportingEntityCapability } from './accountSupportingEntityCapability';
import { CapabilityProblem } from './capabilityProblem';
import { CapabilitySettings } from './capabilitySettings';

export class AccountHolderCapability {
Expand All @@ -27,7 +28,7 @@ export class AccountHolderCapability {
/**
* Contains verification errors and the actions that you can take to resolve them.
*/
'problems'?: Array<object>;
'problems'?: Array<CapabilityProblem>;
/**
* Indicates whether the capability is requested. To check whether the account holder is permitted to use the capability, refer to the `allowed` field.
*/
Expand Down Expand Up @@ -72,7 +73,7 @@ export class AccountHolderCapability {
{
"name": "problems",
"baseName": "problems",
"type": "Array<object>"
"type": "Array<CapabilityProblem>"
},
{
"name": "requested",
Expand Down
38 changes: 38 additions & 0 deletions src/typings/balancePlatform/capabilityProblem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import { CapabilityProblemEntity } from './capabilityProblemEntity';
import { VerificationError } from './verificationError';

export class CapabilityProblem {
'entity'?: CapabilityProblemEntity;
/**
* Contains information about the verification error.
*/
'verificationErrors'?: Array<VerificationError>;

static discriminator: string | undefined = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "entity",
"baseName": "entity",
"type": "CapabilityProblemEntity"
},
{
"name": "verificationErrors",
"baseName": "verificationErrors",
"type": "Array<VerificationError>"
} ];

static getAttributeTypeMap() {
return CapabilityProblem.attributeTypeMap;
}
}

Loading

0 comments on commit 61fcdeb

Please sign in to comment.