feat(payment_method): set the initial payment method as default until its explicitly set (#3970)

This commit is contained in:
Amisha Prabhat
2024-03-06 18:10:59 +05:30
committed by GitHub
parent d220e815dc
commit 34c1b905b1
3 changed files with 24 additions and 16 deletions

View File

@ -275,15 +275,16 @@ pub async fn default_payment_method_set_api(
Ok(auth) => auth,
Err(err) => return api::log_and_return_error_response(err),
};
let db = &*state.store.clone();
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, default_payment_method| {
|_state, auth: auth::AuthenticationData, default_payment_method| {
cards::set_default_payment_method(
state,
auth.merchant_account,
db,
auth.merchant_account.merchant_id,
auth.key_store,
&customer_id,
default_payment_method.payment_method_id,