fix(payment_methods): insert locker_id as null in case of payment method not getting stored in locker (#3919)

This commit is contained in:
Chethan Rao
2024-03-03 01:55:16 +05:30
committed by GitHub
parent 8162668199
commit 9917dd0654
2 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,5 @@
use api_models::payment_methods::PaymentMethodsData;
use common_enums::PaymentMethod;
use common_utils::{ext_traits::ValueExt, pii};
use error_stack::{report, ResultExt};
use masking::ExposeInterface;
@ -342,7 +343,11 @@ where
None => {
let pm_metadata = create_payment_method_metadata(None, connector_token)?;
locker_id = Some(resp.payment_method_id);
locker_id = if resp.payment_method == PaymentMethod::Card {
Some(resp.payment_method_id)
} else {
None
};
resp.payment_method_id = generate_id(consts::ID_LENGTH, "pm");
payment_methods::cards::create_payment_method(
db,