fix(router): updating amount_captured in payment_intent (#251)

This commit is contained in:
Abhishek
2022-12-28 13:50:51 +05:30
committed by GitHub
parent ed27b0c61d
commit e54d3f32b9
9 changed files with 12 additions and 2 deletions

View File

@ -399,6 +399,7 @@ impl<F, T>
redirection_data,
mandate_reference,
}),
amount_captured: Some(item.response.amount_received),
..item.data
})
}

View File

@ -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,
},
};

View File

@ -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)

View File

@ -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,

View File

@ -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,