Skip to content

Commit

Permalink
enhancement: show completion on integrateYourApp
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokesh Jain committed Dec 4, 2023
1 parent 1c6fe1f commit cb0af7b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let make = (
let (currentStep, setCurrentStep) = React.useState(_ => DownloadTestAPIKey)
let {setQuickStartPageState} = React.useContext(GlobalProvider.defaultContext)
let isLastStep = currentStep === DisplayPaymentConfirmation
let updateEnumInRecoil = EnumVariantHook.useUpdateEnumInRecoil()

let theme = switch ThemeProvider.useTheme() {
| Dark => "vs-dark"
Expand All @@ -40,6 +41,9 @@ let make = (
if isLastStep {
markAsDone()->ignore
} else {
let _res = updateEnumInRecoil([
(Boolean(true), currentStep->getPolyMorphicVariantOfIntegrationSubStep),
])
setCurrentStep(_ =>
getNavigationStepForStandardIntegration(~currentStep, ~forward=true, ())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,14 @@ let getNavigationStepForStandardIntegration = (
| DisplayPaymentConfirmation => forward ? DisplayPaymentConfirmation : DisplayCheckout
}
}

let getPolyMorphicVariantOfIntegrationSubStep: standardIntegrationSteps => QuickStartTypes.sectionHeadingVariant = (
currentStep: standardIntegrationSteps,
) => {
switch currentStep {
| DownloadTestAPIKey => #DownloadTestAPIKey
| CreatePayment => #CreatePayment
| DisplayCheckout => #DisplayCheckout
| DisplayPaymentConfirmation => #DisplayPaymentConfirmation
}
}
9 changes: 9 additions & 0 deletions src/screens/HyperSwitch/Home/QuickStart/QuickStartTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ type sectionHeadingVariant = [
| #TestPayment
| #IntegrationMethod
| #IntegrationCompleted
| #DownloadTestAPIKey
| #CreatePayment
| #DisplayCheckout
| #DisplayPaymentConfirmation
| #StripeConnected
| #PaypalConnected
| #SPRoutingConfigured
Expand Down Expand Up @@ -77,6 +81,10 @@ type responseType = {
testPayment: paymentType,
integrationMethod: integrationMethod,
integrationCompleted: bool,
downloadTestAPIKey: bool,
createPayment: bool,
displayCheckout: bool,
displayPaymentConfirmation: bool,
stripeConnected: processorType,
paypalConnected: processorType,
sPRoutingConfigured: routingType,
Expand All @@ -86,6 +94,7 @@ type responseType = {
setupWoocomWebhook: bool,
isMultipleConfiguration: bool,
}

type requestObjectType =
| ProcesorType(processorType)
| RoutingType(routingType)
Expand Down
27 changes: 23 additions & 4 deletions src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ let getTypedValueFromDict = valueString => {
->getDictfromDict(#IntegrationMethod->getStringFromVariant)
->getIntegrationType,
integrationCompleted: value->getBool(#IntegrationCompleted->getStringFromVariant, false),
downloadTestAPIKey: value->getBool(#DownloadTestAPIKey->getStringFromVariant, false),
createPayment: value->getBool(#CreatePayment->getStringFromVariant, false),
displayCheckout: value->getBool(#DisplayCheckout->getStringFromVariant, false),
displayPaymentConfirmation: value->getBool(
#DisplayPaymentConfirmation->getStringFromVariant,
false,
),
stripeConnected: value
->getDictfromDict(#StripeConnected->getStringFromVariant)
->getProcessorType,
Expand Down Expand Up @@ -317,19 +324,31 @@ let getSidebarOptionsForIntegrateYourApp: (
subOptions: [
{
title: "Download Test API Key",
status: COMPLETED,
status: Boolean(enumValue.downloadTestAPIKey)->getStatusValue(
#ConfiguredRouting,
currentPageStateEnum,
),
},
{
title: "Create a Payment",
status: PENDING,
status: Boolean(enumValue.createPayment)->getStatusValue(
#ConfiguredRouting,
currentPageStateEnum,
),
},
{
title: "Display Hyperswitch Checkout",
status: PENDING,
status: Boolean(enumValue.displayCheckout)->getStatusValue(
#ConfiguredRouting,
currentPageStateEnum,
),
},
{
title: "Display Payment Confirmation",
status: PENDING,
status: Boolean(enumValue.displayPaymentConfirmation)->getStatusValue(
#ConfiguredRouting,
currentPageStateEnum,
),
},
],
},
Expand Down

0 comments on commit cb0af7b

Please sign in to comment.