feat: add a domain type for customer_id (#4705)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-05-30 16:19:10 +05:30
committed by GitHub
parent f192fa3866
commit 93d61d1053
106 changed files with 1150 additions and 490 deletions

View File

@ -1,5 +1,5 @@
use api_models::{enums as api_enums, locker_migration::MigrateCardResponse};
use common_utils::errors::CustomResult;
use common_utils::{errors::CustomResult, id_type};
use diesel_models::{enums as storage_enums, PaymentMethod};
use error_stack::{FutureExt, ResultExt};
use futures::TryFutureExt;
@ -77,7 +77,7 @@ pub async fn rust_locker_migration(
pub async fn call_to_locker(
state: &AppState,
payment_methods: Vec<PaymentMethod>,
customer_id: &String,
customer_id: &id_type::CustomerId,
merchant_id: &str,
merchant_account: &domain::MerchantAccount,
) -> CustomResult<usize, errors::ApiErrorResponse> {
@ -136,7 +136,7 @@ pub async fn call_to_locker(
state,
pm_create,
&card_details,
customer_id.to_string(),
customer_id,
merchant_account,
api_enums::LockerChoice::HyperswitchCardVault,
Some(pm.locker_id.as_ref().unwrap_or(&pm.payment_method_id)),
@ -144,7 +144,7 @@ pub async fn call_to_locker(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(format!(
"Card migration failed for merchant_id: {merchant_id}, customer_id: {customer_id}, payment_method_id: {} ",
"Card migration failed for merchant_id: {merchant_id}, customer_id: {customer_id:?}, payment_method_id: {} ",
pm.payment_method_id
));
@ -159,7 +159,7 @@ pub async fn call_to_locker(
cards_moved += 1;
logger::info!(
"Card migrated for merchant_id: {merchant_id}, customer_id: {customer_id}, payment_method_id: {} ",
"Card migrated for merchant_id: {merchant_id}, customer_id: {customer_id:?}, payment_method_id: {} ",
pm.payment_method_id
);
}