mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
refactor: Add secret to metadata (#706)
This commit is contained in:
@ -57,7 +57,7 @@ pub struct MerchantAccountCreate {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// API key that will be used for server side API access
|
||||
#[schema(example = "AH3423bkjbkjdsfbkj")]
|
||||
@ -118,7 +118,7 @@ pub struct MerchantAccountUpdate {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// API key that will be used for server side API access
|
||||
#[schema(example = "AH3423bkjbkjdsfbkj")]
|
||||
@ -185,7 +185,7 @@ pub struct MerchantAccountResponse {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// An identifier for the vault used to store payment method information.
|
||||
#[schema(example = "locker_abc123")]
|
||||
@ -308,7 +308,7 @@ pub struct MerchantConnector {
|
||||
pub merchant_connector_id: Option<String>,
|
||||
/// Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
pub connector_account_details: Option<Secret<serde_json::Value>>,
|
||||
pub connector_account_details: Option<pii::SecretSerdeValue>,
|
||||
/// A boolean value to indicate if the connector is in Test mode. By default, its value is false.
|
||||
#[schema(default = false, example = false)]
|
||||
pub test_mode: Option<bool>,
|
||||
@ -348,7 +348,7 @@ pub struct MerchantConnector {
|
||||
pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>,
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
/// Details of all the payment methods enabled for the connector for the given merchant account
|
||||
|
||||
@ -41,12 +41,12 @@ pub struct CustomerRequest {
|
||||
"first_name": "John",
|
||||
"last_name": "Doe"
|
||||
}))]
|
||||
pub address: Option<Secret<serde_json::Value>>,
|
||||
pub address: Option<pii::SecretSerdeValue>,
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500
|
||||
/// characters long. Metadata is useful for storing additional, structured information on an
|
||||
/// object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, ToSchema)]
|
||||
@ -90,7 +90,7 @@ pub struct CustomerResponse {
|
||||
/// characters long. Metadata is useful for storing additional, structured information on an
|
||||
/// object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Deserialize, Serialize)]
|
||||
|
||||
@ -36,7 +36,7 @@ pub struct PaymentMethodCreate {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// The unique identifier of the customer.
|
||||
#[schema(example = "cus_meowerunwiuwiwqw")]
|
||||
@ -64,7 +64,7 @@ pub struct PaymentMethodUpdate {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
@ -127,7 +127,7 @@ pub struct PaymentMethodResponse {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// A timestamp (ISO 8601 code) that determines when the customer was created
|
||||
#[schema(value_type = Option<PrimitiveDateTime>,example = "2023-01-18T11:04:09.922Z")]
|
||||
@ -514,7 +514,7 @@ pub struct CustomerPaymentMethod {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// A timestamp (ISO 8601 code) that determines when the customer was created
|
||||
#[schema(value_type = Option<PrimitiveDateTime>,example = "2023-01-18T11:04:09.922Z")]
|
||||
|
||||
@ -6,10 +6,7 @@ use router_derive::Setter;
|
||||
use time::PrimitiveDateTime;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::{
|
||||
enums::{self as api_enums},
|
||||
refunds,
|
||||
};
|
||||
use crate::{enums as api_enums, refunds};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum PaymentOp {
|
||||
@ -882,7 +879,7 @@ pub struct PaymentsResponse {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// description: The customer's email address
|
||||
#[schema(max_length = 255, value_type = Option<String>, example = "johntest@test.com")]
|
||||
@ -1187,7 +1184,7 @@ pub struct Metadata {
|
||||
/// Any other metadata that is to be provided
|
||||
#[schema(value_type = Object, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
#[serde(flatten)]
|
||||
pub data: serde_json::Value,
|
||||
pub data: pii::SecretSerdeValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use common_utils::custom_serde;
|
||||
use common_utils::{custom_serde, pii};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::PrimitiveDateTime;
|
||||
use utoipa::ToSchema;
|
||||
@ -42,7 +42,7 @@ pub struct RefundRequest {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, ToSchema, Clone, Deserialize)]
|
||||
@ -54,7 +54,7 @@ pub struct RefundUpdateRequest {
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, ToSchema, Deserialize)]
|
||||
@ -81,7 +81,7 @@ pub struct RefundResponse {
|
||||
pub status: RefundStatus,
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object
|
||||
#[schema(value_type = Option<Object>)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
/// The error message
|
||||
pub error_message: Option<String>,
|
||||
/// The code for the error
|
||||
|
||||
@ -6,6 +6,9 @@ use masking::{Strategy, WithType};
|
||||
|
||||
use crate::validation::validate_email;
|
||||
|
||||
/// Type alias for serde_json value which has Secret Information
|
||||
pub type SecretSerdeValue = masking::Secret<serde_json::Value>;
|
||||
|
||||
/// Card number
|
||||
#[derive(Debug)]
|
||||
pub struct CardNumber;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
use std::{convert::From, default::Default};
|
||||
|
||||
use api_models::payment_methods as api_types;
|
||||
use common_utils::date_time;
|
||||
use common_utils::{date_time, pii};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{logger, pii, types::api};
|
||||
use crate::{logger, types::api};
|
||||
|
||||
#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct CreateCustomerRequest {
|
||||
@ -13,7 +13,7 @@ pub struct CreateCustomerRequest {
|
||||
pub name: Option<String>,
|
||||
pub phone: Option<masking::Secret<String>>,
|
||||
pub address: Option<masking::Secret<serde_json::Value>>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ pub struct CustomerUpdateRequest {
|
||||
pub phone: Option<masking::Secret<String, masking::WithType>>,
|
||||
pub name: Option<String>,
|
||||
pub address: Option<masking::Secret<serde_json::Value>>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, PartialEq, Eq)]
|
||||
@ -34,7 +34,7 @@ pub struct CreateCustomerResponse {
|
||||
pub created: u64,
|
||||
pub description: Option<String>,
|
||||
pub email: Option<masking::Secret<String, pii::Email>>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub name: Option<String>,
|
||||
pub phone: Option<masking::Secret<String, masking::WithType>>,
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use api_models::{payments, refunds};
|
||||
use common_utils::ext_traits::StringExt;
|
||||
use common_utils::{ext_traits::StringExt, pii as secret};
|
||||
use error_stack::ResultExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::{
|
||||
core::errors,
|
||||
@ -63,7 +62,7 @@ pub struct StripePaymentMethodData {
|
||||
pub billing_details: Option<StripeBillingDetails>,
|
||||
#[serde(flatten)]
|
||||
pub payment_method_details: Option<StripePaymentMethodDetails>, // enum
|
||||
pub metadata: Option<Value>,
|
||||
pub metadata: Option<secret::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Deserialize, Clone)]
|
||||
@ -277,7 +276,7 @@ pub struct StripePaymentIntentResponse {
|
||||
pub customer: Option<String>,
|
||||
pub refunds: Option<Vec<refunds::RefundResponse>>,
|
||||
pub mandate_id: Option<String>,
|
||||
pub metadata: Option<Value>,
|
||||
pub metadata: Option<secret::SecretSerdeValue>,
|
||||
pub charges: Charges,
|
||||
pub connector: Option<String>,
|
||||
pub description: Option<String>,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use std::{convert::From, default::Default};
|
||||
|
||||
use common_utils::pii;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::api::refunds;
|
||||
@ -13,7 +14,7 @@ pub struct StripeCreateRefundRequest {
|
||||
|
||||
#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct StripeUpdateRefundRequest {
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, PartialEq, Eq)]
|
||||
@ -24,7 +25,7 @@ pub struct StripeCreateRefundResponse {
|
||||
pub payment_intent: String,
|
||||
pub status: StripeRefundStatus,
|
||||
pub created: Option<i64>,
|
||||
pub metadata: serde_json::Value,
|
||||
pub metadata: pii::SecretSerdeValue,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Eq, PartialEq)]
|
||||
@ -77,7 +78,9 @@ impl From<refunds::RefundResponse> for StripeCreateRefundResponse {
|
||||
payment_intent: res.payment_id,
|
||||
status: res.status.into(),
|
||||
created: res.created_at.map(|t| t.assume_utc().unix_timestamp()),
|
||||
metadata: res.metadata.unwrap_or_else(|| serde_json::json!({})),
|
||||
metadata: res
|
||||
.metadata
|
||||
.unwrap_or_else(|| masking::Secret::new(serde_json::json!({}))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use common_utils::pii;
|
||||
use common_utils::{ext_traits::ValueExt, pii};
|
||||
use error_stack::{report, IntoReport, ResultExt};
|
||||
use masking::Secret;
|
||||
use once_cell::sync::Lazy;
|
||||
@ -45,7 +45,7 @@ pub trait RouterData {
|
||||
fn get_billing_phone(&self) -> Result<&api::PhoneDetails, Error>;
|
||||
fn get_description(&self) -> Result<String, Error>;
|
||||
fn get_billing_address(&self) -> Result<&api::AddressDetails, Error>;
|
||||
fn get_connector_meta(&self) -> Result<serde_json::Value, Error>;
|
||||
fn get_connector_meta(&self) -> Result<pii::SecretSerdeValue, Error>;
|
||||
fn get_session_token(&self) -> Result<String, Error>;
|
||||
fn to_connector_meta<T>(&self) -> Result<T, Error>
|
||||
where
|
||||
@ -89,7 +89,7 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
|
||||
.and_then(|a| a.address.as_ref())
|
||||
.ok_or_else(missing_field_err("billing.address"))
|
||||
}
|
||||
fn get_connector_meta(&self) -> Result<serde_json::Value, Error> {
|
||||
fn get_connector_meta(&self) -> Result<pii::SecretSerdeValue, Error> {
|
||||
self.connector_meta_data
|
||||
.clone()
|
||||
.ok_or_else(missing_field_err("connector_meta_data"))
|
||||
@ -105,8 +105,8 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
|
||||
where
|
||||
T: serde::de::DeserializeOwned,
|
||||
{
|
||||
serde_json::from_value::<T>(self.get_connector_meta()?)
|
||||
.into_report()
|
||||
self.get_connector_meta()?
|
||||
.parse_value(std::any::type_name::<T>())
|
||||
.change_context(errors::ConnectorError::NoConnectorMetaData)
|
||||
}
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ impl PaymentCreate {
|
||||
billing_address_id,
|
||||
statement_descriptor_name: request.statement_descriptor_name.clone(),
|
||||
statement_descriptor_suffix: request.statement_descriptor_suffix.clone(),
|
||||
metadata,
|
||||
metadata: metadata.map(masking::Secret::new),
|
||||
..storage::PaymentIntentNew::default()
|
||||
})
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ pub mod transformers;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub use api_models::enums::Connector;
|
||||
use common_utils::pii::Email;
|
||||
use common_utils::{pii, pii::Email};
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
|
||||
use self::{api::payments, storage::enums as storage_enums};
|
||||
@ -92,7 +92,7 @@ pub struct RouterData<Flow, Request, Response> {
|
||||
pub router_return_url: Option<String>,
|
||||
pub address: PaymentAddress,
|
||||
pub auth_type: storage_enums::AuthenticationType,
|
||||
pub connector_meta_data: Option<serde_json::Value>,
|
||||
pub connector_meta_data: Option<pii::SecretSerdeValue>,
|
||||
pub amount_captured: Option<i64>,
|
||||
pub access_token: Option<AccessToken>,
|
||||
pub session_token: Option<String>,
|
||||
|
||||
@ -379,7 +379,9 @@ pub trait ConnectorActions: Connector {
|
||||
.and_then(|a| a.address)
|
||||
.or_else(|| Some(PaymentAddress::default()))
|
||||
.unwrap(),
|
||||
connector_meta_data: info.clone().and_then(|a| a.connector_meta_data),
|
||||
connector_meta_data: info
|
||||
.clone()
|
||||
.and_then(|a| a.connector_meta_data.map(masking::Secret::new)),
|
||||
amount_captured: None,
|
||||
access_token: info.and_then(|a| a.access_token),
|
||||
session_token: None,
|
||||
|
||||
@ -15,7 +15,7 @@ pub struct CustomerNew {
|
||||
pub phone: Option<Secret<String>>,
|
||||
pub description: Option<String>,
|
||||
pub phone_country_code: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Identifiable, Queryable)]
|
||||
@ -30,7 +30,7 @@ pub struct Customer {
|
||||
pub phone_country_code: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -41,7 +41,7 @@ pub enum CustomerUpdate {
|
||||
phone: Option<Secret<String>>,
|
||||
description: Option<String>,
|
||||
phone_country_code: Option<String>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ pub struct CustomerUpdateInternal {
|
||||
phone: Option<Secret<String>>,
|
||||
description: Option<String>,
|
||||
phone_country_code: Option<String>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
impl From<CustomerUpdate> for CustomerUpdateInternal {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_utils::pii;
|
||||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
|
||||
use masking::StrongSecret;
|
||||
|
||||
@ -31,7 +32,7 @@ pub struct MerchantAccount {
|
||||
pub publishable_key: Option<String>,
|
||||
pub storage_scheme: storage_enums::MerchantStorageScheme,
|
||||
pub locker_id: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub routing_algorithm: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
@ -51,7 +52,7 @@ pub struct MerchantAccountNew {
|
||||
pub redirect_to_merchant_with_http_post: Option<bool>,
|
||||
pub publishable_key: Option<String>,
|
||||
pub locker_id: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub routing_algorithm: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ pub enum MerchantAccountUpdate {
|
||||
redirect_to_merchant_with_http_post: Option<bool>,
|
||||
publishable_key: Option<String>,
|
||||
locker_id: Option<String>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
routing_algorithm: Option<serde_json::Value>,
|
||||
},
|
||||
StorageSchemeUpdate {
|
||||
@ -94,7 +95,7 @@ pub struct MerchantAccountUpdateInternal {
|
||||
publishable_key: Option<String>,
|
||||
storage_scheme: Option<storage_enums::MerchantStorageScheme>,
|
||||
locker_id: Option<String>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
routing_algorithm: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_utils::pii;
|
||||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
|
||||
use masking::Secret;
|
||||
|
||||
@ -26,7 +27,7 @@ pub struct MerchantConnectorAccount {
|
||||
#[diesel(deserialize_as = super::OptionalDieselArray<serde_json::Value>)]
|
||||
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||
pub connector_type: storage_enums::ConnectorType,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
|
||||
@ -40,7 +41,7 @@ pub struct MerchantConnectorAccountNew {
|
||||
pub disabled: Option<bool>,
|
||||
pub merchant_connector_id: String,
|
||||
pub payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -54,7 +55,7 @@ pub enum MerchantConnectorAccountUpdate {
|
||||
disabled: Option<bool>,
|
||||
merchant_connector_id: Option<String>,
|
||||
payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
},
|
||||
}
|
||||
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
|
||||
@ -68,7 +69,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
|
||||
disabled: Option<bool>,
|
||||
merchant_connector_id: Option<String>,
|
||||
payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInternal {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_utils::pii;
|
||||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::PrimitiveDateTime;
|
||||
@ -17,7 +18,7 @@ pub struct PaymentIntent {
|
||||
pub customer_id: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub return_url: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub connector_id: Option<String>,
|
||||
pub shipping_address_id: Option<String>,
|
||||
pub billing_address_id: Option<String>,
|
||||
@ -53,7 +54,7 @@ pub struct PaymentIntentNew {
|
||||
pub customer_id: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub return_url: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub connector_id: Option<String>,
|
||||
pub shipping_address_id: Option<String>,
|
||||
pub billing_address_id: Option<String>,
|
||||
@ -75,7 +76,7 @@ pub enum PaymentIntentUpdate {
|
||||
return_url: Option<String>,
|
||||
},
|
||||
MetadataUpdate {
|
||||
metadata: serde_json::Value,
|
||||
metadata: pii::SecretSerdeValue,
|
||||
},
|
||||
ReturnUrlUpdate {
|
||||
return_url: Option<String>,
|
||||
@ -116,7 +117,7 @@ pub struct PaymentIntentUpdateInternal {
|
||||
pub return_url: Option<String>,
|
||||
pub setup_future_usage: Option<storage_enums::FutureUsage>,
|
||||
pub off_session: Option<bool>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub client_secret: Option<Option<String>>,
|
||||
pub billing_address_id: Option<String>,
|
||||
pub shipping_address_id: Option<String>,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_utils::pii;
|
||||
use diesel::{Identifiable, Insertable, Queryable};
|
||||
use masking::Secret;
|
||||
use time::PrimitiveDateTime;
|
||||
@ -29,7 +30,7 @@ pub struct PaymentMethod {
|
||||
pub payment_method_type: Option<storage_enums::PaymentMethodType>,
|
||||
pub payment_method_issuer: Option<String>,
|
||||
pub payment_method_issuer_code: Option<storage_enums::PaymentMethodIssuerCode>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Insertable, Queryable, router_derive::DebugAsDisplay)]
|
||||
@ -54,7 +55,7 @@ pub struct PaymentMethodNew {
|
||||
pub direct_debit_token: Option<String>,
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub last_modified: PrimitiveDateTime,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
impl Default for PaymentMethodNew {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use common_utils::pii;
|
||||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::PrimitiveDateTime;
|
||||
@ -25,7 +26,7 @@ pub struct Refund {
|
||||
pub refund_status: storage_enums::RefundStatus,
|
||||
pub sent_to_gateway: bool,
|
||||
pub refund_error_message: Option<String>,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub refund_arn: Option<String>,
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub updated_at: PrimitiveDateTime,
|
||||
@ -63,7 +64,7 @@ pub struct RefundNew {
|
||||
pub refund_amount: i64,
|
||||
pub refund_status: storage_enums::RefundStatus,
|
||||
pub sent_to_gateway: bool,
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub refund_arn: Option<String>,
|
||||
pub created_at: Option<PrimitiveDateTime>,
|
||||
pub modified_at: Option<PrimitiveDateTime>,
|
||||
@ -82,7 +83,7 @@ pub enum RefundUpdate {
|
||||
refund_arn: String,
|
||||
},
|
||||
MetadataAndReasonUpdate {
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
reason: Option<String>,
|
||||
},
|
||||
StatusUpdate {
|
||||
@ -105,7 +106,7 @@ pub struct RefundUpdateInternal {
|
||||
sent_to_gateway: Option<bool>,
|
||||
refund_error_message: Option<String>,
|
||||
refund_arn: Option<String>,
|
||||
metadata: Option<serde_json::Value>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
refund_reason: Option<String>,
|
||||
refund_error_code: Option<String>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user