mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
fix(connector): [STRIPE] Retrieving Connect Account Id from Mandate Metadata in MITs (#8326)
Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local>
This commit is contained in:
committed by
GitHub
parent
aee3f6441f
commit
17c30b6105
@ -600,6 +600,7 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
||||
errors::ApiErrorResponse::AddressNotFound => Self::AddressNotFound,
|
||||
errors::ApiErrorResponse::NotImplemented { .. } => Self::Unauthorized,
|
||||
errors::ApiErrorResponse::FlowNotSupported { .. } => Self::InternalServerError,
|
||||
errors::ApiErrorResponse::MandatePaymentDataMismatch { .. } => Self::PlatformBadRequest,
|
||||
errors::ApiErrorResponse::PaymentUnexpectedState {
|
||||
current_flow,
|
||||
field_name,
|
||||
|
||||
@ -176,6 +176,7 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
|
||||
| errors::ConnectorError::DateFormattingFailed
|
||||
| errors::ConnectorError::InvalidDataFormat { .. }
|
||||
| errors::ConnectorError::MismatchedPaymentData
|
||||
| errors::ConnectorError::MandatePaymentDataMismatch { .. }
|
||||
| errors::ConnectorError::InvalidWalletToken { .. }
|
||||
| errors::ConnectorError::MissingConnectorRelatedTransactionID { .. }
|
||||
| errors::ConnectorError::FileValidationFailed { .. }
|
||||
@ -230,6 +231,11 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
|
||||
"payment_method_data, payment_method_type and payment_experience does not match",
|
||||
}
|
||||
},
|
||||
errors::ConnectorError::MandatePaymentDataMismatch {fields}=> {
|
||||
errors::ApiErrorResponse::MandatePaymentDataMismatch {
|
||||
fields: fields.to_owned(),
|
||||
}
|
||||
},
|
||||
errors::ConnectorError::NotSupported { message, connector } => {
|
||||
errors::ApiErrorResponse::NotSupported { message: format!("{message} is not supported by {connector}") }
|
||||
},
|
||||
@ -376,6 +382,7 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
|
||||
| errors::ConnectorError::DateFormattingFailed
|
||||
| errors::ConnectorError::InvalidDataFormat { .. }
|
||||
| errors::ConnectorError::MismatchedPaymentData
|
||||
| errors::ConnectorError::MandatePaymentDataMismatch { .. }
|
||||
| errors::ConnectorError::MissingConnectorRelatedTransactionID { .. }
|
||||
| errors::ConnectorError::FileValidationFailed { .. }
|
||||
| errors::ConnectorError::MissingConnectorRedirectionPayload { .. }
|
||||
|
||||
@ -7017,14 +7017,24 @@ pub fn validate_platform_request_for_marketplace(
|
||||
stripe_split_payment,
|
||||
)) => match amount {
|
||||
api::Amount::Zero => {
|
||||
if stripe_split_payment.application_fees.get_amount_as_i64() != 0 {
|
||||
if stripe_split_payment
|
||||
.application_fees
|
||||
.as_ref()
|
||||
.map_or(MinorUnit::zero(), |amount| *amount)
|
||||
!= MinorUnit::zero()
|
||||
{
|
||||
return Err(errors::ApiErrorResponse::InvalidDataValue {
|
||||
field_name: "split_payments.stripe_split_payment.application_fees",
|
||||
});
|
||||
}
|
||||
}
|
||||
api::Amount::Value(amount) => {
|
||||
if stripe_split_payment.application_fees.get_amount_as_i64() > amount.into() {
|
||||
if stripe_split_payment
|
||||
.application_fees
|
||||
.as_ref()
|
||||
.map_or(MinorUnit::zero(), |amount| *amount)
|
||||
> amount.into()
|
||||
{
|
||||
return Err(errors::ApiErrorResponse::InvalidDataValue {
|
||||
field_name: "split_payments.stripe_split_payment.application_fees",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user