mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(payment_methods_v2): Delete payment method api (#6211)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -14,6 +14,20 @@ use time::PrimitiveDateTime;
|
||||
|
||||
use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
|
||||
pub struct VaultId(String);
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
impl VaultId {
|
||||
pub fn get_string_repr(&self) -> &String {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn generate(id: String) -> Self {
|
||||
Self(id)
|
||||
}
|
||||
}
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
@ -67,7 +81,7 @@ pub struct PaymentMethod {
|
||||
pub payment_method_type: Option<storage_enums::PaymentMethodType>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub payment_method_data: OptionalEncryptableValue,
|
||||
pub locker_id: Option<String>,
|
||||
pub locker_id: Option<VaultId>,
|
||||
pub last_used_at: PrimitiveDateTime,
|
||||
pub connector_mandate_details: Option<pii::SecretSerdeValue>,
|
||||
pub customer_acceptance: Option<pii::SecretSerdeValue>,
|
||||
@ -302,7 +316,7 @@ impl super::behaviour::Conversion for PaymentMethod {
|
||||
payment_method_type: self.payment_method_type,
|
||||
metadata: self.metadata,
|
||||
payment_method_data: self.payment_method_data.map(|val| val.into()),
|
||||
locker_id: self.locker_id,
|
||||
locker_id: self.locker_id.map(|id| id.get_string_repr().clone()),
|
||||
last_used_at: self.last_used_at,
|
||||
connector_mandate_details: self.connector_mandate_details,
|
||||
customer_acceptance: self.customer_acceptance,
|
||||
@ -356,7 +370,7 @@ impl super::behaviour::Conversion for PaymentMethod {
|
||||
.and_then(|val| val.try_into_optionaloperation())
|
||||
})
|
||||
.await?,
|
||||
locker_id: item.locker_id,
|
||||
locker_id: item.locker_id.map(VaultId::generate),
|
||||
last_used_at: item.last_used_at,
|
||||
connector_mandate_details: item.connector_mandate_details,
|
||||
customer_acceptance: item.customer_acceptance,
|
||||
@ -415,7 +429,7 @@ impl super::behaviour::Conversion for PaymentMethod {
|
||||
payment_method_type: self.payment_method_type,
|
||||
metadata: self.metadata,
|
||||
payment_method_data: self.payment_method_data.map(|val| val.into()),
|
||||
locker_id: self.locker_id,
|
||||
locker_id: self.locker_id.map(|id| id.get_string_repr().clone()),
|
||||
last_used_at: self.last_used_at,
|
||||
connector_mandate_details: self.connector_mandate_details,
|
||||
customer_acceptance: self.customer_acceptance,
|
||||
|
||||
Reference in New Issue
Block a user