feat(core): Add Network Details in Payments Response#9273
feat(core): Add Network Details in Payments Response#9273Gnanasundari24 merged 3 commits intomainfrom
Conversation
5b7d457 to
2e20ae2
Compare
crates/api_models/src/payments.rs
Outdated
| /// Allow partial authorization for this payment | ||
| pub enable_partial_authorization: Option<bool>, | ||
|
|
||
| /// Contains Network Response |
There was a problem hiding this comment.
Could we provide a more detailed and clear description for this field ?
| authentication_type: auth_update, | ||
| issuer_error_code: error_response.network_decline_code.clone(), | ||
| issuer_error_message: error_response.network_error_message.clone(), | ||
| network_details: Some(diesel_models::NetworkDetails { |
There was a problem hiding this comment.
Can we use the from conversation here ?
| Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, diesel::AsExpression, | ||
| )] | ||
| #[diesel(sql_type = diesel::sql_types::Jsonb)] | ||
| pub struct NetworkDetails { |
There was a problem hiding this comment.
Do we need Eq and PartialEq for this ?
There was a problem hiding this comment.
The Eq trait is required because the PaymentAttempt struct, which contains the network_details field, derives Eq.
There was a problem hiding this comment.
Does network_details change for every payment, or does it remain the same for a specific payment method?
If it remains constant for a payment method, would it be useful to store it in the payment methods table as well?
For example in future we can use the payment method based on network_advice_code
Yes, it can change per payment. Example: One payment attempt may get network_advice_code = "01" (retry advised), while another may get "05" (do not retry). |
ef96b41 to
7f088c1
Compare
Type of Change
Description
This PR adds a new NetworkDetails struct containing network_advice_code to capture network-level response information from payment processors.
Key Changes:
1)Added network_details JSONB column to payment_attempt table
2)Extended PaymentsResponse API to include optional network_details field
3)Updated payment attempt models and error handling to populate network advice codes
4)Added database migration and comprehensive model updates across the codebase
Additional Changes
Motivation and Context
How did you test it?
Request
Response
Checklist
cargo +nightly fmt --allcargo clippy