fix(connector): [Payme] Fix for partial capture validation (#1939)

This commit is contained in:
Arjun Karthik
2023-08-17 12:58:31 +05:30
committed by GitHub
parent a7340e6d5b
commit 3d62cb07dd

View File

@ -551,6 +551,12 @@ pub struct PaymentCaptureRequest {
impl TryFrom<&types::PaymentsCaptureRouterData> for PaymentCaptureRequest { impl TryFrom<&types::PaymentsCaptureRouterData> for PaymentCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>; type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> { fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
if item.request.amount_to_capture != item.request.payment_amount {
Err(errors::ConnectorError::NotSupported {
message: "Partial Capture".to_string(),
connector: "Payme",
})?
}
Ok(Self { Ok(Self {
payme_sale_id: item.request.connector_transaction_id.clone(), payme_sale_id: item.request.connector_transaction_id.clone(),
sale_price: item.request.amount_to_capture, sale_price: item.request.amount_to_capture,