Skip to content

Commit

Permalink
chore: update smart-retry
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 committed Oct 28, 2024
1 parent 5c995ef commit 037ff38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,20 @@ let make = (
let startTimeVal = filterValueJson->getString("startTime", "")
let endTimeVal = filterValueJson->getString("endTime", "")
let isSmartRetryEnabled =
filterValueJson->getString("is_smart_retry_enabled", "true")->getBoolFromString(true)
filterValueJson
->getString("is_smart_retry_enabled", "true")
->getBoolFromString(true)
->NewPaymentAnalyticsUtils.getSmartRetryMetricType

let getFailedPaymentsDistribution = async () => {
try {
setScreenState(_ => PageLoaderWrapper.Loading)
let url = getURL(
~entityName=isSmartRetryEnabled ? ANALYTICS_PAYMENTS : ANALYTICS_PAYMENTS_V2,
~entityName=isSmartRetryEnabled->getEntityForSmartRetry,
~methodType=Post,
~id=Some((entity.domain: domain :> string)),
)
let metrics = isSmartRetryEnabled
? [#payments_distribution]
: [#sessionized_payments_distribution]
let metrics = isSmartRetryEnabled->getMetricsForSmartRetry

let body = NewAnalyticsUtils.requestBody(
~dimensions=[],
Expand Down Expand Up @@ -136,7 +137,7 @@ let make = (
getFailedPaymentsDistribution()->ignore
}
None
}, [startTimeVal, endTimeVal, groupBy.value, isSmartRetryEnabled->getStringFromBool])
}, [startTimeVal, endTimeVal, groupBy.value, (isSmartRetryEnabled :> string)])

<div>
<ModuleHeader title={entity.title} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ let defaulGroupBy = {

let getKeyForModule = (field, ~isSmartRetryEnabled) => {
switch (field, isSmartRetryEnabled) {
| (Payments_Failure_Rate_Distribution, true) => Payments_Failure_Rate_Distribution
| (Payments_Failure_Rate_Distribution, false) | _ =>
| (Payments_Failure_Rate_Distribution, Smart_Retry) => Payments_Failure_Rate_Distribution
| (Payments_Failure_Rate_Distribution, Default) | _ =>
Payments_Failure_Rate_Distribution_Without_Smart_Retries
}->getStringFromVariant
}
Expand All @@ -167,3 +167,18 @@ let isSmartRetryEnbldForFailedPmtDist = isEnabled => {
| Default => Payments_Failure_Rate_Distribution_Without_Smart_Retries
}
}

let getEntityForSmartRetry = isEnabled => {
open APIUtilsTypes
switch isEnabled {
| Smart_Retry => ANALYTICS_PAYMENTS
| Default => ANALYTICS_PAYMENTS_V2
}
}

let getMetricsForSmartRetry = isEnabled => {
switch isEnabled {
| Smart_Retry => [#payments_distribution]
| Default => [#sessionized_payments_distribution]
}
}

0 comments on commit 037ff38

Please sign in to comment.