From 1ead0c996b853e289d3333837b14dcbd96b5e0fe Mon Sep 17 00:00:00 2001 From: Saksham Sharma Date: Tue, 29 Oct 2024 13:09:15 +0530 Subject: [PATCH] fix: conflicts merge --- CHANGELOG.md | 30 +++++++ .../cypress/e2e/cvc-checks-e2e-test.cy.ts | 84 +++++++++++++++++++ cypress-tests/cypress/support/utils.ts | 2 + package-lock.json | 4 +- package.json | 27 +++--- webpack.common.js | 4 +- 6 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 cypress-tests/cypress/e2e/cvc-checks-e2e-test.cy.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index ba0fefc95..962929a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ +# [0.97.0](https://github.com/juspay/hyperswitch-web/compare/v0.96.3...v0.97.0) (2024-10-29) + + +### Features + +* tax calculation in google pay ([#750](https://github.com/juspay/hyperswitch-web/issues/750)) ([0039fbe](https://github.com/juspay/hyperswitch-web/commit/0039fbe65ec7ff958d637d00c58aed710fed5b1f)) + +## [0.96.3](https://github.com/juspay/hyperswitch-web/compare/v0.96.2...v0.96.3) (2024-10-29) + + +### Bug Fixes + +* remove blue border in firefox ([#746](https://github.com/juspay/hyperswitch-web/issues/746)) ([40ef7a5](https://github.com/juspay/hyperswitch-web/commit/40ef7a5578b3a687c9b596a27818f4533758f136)) + +## [0.96.2](https://github.com/juspay/hyperswitch-web/compare/v0.96.1...v0.96.2) (2024-10-28) + +## [0.96.1](https://github.com/juspay/hyperswitch-web/compare/v0.96.0...v0.96.1) (2024-10-25) + + +### Bug Fixes + +* card cvc bug fix ([#748](https://github.com/juspay/hyperswitch-web/issues/748)) ([6122d9d](https://github.com/juspay/hyperswitch-web/commit/6122d9d200b934969ee8643e598754d724a786a4)) + +# [0.96.0](https://github.com/juspay/hyperswitch-web/compare/v0.95.3...v0.96.0) (2024-10-23) + + +### Features + +* added apple pay support inside an iframe ([#743](https://github.com/juspay/hyperswitch-web/issues/743)) ([44ed3a8](https://github.com/juspay/hyperswitch-web/commit/44ed3a83b9686b140470575f7aa15c516cac1cc8)) + ## [0.95.3](https://github.com/juspay/hyperswitch-web/compare/v0.95.2...v0.95.3) (2024-10-21) diff --git a/cypress-tests/cypress/e2e/cvc-checks-e2e-test.cy.ts b/cypress-tests/cypress/e2e/cvc-checks-e2e-test.cy.ts new file mode 100644 index 000000000..883aaa5bf --- /dev/null +++ b/cypress-tests/cypress/e2e/cvc-checks-e2e-test.cy.ts @@ -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>; + 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'); + }) + + }) + +}) + + + + diff --git a/cypress-tests/cypress/support/utils.ts b/cypress-tests/cypress/support/utils.ts index 08a516365..4d6ca4c02 100644 --- a/cypress-tests/cypress/support/utils.ts +++ b/cypress-tests/cypress/support/utils.ts @@ -116,3 +116,5 @@ export const confirmBody = { export const stripeTestCard = "4000000000003220"; export const adyenTestCard = "4917610000000000"; export const bluesnapTestCard = "4000000000001091"; +export const amexTestCard = "378282246310005" +export const visaTestCard = "4242424242424242"; diff --git a/package-lock.json b/package-lock.json index ac674f2f0..ff68b0145 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.95.3", + "version": "0.97.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.95.3", + "version": "0.97.0", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index d72e1f99a..b65050649 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.95.3", + "version": "0.97.0", "main": "index.js", "private": true, "dependencies": { @@ -16,23 +16,22 @@ "webpack-merge": "^5.9.0" }, "scripts": { - "build:dev": "cross-env sdkEnv=sandbox webpack --config webpack.dev.js", - "build:dev-integ": "cross-env sdkEnv=integ webpack --config webpack.dev.js", - "start": "cross-env sdkEnv=local webpack serve --config webpack.dev.js", - "build:prod": "cross-env sdkEnv=prod webpack --config webpack.common.js", "build": "webpack --config webpack.common.js", - "build:sandbox": "cross-env sdkEnv=sandbox webpack --config webpack.common.js", - "build:integ": "cross-env sdkEnv=integ webpack --config webpack.common.js", - "test": "cd cypress-tests && npm run cypress:run", + "build:integ": "cross-env sdkEnv=integ enableLogging=false webpack --config webpack.common.js", + "build:playground": "npm run setup:playground && npm run build", + "build:prod": "cross-env sdkEnv=prod enableLogging=true webpack --config webpack.common.js", + "build:sandbox": "cross-env sdkEnv=sandbox enableLogging=true webpack --config webpack.common.js", + "deploy-to-s3": "node ./scripts/pushToS3.js", + "postinstall": "cd Hyperswitch-React-Demo-App && npm i", + "prepare": "husky install", "re:build": "rescript", "re:clean": "rescript clean", - "re:start": "rescript -w", "re:format": "rescript format -all", - "start:playground": "npm run postinstall && cd Hyperswitch-React-Demo-App && node promptScript.js && npm run start", - "build:playground": "npm run postinstall && cd Hyperswitch-React-Demo-App && node promptScript.js && npm run build", - "prepare": "husky install", - "deploy-to-s3": "node ./scripts/pushToS3.js", - "postinstall": "cd Hyperswitch-React-Demo-App && npm i", + "re:start": "rescript -w", + "setup:playground": "npm run postinstall && cd Hyperswitch-React-Demo-App && node promptScript.js", + "start": "cross-env sdkEnv=local enableLogging=false webpack serve --config webpack.dev.js", + "start:playground": "npm run setup:playground && npm run start", + "test": "cd cypress-tests && npm run cypress:run", "test:hooks": "npx eslint src/" }, "eslintConfig": { diff --git a/webpack.common.js b/webpack.common.js index 981f2a979..4357ab075 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -14,6 +14,7 @@ const getEnvVariable = (variable, defaultValue) => process.env[variable] ?? defaultValue; const sdkEnv = getEnvVariable("sdkEnv", "local"); +const enableLogging = getEnvVariable("enableLogging", "false") === "true"; const envSdkUrl = getEnvVariable("ENV_SDK_URL", ""); const envBackendUrl = getEnvVariable("ENV_BACKEND_URL", ""); const envLoggingUrl = getEnvVariable("ENV_LOGGING_URL", ""); @@ -60,7 +61,6 @@ const confirmEndPoint = const logEndpoint = envLoggingUrl || `https://${logDomain}.hyperswitch.io/logs/sdk`; -const enableLogging = true; const loggingLevel = "DEBUG"; const maxLogsPushedPerEventName = 100; @@ -84,7 +84,7 @@ module.exports = (publicPath = "auto") => { logEndpoint: JSON.stringify(logEndpoint), sentryDSN: JSON.stringify(process.env.SENTRY_DSN), sentryScriptUrl: JSON.stringify(process.env.SENTRY_SCRIPT_URL), - enableLogging: JSON.stringify(enableLogging), + enableLogging: enableLogging, loggingLevel: JSON.stringify(loggingLevel), maxLogsPushedPerEventName: JSON.stringify(maxLogsPushedPerEventName), }),