Skip to content

Commit

Permalink
Merge branch 'main' into fix/block_http_urls
Browse files Browse the repository at this point in the history
  • Loading branch information
prafulkoppalkar authored Apr 18, 2024
2 parents 0f29a70 + e4d2243 commit b7d59d9
Show file tree
Hide file tree
Showing 25 changed files with 919 additions and 814 deletions.
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
## [0.43.2](https://github.com/juspay/hyperswitch-web/compare/v0.43.1...v0.43.2) (2024-04-18)


### Bug Fixes

* Added envLoggingUrl in webpack ([#294](https://github.com/juspay/hyperswitch-web/issues/294)) ([88587ac](https://github.com/juspay/hyperswitch-web/commit/88587ac725c03fa1362e3ad79222a290f4d86cdb))

## [0.43.1](https://github.com/juspay/hyperswitch-web/compare/v0.43.0...v0.43.1) (2024-04-18)


### Bug Fixes

* **threedsmethod:** changed Three DS method API call to hidden Form Post ([#302](https://github.com/juspay/hyperswitch-web/issues/302)) ([e42a5a3](https://github.com/juspay/hyperswitch-web/commit/e42a5a3b0f68ba3264ffbe6d7afde41b1cc01d9d))

# [0.43.0](https://github.com/juspay/hyperswitch-web/compare/v0.42.6...v0.43.0) (2024-04-18)


### Features

* mandate changes for Saved Card flow ([#309](https://github.com/juspay/hyperswitch-web/issues/309)) ([648ea87](https://github.com/juspay/hyperswitch-web/commit/648ea87d8e2b0c989edbe7949b43a2c1e70e70cc))

## [0.42.6](https://github.com/juspay/hyperswitch-web/compare/v0.42.5...v0.42.6) (2024-04-17)


### Bug Fixes

* mandate data pass hide checkbox ([#308](https://github.com/juspay/hyperswitch-web/issues/308)) ([51c98ab](https://github.com/juspay/hyperswitch-web/commit/51c98abc4da2438195cfbb7e418bf7f47f800008))

## [0.42.5](https://github.com/juspay/hyperswitch-web/compare/v0.42.4...v0.42.5) (2024-04-17)

## [0.42.4](https://github.com/juspay/hyperswitch-web/compare/v0.42.3...v0.42.4) (2024-04-17)


### Bug Fixes

* promise unresolved type error ([#298](https://github.com/juspay/hyperswitch-web/issues/298)) ([03da575](https://github.com/juspay/hyperswitch-web/commit/03da57557f70ae36dc155392a6ccae2b9cad573e))

## [0.42.3](https://github.com/juspay/hyperswitch-web/compare/v0.42.2...v0.42.3) (2024-04-17)


### Bug Fixes

* (paymenthelpers, paymentelement) promise being unresolved ([#297](https://github.com/juspay/hyperswitch-web/issues/297)) ([6494f51](https://github.com/juspay/hyperswitch-web/commit/6494f517a95321b4cb0911f772866deff055d878))

## [0.42.2](https://github.com/juspay/hyperswitch-web/compare/v0.42.1...v0.42.2) (2024-04-17)


### Bug Fixes

* changes card payment ([#306](https://github.com/juspay/hyperswitch-web/issues/306)) ([d9a5b61](https://github.com/juspay/hyperswitch-web/commit/d9a5b611dbb191f1e3f5a4504f3729249e60d73b))

## [0.42.1](https://github.com/juspay/hyperswitch-web/compare/v0.42.0...v0.42.1) (2024-04-17)


### Bug Fixes

* card payment changes ([#303](https://github.com/juspay/hyperswitch-web/issues/303)) ([25dc996](https://github.com/juspay/hyperswitch-web/commit/25dc996c82fd459a67cf4836c2652cdee91b1cca))

# [0.42.0](https://github.com/juspay/hyperswitch-web/compare/v0.41.0...v0.42.0) (2024-04-17)


### Features

* (revert) mandate Changes for the Saved card screen & SDK Button Loader changes ([#301](https://github.com/juspay/hyperswitch-web/issues/301)) ([b490fed](https://github.com/juspay/hyperswitch-web/commit/b490fed4702306997a642041fdff56417822b7ca))

# [0.41.0](https://github.com/juspay/hyperswitch-web/compare/v0.40.0...v0.41.0) (2024-04-16)


Expand Down
6 changes: 3 additions & 3 deletions aws/hyperswitch_web_aws_production_deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ echo $( (aws s3api put-bucket-policy --bucket $MY_AWS_S3_BUCKET_NAME --policy "$

echo "Bucket configuration updated"

echo "Enter the backend endpoint your Hyperswitch Client will hit (hosted Hyperswitch Backend, https://sandbox.hyperswitch.io is taken by default):"
echo "Enter the backend endpoint your Hyperswitch Client will hit (hosted Hyperswitch Backend, https://beta.hyperswitch.io/api is taken by default):"
read AWS_BACKEND_URL </dev/tty

if [ -z $AWS_BACKEND_URL ]; then
echo "Setting backend URL value to https://sandbox.hyperswitch.io by default"
AWS_BACKEND_URL="https://sandbox.hyperswitch.io"
echo "Setting backend URL value to https://beta.hyperswitch.io/api by default"
AWS_BACKEND_URL="https://beta.hyperswitch.io/api"

fi

Expand Down
12 changes: 6 additions & 6 deletions aws/hyperswitch_web_aws_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ command_discovery() {
command_discovery curl
command_discovery aws

echo "Please enter the URL where you have hosted Hyperswitch Backend (https://sandbox.hyperswitch.io) "
echo "Please enter the URL where you have hosted Hyperswitch Backend (https://beta.hyperswitch.io/api) "
read HYPERSWITCH_SERVER_URL < /dev/tty

if [ -z "$HYPERSWITCH_SERVER_URL" ]; then
echo "Using default api url: https://sandbox.hyperswitch.io"
HYPERSWITCH_SERVER_URL="https://sandbox.hyperswitch.io"
echo "Using default api url: https://beta.hyperswitch.io/api"
HYPERSWITCH_SERVER_URL="https://beta.hyperswitch.io/api"
fi

# echo "Please enter the api url (https://sandbox.hyperswitch.io) "
# echo "Please enter the api url (https://beta.hyperswitch.io/api) "
# read apiBaseUrl < /dev/tty

# if [ -z "$apiBaseUrl" ]; then
# echo "Using default api url: https://sandbox.hyperswitch.io"
# apiBaseUrl="https://sandbox.hyperswitch.io"
# echo "Using default api url: https://beta.hyperswitch.io/api"
# apiBaseUrl="https://beta.hyperswitch.io/api"
# fi

echo "Please enter the URL where you have hosted Hyperswitch Client SDK (https://beta.hyperswitch.io/v1) "
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.41.0",
"version": "0.43.2",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions src/App.res
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ let make = () => {
let clientSecret = CardUtils.getQueryParamsDictforKey(url.search, "clientSecret")
let sessionId = CardUtils.getQueryParamsDictforKey(url.search, "sessionId")
let publishableKey = CardUtils.getQueryParamsDictforKey(url.search, "publishableKey")
let endpoint =
CardUtils.getQueryParamsDictforKey(url.search, "endpoint")->decodeURIComponent
<PreMountLoader publishableKey sessionId clientSecret endpoint />
<PreMountLoader publishableKey sessionId clientSecret />
}
| "achBankTransfer"
| "bacsBankTransfer"
Expand Down
14 changes: 6 additions & 8 deletions src/Components/SaveDetailsCheckbox.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@react.component
let make = (~isChecked, ~setIsChecked, ~list: PaymentMethodsRecord.list) => {
let make = (~isChecked, ~setIsChecked) => {
let {themeObj} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
let showFields = Recoil.useRecoilValueFromAtom(RecoilAtoms.showCardFieldsAtom)
let {business} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
Expand Down Expand Up @@ -44,25 +44,23 @@ let make = (~isChecked, ~setIsChecked, ~list: PaymentMethodsRecord.list) => {
setIsChecked(_ => value)
}
let {localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
let (checkboxState, checkedState, checkBoxLabelSate) = isChecked
let (checkboxState, checkedState, checkBoxLabelState) = isChecked
? ("Checkbox--checked", "CheckboxInput--checked", "CheckboxLabel--checked")
: ("", "", "")

let valueToBeRendered = if showFields {
let saveCardCheckboxLabel = if showFields {
localeString.saveCardDetails
} else if business.name !== "" {
localeString.cardTerms(business.name)
} else {
localeString.cardTerms(list.merchant_name)
localeString.cardTerms(business.name)
}

<div className={`Checkbox ${checkboxState} flex flex-row gap-2 items-center`}>
<style> {React.string(css)} </style>
<label className={`container CheckboxInput ${checkedState}`}>
<input type_={`checkbox`} onChange />
<div className={`checkmark CheckboxInput ${checkedState} mt-1`} />
<div className={`CheckboxLabel ${checkBoxLabelSate} ml-2 w-11/12`}>
{React.string(valueToBeRendered)}
<div className={`CheckboxLabel ${checkBoxLabelState} ml-2 w-11/12`}>
{React.string(saveCardCheckboxLabel)}
</div>
</label>
</div>
Expand Down
16 changes: 13 additions & 3 deletions src/Components/SavedMethods.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ let make = (
~loadSavedCards: PaymentType.savedCardsLoadState,
~cvcProps,
~paymentType,
~list: PaymentMethodsRecord.list,
~list,
) => {
open CardUtils
open Utils
open UtilityHooks

let {themeObj, localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
let (showFields, setShowFields) = Recoil.useRecoilState(RecoilAtoms.showCardFieldsAtom)
let areRequiredFieldsValid = Recoil.useRecoilValueFromAtom(RecoilAtoms.areRequiredFieldsValid)
Expand Down Expand Up @@ -226,7 +225,18 @@ let make = (
}}
<RenderIf condition={conditionsForShowingSaveCardCheckbox}>
<div className="pt-4 pb-2 flex items-center justify-start">
<SaveDetailsCheckbox isChecked=isSaveCardsChecked setIsChecked=setIsSaveCardsChecked list />
<SaveDetailsCheckbox isChecked=isSaveCardsChecked setIsChecked=setIsSaveCardsChecked />
</div>
</RenderIf>
<RenderIf condition={list.payment_type === SETUP_MANDATE}>
<div
className="opacity-50 text-xs mb-2 text-left"
style={ReactDOMStyle.make(
~color=themeObj.colorText,
~marginTop=themeObj.spacingGridColumn,
(),
)}>
<Terms mode={Card} />
</div>
</RenderIf>
<RenderIf condition={!showFields}>
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/UtilityHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ let useIsCustomerAcceptanceRequired = (
} else {
!(isGuestCustomer || list.payment_type === NORMAL)
}
}, (isSaveCardsChecked, list.payment_type))
}, (isSaveCardsChecked, list.payment_type, isGuestCustomer, displaySavedPaymentMethodsCheckbox))
15 changes: 12 additions & 3 deletions src/LoaderController.res
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
}
if dict->getDictIsSome("paymentMethodList") {
let list = dict->getJsonObjectFromDict("paymentMethodList")
let listDict = list->getDictFromJson
if optionsPayment.business.name === "" {
setOptionsPayment(prev => {
...prev,
business: {
name: listDict->getString("merchant_name", ""),
},
})
}
let finalLoadLatency = if launchTime <= 0.0 {
-1.0
} else {
Expand All @@ -370,11 +379,11 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
let updatedState: PaymentType.loadType =
list == Dict.make()->JSON.Encode.object
? LoadError(list)
: switch list->getDictFromJson->Dict.get("error") {
: switch listDict->Dict.get("error") {
| Some(_) => LoadError(list)
| None =>
let isNonEmptyPaymentMethodList =
list->getDictFromJson->getArray("payment_methods")->Array.length > 0
listDict->getArray("payment_methods")->Array.length > 0
isNonEmptyPaymentMethodList ? Loaded(list) : LoadError(list)
}

Expand Down Expand Up @@ -474,7 +483,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
}
}
handleMessage(handleFun, "Error in parsing sent Data")
}, (showCardFormByDefault, paymentMethodOrder))
}, (showCardFormByDefault, paymentMethodOrder, optionsPayment))

let observer = ResizeObserver.newResizerObserver(entries => {
entries
Expand Down
3 changes: 2 additions & 1 deletion src/PaymentElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ let make = (
React.useEffect(() => {
let evalMethodsList = () =>
switch methodslist {
| SemiLoaded | Loaded(_) => handlePostMessage([("ready", true->JSON.Encode.bool)])
| SemiLoaded | LoadError(_) | Loaded(_) =>
handlePostMessage([("ready", true->JSON.Encode.bool)])
| _ => ()
}
if !displaySavedPaymentMethods {
Expand Down
17 changes: 11 additions & 6 deletions src/Payments/CardPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ let make = (
let paymentMethod = isBancontact ? "bank_redirect" : "card"
let paymentMethodType = isBancontact ? "bancontact_card" : "debit"
let conditionsForShowingSaveCardCheckbox =
list.mandate_payment->Option.isNone &&
!isGuestCustomer &&
list.payment_type !== SETUP_MANDATE &&
options.displaySavedPaymentMethodsCheckbox &&
Expand Down Expand Up @@ -274,7 +275,7 @@ let make = (
<RenderIf condition={conditionsForShowingSaveCardCheckbox}>
<div className="pt-4 pb-2 flex items-center justify-start">
<SaveDetailsCheckbox
isChecked=isSaveCardsChecked setIsChecked=setIsSaveCardsChecked list
isChecked=isSaveCardsChecked setIsChecked=setIsSaveCardsChecked
/>
</div>
</RenderIf>
Expand All @@ -292,19 +293,23 @@ let make = (
/>
</RenderIf>
<RenderIf condition={!isBancontact}>
{switch (list.mandate_payment, options.terms.card) {
| (Some(_), Auto)
| (_, Always) =>
{switch (list.mandate_payment, options.terms.card, list.payment_type) {
| (Some(_), Auto, NEW_MANDATE)
| (Some(_), Auto, SETUP_MANDATE)
| (_, Always, NEW_MANDATE)
| (_, Always, SETUP_MANDATE)
| (_, _, SETUP_MANDATE)
| (_, _, NEW_MANDATE) =>
<div
className="opacity-50 text-xs mb-2 text-left"
style={ReactDOMStyle.make(
~color=themeObj.colorText,
~marginTop=themeObj.spacingGridColumn->addSize(10.0, Pixel),
~marginTop=themeObj.spacingGridColumn,
(),
)}>
<Terms mode={Card} />
</div>
| (_, _) => React.null
| (_, _, _) => React.null
}}
</RenderIf>
</div>
Expand Down
Loading

0 comments on commit b7d59d9

Please sign in to comment.