Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 committed Feb 29, 2024
2 parents a23810c + c08b70f commit 4ac154c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 27 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file. See [conven

- - -

## 2024.02.29.0

### Bug Fixes

- Clear recoil ([#461](https://github.com/juspay/hyperswitch-control-center/pull/461)) ([`8865a76`](https://github.com/juspay/hyperswitch-control-center/commit/8865a76b8ef9fb83ce63ff02bc557e4b56e6f0d1))
- Connector type change ([#462](https://github.com/juspay/hyperswitch-control-center/pull/462)) ([`c31de0f`](https://github.com/juspay/hyperswitch-control-center/commit/c31de0f25840e0e930eb80b658f89c564246c424))

### Refactors

- Business recoil value from string to typed ([#458](https://github.com/juspay/hyperswitch-control-center/pull/458)) ([`16655fb`](https://github.com/juspay/hyperswitch-control-center/commit/16655fbcd59fdf27f3e6c07c2cc49c9b3c99b8f1))

**Full Changelog:** [`2024.02.28.0...2024.02.29.0`](https://github.com/juspay/hyperswitch-control-center/compare/2024.02.28.0...2024.02.29.0)

- - -

## 2024.02.28.0

### Features
Expand Down
8 changes: 7 additions & 1 deletion src/screens/Connectors/ConnectorAccountDetails.res
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ let make = (~setCurrentStep, ~setInitialValues, ~initialValues, ~isUpdateFlow, ~

// TODO: Refactor for generic case
if !isUpdateFlow {
if connectorTypeFromName === Processors(PAYPAL) && featureFlagDetails.paypalAutomaticFlow {
if (
switch connectorTypeFromName {
| Processors(PAYPAL) => true
| _ => false
} &&
featureFlagDetails.paypalAutomaticFlow
) {
initialValuesToDict->Dict.set(
"connector_label",
initialValues
Expand Down
12 changes: 9 additions & 3 deletions src/screens/Connectors/ConnectorAccountDetailsHelper.res
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ module ConnectorConfigurationFields = {
~connectorLabelDetailField,
) => {
<div className="flex flex-col">
{if connector === Processors(CASHTOCODE) {
{switch connector {
| Processors(CASHTOCODE) =>
<CashToCodeMethods connectorAccountFields connector selectedConnector />
} else {

| _ =>
<RenderConnectorInputFields
details={connectorAccountFields}
name={"connector_account_details"}
Expand Down Expand Up @@ -509,7 +511,11 @@ module ConnectorHeaderWrapper = {
{headerButton}
</div>
</div>
<UIUtils.RenderIf condition={connectorNameFromType === Processors(BRAINTREE)}>
<UIUtils.RenderIf
condition={switch connectorNameFromType {
| Processors(BRAINTREE) => true
| _ => false
}}>
<div className="flex flex-col gap-2 p-2 md:p-10">
<h1
className="flex items-center mx-12 leading-6 text-orange-950 bg-orange-100 border w-fit p-2 rounded-md ">
Expand Down
18 changes: 14 additions & 4 deletions src/screens/Connectors/ConnectorUIUtils/PaymentMethod.res
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ module CardRenderer = {
let methodVariant = method.payment_method_type->getPaymentMethodTypeFromString
if (
(methodVariant === GooglePay || methodVariant === ApplePay) &&
(connector->getConnectorNameTypeFromString() !== Processors(TRUSTPAY) &&
connector->getConnectorNameTypeFromString() !== Processors(AIRWALLEX) &&
connector->getConnectorNameTypeFromString() !== Processors(STRIPE_TEST))
{
switch connector->getConnectorNameTypeFromString() {
| Processors(TRUSTPAY) => false
| Processors(AIRWALLEX) => false
| Processors(STRIPE_TEST) => false
| _ => true
}
}
) {
setShowWalletConfigurationModal(_ => !showWalletConfigurationModal)
setSelectedWallet(_ => method)
Expand Down Expand Up @@ -140,7 +145,12 @@ module CardRenderer = {
</div>
<RenderIf
condition={paymentMethod->getPaymentMethodFromString === Wallet &&
connector->getConnectorNameTypeFromString() === Processors(ZEN)}>
{
switch connector->getConnectorNameTypeFromString() {
| Processors(ZEN) => true
| _ => false
}
}}>
<div className="border rounded p-2 bg-jp-gray-100 flex gap-4">
<Icon name="outage_icon" size=15 />
{"Zen doesn't support Googlepay and Applepay in sandbox."->React.string}
Expand Down
30 changes: 16 additions & 14 deletions src/screens/Connectors/ConnectorUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -855,26 +855,28 @@ let validateConnectorRequiredFields = (
) => {
open LogicUtils
let newDict = getDictFromJsonObject(errors)
if connector === Processors(CASHTOCODE) {
let dict = connectorAccountFields->getAuthKeyMapFromConnectorAccountFields
switch connector {
| Processors(CASHTOCODE) => {
let dict = connectorAccountFields->getAuthKeyMapFromConnectorAccountFields

let indexLength = dict->Dict.keysToArray->Array.length
let vector = Js.Vector.make(indexLength, false)
let indexLength = dict->Dict.keysToArray->Array.length
let vector = Js.Vector.make(indexLength, false)

dict
->Dict.keysToArray
->Array.forEachWithIndex((country, index) => {
let res = checkCashtoCodeInnerField(valuesFlattenJson, dict, country)
dict
->Dict.keysToArray
->Array.forEachWithIndex((country, index) => {
let res = checkCashtoCodeInnerField(valuesFlattenJson, dict, country)

vector->Js.Vector.set(index, res)
})
vector->Js.Vector.set(index, res)
})

let _ = Js.Vector.filterInPlace((. val) => val == true, vector)
let _ = Js.Vector.filterInPlace((. val) => val == true, vector)

if vector->Js.Vector.length === 0 {
Dict.set(newDict, "Currency", `Please enter currency`->JSON.Encode.string)
if vector->Js.Vector.length === 0 {
Dict.set(newDict, "Currency", `Please enter currency`->JSON.Encode.string)
}
}
} else {
| _ =>
connectorAccountFields
->Dict.keysToArray
->Array.forEach(value => {
Expand Down
1 change: 0 additions & 1 deletion src/screens/Sidebar/Sidebar.res
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ module SidebarItem = {

let tabLinklement = switch tabInfo {
| Link(tabOption) => {
Js.log("options")
let {name, icon, link, access} = tabOption
let redirectionLink = `${link}${getSearchParamByLink(link)}`
<RenderIf condition={access !== NoAccess}>
Expand Down
11 changes: 7 additions & 4 deletions src/screens/StripePlusPaypal/StripePlusPaypalUIUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ module SelectPaymentMethods = {
enumRecoilUpdateArr->Array.push((body, #SecondProcessorConnected))
}

if selectedConnector === Processors(STRIPE) {
enumRecoilUpdateArr->Array.push((body, #StripeConnected))
} else if selectedConnector === Processors(PAYPAL) {
enumRecoilUpdateArr->Array.push((body, #PaypalConnected))
{
switch selectedConnector {
| Processors(STRIPE) => enumRecoilUpdateArr->Array.push((body, #StripeConnected))
| Processors(PAYPAL) => enumRecoilUpdateArr->Array.push((body, #PaypalConnected))
| _ => ()
}
}

let _ = updateEnumInRecoil(enumRecoilUpdateArr)
} catch {
| _ => setButtonState(_ => Button.Normal)
Expand Down

0 comments on commit 4ac154c

Please sign in to comment.