mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(payment_method): add capability to store bank details using /payment_methods endpoint (#3113)
Co-authored-by: Kashif <mohammed.kashif@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Bernard Eugine <114725419+bernard-eugine@users.noreply.github.com>
This commit is contained in:
@ -55,6 +55,11 @@ pub struct PaymentMethodCreate {
|
||||
/// The card network
|
||||
#[schema(example = "Visa")]
|
||||
pub card_network: Option<String>,
|
||||
|
||||
/// Payment method details from locker
|
||||
#[cfg(feature = "payouts")]
|
||||
#[schema(value_type = Option<Bank>)]
|
||||
pub bank_transfer: Option<payouts::Bank>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
@ -72,6 +77,11 @@ pub struct PaymentMethodUpdate {
|
||||
#[schema(value_type = Option<CardNetwork>,example = "Visa")]
|
||||
pub card_network: Option<api_enums::CardNetwork>,
|
||||
|
||||
/// Payment method details from locker
|
||||
#[cfg(feature = "payouts")]
|
||||
#[schema(value_type = Option<Bank>)]
|
||||
pub bank_transfer: Option<payouts::Bank>,
|
||||
|
||||
/// 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<pii::SecretSerdeValue>,
|
||||
@ -147,6 +157,11 @@ pub struct PaymentMethodResponse {
|
||||
#[schema(value_type = Option<PrimitiveDateTime>, example = "2023-01-18T11:04:09.922Z")]
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub created: Option<time::PrimitiveDateTime>,
|
||||
|
||||
/// Payment method details from locker
|
||||
#[cfg(feature = "payouts")]
|
||||
#[schema(value_type = Option<Bank>)]
|
||||
pub bank_transfer: Option<payouts::Bank>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||
|
||||
@ -181,7 +181,7 @@ pub struct Card {
|
||||
|
||||
/// The card holder's name
|
||||
#[schema(value_type = String, example = "John Doe")]
|
||||
pub card_holder_name: Secret<String>,
|
||||
pub card_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
|
||||
@ -195,16 +195,16 @@ pub enum Bank {
|
||||
#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
|
||||
pub struct AchBankTransfer {
|
||||
/// Bank name
|
||||
#[schema(value_type = String, example = "Deutsche Bank")]
|
||||
pub bank_name: String,
|
||||
#[schema(value_type = Option<String>, example = "Deutsche Bank")]
|
||||
pub bank_name: Option<String>,
|
||||
|
||||
/// Bank country code
|
||||
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||
pub bank_country_code: api_enums::CountryAlpha2,
|
||||
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
|
||||
pub bank_country_code: Option<api_enums::CountryAlpha2>,
|
||||
|
||||
/// Bank city
|
||||
#[schema(value_type = String, example = "California")]
|
||||
pub bank_city: String,
|
||||
#[schema(value_type = Option<String>, example = "California")]
|
||||
pub bank_city: Option<String>,
|
||||
|
||||
/// Bank account number is an unique identifier assigned by a bank to a customer.
|
||||
#[schema(value_type = String, example = "000123456")]
|
||||
@ -218,16 +218,16 @@ pub struct AchBankTransfer {
|
||||
#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
|
||||
pub struct BacsBankTransfer {
|
||||
/// Bank name
|
||||
#[schema(value_type = String, example = "Deutsche Bank")]
|
||||
pub bank_name: String,
|
||||
#[schema(value_type = Option<String>, example = "Deutsche Bank")]
|
||||
pub bank_name: Option<String>,
|
||||
|
||||
/// Bank country code
|
||||
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||
pub bank_country_code: api_enums::CountryAlpha2,
|
||||
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
|
||||
pub bank_country_code: Option<api_enums::CountryAlpha2>,
|
||||
|
||||
/// Bank city
|
||||
#[schema(value_type = String, example = "California")]
|
||||
pub bank_city: String,
|
||||
#[schema(value_type = Option<String>, example = "California")]
|
||||
pub bank_city: Option<String>,
|
||||
|
||||
/// Bank account number is an unique identifier assigned by a bank to a customer.
|
||||
#[schema(value_type = String, example = "000123456")]
|
||||
@ -242,16 +242,16 @@ pub struct BacsBankTransfer {
|
||||
// The SEPA (Single Euro Payments Area) is a pan-European network that allows you to send and receive payments in euros between two cross-border bank accounts in the eurozone.
|
||||
pub struct SepaBankTransfer {
|
||||
/// Bank name
|
||||
#[schema(value_type = String, example = "Deutsche Bank")]
|
||||
pub bank_name: String,
|
||||
#[schema(value_type = Option<String>, example = "Deutsche Bank")]
|
||||
pub bank_name: Option<String>,
|
||||
|
||||
/// Bank country code
|
||||
#[schema(value_type = CountryAlpha2, example = "US")]
|
||||
pub bank_country_code: api_enums::CountryAlpha2,
|
||||
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
|
||||
pub bank_country_code: Option<api_enums::CountryAlpha2>,
|
||||
|
||||
/// Bank city
|
||||
#[schema(value_type = String, example = "California")]
|
||||
pub bank_city: String,
|
||||
#[schema(value_type = Option<String>, example = "California")]
|
||||
pub bank_city: Option<String>,
|
||||
|
||||
/// International Bank Account Number (iban) - used in many countries for identifying a bank along with it's customer.
|
||||
#[schema(value_type = String, example = "DE89370400440532013000")]
|
||||
|
||||
Reference in New Issue
Block a user