-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into log-event-rename
- Loading branch information
Showing
135 changed files
with
9,156 additions
and
4,645 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ const paymentData = { | |
authentication_type: "three_ds", | ||
customer_id: "hyperswitch_sdk_demo_id", | ||
email: "[email protected]", | ||
request_external_three_ds_authentication: false, | ||
description: "Hello this is description", | ||
shipping: { | ||
address: { | ||
|
@@ -97,7 +98,7 @@ const paymentData = { | |
} | ||
|
||
const profileId = process.env.PROFILE_ID; | ||
if(profileId) { | ||
if (profileId) { | ||
paymentData.profile_id = profileId; | ||
} | ||
|
||
|
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
Empty file.
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,4 @@ | ||
{ | ||
"HYPERSWITCH_PUBLISHABLE_KEY": "", | ||
"HYPERSWITCH_SECRET_KEY": "" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import * as testIds from "../../../src/Utilities/TestUtils.bs"; | ||
import { getClientURL, amexTestCard, visaTestCard, createPaymentBody } from "../support/utils"; | ||
|
||
describe("Card CVC Checks", () => { | ||
let getIframeBody: () => Cypress.Chainable<JQuery<HTMLBodyElement>>; | ||
const publishableKey = Cypress.env('HYPERSWITCH_PUBLISHABLE_KEY') | ||
const secretKey = Cypress.env('HYPERSWITCH_SECRET_KEY') | ||
let iframeSelector = | ||
"#orca-payment-element-iframeRef-orca-elements-payment-element-payment-element"; | ||
|
||
|
||
beforeEach(() => { | ||
getIframeBody = () => cy.iframe(iframeSelector); | ||
cy.createPaymentIntent(secretKey, createPaymentBody).then(() => { | ||
cy.getGlobalState("clientSecret").then((clientSecret) => { | ||
|
||
cy.visit(getClientURL(clientSecret, publishableKey)); | ||
}); | ||
|
||
}) | ||
}); | ||
|
||
|
||
|
||
|
||
it("title rendered correctly", () => { | ||
cy.contains("Hyperswitch Unified Checkout").should("be.visible"); | ||
}); | ||
|
||
it("orca-payment-element iframe loaded", () => { | ||
cy.get( | ||
"#orca-payment-element-iframeRef-orca-elements-payment-element-payment-element" | ||
) | ||
.should("be.visible") | ||
.its("0.contentDocument") | ||
.its("body"); | ||
}); | ||
|
||
|
||
it('user can enter 4 digit cvc in card form', () => { | ||
getIframeBody().find(`[data-testid=${testIds.addNewCardIcon}]`).click() | ||
getIframeBody().find(`[data-testid=${testIds.cardNoInputTestId}]`).type(amexTestCard) | ||
getIframeBody().find(`[data-testid=${testIds.expiryInputTestId}]`).type("0444") | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type("1234").then(() => { | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).should('have.value', '1234'); | ||
}) | ||
|
||
|
||
}) | ||
it('user can enter 3 digit cvc on saved payment methods screen', () => { | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type('123').then(() => { | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).should('have.value', '123'); | ||
}) | ||
|
||
}) | ||
|
||
it('user can enter 3 digit cvc in card form', () => { | ||
getIframeBody().find(`[data-testid=${testIds.addNewCardIcon}]`).click() | ||
getIframeBody().find(`[data-testid=${testIds.cardNoInputTestId}]`).type(visaTestCard) | ||
getIframeBody().find(`[data-testid=${testIds.expiryInputTestId}]`).type("0444") | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type("123").then(() => { | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).should('have.value', '123'); | ||
}) | ||
}) | ||
|
||
it('user can enter 4 digit cvc on saved payment methods screen', () => { | ||
cy.wait(2000) | ||
getIframeBody() | ||
.contains('div', '4 digit cvc test card') | ||
.should('exist') | ||
.trigger('click') | ||
cy.wait(1000) | ||
|
||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type("1234").then(() => { | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).should('have.value', '1234'); | ||
}) | ||
|
||
}) | ||
|
||
}) | ||
|
||
|
||
|
||
|
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 |
---|---|---|
|
@@ -24,9 +24,10 @@ | |
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
import "cypress-iframe"; | ||
import { createPaymentBody } from "./utils" | ||
import * as testIds from "../../../src/Utilities/TestUtils.bs"; | ||
// commands.js or your custom support file | ||
const iframeSelector = | ||
const iframeSelector = | ||
"#orca-payment-element-iframeRef-orca-elements-payment-element-payment-element"; | ||
|
||
let globalState = {}; | ||
|
@@ -73,11 +74,11 @@ Cypress.Commands.add( | |
mapping[testIds.cardNoInputTestId] = customerData.threeDSCardNo; | ||
} | ||
let publishableKey = "pk_snd_3b33cd9404234113804aa1accaabe22f"; | ||
let clientSecret:string; | ||
let clientSecret: string; | ||
cy.request({ | ||
method: "GET", | ||
url: "http://localhost:5252/create-payment-intent", | ||
}).then((response: {body: { clientSecret: string }}) => { | ||
}).then((response: { body: { clientSecret: string } }) => { | ||
clientSecret = response.body.clientSecret; | ||
|
||
cy.request({ | ||
|
@@ -145,37 +146,18 @@ Cypress.Commands.add( | |
} | ||
); | ||
|
||
const request = { | ||
currency: "USD", | ||
amount: 6500, | ||
authentication_type: "three_ds", | ||
description: "Joseph First Crypto", | ||
email: "[email protected]", | ||
connector_metadata: { | ||
noon: { | ||
order_category: "applepay", | ||
}, | ||
}, | ||
metadata: { | ||
udf1: "value1", | ||
new_customer: "true", | ||
login_date: "2019-09-10T10:11:12Z", | ||
}, | ||
// customer_id: "hyperswitch_sdk_demo_test_id", | ||
business_country: "US", | ||
business_label: "default", | ||
}; | ||
Cypress.Commands.add("createPaymentIntent", () => { | ||
|
||
Cypress.Commands.add("createPaymentIntent", (secretKey: string, createPaymentBody: any) => { | ||
return cy | ||
.request({ | ||
method: "POST", | ||
url: "https://sandbox.hyperswitch.io/payments", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Accept: "application/json", | ||
"api-key": "snd_c691ade6995743bd88c166ba509ff5da", | ||
"api-key": secretKey, | ||
}, | ||
body: JSON.stringify(request), | ||
body: JSON.stringify(createPaymentBody), | ||
}) | ||
.then((response) => { | ||
expect(response.headers["content-type"]).to.include("application/json"); | ||
|
@@ -188,6 +170,6 @@ Cypress.Commands.add("createPaymentIntent", () => { | |
}); | ||
}); | ||
|
||
Cypress.Commands.add("getGlobalState", (key: number) => { | ||
Cypress.Commands.add("getGlobalState", (key: any) => { | ||
return globalState[key]; | ||
}); |
Oops, something went wrong.