mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(router): updating amount_captured in payment_intent (#251)
This commit is contained in:
@ -399,6 +399,7 @@ impl<F, T>
|
||||
redirection_data,
|
||||
mandate_reference,
|
||||
}),
|
||||
amount_captured: Some(item.response.amount_received),
|
||||
..item.data
|
||||
})
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ async fn payment_response_update_tracker<F: Clone, T>(
|
||||
Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate {
|
||||
status: router_data.status.foreign_into(),
|
||||
return_url: router_data.return_url,
|
||||
amount_captured: None,
|
||||
amount_captured: router_data.amount_captured,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -96,6 +96,7 @@ where
|
||||
connector_meta_data: merchant_connector_account.metadata,
|
||||
request: T::try_from(payment_data.clone())?,
|
||||
response: response.map_or_else(|| Err(types::ErrorResponse::default()), Ok),
|
||||
amount_captured: payment_data.payment_intent.amount_captured,
|
||||
};
|
||||
|
||||
Ok(router_data)
|
||||
|
||||
@ -74,7 +74,7 @@ pub async fn construct_refund_router_data<'a, F>(
|
||||
address: PaymentAddress::default(),
|
||||
auth_type: payment_attempt.authentication_type.unwrap_or_default(),
|
||||
connector_meta_data: None,
|
||||
|
||||
amount_captured: payment_intent.amount_captured,
|
||||
request: types::RefundsData {
|
||||
refund_id: refund.refund_id.clone(),
|
||||
payment_method_data,
|
||||
|
||||
@ -76,6 +76,7 @@ pub struct RouterData<Flow, Request, Response> {
|
||||
pub address: PaymentAddress,
|
||||
pub auth_type: storage_enums::AuthenticationType,
|
||||
pub connector_meta_data: Option<serde_json::Value>,
|
||||
pub amount_captured: Option<i64>,
|
||||
|
||||
/// Contains flow-specific data required to construct a request and send it to the connector.
|
||||
pub request: Request,
|
||||
|
||||
@ -54,6 +54,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
|
||||
payment_method_id: None,
|
||||
address: PaymentAddress::default(),
|
||||
connector_meta_data: None,
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,6 +94,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
|
||||
response: Err(types::ErrorResponse::default()),
|
||||
address: PaymentAddress::default(),
|
||||
connector_meta_data: None,
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
|
||||
response: Err(types::ErrorResponse::default()),
|
||||
address: PaymentAddress::default(),
|
||||
connector_meta_data: None,
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +93,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
|
||||
response: Err(types::ErrorResponse::default()),
|
||||
payment_method_id: None,
|
||||
address: PaymentAddress::default(),
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
|
||||
payment_method_id: None,
|
||||
address: PaymentAddress::default(),
|
||||
connector_meta_data: None,
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,6 +90,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
|
||||
response: Err(types::ErrorResponse::default()),
|
||||
payment_method_id: None,
|
||||
address: PaymentAddress::default(),
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -188,5 +188,6 @@ fn generate_data<Flow, Req: From<Req>, Res>(
|
||||
payment_method_id: None,
|
||||
address: PaymentAddress::default(),
|
||||
connector_meta_data: None,
|
||||
amount_captured: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user