Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 24 additions & 8 deletions lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ createPayoutOrder config mRoutingId req = do
webhookDetails <- case isDynamicWebhookRequired of
True -> Just <$> mkDynamicWebhookDetails
False -> pure Nothing
let (accountDetails, detailsType') = case accountDetailsType of
Just "ACCOUNT_IFSC" ->
( Payout.AccountDetails
{ name = customerName,
vpa = Nothing,
mobileNo = Just customerPhone,
account = accountNumber,
ifsc = ifscCode
},
Juspay.ACCOUNT_IFSC
)
_ ->
-- Default to UPI_ID
( Payout.AccountDetails
{ name = customerName,
vpa = Just customerVpa,
mobileNo = Just customerPhone,
account = Nothing,
ifsc = Nothing
},
Juspay.UPI_ID
)
return $
Juspay.CreatePayoutOrderReq
{ amount = realToFrac amount,
Expand All @@ -75,14 +97,8 @@ createPayoutOrder config mRoutingId req = do
beneficiaryDetails =
Just $
Juspay.BeneficiaryDetails
{ details =
Just
Payout.AccountDetails
{ name = customerName,
vpa = Just customerVpa,
mobileNo = Just customerPhone
},
detailsType = Just Juspay.UPI_ID
{ details = Just accountDetails,
detailsType = Just detailsType'
},
additionalInfo =
Just $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ data CreatePayoutOrderReq = CreatePayoutOrderReq
remark :: Text,
customerName :: Text,
customerVpa :: Text,
isDynamicWebhookRequired :: Bool
isDynamicWebhookRequired :: Bool,
accountDetailsType :: Maybe Text,
accountNumber :: Maybe Text,
ifscCode :: Maybe Text
}
deriving stock (Show, Eq, Generic)
deriving anyclass (FromJSON, ToJSON, ToSchema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ $(mkBeamInstancesForEnum ''AccountDetailsType)
data AccountDetails = AccountDetails
{ name :: Text,
vpa :: Maybe Text,
mobileNo :: Maybe Text
mobileNo :: Maybe Text,
account :: Maybe Text,
ifsc :: Maybe Text
}
deriving (Show, Generic, ToSchema)
deriving anyclass (FromJSON, ToJSON)
Expand Down