Skip to content

Commit

Permalink
Added PaymentGatewayResponse to OrderStatusResp
Browse files Browse the repository at this point in the history
  • Loading branch information
ErasedSoul committed Dec 3, 2024
1 parent 1ad649c commit 6c3419a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/mobility-core/src/Kernel/External/Payment/Interface/Juspay.hs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ mkOrderStatusResp Juspay.OrderData {..} =
transactionStatus = status,
paymentMethodType = payment_method_type,
paymentMethod = payment_method,
paymentGatewayResponse =
payment_gateway_response
<&> ( \pgResp ->
PaymentGatewayResponse
{ respCode = pgResp.resp_code,
rrn = pgResp.rrn,
created = pgResp.created,
epgTxnId = pgResp.epg_txn_id,
respMessage = pgResp.resp_message,
authIdCode = pgResp.auth_id_code,
txnId = pgResp.txn_id
}
),
respMessage = resp_message,
respCode = resp_code,
gatewayReferenceId = gateway_reference_id,
Expand Down Expand Up @@ -412,6 +425,19 @@ mkWebhookOrderStatusResp now (eventName, Juspay.OrderAndNotificationStatusConten
transactionStatus = justOrder.status,
paymentMethodType = justOrder.payment_method_type,
paymentMethod = justOrder.payment_method,
paymentGatewayResponse =
justOrder.payment_gateway_response
<&> ( \pgResp ->
PaymentGatewayResponse
{ respCode = pgResp.resp_code,
rrn = pgResp.rrn,
created = pgResp.created,
epgTxnId = pgResp.epg_txn_id,
respMessage = pgResp.resp_message,
authIdCode = pgResp.auth_id_code,
txnId = pgResp.txn_id
}
),
respMessage = justOrder.resp_message,
respCode = justOrder.resp_code,
gatewayReferenceId = justOrder.gateway_reference_id,
Expand Down Expand Up @@ -462,6 +488,7 @@ mkWebhookOrderStatusResp now (eventName, Juspay.OrderAndNotificationStatusConten
transactionStatus = justTransaction.status,
paymentMethodType = Nothing,
paymentMethod = Nothing,
paymentGatewayResponse = Nothing,
respMessage = Nothing,
respCode = Nothing,
gatewayReferenceId = Nothing,
Expand Down
12 changes: 12 additions & 0 deletions lib/mobility-core/src/Kernel/External/Payment/Interface/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ data OrderStatusResp
transactionStatus :: TransactionStatus,
paymentMethodType :: Maybe Text,
paymentMethod :: Maybe Text,
paymentGatewayResponse :: Maybe PaymentGatewayResponse,
respMessage :: Maybe Text,
respCode :: Maybe Text,
gatewayReferenceId :: Maybe Text,
Expand Down Expand Up @@ -241,6 +242,17 @@ data SourceInfo = SourceInfo
}
deriving (Eq, Show, Read, Generic, ToJSON, FromJSON, ToSchema)

data PaymentGatewayResponse = PaymentGatewayResponse
{ txnId :: Maybe Text,
rrn :: Maybe Text,
respMessage :: Maybe Text,
respCode :: Maybe Text,
epgTxnId :: Maybe Text,
created :: Maybe UTCTime,
authIdCode :: Maybe Text
}
deriving (Eq, Show, Read, Generic, ToJSON, FromJSON, ToSchema)

--- Notification status response and request --
newtype NotificationStatusReq = NotificationStatusReq
{notificationId :: Text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ data OrderData = OrderData
status :: TransactionStatus,
payment_method_type :: Maybe Text,
payment_method :: Maybe Text,
payment_gateway_response :: Maybe PaymentGatewayResponse,
resp_message :: Maybe Text,
resp_code :: Maybe Text,
gateway_reference_id :: Maybe Text,
Expand Down Expand Up @@ -181,6 +182,18 @@ data SplitDetailsResponse = SplitDetailsResponse
deriving stock (Show, Generic)
deriving anyclass (FromJSON, ToJSON, ToSchema)

data PaymentGatewayResponse = PaymentGatewayResponse
{ resp_code :: Maybe Text,
rrn :: Maybe Text,
created :: Maybe UTCTime,
epg_txn_id :: Maybe Text,
resp_message :: Maybe Text,
auth_id_code :: Maybe Text,
txn_id :: Maybe Text
}
deriving stock (Show, Generic)
deriving anyclass (FromJSON, ToJSON, ToSchema)

data MandateData = MandateData
{ mandate_status :: MandateStatus,
start_date :: Text,
Expand Down

0 comments on commit 6c3419a

Please sign in to comment.