Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Recon screens #2052

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
ecd12d0
feat: Recon Configuration Setup
susrithasabbini Dec 27, 2024
eefe204
feat: Recon Configuration Setup
susrithasabbini Dec 27, 2024
595400d
chore: Removed comments
susrithasabbini Dec 27, 2024
31ae6e3
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 8, 2025
eeffc48
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 8, 2025
6123760
feat: Recon Configuration Setup
susrithasabbini Jan 9, 2025
3e6bb94
feat: Recon Configuration Setup
susrithasabbini Jan 9, 2025
d512811
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 9, 2025
f2fc35a
Merge branch 'recon-order-data-screen' of github.com:juspay/hyperswit…
JeevaRamu0104 Jan 9, 2025
2852648
chore: Reconciliation Configurations
susrithasabbini Jan 9, 2025
2a7be42
chore: Changed Dimensions according to figma
susrithasabbini Jan 9, 2025
8609cf1
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 9, 2025
51ec61e
chore: Overflow of footer modified
susrithasabbini Jan 9, 2025
763ee06
chore: Configurations and APIs
susrithasabbini Jan 10, 2025
0d80191
Merge branch 'recon-order-data-screen' of github.com:juspay/hyperswit…
JeevaRamu0104 Jan 10, 2025
070b5af
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 10, 2025
e61e0a6
chore: update build script
JeevaRamu0104 Jan 10, 2025
8565587
chore: update build script
JeevaRamu0104 Jan 10, 2025
d577570
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 12, 2025
ebdceee
chore: Added file input to the order data api connection
susrithasabbini Jan 12, 2025
112dba1
chore: Removed duplicate recon v2 product feature
susrithasabbini Jan 12, 2025
f2ce181
chore: Added APIs for BASE and PSP files
susrithasabbini Jan 13, 2025
273940f
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 13, 2025
bf55b34
Merge branch 'recon-order-data-screen' of github.com:juspay/hyperswit…
JeevaRamu0104 Jan 13, 2025
03d7411
chore: update recon
JeevaRamu0104 Jan 13, 2025
fdc36a8
Merge branch 'recon-order-data-screen' of github.com:juspay/hyperswit…
JeevaRamu0104 Jan 13, 2025
efef2e5
chore: Added Approve Base and PSP config APIs
susrithasabbini Jan 13, 2025
a34ab7b
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 15, 2025
8231233
chore: Changed date in request
susrithasabbini Jan 15, 2025
414b283
feat: Added Reports Page
susrithasabbini Jan 15, 2025
1913354
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 15, 2025
069dd23
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 16, 2025
4f9e974
chore: UI enhancements
susrithasabbini Jan 16, 2025
236dc1a
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 16, 2025
f9883b5
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 16, 2025
2c9762b
chore: Onboarding page changes according to figma
susrithasabbini Jan 16, 2025
3a30f00
Merge branch 'recon-order-data-screen' of github.com:juspay/hyperswit…
JeevaRamu0104 Jan 17, 2025
880ab6c
chore: update recon
JeevaRamu0104 Jan 17, 2025
dcb0de3
Merge branch 'main' into recon-order-data-screen
susrithasabbini Jan 20, 2025
a11cd45
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 20, 2025
b192e60
chore: Formatted
susrithasabbini Jan 20, 2025
9d07204
Merge branch 'recon-order-data-screen' of https://github.com/juspay/h…
susrithasabbini Jan 20, 2025
cf5e7cd
chore: Analyltics for PAYU
susrithasabbini Jan 21, 2025
d18eb14
chore: Analyltics for PAYU
susrithasabbini Jan 21, 2025
d778021
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 21, 2025
3d0da7e
chore: Added formatters for the analytics cards
susrithasabbini Jan 21, 2025
a795132
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 21, 2025
c292ba9
Merge branch 'main' into recon-order-data-screen
susrithasabbini Jan 21, 2025
ff6c032
feat: Added BarGraph for Recon Success Rate
susrithasabbini Jan 22, 2025
2f1eaf5
fix: Added transformation before uploading the data files
susrithasabbini Jan 22, 2025
2d18109
Merge branch 'main' into recon-order-data-screen
susrithasabbini Jan 23, 2025
118f692
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 27, 2025
eac3b25
Merge branch 'recon-order-data-screen' of https://github.com/juspay/h…
susrithasabbini Jan 27, 2025
3efb26e
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 28, 2025
ab89f48
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 28, 2025
57d5533
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 29, 2025
dd396fe
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 29, 2025
ac6ed5d
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 29, 2025
ac23e51
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 29, 2025
4f078e8
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 30, 2025
4b4c0d1
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 30, 2025
6785500
feat: New Recon design
susrithasabbini Jan 30, 2025
02efe48
feat: New Recon design
susrithasabbini Jan 30, 2025
5890231
fix: Solid icons for recon
susrithasabbini Jan 30, 2025
713d176
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Jan 31, 2025
40f9b02
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Feb 1, 2025
e708466
feat: Added date range selection for recon reports and analytics
susrithasabbini Feb 1, 2025
9003939
feat: Added Recon History Page and OMS
susrithasabbini Feb 2, 2025
a405147
chore: Changed the side bar naming
susrithasabbini Feb 3, 2025
4a50e8d
chore: Handled error cases
susrithasabbini Feb 3, 2025
9811fb4
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Feb 3, 2025
c06696a
Merge branch 'main' of https://github.com/juspay/hyperswitch-control-…
susrithasabbini Feb 5, 2025
917cb9f
refactor: Used Vertical Step Indicator from fragments
susrithasabbini Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ primary_color="#006DF9"
primary_hover_color="#005ED6"
sidebar_color="#242F48"
[default.endpoints]
api_url="http://localhost:9000/api"
api_url="http://localhost:8000/api"
sdk_url="http://localhost:9050/HyperLoader.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this 9050 port number also need to point to local host port number right ??

logo_url=""
favicon_url=""
Expand All @@ -16,14 +16,14 @@ dss_certificate_url=""
[default.features]
test_live_toggle=false
is_live_mode=false
email=false
email=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it be false by default

quick_start=false
audit_trail=false
system_metrics=false
sample_data=false
frm=false
payout=true
recon=false
recon=true
test_processors=true
feedback=false
mixpanel=false
Expand Down Expand Up @@ -55,7 +55,7 @@ force_cookies=false
x_feature_route=false
tenant_user=false
dev_click_to_pay=false
dev_recon_v2_product=false
dev_recon_v2_product=true
maintainence_alert=""
[default.merchant_config]
[default.merchant_config.new_analytics]
Expand Down
4 changes: 4 additions & 0 deletions src/components/InputFields.res
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ let textTagInput = (
/>
}

let fileInput = () => (~input: ReactFinalForm.fieldRenderPropsInput) => {
<MultipleFileUpload input />
}

let numericTextInput = (
~isDisabled=false,
~customStyle="",
Expand Down
3 changes: 3 additions & 0 deletions src/components/InputFields.resi
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ let multiLineTextInput: (
~leftIcon: React.element=?,
~maxLength: int=?,
) => (~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder: string) => React.element

let fileInput: unit => (~input: ReactFinalForm.fieldRenderPropsInput) => React.element

let iconFieldWithMessageDes: (
(~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder: 'a) => React.element,
~description: string=?,
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadedTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ let make = (
: tableDataBackgroundClass}`}>
paginationUI
{
let topBottomActions = if bottomActions->Option.isSome{
let topBottomActions = if bottomActions->Option.isSome {
bottomActions
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion src/components/MultipleFileUpload.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open LogicUtils
@react.component
let make = (
~input: ReactFinalForm.fieldRenderPropsInput,
~fileType=".pdf",
~fileType=".csv,.pdf",
~fileNamesInput: option<ReactFinalForm.fieldRenderPropsInput>=?,
~isDisabled=false,
~shouldParse=true,
Expand Down
1 change: 1 addition & 0 deletions src/entryPoints/HSReconApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let make = () => {
| list{"v2", "recon", "configuration"} => <ReconConfigurationContainer />
| list{"v2", "recon", "home"} => <ReconHomeContainer />
| list{"v2", "recon", "analytics"} => <ReconAnalyticsContainer />
| list{"v2", "recon", "reports"} => <ReconReportsContainer />
| _ => React.null
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/entryPoints/HSReconSidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ let reconAnalytics = {
searchOptions: [("Recon analytics", "")],
})
}
let reconReports = {
SubLevelLink({
name: "Reports",
link: `v2/recon/reports`,
access: Access,
searchOptions: [("Recon reports", "")],
})
}

let recon = () => {
let links = [reconOnBoarding, reconAnalytics]
let links = [reconOnBoarding, reconAnalytics, reconReports]
Section({
name: "Recon And Settlement",
icon: "v2/recon",
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/AuthHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ let getHeaders = (
| Some(str) => {
headers->Dict.set("authorization", `Bearer ${str}`)
headers->Dict.set("api-key", `hyperswitch`)
// Need to be removed later
headers->Dict.set("secret-key", str)
headers->Dict.set("client-id", "DASHBOARD")
}
| None => ()
}
Expand Down
4 changes: 4 additions & 0 deletions src/reconContainer/ReconReportsContainer.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@react.component
let make = () => {
<ReconReports />
}
Original file line number Diff line number Diff line change
@@ -1,79 +1,187 @@
open HSwitchUtils
let p1RegularText = getTextClass((P1, Regular))

module SelectSource = {
@react.component
let make = (~currentStep, ~setCurrentStep) => {
open ConnectOrderDataUtils
open ConnectOrderDataTypes

open ReconConfigurationUtils
open TempAPIUtils
let stepConfig = useStepConfig(~step=currentStep->getSubsectionFromStep)
let (selectedStep, setSelectedStep) = React.useState(_ => Hyperswitch)
<div className="flex flex-col h-full">
<div className="flex flex-col gap-3 flex-grow p-2 md:p-7">
<p className="text-medium text-grey-800 font-semibold mb-5">
{"Select your order data source"->React.string}
</p>
<div className="flex flex-col gap-4">
{orderDataStepsArr
->Array.map(step => {
let stepName = step->getSelectedStepName
let description = step->getSelectedStepDescription
let isSelected = selectedStep === step
<ReconConfigurationHelper.StepCard
key={stepName}
stepName={stepName}
description={description}
isSelected={isSelected}
iconName={step->getIconName}
onClick={_ => setSelectedStep(_ => step)}
/>
})
->React.array}
let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success)

let onSubmit = async () => {
try {
setScreenState(_ => PageLoaderWrapper.Loading)
let _ = await stepConfig()
setCurrentStep(prev => getNextStep(prev))
} catch {
| Exn.Error(e) =>
let err = Exn.message(e)->Option.getOr("Failed to Fetch!")
setScreenState(_ => PageLoaderWrapper.Error(err))
}
}

<PageLoaderWrapper screenState={screenState}>
<div className="flex flex-col h-full">
<div className="flex flex-col gap-3 flex-grow p-2 md:p-7">
<p className="text-medium text-grey-800 font-semibold mb-5">
{"Select your order data source"->React.string}
</p>
<div className="flex flex-col gap-4">
{orderDataStepsArr
->Array.map(step => {
let stepName = step->getSelectedStepName
let description = step->getSelectedStepDescription
let isSelected = selectedStep === step
<ReconConfigurationHelper.StepCard
key={stepName}
stepName={stepName}
description={description}
isSelected={isSelected}
iconName={step->getIconName}
onClick={_ => setSelectedStep(_ => step)}
/>
})
->React.array}
</div>
</div>
<div className="flex justify-end items-center border-t">
<ReconConfigurationHelper.Footer
currentStep={currentStep} buttonName="Continue" onSubmit={_ => onSubmit()->ignore}
/>
</div>
</div>
<div className="flex justify-end items-center border-t">
<ReconConfigurationHelper.Footer
currentStep={currentStep} setCurrentStep={setCurrentStep} buttonName="Continue"
/>
</div>
</div>
</PageLoaderWrapper>
}
}

module SetupAPIConnection = {
@react.component
let make = (~currentStep, ~setCurrentStep) => {
<div className="flex flex-col h-full">
<div className="flex flex-col gap-4 flex-grow p-2 md:p-7">
<p className="text-medium text-grey-800 font-semibold mb-5">
{"Setup Your API Connection"->React.string}
</p>
<div className="flex gap-6">
<FormRenderer.FieldRenderer
field={FormRenderer.makeFieldInfo(
~label="Endpoint URL",
~name="endPointURL",
~placeholder="https://",
~isRequired=true,
~customInput=InputFields.textInput(~customWidth="w-18-rem"),
)}
/>
<FormRenderer.FieldRenderer
field={FormRenderer.makeFieldInfo(
~label="Auth Key",
~name="authKey",
~placeholder="***********",
~isRequired=true,
~customInput=InputFields.textInput(~customWidth="w-18-rem"),
)}
open ReconConfigurationUtils
open LogicUtils
open TempAPIUtils

let (fileUploadedDict, setFileUploadedDict) = React.useState(_ => Dict.make())
let uploadEvidenceType = "Basefile"->String.toLowerCase->titleToSnake
let showToast = ToastState.useShowToast()
let stepConfig = useStepConfig(~step=currentStep->getSubsectionFromStep, ~fileUploadedDict)
let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success)

let toast = (message, toastType) => {
showToast(~message, ~toastType)
}

let onSubmit = async () => {
if fileUploadedDict->Dict.get(uploadEvidenceType)->Option.isNone {
toast("Please upload a file", ToastError)
} else {
try {
setScreenState(_ => PageLoaderWrapper.Loading)
let _ = await stepConfig()
setCurrentStep(prev => getNextStep(prev))
} catch {
| Exn.Error(e) =>
let err = Exn.message(e)->Option.getOr("Failed to Fetch!")
setScreenState(_ => PageLoaderWrapper.Error(err))
}
}
}

let handleBrowseChange = (event, uploadEvidenceType) => {
let target = ReactEvent.Form.target(event)
let fileDict =
[
("uploadedFile", target["files"]["0"]->Identity.genericTypeToJson),
("fileName", target["files"]["0"]["name"]->JSON.Encode.string),
]->getJsonFromArrayOfJson

setFileUploadedDict(prev => {
let arr = prev->Dict.toArray
let newDict = [(uploadEvidenceType, fileDict)]->Array.concat(arr)->Dict.fromArray
newDict
})
}
<PageLoaderWrapper screenState={screenState}>
<div className="flex flex-col h-full">
<div className="flex flex-col gap-4 flex-grow p-2 md:p-7">
<p className="text-medium text-grey-800 font-semibold mb-5">
{"Setup Your API Connection"->React.string}
</p>
<div className="flex items-center">
{if fileUploadedDict->Dict.get(uploadEvidenceType)->Option.isNone {
<label>
<p className="cursor-pointer text-gray-500">
<div className="flex gap-2 border border-gray-500 rounded-lg p-2 items-center">
<Icon name="plus" size=14 />
<p> {"Upload base file"->React.string} </p>
</div>
<input
type_="file"
accept=".csv"
onChange={ev => ev->handleBrowseChange(uploadEvidenceType)}
required=true
hidden=true
/>
</p>
</label>
} else {
let fileName =
fileUploadedDict->getDictfromDict(uploadEvidenceType)->getString("fileName", "")
let truncatedFileName = truncateFileNameWithEllipses(~fileName, ~maxTextLength=10)

<div className="flex gap-4 items-center ">
<p className={`${p1RegularText} text-grey-700`}>
{truncatedFileName->React.string}
</p>
<Icon
name="cross-skeleton"
className="cursor-pointer"
size=12
onClick={_ => {
setFileUploadedDict(prev => {
let prevCopy = prev->Dict.copy
prevCopy->Dict.delete(uploadEvidenceType)
prevCopy
})
}}
/>
</div>
}}
</div>
<div className="flex gap-6">
<FormRenderer.FieldRenderer
field={FormRenderer.makeFieldInfo(
~label="Endpoint URL",
~name="endPointURL",
~placeholder="https://",
~isRequired=true,
~customInput=InputFields.textInput(~customWidth="w-18-rem"),
)}
/>
<FormRenderer.FieldRenderer
field={FormRenderer.makeFieldInfo(
~label="Auth Key",
~name="authKey",
~placeholder="***********",
~isRequired=true,
~customInput=InputFields.textInput(~customWidth="w-18-rem"),
)}
/>
</div>
<h1 className="text-sm font-medium text-blue-500 mt-2 px-1.5">
{"Learn where to find these values ->"->React.string}
</h1>
</div>
<div className="flex justify-end items-center border-t">
<ReconConfigurationHelper.Footer
currentStep={currentStep} buttonName="Validate" onSubmit={_ => onSubmit()->ignore}
/>
</div>
<h1 className="text-sm font-medium text-blue-500 mt-2 px-1.5">
{"Learn where to find these values ->"->React.string}
</h1>
</div>
<div className="flex justify-end items-center border-t">
<ReconConfigurationHelper.Footer
currentStep={currentStep} setCurrentStep={setCurrentStep} buttonName="Continue"
/>
</div>
</div>
</PageLoaderWrapper>
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@react.component
let make = (~currentStep, ~setCurrentStep) => {
let make = (~currentStep, ~setCurrentStep, ~selectedProcessor, ~setSelectedProcessor) => {
open ReconConfigurationUtils

let currentStepCount = currentStep->getSectionFromStep->getSectionCount
Expand All @@ -15,11 +15,14 @@ let make = (~currentStep, ~setCurrentStep) => {
{switch currentStep->getSubsectionFromStep {
| APIKeysAndLiveEndpoints =>
<ConnectProcessorDataHelper.APIKeysAndLiveEndpoints
currentStep={currentStep} setCurrentStep={setCurrentStep}
currentStep={currentStep}
setCurrentStep={setCurrentStep}
selectedProcessor
setSelectedProcessor
/>
| WebHooks =>
<ConnectProcessorDataHelper.WebHooks
currentStep={currentStep} setCurrentStep={setCurrentStep}
currentStep={currentStep} setCurrentStep={setCurrentStep} selectedProcessor
/>
| _ => <div />
}}
Expand Down
Loading
Loading