feat(payment_methods_v2): Payment methods v2 API models (#5564)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sarthak Soni
2024-08-26 12:19:22 +05:30
committed by GitHub
parent dd484a0a4f
commit e98ff95b10
18 changed files with 1626 additions and 247 deletions

View File

@ -1,6 +1,16 @@
use api_models::{enums as api_enums, locker_migration::MigrateCardResponse};
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
use api_models::enums as api_enums;
use api_models::locker_migration::MigrateCardResponse;
use common_utils::{errors::CustomResult, id_type};
use diesel_models::{enums as storage_enums, PaymentMethod};
#[cfg(all(
any(feature = "v1", feature = "v2"),
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;
@ -9,13 +19,22 @@ use futures::TryFutureExt;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use super::errors::StorageErrorExt;
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
use super::payment_methods::cards;
use crate::{
errors,
routes::SessionState,
services::{self, logger},
types::{api, domain},
};
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
use crate::services::logger;
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
use crate::types::api;
use crate::{errors, routes::SessionState, services, types::domain};
#[cfg(all(feature = "v2", feature = "customer_v2"))]
pub async fn rust_locker_migration(
@ -89,6 +108,10 @@ pub async fn rust_locker_migration(
))
}
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
pub async fn call_to_locker(
state: &SessionState,
payment_methods: Vec<PaymentMethod>,
@ -185,3 +208,14 @@ pub async fn call_to_locker(
Ok(cards_moved)
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn call_to_locker(
_state: &SessionState,
_payment_methods: Vec<PaymentMethod>,
_customer_id: &id_type::CustomerId,
_merchant_id: &id_type::MerchantId,
_merchant_account: &domain::MerchantAccount,
) -> CustomResult<usize, errors::ApiErrorResponse> {
todo!()
}