Skip to content

Commit

Permalink
refactor(connector): [Wise] Error Message For Connector Implementation (
Browse files Browse the repository at this point in the history
#2952)

Co-authored-by: Oleksandr.Zoria <[email protected]>
  • Loading branch information
CouldBeFree and Oleksandr.Zoria authored Dec 12, 2023
1 parent 9d010b1 commit 1add2c0
Showing 1 changed file with 19 additions and 25 deletions.
44 changes: 19 additions & 25 deletions crates/router/src/connector/wise/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Error = error_stack::Report<errors::ConnectorError>;

#[cfg(feature = "payouts")]
use crate::{
connector::utils::RouterData,
connector::utils::{self, RouterData},
types::{
api::payouts,
storage::enums::{self as storage_enums, PayoutEntityType},
Expand Down Expand Up @@ -344,10 +344,9 @@ fn get_payout_bank_details(
bic: b.bic,
..WiseBankDetails::default()
}),
_ => Err(errors::ConnectorError::NotSupported {
message: "Card payout creation is not supported".to_string(),
connector: "Wise",
}),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
))?,
}
}

Expand All @@ -371,10 +370,9 @@ impl<F> TryFrom<&types::PayoutsRouterData<F>> for WiseRecipientCreateRequest {
}),
}?;
match request.payout_type.to_owned() {
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotSupported {
message: "Card payout creation is not supported".to_string(),
connector: "Wise",
})?,
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
))?,
storage_enums::PayoutType::Bank => {
let account_holder_name = customer_details
.ok_or(errors::ConnectorError::MissingRequiredField {
Expand Down Expand Up @@ -432,10 +430,9 @@ impl<F> TryFrom<&types::PayoutsRouterData<F>> for WisePayoutQuoteRequest {
target_currency: request.destination_currency.to_string(),
pay_out: WisePayOutOption::default(),
}),
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotSupported {
message: "Card payout fulfillment is not supported".to_string(),
connector: "Wise",
})?,
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
))?,
}
}
}
Expand Down Expand Up @@ -489,10 +486,9 @@ impl<F> TryFrom<&types::PayoutsRouterData<F>> for WisePayoutCreateRequest {
details: wise_transfer_details,
})
}
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotSupported {
message: "Card payout fulfillment is not supported".to_string(),
connector: "Wise",
})?,
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
))?,
}
}
}
Expand Down Expand Up @@ -533,10 +529,9 @@ impl<F> TryFrom<&types::PayoutsRouterData<F>> for WisePayoutFulfillRequest {
storage_enums::PayoutType::Bank => Ok(Self {
fund_type: FundType::default(),
}),
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotSupported {
message: "Card payout fulfillment is not supported".to_string(),
connector: "Wise",
})?,
storage_enums::PayoutType::Card => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
))?,
}
}
}
Expand Down Expand Up @@ -599,10 +594,9 @@ impl TryFrom<PayoutMethodData> for RecipientType {
PayoutMethodData::Bank(api_models::payouts::Bank::Ach(_)) => Ok(Self::Aba),
PayoutMethodData::Bank(api_models::payouts::Bank::Bacs(_)) => Ok(Self::SortCode),
PayoutMethodData::Bank(api_models::payouts::Bank::Sepa(_)) => Ok(Self::Iban),
_ => Err(errors::ConnectorError::NotSupported {
message: "Requested payout_method_type is not supported".to_string(),
connector: "Wise",
}
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Wise"),
)
.into()),
}
}
Expand Down

0 comments on commit 1add2c0

Please sign in to comment.