Skip to content

Commit

Permalink
Merge branch 'main' into disable-button-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja authored Mar 20, 2024
2 parents a0013f2 + 440b826 commit cea2818
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 143 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.33.10](https://github.com/juspay/hyperswitch-web/compare/v0.33.9...v0.33.10) (2024-03-20)


### Bug Fixes

* saved Payment Method stuck in loading state and Card Holder Name for every saved card ([#241](https://github.com/juspay/hyperswitch-web/issues/241)) ([6b1bc56](https://github.com/juspay/hyperswitch-web/commit/6b1bc565f659d163297453c6b6f5cc602bee6ff5))

## [0.33.9](https://github.com/juspay/hyperswitch-web/compare/v0.33.8...v0.33.9) (2024-03-19)

## [0.33.8](https://github.com/juspay/hyperswitch-web/compare/v0.33.7...v0.33.8) (2024-03-18)
Expand Down
179 changes: 58 additions & 121 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.33.9",
"version": "0.33.10",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions src/Components/DynamicFields.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let make = (
~paymentMethodType,
~setRequiredFieldsBody,
~isSavedCardFlow=false,
~savedCards=[]: array<PaymentType.customerMethods>,
~savedMethod=PaymentType.defaultCustomerMethods,
~cardProps=None,
~expiryProps=None,
~cvcProps=None,
Expand Down Expand Up @@ -46,8 +46,8 @@ let make = (
}, [requiredFieldsWithBillingDetails])

let isAllStoredCardsHaveName = React.useMemo1(() => {
PaymentType.getIsAllStoredCardsHaveName(savedCards)
}, [savedCards])
PaymentType.getIsStoredPaymentMethodHasName(savedMethod)
}, [savedMethod])

//<...>//
let fieldsArr = React.useMemo3(() => {
Expand Down
3 changes: 1 addition & 2 deletions src/Components/SavedCardItem.res
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let make = (
~cvcProps,
~paymentType,
~list,
~savedMethods,
~setRequiredFieldsBody,
) => {
let {themeObj, config} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
Expand Down Expand Up @@ -162,7 +161,7 @@ let make = (
paymentMethodType
setRequiredFieldsBody
isSavedCardFlow=true
savedCards=savedMethods
savedMethod=paymentItem
/>
<Surcharge
list
Expand Down
1 change: 0 additions & 1 deletion src/Components/SavedMethods.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ let make = (
cvcProps
paymentType
list
savedMethods
setRequiredFieldsBody
/>
})
Expand Down
5 changes: 0 additions & 5 deletions src/PaymentElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ let make = (
</ErrorBoundary>
}

React.useEffect(() => {
setShowFields(_ => !displaySavedPaymentMethods)
None
}, [displaySavedPaymentMethods])

let paymentLabel = if displaySavedPaymentMethods {
showFields
? optionAtomValue.paymentMethodsHeaderText
Expand Down
12 changes: 2 additions & 10 deletions src/Types/PaymentType.res
Original file line number Diff line number Diff line change
Expand Up @@ -974,14 +974,6 @@ let itemToObjMapper = (dict, logger) => {

type loadType = Loading | Loaded(JSON.t) | SemiLoaded | LoadError(JSON.t)

let getIsAllStoredCardsHaveName = (savedCards: array<customerMethods>) => {
savedCards
->Array.filter(savedCard => {
switch savedCard.card.cardHolderName {
| None
| Some("") => false
| _ => true
}
})
->Array.length === savedCards->Array.length
let getIsStoredPaymentMethodHasName = (savedMethod: customerMethods) => {
savedMethod.card.cardHolderName->Option.getOr("")->String.length > 0
}

0 comments on commit cea2818

Please sign in to comment.