diff --git a/src/__tests__/modification.spec.ts b/src/__tests__/modification.spec.ts index ca21c53..8017c62 100644 --- a/src/__tests__/modification.spec.ts +++ b/src/__tests__/modification.spec.ts @@ -171,6 +171,7 @@ let modification: Modification; let scope: nock.Scope; const paymentPspReference = "863620292981235A"; const invalidPaymentPspReference = "invalid_psp_reference"; +const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI); beforeEach((): void => { if (!nock.isActive()) { @@ -186,7 +187,7 @@ afterEach(() => { }); describe("Modification", (): void => { - test.each([false, true])("should perform an amount update request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform an amount update request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createAmountUpdateRequest(); scope.post(`/payments/${paymentPspReference}/amountUpdates`) @@ -215,7 +216,7 @@ describe("Modification", (): void => { } }); - test.each([false, true])("should perform a cancels request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform a cancels request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createCancelsRequest(); scope.post(`/payments/${paymentPspReference}/cancels`) @@ -242,7 +243,7 @@ describe("Modification", (): void => { } }); - test.each([false, true])("should perform a standalone cancels request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform a standalone cancels request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createStandaloneCancelsRequest(); scope.post("/cancels") @@ -270,7 +271,7 @@ describe("Modification", (): void => { } }); - test.each([false, true])("should perform a captures request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform a captures request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createCapturesRequest(); scope.post(`/payments/${paymentPspReference}/captures`) @@ -297,7 +298,7 @@ describe("Modification", (): void => { } }); - test.each([false, true])("should perform a refunds request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform a refunds request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createRefundsRequest(); scope.post(`/payments/${paymentPspReference}/refunds`) @@ -324,7 +325,7 @@ describe("Modification", (): void => { } }); - test.each([false, true])("should perform a reversals request, isMock: %p", async (isMock): Promise => { + test.each([isCI, true])("should perform a reversals request, isMock: %p", async (isMock): Promise => { !isMock && nock.restore(); const request = createReversalsRequest(); scope.post(`/payments/${paymentPspReference}/reversals`) diff --git a/src/services/modification.ts b/src/services/modification.ts index 52af007..78b5522 100644 --- a/src/services/modification.ts +++ b/src/services/modification.ts @@ -19,7 +19,6 @@ import Client from "../client"; import getJsonResponse from "../helpers/getJsonResponse"; import Service from "../service"; -import setApplicationInfo from "../helpers/setApplicationInfo"; import { ApplicationInfo } from "../typings/applicationInfo"; import { IRequest } from "../typings/requestOptions"; import AmountUpdates from "./resource/modification/amountUpdates"; @@ -56,7 +55,7 @@ class Modification extends Service { const amountUpdates = new AmountUpdates(this, paymentPspReference); return getJsonResponse( amountUpdates, - setApplicationInfo(amountUpdatesRequest), + amountUpdatesRequest, requestOptions ); } @@ -68,7 +67,7 @@ class Modification extends Service { const cancelsStandalone = new CancelsStandalone(this); return getJsonResponse( cancelsStandalone, - setApplicationInfo(cancelsStandaloneRequest), + cancelsStandaloneRequest, requestOptions ); } @@ -81,7 +80,7 @@ class Modification extends Service { const cancels = new Cancels(this, paymentPspReference); return getJsonResponse( cancels, - setApplicationInfo(cancelsRequest), + cancelsRequest, requestOptions ); } @@ -94,7 +93,7 @@ class Modification extends Service { const captures = new Captures(this, paymentPspReference); return getJsonResponse( captures, - setApplicationInfo(capturesRequest), + capturesRequest, requestOptions ); } @@ -107,7 +106,7 @@ class Modification extends Service { const refunds = new Refunds(this, paymentPspReference); return getJsonResponse( refunds, - setApplicationInfo(refundsRequest), + refundsRequest, requestOptions ); } @@ -120,7 +119,7 @@ class Modification extends Service { const refunds = new Reversals(this, paymentPspReference); return getJsonResponse( refunds, - setApplicationInfo(reversalsRequest), + reversalsRequest, requestOptions ); }