fix: don't update payment on requires_capture (#405)

This commit is contained in:
Kartikeya Hegde
2023-01-18 19:51:53 +05:30
committed by GitHub
parent 5a46d30100
commit a9e5193b90

View File

@ -174,11 +174,14 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
}; };
match payment_intent.status { match payment_intent.status {
enums::IntentStatus::Succeeded | enums::IntentStatus::Failed => { enums::IntentStatus::Succeeded
| enums::IntentStatus::Failed
| enums::IntentStatus::RequiresCapture => {
Err(report!(errors::ApiErrorResponse::PreconditionFailed { Err(report!(errors::ApiErrorResponse::PreconditionFailed {
message: message: format!(
"You cannot update this Payment because it has already succeeded/failed." "You cannot update this Payment because the status of this payment is {}",
.into() payment_intent.status
)
})) }))
} }
_ => Ok(( _ => Ok((