WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
36 changes: 14 additions & 22 deletions crates/payment_methods/src/core/migration/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub async fn migrate_payment_method(
get_client_secret_or_add_payment_method_for_migration(
state,
payment_method_create_request,
platform,
platform.get_provider(),
&mut migration_status,
controller,
)
Expand All @@ -105,7 +105,7 @@ pub async fn migrate_payment_method(
state,
&req,
merchant_id.to_owned(),
platform,
platform.get_provider(),
card_bin_details.clone(),
should_require_connector_mandate_details,
&mut migration_status,
Expand Down Expand Up @@ -134,7 +134,7 @@ pub async fn migrate_payment_method(
controller
.save_network_token_and_update_payment_method(
&req,
platform.get_processor().get_key_store(),
platform.get_provider().get_key_store(),
network_token_data,
network_token_requestor_ref_id,
pm_id,
Expand Down Expand Up @@ -385,11 +385,11 @@ impl
pub async fn get_client_secret_or_add_payment_method_for_migration(
state: &state::PaymentMethodsState,
req: pm_api::PaymentMethodCreate,
platform: &platform::Platform,
provider: &platform::Provider,
migration_status: &mut migration::RecordMigrationStatusBuilder,
controller: &dyn PaymentMethodsController,
) -> CustomResult<ApplicationResponse<pm_api::PaymentMethodResponse>, errors::ApiErrorResponse> {
let merchant_id = platform.get_processor().get_account().get_id();
let merchant_id = provider.get_account().get_id();
let customer_id = req.customer_id.clone().get_required_value("customer_id")?;

#[cfg(not(feature = "payouts"))]
Expand All @@ -402,11 +402,7 @@ pub async fn get_client_secret_or_add_payment_method_for_migration(
.billing
.clone()
.async_map(|billing| {
create_encrypted_data(
key_manager_state,
platform.get_processor().get_key_store(),
billing,
)
create_encrypted_data(key_manager_state, provider.get_key_store(), billing)
})
.await
.transpose()
Expand Down Expand Up @@ -490,7 +486,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
state: &state::PaymentMethodsState,
req: &pm_api::PaymentMethodMigrate,
merchant_id: id_type::MerchantId,
platform: &platform::Platform,
provider: &platform::Provider,
card: pm_api::CardDetailFromLocker,
should_require_connector_mandate_details: bool,
migration_status: &mut migration::RecordMigrationStatusBuilder,
Expand Down Expand Up @@ -531,11 +527,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
.billing
.clone()
.async_map(|billing| {
create_encrypted_data(
key_manager_state,
platform.get_processor().get_key_store(),
billing,
)
create_encrypted_data(key_manager_state, provider.get_key_store(), billing)
})
.await
.transpose()
Expand All @@ -546,8 +538,8 @@ pub async fn skip_locker_call_and_migrate_payment_method(
.find_customer_by_customer_id_merchant_id(
&customer_id,
&merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
provider.get_key_store(),
provider.get_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
Expand All @@ -559,7 +551,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
let payment_method_data_encrypted: Option<Encryptable<Secret<serde_json::Value>>> = Some(
create_encrypted_data(
&state.into(),
platform.get_processor().get_key_store(),
provider.get_key_store(),
payment_method_card_details,
)
.await
Expand All @@ -578,7 +570,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(

let response = db
.insert_payment_method(
platform.get_processor().get_key_store(),
provider.get_key_store(),
domain_pm::PaymentMethod {
customer_id: customer_id.to_owned(),
merchant_id: merchant_id.to_owned(),
Expand Down Expand Up @@ -618,7 +610,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
created_by: None,
last_modified_by: None,
},
platform.get_processor().get_account().storage_scheme,
provider.get_account().storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
Expand Down Expand Up @@ -659,7 +651,7 @@ pub async fn skip_locker_call_and_migrate_payment_method(
_state: state::PaymentMethodsState,
_req: &pm_api::PaymentMethodMigrate,
_merchant_id: id_type::MerchantId,
_platform: &platform::Platform,
_provider: &platform::Provider,
_card: pm_api::CardDetailFromLocker,
) -> CustomResult<ApplicationResponse<pm_api::PaymentMethodResponse>, errors::ApiErrorResponse> {
todo!()
Expand Down
24 changes: 12 additions & 12 deletions crates/router/src/compatibility/stripe/customers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pub async fn customer_create(
customers::create_customer(state, platform.get_provider().clone(), req, None)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
is_connected_allowed: true,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
Expand Down Expand Up @@ -95,8 +95,8 @@ pub async fn customer_retrieve(
customers::retrieve_customer(state, platform.get_provider().clone(), None, customer_id)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
is_connected_allowed: true,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
Expand Down Expand Up @@ -147,8 +147,8 @@ pub async fn customer_update(
customers::update_customer(state, platform.get_provider().clone(), request_internal)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
is_connected_allowed: true,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
Expand Down Expand Up @@ -181,12 +181,12 @@ pub async fn customer_delete(
&req,
customer_id,
|state, auth: auth::AuthenticationData, customer_id, _| {
let platform = auth.into();
customers::delete_customer(state, platform, customer_id)
let platform: domain::Platform = auth.into();
customers::delete_customer(state, platform.get_provider().clone(), customer_id)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
is_connected_allowed: true,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
Expand Down Expand Up @@ -230,8 +230,8 @@ pub async fn list_customer_payment_method_api(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
is_connected_allowed: true,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
Expand Down
Loading
Loading