@@ -920,7 +920,7 @@ pub async fn create_payment_method_core(
920
920
. change_context ( errors:: ApiErrorResponse :: InternalServerError )
921
921
. attach_printable ( "Unable to generate GlobalPaymentMethodId" ) ?;
922
922
923
- let mut payment_method = create_payment_method_for_intent (
923
+ let payment_method = create_payment_method_for_intent (
924
924
state,
925
925
req. metadata . clone ( ) ,
926
926
& customer_id,
@@ -970,9 +970,6 @@ pub async fn create_payment_method_core(
970
970
971
971
let ( response, payment_method) = match vaulting_result {
972
972
Ok ( ( vaulting_resp, fingerprint_id) ) => {
973
- payment_method. set_payment_method_type ( req. payment_method_type ) ;
974
- payment_method. set_payment_method_subtype ( req. payment_method_subtype ) ;
975
-
976
973
let pm_update = create_pm_additional_data_update (
977
974
Some ( & payment_method_data) ,
978
975
state,
@@ -982,6 +979,8 @@ pub async fn create_payment_method_core(
982
979
& payment_method,
983
980
None ,
984
981
network_tokenization_resp,
982
+ Some ( req. payment_method_type ) ,
983
+ Some ( req. payment_method_subtype ) ,
985
984
)
986
985
. await
987
986
. attach_printable ( "Unable to create Payment method data" ) ?;
@@ -1552,6 +1551,8 @@ pub async fn create_pm_additional_data_update(
1552
1551
payment_method : & domain:: PaymentMethod ,
1553
1552
connector_token_details : Option < payment_methods:: ConnectorTokenDetails > ,
1554
1553
nt_data : Option < NetworkTokenPaymentMethodDetails > ,
1554
+ payment_method_type : Option < common_enums:: PaymentMethod > ,
1555
+ payment_method_subtype : Option < common_enums:: PaymentMethodType > ,
1555
1556
) -> RouterResult < storage:: PaymentMethodUpdate > {
1556
1557
let encrypted_payment_method_data = payment_method_vaulting_data
1557
1558
. map (
@@ -1591,9 +1592,8 @@ pub async fn create_pm_additional_data_update(
1591
1592
let pm_update = storage:: PaymentMethodUpdate :: GenericUpdate {
1592
1593
status : Some ( enums:: PaymentMethodStatus :: Active ) ,
1593
1594
locker_id : vault_id,
1594
- // Payment method type remains the same, only card details are updated
1595
- payment_method_type_v2 : None ,
1596
- payment_method_subtype : None ,
1595
+ payment_method_type_v2 : payment_method_type,
1596
+ payment_method_subtype,
1597
1597
payment_method_data : encrypted_payment_method_data,
1598
1598
network_token_requestor_reference_id : nt_data
1599
1599
. clone ( )
@@ -1903,6 +1903,8 @@ pub async fn update_payment_method_core(
1903
1903
& payment_method,
1904
1904
request. connector_token_details ,
1905
1905
None ,
1906
+ None ,
1907
+ None ,
1906
1908
)
1907
1909
. await
1908
1910
. attach_printable ( "Unable to create Payment method data" ) ?;
0 commit comments