diff --git a/src/components/Paginator.res b/src/components/Paginator.res index 6c3c77a0c..55148c49b 100644 --- a/src/components/Paginator.res +++ b/src/components/Paginator.res @@ -67,12 +67,10 @@ let make = ( setOffset(_ => newOffset) }, (setOffset, resultsPerPage, currrentFetchCount, url.search, totalResults)) - let borderClass = !isMobileView ? "border-b border-x border-jp-2-light-gray-300 rounded-b-lg" : "" let marginClass = "mt-4 md:mr-0" if totalResults >= resultsPerPage { -
+
{ onClick={_ => updateTestPaymentEnum(~paymentId="pay_default")->ignore} />}> SDKPaymentUtils.initialValueForForm} + initialValues={activeBusinessProfile->SDKPaymentUtils.initialValueForForm} returnUrl={`${HSwitchGlobalVars.hyperSwitchFEPrefix}/quick-start`} onProceed={updateTestPaymentEnum} keyValue=key diff --git a/src/screens/HyperSwitch/Routing/RoutingTypes.res b/src/screens/HyperSwitch/Routing/RoutingTypes.res index 0dbfcebc6..bd0b6c90d 100644 --- a/src/screens/HyperSwitch/Routing/RoutingTypes.res +++ b/src/screens/HyperSwitch/Routing/RoutingTypes.res @@ -20,8 +20,9 @@ type operator = | EQUAL_TO | CONTAINS | NOT_CONTAINS + | NOT_EQUAL_TO | UnknownOperator(string) -type variantType = Number | Enum_variant | Metadata_value | UnknownVariant(string) +type variantType = Number | Enum_variant | Metadata_value | String_value | UnknownVariant(string) type logicalOperator = AND | OR | UnknownLogicalOperator(string) type val = StringArray(array) | String(string) | Int(int) type logic = { diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index 71e4c8dca..079bfea39 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -38,6 +38,7 @@ let operatorMapper = value => { | "GREATER THAN" => GREATER_THAN | "LESS THAN" => LESS_THAN | "EQUAL TO" => EQUAL_TO + | "NOT EQUAL_TO" => NOT_EQUAL_TO | _ => UnknownOperator("") } } @@ -47,6 +48,7 @@ let variantTypeMapper = variantType => { | "number" => Number | "enum_variant" => Enum_variant | "metadata_value" => Metadata_value + | "str_value" => String_value | _ => UnknownVariant("") } } @@ -99,6 +101,7 @@ let operatorTypeToStringMapper = operator => { | GREATER_THAN => "GREATER THAN" | LESS_THAN => "LESS THAN" | EQUAL_TO => "EQUAL TO" + | NOT_EQUAL_TO => "NOT EQUAL_TO" | UnknownOperator(str) => str } } @@ -210,6 +213,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => { | EQUAL_TO => "equal" | GREATER_THAN => "greater_than" | LESS_THAN => "less_than" + | NOT_EQUAL_TO => "not_equal" | UnknownOperator(str) => str }, value: { @@ -224,6 +228,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => { | _ => "" } | Metadata_value => "metadata_variant" + | String_value => "str_value" | _ => "" }->Js.Json.string, "value": switch variantType->variantTypeMapper { @@ -243,6 +248,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => { let value = dict->getString("value", "")->Js.String2.trim->Js.Json.string Js.Dict.fromArray([("key", key), ("value", value)])->Js.Json.object_ } + | String_value => dict->getString("value", "")->Js.Json.string | _ => ""->Js.Json.string }, }, diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res index 989d2cca4..cccabcc27 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res @@ -598,7 +598,8 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { | EQUAL_TO | CONTAINS => "equal" | IS_NOT - | NOT_CONTAINS => "not_equal" + | NOT_CONTAINS + | NOT_EQUAL_TO => "not_equal" | GREATER_THAN => "greater_than" | LESS_THAN => "less_than" | UnknownOperator(str) => str diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingTypes.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingTypes.res index f3eeccb4d..f01a7ba21 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingTypes.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingTypes.res @@ -1,5 +1,5 @@ type routing = SINGLE | PRIORITY | VOLUME_SPLIT | ADVANCED | COST | DEFAULTFALLBACK | NO_ROUTING -type variantType = Number | Enum_variant | Metadata_value | UnknownVariant(string) +type variantType = Number | Enum_variant | Metadata_value | String_value | UnknownVariant(string) type pageState = Preview | Create | Edit type formState = CreateConfig | EditConfig | EditReplica | ViewConfig @@ -11,6 +11,7 @@ type operator = | EQUAL_TO | CONTAINS | NOT_CONTAINS + | NOT_EQUAL_TO | UnknownOperator(string) type connector = { diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index 973503edd..48c1b2341 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -67,6 +67,7 @@ module OperatorInp = { | Enum_variant => ["IS", "CONTAINS", "IS_NOT", "NOT_CONTAINS"] | Number => ["EQUAL TO", "GREATER THAN", "LESS THAN"] | Metadata_value => ["EQUAL TO"] + | String_value => ["EQUAL TO", "NOT EQUAL_TO"] | _ => [] } @@ -128,6 +129,8 @@ module ValueInp = { typeField.onChange( if keyType->variantTypeMapper === Metadata_value { "metadata_variant" + } else if keyType->variantTypeMapper === String_value { + "str_value" } else { switch opField.value->LogicUtils.getStringFromJson("")->operatorMapper { | IS @@ -174,8 +177,15 @@ module ValueInp = { fixedDropDownDirection=SelectBox.TopRight /> } + | EQUAL_TO => + switch keyType->variantTypeMapper { + | String_value => + | _ => + } + + | NOT_EQUAL_TO => + | LESS_THAN | GREATER_THAN => - | EQUAL_TO | LESS_THAN | GREATER_THAN => | _ => React.null } } diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res index db57622f2..92451c08c 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res @@ -27,6 +27,7 @@ let operatorMapper: string => AdvancedRoutingTypes.operator = value => { | "GREATER THAN" => GREATER_THAN | "LESS THAN" => LESS_THAN | "EQUAL TO" => EQUAL_TO + | "NOT EQUAL_TO" => NOT_EQUAL_TO | _ => UnknownOperator("") } } @@ -91,6 +92,7 @@ let variantTypeMapper: string => AdvancedRoutingTypes.variantType = variantType | "number" => Number | "enum_variant" => Enum_variant | "metadata_value" => Metadata_value + | "str_value" => String_value | _ => UnknownVariant("") } } @@ -228,12 +230,14 @@ let getOperatorFromComparisonType = (comparison, variantType) => { switch variantType { | "enum_variant" => "IS" | "enum_variant_array" => "CONTAINS" + | "str_value" => "EQUAL_TO" | _ => "IS" } | "not_equal" => switch variantType { | "enum_variant_array" => "NOT_CONTAINS" | "enum_variant" => "IS_NOT" + | "str_value" => "NOT EQUAL_TO" | _ => "IS_NOT" } | "greater_than" => "GREATER_THAN" diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPage.res b/src/screens/HyperSwitch/SDKPayment/SDKPage.res index 790c37925..101429608 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPage.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPage.res @@ -1,10 +1,10 @@ let h3Leading2Style = HSwitchUtils.getTextClass(~textVariant=H3, ~h3TextVariant=Leading_2, ()) external toJson: 'a => Js.Json.t = "%identity" -module SDKConfifiguarationFields = { +module SDKConfiguarationFields = { open HSwitchMerchantAccountUtils @react.component - let make = () => { + let make = (~initialValues: SDKPaymentTypes.paymentType) => { let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) let arrayOfBusinessProfile = businessProfiles->getArrayOfBusinessProfile let disableSelectionForProfile = arrayOfBusinessProfile->HomeUtils.isDefaultBusinessProfile @@ -70,7 +70,9 @@ module SDKConfifiguarationFields = { - + Js.String2.length > 0)} + /> } } @@ -86,7 +88,7 @@ let make = () => { let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) let defaultBusinessProfile = businessProfiles->getValueFromBusinessProfile let (initialValues, setInitialValues) = React.useState(_ => - defaultBusinessProfile.profile_id->SDKPaymentUtils.initialValueForForm + defaultBusinessProfile->SDKPaymentUtils.initialValueForForm ) React.useEffect1(() => { let paymentIntentOptional = filtersFromUrl->Js.Dict.get("payment_intent_client_secret") @@ -96,6 +98,11 @@ let make = () => { None }, [filtersFromUrl]) + React.useEffect1(() => { + setInitialValues(_ => defaultBusinessProfile->SDKPaymentUtils.initialValueForForm) + None + }, [defaultBusinessProfile.profile_id->Js.String2.length]) + let onProceed = async (~paymentId as _) => { let paymentId = filtersFromUrl @@ -138,7 +145,7 @@ let make = () => { initialValues={initialValues->toJson} formClass="grid grid-cols-2 gap-x-8 gap-y-4" onSubmit> - +
diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res b/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res index 546b37b09..42146dfe9 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res @@ -3,4 +3,5 @@ type paymentType = { currency: string, profile_id: string, customer_id: string, + description: string, } diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res b/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res index 14184cbdc..1680b7392 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res @@ -1,8 +1,11 @@ -let initialValueForForm: string => SDKPaymentTypes.paymentType = profileId => { - amount: 100, - currency: "United States-USD", - profile_id: profileId, - customer_id: "hyperswitch_sdk_demo_id", +let initialValueForForm: HSwitchSettingTypes.profileEntity => SDKPaymentTypes.paymentType = defaultBusinessProfile => { + { + amount: 100, + currency: "United States-USD", + profile_id: defaultBusinessProfile.profile_id, + description: "Default value", + customer_id: "hyperswitch_sdk_demo_id", + } } let getTypedValueForPayment: Js.Json.t => SDKPaymentTypes.paymentType = values => { @@ -13,6 +16,7 @@ let getTypedValueForPayment: Js.Json.t => SDKPaymentTypes.paymentType = values = currency: dictOfValues->getString("currency", "United States-USD"), profile_id: dictOfValues->getString("profile_id", ""), customer_id: dictOfValues->getString("customer_id", ""), + description: dictOfValues->getString("description", "Default value"), } } diff --git a/src/screens/HyperSwitch/SDKPayment/TestPayment.res b/src/screens/HyperSwitch/SDKPayment/TestPayment.res index b10d705ca..0c5b7fd42 100644 --- a/src/screens/HyperSwitch/SDKPayment/TestPayment.res +++ b/src/screens/HyperSwitch/SDKPayment/TestPayment.res @@ -1,3 +1,4 @@ +external toJson: 'a => Js.Json.t = "%identity" let headerTextStyle = "text-xl font-semibold text-grey-700" let subTextStyle = "text-base font-normal text-grey-700 opacity-50" let dividerColor = "bg-grey-700 bg-opacity-20 h-px w-full" @@ -46,6 +47,7 @@ let make = ( ), ("profile_id", initialValues.profile_id->Js.Json.string), ("customer_id", "hyperswitch_sdk_demo_id"->Js.Json.string), + ("description", initialValues.description->Js.Json.string), ])->Js.Json.object_ let response = await updateDetails(url, body, Post) let clientSecret = response->getDictFromJsonObject->getOptionString("client_secret") diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res index f91d6c9ed..99a79cc1a 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res @@ -173,7 +173,7 @@ module TestPayment = { }} />}> SDKPaymentUtils.initialValueForForm} + initialValues={defaultBusinessProfile->SDKPaymentUtils.initialValueForForm} returnUrl={`${HSwitchGlobalVars.hyperSwitchFEPrefix}/stripe-plus-paypal`} onProceed={sptestPaymentProceed} keyValue={key} diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res index b410f0949..a706cb5f0 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res @@ -238,9 +238,8 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, className={`flex flex-col justify-evenly gap-5 h-full w-full !overflow-visible text-grey-600`}> {switch authType { | LoginWithPassword => + | ForgetPassword => forgetPassword ? : React.null | LoginWithEmail - | ForgetPassword => - forgetPassword ? : React.null | ResendVerifyEmail | SignUP => isMagicLinkEnabled ? :