Skip to content

Commit

Permalink
Pull request #147: Removed country from card form
Browse files Browse the repository at this point in the history
Merge in EXC/orca-elements from praful/removed_Country_from_card to master

* commit 'd4a175129e017c6e97b15bdfb1a301a85fb5eb60':
  commented it out for future
  Removed country from card form
  • Loading branch information
prafulkoppalkar authored and arun.mishra committed Jul 25, 2023
2 parents 7ce3e65 + d4a1751 commit 1569f36
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 41 deletions.
13 changes: 2 additions & 11 deletions src/PaymentElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ let make = (
}
let checkoutEle = {
switch selectedOption->paymentMode {
| Card => <CardPayment cardProps expiryProps cvcProps countryProps paymentType list />
| Card => <CardPayment cardProps expiryProps cvcProps paymentType list />
| Klarna =>
<SessionPaymentWrapper type_=Others>
{switch tokenObj {
Expand Down Expand Up @@ -232,16 +232,7 @@ let make = (
| BacsBankDebit =>
<React.Suspense fallback={loader()}> <BacsBankDebitLazy paymentType /> </React.Suspense>
| BanContactCard =>
<CardPayment
cardProps
expiryProps
cvcProps
countryProps
paymentType
showSavedCard=false
isBancontact=true
list
/>
<CardPayment cardProps expiryProps cvcProps paymentType isBancontact=true list />
| BecsBankDebit =>
<React.Suspense fallback={loader()}> <BecsBankDebitLazy paymentType /> </React.Suspense>
| _ => <PaymentMethodsWrapperLazy paymentType list=newList paymentMethodName=selectedOption />
Expand Down
2 changes: 1 addition & 1 deletion src/Payments/ACHBankDebit.res
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module ToolTip = {
}

let default = (props: props) => {
let {themeObj, localeString, config} = Recoil.useRecoilValueFromAtom(configAtom)
let {themeObj, localeString} = Recoil.useRecoilValueFromAtom(configAtom)

let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom)

Expand Down
56 changes: 27 additions & 29 deletions src/Payments/CardPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ let make = (
~cardProps,
~expiryProps,
~cvcProps,
~countryProps,
~showSavedCard=true,
// ~countryProps,
// ~showSavedCard=true,
~isBancontact=false,
~paymentType: CardThemeType.mode,
~list: PaymentMethodListType.list,
Expand Down Expand Up @@ -54,11 +54,9 @@ let make = (
cvcError,
setCvcError,
) = cvcProps
let {customerPaymentMethods, defaultValues, fields} = Recoil.useRecoilValueFromAtom(
RecoilAtoms.optionAtom,
)
let (clientCountry, countryNames) = countryProps
let (country, setCountry) = React.useState(_ => clientCountry)
let {customerPaymentMethods} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
// let (clientCountry, countryNames) = countryProps
// let (country, setCountry) = React.useState(_ => clientCountry)
let intent = PaymentHelpers.usePaymentIntent(Some(loggerState), Card)
let (savedMethods, setSavedMethods) = React.useState(_ => [])
let (showFeilds, setShowFeilds) = Recoil.useRecoilState(RecoilAtoms.showCardFeildsAtom)
Expand All @@ -75,10 +73,10 @@ let make = (
postFailedSubmitResponse(~errortype="validation_error", ~message)
}

let showDetails = getShowAddressDetails(
~billingDetails=fields.billingDetails,
~logger=loggerState,
)
// let showDetails = getShowAddressDetails(
// ~billingDetails=fields.billingDetails,
// ~logger=loggerState,
// )
React.useEffect1(() => {
switch customerPaymentMethods {
| Some(promise) =>
Expand Down Expand Up @@ -155,13 +153,13 @@ let make = (
}
}

React.useEffect1(() => {
let countryName = defaultValues.billingDetails.address.country
countryNames->Js.Array2.includes(countryName) && countryName !== ""
? setCountry(_ => countryName)
: ()
None
}, [defaultValues])
// React.useEffect1(() => {
// let countryName = defaultValues.billingDetails.address.country
// countryNames->Js.Array2.includes(countryName) && countryName !== ""
// ? setCountry(_ => countryName)
// : ()
// None
// }, [defaultValues])

let submitCallback = React.useCallback((ev: Window.event) => {
let json = ev.data->Js.Json.parseExn
Expand Down Expand Up @@ -315,17 +313,17 @@ let make = (
<div className="py-2 flex items-center justify-start">
<AnimatedCheckbox isChecked=isSaveCardsChecked setIsChecked=setIsSaveCardsChecked />
</div>
<RenderIf condition={showDetails.country == Auto}>
<div style={ReactDOMStyle.make(~marginTop=themeObj.spacingGridColumn, ())}>
<DropdownField
appearance=config.appearance
fieldName=localeString.countryLabel
value=country
setValue=setCountry
options=countryNames
/>
</div>
</RenderIf>
// <RenderIf condition={showDetails.country == Auto}>
// <div style={ReactDOMStyle.make(~marginTop=themeObj.spacingGridColumn, ())}>
// <DropdownField
// appearance=config.appearance
// fieldName=localeString.countryLabel
// value=country
// setValue=setCountry
// options=countryNames
// />
// </div>
// </RenderIf>
</RenderIf>
<RenderIf condition={savedMethods->Js.Array2.length > 0 && !isBancontact}>
<div
Expand Down

0 comments on commit 1569f36

Please sign in to comment.