-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(cypress): add testcases for nti based mit flow (#6567)
- Loading branch information
1 parent
9baa1ef
commit ea81432
Showing
8 changed files
with
347 additions
and
0 deletions.
There are no files selected for viewing
221 changes: 221 additions & 0 deletions
221
cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
import * as fixtures from "../../fixtures/imports"; | ||
import State from "../../utils/State"; | ||
import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; | ||
|
||
let globalState; | ||
let connector; | ||
|
||
describe("Card - Mandates using Network Transaction Id flow test", () => { | ||
before("seed global state", () => { | ||
cy.task("getGlobalState").then((state) => { | ||
globalState = new State(state); | ||
connector = globalState.get("connectorId"); | ||
}); | ||
}); | ||
|
||
afterEach("flush global state", () => { | ||
cy.task("setGlobalState", globalState.data); | ||
}); | ||
|
||
context( | ||
"Card - NoThreeDS Create and Confirm Automatic MIT payment flow test", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
} | ||
); | ||
|
||
context( | ||
"Card - NoThreeDS Create and Confirm Manual MIT payment flow test", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"manual", | ||
globalState | ||
); | ||
}); | ||
} | ||
); | ||
|
||
context( | ||
"Card - NoThreeDS Create and Confirm Automatic multiple MITs payment flow test", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
} | ||
); | ||
|
||
context( | ||
"Card - NoThreeDS Create and Confirm Manual multiple MITs payment flow test", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT 1", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
6500, | ||
true, | ||
"manual", | ||
globalState | ||
); | ||
}); | ||
|
||
it("mit-capture-call-test", () => { | ||
let data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
|
||
cy.captureCallTest( | ||
fixtures.captureBody, | ||
req_data, | ||
res_data, | ||
6500, | ||
globalState | ||
); | ||
if (should_continue) | ||
should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("Confirm No 3DS MIT 2", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
6500, | ||
true, | ||
"manual", | ||
globalState | ||
); | ||
}); | ||
|
||
it("mit-capture-call-test", () => { | ||
let data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
|
||
cy.captureCallTest( | ||
fixtures.captureBody, | ||
req_data, | ||
res_data, | ||
6500, | ||
globalState | ||
); | ||
if (should_continue) | ||
should_continue = utils.should_continue_further(res_data); | ||
}); | ||
} | ||
); | ||
|
||
context( | ||
"Card - ThreeDS Create and Confirm Automatic multiple MITs payment flow test", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
} | ||
); | ||
|
||
context( | ||
"Card - ThreeDS Create and Confirm Manual multiple MITs payment flow", | ||
() => { | ||
let should_continue = true; | ||
|
||
beforeEach(function () { | ||
if (!should_continue || connector !== "cybersource") { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Confirm No 3DS MIT", () => { | ||
cy.mitUsingNTID( | ||
fixtures.ntidConfirmBody, | ||
7000, | ||
true, | ||
"automatic", | ||
globalState | ||
); | ||
}); | ||
} | ||
); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"amount": 999, | ||
"currency": "USD", | ||
"confirm": true, | ||
"payment_method": "card", | ||
"return_url": "https://hyperswitch.io", | ||
"email": "[email protected]", | ||
"recurring_details": { | ||
"type": "network_transaction_id_and_card_details", | ||
"data": { | ||
"card_number": "4242424242424242", | ||
"card_exp_month": "11", | ||
"card_exp_year": "2024", | ||
"card_holder_name": "joseph Doe", | ||
"network_transaction_id": "MCC5ZRGMI0925" | ||
} | ||
}, | ||
"off_session": true, | ||
"billing": { | ||
"address": { | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"line1": "1467", | ||
"line2": "Harrison Street", | ||
"line3": "Harrison Street", | ||
"city": "San Fransico", | ||
"state": "California", | ||
"zip": "94122", | ||
"country": "US" | ||
}, | ||
"phone": { | ||
"number": "9123456789", | ||
"country_code": "+91" | ||
} | ||
}, | ||
"browser_info": { | ||
"ip_address": "129.0.0.1", | ||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", | ||
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", | ||
"language": "en-US", | ||
"color_depth": 30, | ||
"screen_height": 1117, | ||
"screen_width": 1728, | ||
"time_zone": -330, | ||
"java_enabled": true, | ||
"java_script_enabled": true | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters