Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PaymentGatewayResponse to OrderStatusResp #703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
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