Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [STRIPE] Populate Error Message in Incremental Authorization Flow (#9006)

Anurag8d398c623d21
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs
index fc27effefc..b781031036 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs
@@ -1086,7 +1086,7 @@ impl
MinorUnit::new(req.request.total_amount),
req.request.currency,
)?;
- let connector_req = stripe::StripeIncrementalAuthRequest { amount };
+ let connector_req = stripe::StripeIncrementalAuthRequest { amount }; // Incremental authorization can be done a maximum of 10 times in Stripe
Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
}
@@ -1162,7 +1162,8 @@ impl
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: response
.error
- .code
+ .message
+ .clone()
.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
reason: response.error.message.map(|message| {
response
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index a32f89ef4d..862fcd8ff1 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -101,7 +101,7 @@ impl<F: Send + Clone + Sync>
// Incremental authorization should be performed on an amount greater than the original authorized amount (in this case, greater than the net_amount which is sent for authorization)
// request.amount is the total amount that should be authorized in incremental authorization which should be greater than the original authorized amount
- if payment_attempt.get_total_amount() > request.amount {
+ if payment_attempt.get_total_amount() >= request.amount {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: "Amount should be greater than original authorized amount".to_owned(),
})?