Skip to content

Commit

Permalink
chore: code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay committed Jan 18, 2024
1 parent 0202f0c commit f1a7c69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
14 changes: 12 additions & 2 deletions src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
@module("js-sha256") external sha256: string => string = "sha256"

open PaymentLogsTypes
let getLogType = dict => {
if dict->Dict.get("request_id")->Belt.Option.isSome {
PAYMENTS
} else if dict->Dict.get("component")->Belt.Option.isSome {
SDK
} else {
WEBHOOKS
}
}

module PrettyPrintJson = {
open HSwitchUtils
@react.component
Expand Down Expand Up @@ -93,7 +104,6 @@ module PrettyPrintJson = {
}

module ApiDetailsComponent = {
open PaymentLogsTypes
open LogicUtils
open PaymentLogsUtils
@react.component
Expand Down Expand Up @@ -241,8 +251,8 @@ let make = (~paymentId, ~createdAt) => {
open APIUtils
open HSwitchUtils
open LogicUtils
open PaymentLogsTypes
open PaymentLogsUtils

let fetchDetails = useGetMethod(~showErrorToast=false, ())
let fetchPostDetils = useUpdateMethod()
let logs = React.useMemo0(() => {ref([])})
Expand Down
11 changes: 0 additions & 11 deletions src/screens/HyperSwitch/PaymentLogs/PaymentLogsUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ let filteredKeys = [
"version",
]

let getLogType = dict => {
open PaymentLogsTypes
if dict->Dict.get("request_id")->Belt.Option.isSome {
PAYMENTS
} else if dict->Dict.get("component")->Belt.Option.isSome {
SDK
} else {
WEBHOOKS
}
}

let sortByCreatedAt = (log1: Js.Json.t, log2: Js.Json.t) => {
open LogicUtils
let getKey = dict => dict->getDictFromJsonObject->getString("created_at", "")->Js.Date.fromString
Expand Down

0 comments on commit f1a7c69

Please sign in to comment.