mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
fix(payment_methods_v2): update fingerprint implementation in v2 (#7270)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -921,6 +921,7 @@ pub async fn create_payment_method(
|
|||||||
merchant_account,
|
merchant_account,
|
||||||
key_store,
|
key_store,
|
||||||
None,
|
None,
|
||||||
|
&customer_id,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@ -1513,14 +1514,16 @@ pub async fn vault_payment_method(
|
|||||||
merchant_account: &domain::MerchantAccount,
|
merchant_account: &domain::MerchantAccount,
|
||||||
key_store: &domain::MerchantKeyStore,
|
key_store: &domain::MerchantKeyStore,
|
||||||
existing_vault_id: Option<domain::VaultId>,
|
existing_vault_id: Option<domain::VaultId>,
|
||||||
|
customer_id: &id_type::GlobalCustomerId,
|
||||||
) -> RouterResult<(pm_types::AddVaultResponse, String)> {
|
) -> RouterResult<(pm_types::AddVaultResponse, String)> {
|
||||||
let db = &*state.store;
|
let db = &*state.store;
|
||||||
|
|
||||||
// get fingerprint_id from vault
|
// get fingerprint_id from vault
|
||||||
let fingerprint_id_from_vault = vault::get_fingerprint_id_from_vault(state, pmd)
|
let fingerprint_id_from_vault =
|
||||||
.await
|
vault::get_fingerprint_id_from_vault(state, pmd, customer_id.get_string_repr().to_owned())
|
||||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
.await
|
||||||
.attach_printable("Failed to get fingerprint_id from vault")?;
|
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||||
|
.attach_printable("Failed to get fingerprint_id from vault")?;
|
||||||
|
|
||||||
// throw back error if payment method is duplicated
|
// throw back error if payment method is duplicated
|
||||||
when(
|
when(
|
||||||
@ -1796,6 +1799,7 @@ pub async fn update_payment_method_core(
|
|||||||
&merchant_account,
|
&merchant_account,
|
||||||
&key_store,
|
&key_store,
|
||||||
current_vault_id, // using current vault_id for now, will have to refactor this
|
current_vault_id, // using current vault_id for now, will have to refactor this
|
||||||
|
&payment_method.customer_id,
|
||||||
) // to generate new one on each vaulting later on
|
) // to generate new one on each vaulting later on
|
||||||
.await
|
.await
|
||||||
.attach_printable("Failed to add payment method in vault")?;
|
.attach_printable("Failed to add payment method in vault")?;
|
||||||
|
|||||||
@ -1257,8 +1257,8 @@ pub async fn get_fingerprint_id_from_vault<
|
|||||||
>(
|
>(
|
||||||
state: &routes::SessionState,
|
state: &routes::SessionState,
|
||||||
data: &D,
|
data: &D,
|
||||||
|
key: String,
|
||||||
) -> CustomResult<String, errors::VaultError> {
|
) -> CustomResult<String, errors::VaultError> {
|
||||||
let key = data.get_vaulting_data_key();
|
|
||||||
let data = serde_json::to_string(data)
|
let data = serde_json::to_string(data)
|
||||||
.change_context(errors::VaultError::RequestEncodingFailed)
|
.change_context(errors::VaultError::RequestEncodingFailed)
|
||||||
.attach_printable("Failed to encode Vaulting data to string")?;
|
.attach_printable("Failed to encode Vaulting data to string")?;
|
||||||
|
|||||||
Reference in New Issue
Block a user