diff --git a/lib/mobility-core/src/Kernel/External/Payment/Juspay/Types/CreateOrder.hs b/lib/mobility-core/src/Kernel/External/Payment/Juspay/Types/CreateOrder.hs index 0a7a4c14..b0504cdb 100644 --- a/lib/mobility-core/src/Kernel/External/Payment/Juspay/Types/CreateOrder.hs +++ b/lib/mobility-core/src/Kernel/External/Payment/Juspay/Types/CreateOrder.hs @@ -120,10 +120,21 @@ data CreateOrderResp = CreateOrderResp id :: Text, order_id :: Text, payment_links :: Maybe PaymentLinks, - sdk_payload :: SDKPayload + sdk_payload :: SDKPayload, + sdk_payload_json :: Maybe Value } deriving stock (Show, Generic) - deriving anyclass (FromJSON, ToJSON, ToSchema) + deriving anyclass (ToJSON, ToSchema) + +instance FromJSON CreateOrderResp where + parseJSON = withObject "CreateOrderResp" $ \v -> do + status <- v .: "status" + order_id <- v .: "order_id" + id <- v .: "id" + payment_links <- v .: "payment_links" + sdk_payload <- v .: "sdk_payload" + sdk_payload_json <- v .: "sdk_payload" + return (CreateOrderResp status id order_id payment_links sdk_payload sdk_payload_json) data PaymentLinks = PaymentLinks { web :: Maybe BaseUrl,