Skip to content

Commit

Permalink
Merge branch 'main' into test/adyen-card-e2e-success-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamchasing authored Dec 5, 2024
2 parents 3caabc5 + 77f3c3b commit 7df9fd0
Show file tree
Hide file tree
Showing 43 changed files with 866 additions and 197 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## [0.105.2](https://github.com/juspay/hyperswitch-web/compare/v0.105.1...v0.105.2) (2024-12-05)


### Bug Fixes

* re render issue of card nickname ([#823](https://github.com/juspay/hyperswitch-web/issues/823)) ([a4691b0](https://github.com/juspay/hyperswitch-web/commit/a4691b09f8dba1fa3ebaa8a56b910206296b899d))

## [0.105.1](https://github.com/juspay/hyperswitch-web/compare/v0.105.0...v0.105.1) (2024-12-05)

# [0.105.0](https://github.com/juspay/hyperswitch-web/compare/v0.104.6...v0.105.0) (2024-12-04)


### Features

* add traditional chinese locale ([#822](https://github.com/juspay/hyperswitch-web/issues/822)) ([2707923](https://github.com/juspay/hyperswitch-web/commit/27079236edef9bdd776753b67a70c474a794dd72))

## [0.104.6](https://github.com/juspay/hyperswitch-web/compare/v0.104.5...v0.104.6) (2024-12-04)

## [0.104.5](https://github.com/juspay/hyperswitch-web/compare/v0.104.4...v0.104.5) (2024-12-03)

## [0.104.4](https://github.com/juspay/hyperswitch-web/compare/v0.104.3...v0.104.4) (2024-12-03)


### Bug Fixes

* show card form by default rendering issue ([#817](https://github.com/juspay/hyperswitch-web/issues/817)) ([00e8562](https://github.com/juspay/hyperswitch-web/commit/00e8562b97c20ed02dc86eaf139ffafb822be075))

## [0.104.3](https://github.com/juspay/hyperswitch-web/compare/v0.104.2...v0.104.3) (2024-12-02)

## [0.104.2](https://github.com/juspay/hyperswitch-web/compare/v0.104.1...v0.104.2) (2024-12-02)

## [0.104.1](https://github.com/juspay/hyperswitch-web/compare/v0.104.0...v0.104.1) (2024-12-02)

# [0.104.0](https://github.com/juspay/hyperswitch-web/compare/v0.103.2...v0.104.0) (2024-11-26)


### Features

* samsung pay added ([#806](https://github.com/juspay/hyperswitch-web/issues/806)) ([01db104](https://github.com/juspay/hyperswitch-web/commit/01db104a2512e99eb38305751a9e9395e0812940))

## [0.103.2](https://github.com/juspay/hyperswitch-web/compare/v0.103.1...v0.103.2) (2024-11-26)

## [0.103.1](https://github.com/juspay/hyperswitch-web/compare/v0.103.0...v0.103.1) (2024-11-25)
Expand Down
1 change: 0 additions & 1 deletion Hyperswitch-React-Demo-App/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"dependencies": {
"@juspay-tech/hyper-js": "^1.6.0",
"@juspay-tech/hyperswitch-node": "^1.0.1",
"@juspay-tech/react-hyper-js": "^1.0.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
Expand Down
43 changes: 18 additions & 25 deletions Hyperswitch-React-Demo-App/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ const fetch = require("node-fetch");
const express = require("express");
const { resolve } = require("path");
const dotenv = require("dotenv");
const hyper = require("@juspay-tech/hyperswitch-node");
dotenv.config({ path: "./.env" });

const app = express();
const PORT = 5252;

const hyperswitch = hyper(process.env.HYPERSWITCH_SECRET_KEY);

function getUrl(envVar, selfHostedValue) {
return process.env[envVar] === selfHostedValue ? "" : process.env[envVar];
}
Expand Down Expand Up @@ -95,7 +92,7 @@ const paymentData = {
country_code: "+91",
},
},
}
};

const profileId = process.env.PROFILE_ID;
if (profileId) {
Expand All @@ -122,29 +119,25 @@ app.get("/create-payment-intent", async (_, res) => {
});

async function createPaymentIntent(request) {
if (SERVER_URL) {
const url =
process.env.HYPERSWITCH_SERVER_URL_FOR_DEMO_APP ||
process.env.HYPERSWITCH_SERVER_URL;
const apiResponse = await fetch(`${url}/payments`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"api-key": process.env.HYPERSWITCH_SECRET_KEY,
},
body: JSON.stringify(request),
});
const paymentIntent = await apiResponse.json();
const url =
process.env.HYPERSWITCH_SERVER_URL_FOR_DEMO_APP ||
process.env.HYPERSWITCH_SERVER_URL;
const apiResponse = await fetch(`${url}/payments`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"api-key": process.env.HYPERSWITCH_SECRET_KEY,
},
body: JSON.stringify(request),
});
const paymentIntent = await apiResponse.json();

if (paymentIntent.error) {
console.error("Error - ", paymentIntent.error);
throw new Error(paymentIntent?.error?.message ?? "Something went wrong.");
}
return paymentIntent;
} else {
return await hyperswitch?.paymentIntents?.create(request);
if (paymentIntent.error) {
console.error("Error - ", paymentIntent.error);
throw new Error(paymentIntent?.error?.message ?? "Something went wrong.");
}
return paymentIntent;
}

app.listen(PORT, () => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.103.2",
"version": "0.105.2",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/App.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let make = () => {
switch fullscreenMode {
| "paymentloader" => <PaymentLoader />
| "plaidSDK" => <PlaidSDKIframe />
| "pazeWallet" => <PazeWallet />
| "pazeWallet" => <PazeWallet logger />
| "fullscreen" =>
<div id="fullscreen">
<FullScreenDivDriver />
Expand Down
1 change: 1 addition & 0 deletions src/CardTheme.res
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let getLocaleObject = async string => {
| NL => Js.import(DutchLocale.localeStrings)
| SV => Js.import(SwedishLocale.localeStrings)
| RU => Js.import(RussianLocale.localeStrings)
| ZH_HANT => Js.import(TraditionalChineseLocale.localeStrings)
}

let awaitedLocaleValue = await promiseLocale
Expand Down
6 changes: 2 additions & 4 deletions src/CardUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ let getCardBrandIcon = (cardType, paymentType) => {
| GooglePayElement
| PayPalElement
| ApplePayElement
| SamsungPayElement
| KlarnaElement
| ExpressCheckoutElement
| PaymentMethodsManagement
Expand Down Expand Up @@ -677,10 +678,7 @@ let getCardBrandFromStates = (cardBrand, cardScheme, showFields) => {
!showFields ? cardScheme : cardBrand
}

let getCardBrandInvalidError = (
~cardNumber,
~localeString: OrcaPaymentPage.LocaleStringTypes.localeStrings,
) => {
let getCardBrandInvalidError = (~cardNumber, ~localeString: LocaleStringTypes.localeStrings) => {
switch cardNumber->getCardBrand {
| "" => localeString.enterValidCardNumberErrorText
| cardBrandValue => localeString.cardBrandConfiguredErrorText(cardBrandValue)
Expand Down
2 changes: 2 additions & 0 deletions src/Components/SurchargeUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type oneClickWallets = {
}
let oneClickWallets = [
{paymentMethodType: "apple_pay", displayName: "ApplePay"},
{paymentMethodType: "samsung_pay", displayName: "SamsungPay"},
{paymentMethodType: "paypal", displayName: "Paypal"},
{paymentMethodType: "google_pay", displayName: "GooglePay"},
{paymentMethodType: "klarna", displayName: "Klarna"},
Expand All @@ -23,6 +24,7 @@ let useSurchargeDetailsForOneClickWallets = (~paymentMethodListValue) => {
oneClickWallets->Array.reduce([], (acc, wallet) => {
let (isWalletBtnRendered, paymentMethod) = switch wallet.paymentMethodType {
| "apple_pay" => (areOneClickWalletsRendered.isApplePay, "wallet")
| "samsung_pay" => (areOneClickWalletsRendered.isSamsungPay, "wallet")
| "paypal" => (areOneClickWalletsRendered.isPaypal, "wallet")
| "google_pay" => (areOneClickWalletsRendered.isGooglePay, "wallet")
| "klarna" => (areOneClickWalletsRendered.isKlarna, "pay_later")
Expand Down
5 changes: 5 additions & 0 deletions src/LoaderController.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
let setCustomPodUri = Recoil.useSetRecoilState(customPodUri)
let setIsGooglePayReady = Recoil.useSetRecoilState(isGooglePayReady)
let setIsApplePayReady = Recoil.useSetRecoilState(isApplePayReady)
let setIsSamsungPayReady = Recoil.useSetRecoilState(isSamsungPayReady)
let (divH, setDivH) = React.useState(_ => 0.0)
let (launchTime, setLaunchTime) = React.useState(_ => 0.0)
let {showCardFormByDefault, paymentMethodOrder} = optionsPayment
Expand Down Expand Up @@ -96,6 +97,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
| GooglePayElement
| PayPalElement
| ApplePayElement
| SamsungPayElement
| KlarnaElement
| PazeElement
| ExpressCheckoutElement
Expand Down Expand Up @@ -385,6 +387,9 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
dict->getJsonObjectFromDict("isReadyToPay")->JSON.Decode.bool->Option.getOr(false)
)
}
if dict->getDictIsSome("isSamsungPayReady") {
setIsSamsungPayReady(_ => dict->getBool("isSamsungPayReady", false))
}
if (
dict->getDictIsSome("customBackendUrl") &&
dict
Expand Down
2 changes: 1 addition & 1 deletion src/LocaleStrings/ChineseLocale.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let localeStrings: LocaleStringTypes.localeStrings = {
locale: `zh`,
localeDirection: `ltr`,
cardNumberLabel: `卡号`,
cardNumberLabel: `卡號`,
inValidCardErrorText: `卡号无效。`,
inCompleteCVCErrorText: `您的卡片安全码不完整。`,
inCompleteExpiryErrorText: `您的卡片到期日期不完整。`,
Expand Down
1 change: 1 addition & 0 deletions src/LocaleStrings/LocaleStringHelper.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ let mapLocalStringToTypeLocale = val => {
| "sv" => SV
| "ru" => RU
| "zh" => ZH
| "zh-Hant" => ZH_HANT
| "en"
| _ =>
EN
Expand Down
2 changes: 1 addition & 1 deletion src/LocaleStrings/LocaleStringTypes.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type locale =
EN | HE | FR | EN_GB | AR | JA | DE | FR_BE | ES | CA | PT | IT | PL | NL | SV | RU | ZH
EN | HE | FR | EN_GB | AR | JA | DE | FR_BE | ES | CA | PT | IT | PL | NL | SV | RU | ZH | ZH_HANT

type localeStrings = {
locale: string,
Expand Down
Loading

0 comments on commit 7df9fd0

Please sign in to comment.