Skip to content

Commit

Permalink
fix: consider status of payment method before filtering wallets in li…
Browse files Browse the repository at this point in the history
…st pm (#7007)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
Chethan-rao and hyperswitch-bot[bot] authored Jan 9, 2025
1 parent d2960b6 commit 57c6caa
Show file tree
Hide file tree
Showing 55 changed files with 99 additions and 137 deletions.
1 change: 0 additions & 1 deletion crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,6 @@ pub struct MerchantConnectorUpdate {

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]

pub struct ConnectorWalletDetails {
/// This field contains the Apple Pay certificates and credentials for iOS and Web Apple Pay flow
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
3 changes: 0 additions & 3 deletions crates/api_models/src/analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ pub struct PaymentIntentFilterValue {

#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]

pub struct GetRefundFilterRequest {
pub time_range: TimeRange,
#[serde(default)]
Expand All @@ -287,7 +286,6 @@ pub struct RefundFiltersResponse {

#[derive(Debug, serde::Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]

pub struct RefundFilterValue {
pub dimension: RefundDimensions,
pub values: Vec<String>,
Expand Down Expand Up @@ -413,7 +411,6 @@ pub struct DisputeFiltersResponse {

#[derive(Debug, serde::Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]

pub struct DisputeFilterValue {
pub dimension: DisputeDimensions,
pub values: Vec<String>,
Expand Down
2 changes: 1 addition & 1 deletion crates/api_models/src/api_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ mod never {
{
struct NeverVisitor;

impl<'de> serde::de::Visitor<'de> for NeverVisitor {
impl serde::de::Visitor<'_> for NeverVisitor {
type Value = ();

fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down
1 change: 0 additions & 1 deletion crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ pub enum FrmConnectors {
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]

pub enum TaxConnectors {
Taxjar,
}
Expand Down
7 changes: 2 additions & 5 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,6 @@ pub enum BankRedirectData {
/// The billing details for bank redirection
billing_details: Option<BankRedirectBilling>,
/// Bank account details for Giropay
#[schema(value_type = Option<String>)]
/// Bank account bic code
bank_account_bic: Option<Secret<String>>,
Expand Down Expand Up @@ -4117,7 +4116,6 @@ pub struct ReceiverDetails {

#[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema, router_derive::PolymorphicSchema)]
#[generate_schemas(PaymentsCreateResponseOpenApi)]

pub struct PaymentsResponse {
/// Unique identifier for the payment. This ensures idempotency for multiple payments
/// that have been done by a single merchant.
Expand Down Expand Up @@ -6247,7 +6245,7 @@ mod payment_id_type {
struct PaymentIdVisitor;
struct OptionalPaymentIdVisitor;

impl<'de> Visitor<'de> for PaymentIdVisitor {
impl Visitor<'_> for PaymentIdVisitor {
type Value = PaymentIdType;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -6321,7 +6319,7 @@ pub mod amount {

// This is defined to provide guarded deserialization of amount
// which itself handles zero and non-zero values internally
impl<'de> de::Visitor<'de> for AmountVisitor {
impl de::Visitor<'_> for AmountVisitor {
type Value = Amount;

fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down Expand Up @@ -6517,7 +6515,6 @@ pub struct PaymentLinkStatusDetails {

#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
#[serde(deny_unknown_fields)]

pub struct PaymentLinkListConstraints {
/// limit on the number of objects to return
pub limit: Option<i64>,
Expand Down
1 change: 0 additions & 1 deletion crates/api_models/src/pm_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub struct LinkTokenCreateResponse {

#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]

pub struct ExchangeTokenCreateRequest {
pub public_token: String,
pub client_secret: Option<String>,
Expand Down
6 changes: 3 additions & 3 deletions crates/common_enums/src/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ mod custom_serde {

struct FieldVisitor;

impl<'de> Visitor<'de> for FieldVisitor {
impl Visitor<'_> for FieldVisitor {
type Value = CountryAlpha2;

fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -1945,7 +1945,7 @@ mod custom_serde {

struct FieldVisitor;

impl<'de> Visitor<'de> for FieldVisitor {
impl Visitor<'_> for FieldVisitor {
type Value = CountryAlpha3;

fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -1977,7 +1977,7 @@ mod custom_serde {

struct FieldVisitor;

impl<'de> Visitor<'de> for FieldVisitor {
impl Visitor<'_> for FieldVisitor {
type Value = u32;

fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
Expand Down
1 change: 0 additions & 1 deletion crates/common_utils/src/custom_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ pub mod timestamp {
}

/// <https://github.com/serde-rs/serde/issues/994#issuecomment-316895860>
pub mod json_string {
use serde::de::{self, Deserialize, DeserializeOwned, Deserializer};
use serde_json;
Expand Down
2 changes: 1 addition & 1 deletion crates/common_utils/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ mod client_secret_type {
{
struct ClientSecretVisitor;

impl<'de> Visitor<'de> for ClientSecretVisitor {
impl Visitor<'_> for ClientSecretVisitor {
type Value = ClientSecret;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions crates/common_utils/src/types/keymanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ impl<'de> Deserialize<'de> for DecryptedData {
{
struct DecryptedDataVisitor;

impl<'de> Visitor<'de> for DecryptedDataVisitor {
impl Visitor<'_> for DecryptedDataVisitor {
type Value = DecryptedData;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -449,7 +449,7 @@ impl<'de> Deserialize<'de> for EncryptedData {
{
struct EncryptedDataVisitor;

impl<'de> Visitor<'de> for EncryptedDataVisitor {
impl Visitor<'_> for EncryptedDataVisitor {
type Value = EncryptedData;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
1 change: 0 additions & 1 deletion crates/diesel_models/src/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::schema::configs;

#[derive(Default, Clone, Debug, Insertable, Serialize, Deserialize)]
#[diesel(table_name = configs)]

pub struct ConfigNew {
pub key: String,
pub config: String,
Expand Down
1 change: 0 additions & 1 deletion crates/diesel_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub use self::{
/// `Option<T>` values.
///
/// [diesel-2.0-array-nullability]: https://diesel.rs/guides/migration_guide.html#2-0-0-nullability-of-array-elements
#[doc(hidden)]
pub(crate) mod diesel_impl {
use diesel::{
Expand Down
1 change: 0 additions & 1 deletion crates/diesel_models/src/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ impl From<OrganizationUpdate> for OrganizationUpdateInternal {
}
}
#[cfg(feature = "v2")]

impl From<OrganizationUpdate> for OrganizationUpdateInternal {
fn from(value: OrganizationUpdate) -> Self {
match value {
Expand Down
2 changes: 1 addition & 1 deletion crates/euclid/src/dssa/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum CtxValueKind<'a> {
Negation(&'a [dir::DirValue]),
}

impl<'a> CtxValueKind<'a> {
impl CtxValueKind<'_> {
pub fn get_assertion(&self) -> Option<&dir::DirValue> {
if let Self::Assertion(val) = self {
Some(val)
Expand Down
4 changes: 0 additions & 4 deletions crates/euclid/src/frontend/ast/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::{
/// This serves for the purpose were we have the DirKey as an explicit Enum type and value as one
/// of the member of the same Enum.
/// So particularly it lowers a predefined Enum from DirKey to an Enum of DirValue.
macro_rules! lower_enum {
($key:ident, $value:ident) => {
match $value {
Expand Down Expand Up @@ -70,7 +69,6 @@ macro_rules! lower_enum {
/// This is for the cases in which there are numerical values involved and they are lowered
/// accordingly on basis of the supplied key, currently payment_amount is the only key having this
/// use case
macro_rules! lower_number {
($key:ident, $value:ident, $comp:ident) => {
match $value {
Expand Down Expand Up @@ -117,7 +115,6 @@ macro_rules! lower_number {
///
/// This serves for the purpose were we have the DirKey as Card_bin and value as an arbitrary string
/// So particularly it lowers an arbitrary value to a predefined key.
macro_rules! lower_str {
($key:ident, $value:ident $(, $validation_closure:expr)?) => {
match $value {
Expand Down Expand Up @@ -155,7 +152,6 @@ macro_rules! lower_metadata {
/// by throwing required errors for comparisons that can't be performed for a certain value type
/// for example
/// can't have greater/less than operations on enum types
fn lower_comparison_inner<O: EuclidDirFilter>(
comp: ast::Comparison,
) -> Result<Vec<dir::DirValue>, AnalysisErrorType> {
Expand Down
4 changes: 2 additions & 2 deletions crates/euclid/src/frontend/ast/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ impl EuclidParsable for DummyOutput {
)(input)
}
}
pub fn skip_ws<'a, F, O>(inner: F) -> impl FnMut(&'a str) -> ParseResult<&str, O>
pub fn skip_ws<'a, F, O>(inner: F) -> impl FnMut(&'a str) -> ParseResult<&'a str, O>
where
F: FnMut(&'a str) -> ParseResult<&str, O> + 'a,
F: FnMut(&'a str) -> ParseResult<&'a str, O> + 'a,
{
sequence::preceded(pchar::multispace0, inner)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ pub struct NexinetsBankRedirects {

#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]

pub struct NexinetsAsyncDetails {
pub success_url: Option<String>,
pub cancel_url: Option<String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub struct RazorpayPaymentsRequest {

#[derive(Default, Debug, Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]

pub struct SecondFactor {
txn_id: String,
id: String,
Expand Down Expand Up @@ -980,7 +979,6 @@ pub struct RazorpaySyncResponse {

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]

pub enum PsyncStatus {
Charged,
Pending,
Expand Down Expand Up @@ -1053,7 +1051,6 @@ pub struct Refund {

#[derive(Default, Debug, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]

pub enum RefundStatus {
Success,
Failure,
Expand Down Expand Up @@ -1220,7 +1217,6 @@ impl From<RefundStatus> for enums::RefundStatus {

#[derive(Default, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]

pub struct RefundResponse {
txn_id: Option<String>,
refund: RefundRes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ pub struct TsysCaptureRequest {

#[derive(Debug, Serialize)]
#[serde(rename_all = "PascalCase")]

pub struct TsysPaymentsCaptureRequest {
capture: TsysCaptureRequest,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hyperswitch_connectors/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ where

pub(crate) fn missing_field_err(
message: &'static str,
) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + '_> {
) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + 'static> {
Box::new(move || {
errors::ConnectorError::MissingRequiredField {
field_name: message,
Expand Down
1 change: 0 additions & 1 deletion crates/hyperswitch_domain_models/src/merchant_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ pub enum MerchantAccountUpdate {
}

#[cfg(feature = "v1")]

impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
fn from(merchant_account_update: MerchantAccountUpdate) -> Self {
let now = date_time::now();
Expand Down
1 change: 0 additions & 1 deletion crates/hyperswitch_interfaces/src/secrets_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub trait SecretManagementInterface: Send + Sync {
// &self,
// input: Secret<String>,
// ) -> CustomResult<String, SecretsManagementError>;

/// Given an input, decrypt/retrieve the secret
async fn get_secret(
&self,
Expand Down
8 changes: 4 additions & 4 deletions crates/masking/src/diesel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use diesel::{

use crate::{Secret, Strategy, StrongSecret, ZeroizableSecret};

impl<'expr, S, I, T> AsExpression<T> for &'expr Secret<S, I>
impl<S, I, T> AsExpression<T> for &Secret<S, I>
where
T: sql_types::SingleValue,
I: Strategy<S>,
Expand All @@ -24,7 +24,7 @@ where
}
}

impl<'expr2, 'expr, S, I, T> AsExpression<T> for &'expr2 &'expr Secret<S, I>
impl<S, I, T> AsExpression<T> for &&Secret<S, I>
where
T: sql_types::SingleValue,
I: Strategy<S>,
Expand Down Expand Up @@ -81,7 +81,7 @@ where
}
}

impl<'expr, S, I, T> AsExpression<T> for &'expr StrongSecret<S, I>
impl<S, I, T> AsExpression<T> for &StrongSecret<S, I>
where
T: sql_types::SingleValue,
S: ZeroizableSecret,
Expand All @@ -93,7 +93,7 @@ where
}
}

impl<'expr2, 'expr, S, I, T> AsExpression<T> for &'expr2 &'expr StrongSecret<S, I>
impl<S, I, T> AsExpression<T> for &&StrongSecret<S, I>
where
T: sql_types::SingleValue,
S: ZeroizableSecret,
Expand Down
2 changes: 0 additions & 2 deletions crates/masking/src/maskable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ impl<T: Eq + PartialEq + Clone> Maskable<T> {
}

/// Trait for providing a method on custom types for constructing `Maskable`
pub trait Mask {
/// The type returned by the `into_masked()` method. Must implement `PartialEq`, `Eq` and `Clone`
type Output: Eq + Clone + PartialEq;

///
Expand Down
4 changes: 2 additions & 2 deletions crates/masking/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<T: Serialize + ErasedSerialize> ErasedMaskSerialize for T {
}
}

impl<'a> Serialize for dyn ErasedMaskSerialize + 'a {
impl Serialize for dyn ErasedMaskSerialize + '_ {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -127,7 +127,7 @@ impl<'a> Serialize for dyn ErasedMaskSerialize + 'a {
}
}

impl<'a> Serialize for dyn ErasedMaskSerialize + 'a + Send {
impl Serialize for dyn ErasedMaskSerialize + '_ + Send {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
Loading

0 comments on commit 57c6caa

Please sign in to comment.