refactor(pm_list): modify pm list to support new api contract (#657)

Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in>
This commit is contained in:
Narayan Bhat
2023-02-27 00:51:29 +05:30
committed by GitHub
parent d1c9305ebb
commit a2616d87b1
12 changed files with 422 additions and 252 deletions

View File

@ -409,7 +409,6 @@ pub enum PaymentMethodIssuerCode {
JpSepa,
JpBacs,
}
#[derive(
Clone,
Copy,

View File

@ -89,19 +89,38 @@ impl MerchantConnectorAccount {
pub async fn find_by_merchant_id(
conn: &PgPooledConn,
merchant_id: &str,
get_disabled: bool,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
None,
None,
)
.await
if get_disabled {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
None,
None,
)
.await
} else {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::disabled.eq(false)),
None,
None,
None,
)
.await
}
}
}