mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
refactor(payment_methods): revamp payment methods update endpoint (#4305)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -219,22 +219,28 @@ pub async fn payment_method_update_api(
|
||||
) -> HttpResponse {
|
||||
let flow = Flow::PaymentMethodsUpdate;
|
||||
let payment_method_id = path.into_inner();
|
||||
let payload = json_payload.into_inner();
|
||||
|
||||
let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
|
||||
Ok((auth, _auth_flow)) => (auth, _auth_flow),
|
||||
Err(e) => return api::log_and_return_error_response(e),
|
||||
};
|
||||
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
state,
|
||||
&req,
|
||||
json_payload.into_inner(),
|
||||
|state, auth, payload, _| {
|
||||
payload,
|
||||
|state, auth, req, _| {
|
||||
cards::update_customer_payment_method(
|
||||
state,
|
||||
auth.merchant_account,
|
||||
payload,
|
||||
req,
|
||||
&payment_method_id,
|
||||
auth.key_store,
|
||||
)
|
||||
},
|
||||
&auth::ApiKeyAuth,
|
||||
&*auth,
|
||||
api_locking::LockAction::NotApplicable,
|
||||
))
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user