feat(payment_methods_v2): Implemented Diesel and Domain models for v2 (#5700)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sarthak Soni
2024-09-04 18:00:42 +05:30
committed by GitHub
parent 1c39cc1262
commit c3cc887ea3
39 changed files with 2712 additions and 668 deletions

View File

@ -10,7 +10,6 @@ use common_utils::{errors::CustomResult, id_type};
not(feature = "payment_methods_v2")
))]
use diesel_models::enums as storage_enums;
use diesel_models::PaymentMethod;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use error_stack::FutureExt;
use error_stack::ResultExt;
@ -36,7 +35,11 @@ use crate::services::logger;
use crate::types::api;
use crate::{errors, routes::SessionState, services, types::domain};
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(all(
feature = "v2",
feature = "customer_v2",
feature = "payment_methods_v2"
))]
pub async fn rust_locker_migration(
_state: SessionState,
_merchant_id: &id_type::MerchantId,
@ -44,7 +47,11 @@ pub async fn rust_locker_migration(
todo!()
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "customer_v2"),
not(feature = "payment_methods_v2")
))]
pub async fn rust_locker_migration(
state: SessionState,
merchant_id: &id_type::MerchantId,
@ -86,6 +93,8 @@ pub async fn rust_locker_migration(
for customer in domain_customers {
let result = db
.find_payment_method_by_customer_id_merchant_id_list(
key_manager_state,
&key_store,
&customer.customer_id,
merchant_id,
None,
@ -122,7 +131,7 @@ pub async fn rust_locker_migration(
))]
pub async fn call_to_locker(
state: &SessionState,
payment_methods: Vec<PaymentMethod>,
payment_methods: Vec<domain::PaymentMethod>,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
merchant_account: &domain::MerchantAccount,
@ -220,7 +229,7 @@ pub async fn call_to_locker(
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn call_to_locker(
_state: &SessionState,
_payment_methods: Vec<PaymentMethod>,
_payment_methods: Vec<domain::PaymentMethod>,
_customer_id: &id_type::CustomerId,
_merchant_id: &id_type::MerchantId,
_merchant_account: &domain::MerchantAccount,