diff --git a/lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs b/lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs index d15da7f85..624fdec6a 100644 --- a/lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs +++ b/lib/mobility-core/src/Kernel/External/Payout/Interface/Juspay.hs @@ -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, @@ -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 $ diff --git a/lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs b/lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs index 0490bc544..d6406a4f2 100644 --- a/lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs +++ b/lib/mobility-core/src/Kernel/External/Payout/Interface/Types.hs @@ -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) diff --git a/lib/mobility-core/src/Kernel/External/Payout/Juspay/Types/Payout.hs b/lib/mobility-core/src/Kernel/External/Payout/Juspay/Types/Payout.hs index 1d7ceccab..0ddd74429 100644 --- a/lib/mobility-core/src/Kernel/External/Payout/Juspay/Types/Payout.hs +++ b/lib/mobility-core/src/Kernel/External/Payout/Juspay/Types/Payout.hs @@ -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)