From 53f9356c73756a1806c8473bb6c329b272a838d1 Mon Sep 17 00:00:00 2001 From: shivendrashah Date: Fri, 11 Sep 2026 09:35:15 +0530 Subject: [PATCH] feat: usage counters on payment OfferResp Optional minimumAmount and a counters object (frequencyType, appliedCount, maxApplyCount) for domain offers; the Juspay adapter leaves both empty. --- .../src/Kernel/External/Payment/Interface/Juspay.hs | 4 +++- .../src/Kernel/External/Payment/Interface/Types.hs | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/mobility-core/src/Kernel/External/Payment/Interface/Juspay.hs b/lib/mobility-core/src/Kernel/External/Payment/Interface/Juspay.hs index ceffe0323..7558a91f7 100644 --- a/lib/mobility-core/src/Kernel/External/Payment/Interface/Juspay.hs +++ b/lib/mobility-core/src/Kernel/External/Payment/Interface/Juspay.hs @@ -999,7 +999,9 @@ mkOfferResp offer = do cashbackAmount = read $ T.unpack order_breakup.cashback_amount, benefitType = benefitType', offerCode = offer_code, - productDiscounts + productDiscounts, + minimumAmount = Nothing, + counters = Nothing } where Juspay.OfferResp {offer_id, status, offer_code, offer_description, ui_configs, order_breakup} = offer diff --git a/lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs b/lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs index 7595ffbf9..673d9a501 100644 --- a/lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs +++ b/lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs @@ -624,7 +624,17 @@ data OfferResp = OfferResp cashbackAmount :: HighPrecMoney, benefitType :: Text, -- "CASHBACK" or "DISCOUNT" offerCode :: Text, - productDiscounts :: Maybe [ProductDiscount] + productDiscounts :: Maybe [ProductDiscount], + minimumAmount :: Maybe HighPrecMoney, + counters :: Maybe OfferCounters + } + deriving (Generic, Show, FromJSON, ToJSON) + deriving anyclass (ToSchema) + +data OfferCounters = OfferCounters + { frequencyType :: Maybe Text, + appliedCount :: Maybe Int, + maxApplyCount :: Maybe Int } deriving (Generic, Show, FromJSON, ToJSON) deriving anyclass (ToSchema)