mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
refactor(api_models): rename Card struct for payouts to avoid overrides in auto generated open API spec (#4861)
This commit is contained in:
@ -153,19 +153,19 @@ pub struct PayoutCreateRequest {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PayoutMethodData {
|
||||
Card(Card),
|
||||
Card(CardPayout),
|
||||
Bank(Bank),
|
||||
Wallet(Wallet),
|
||||
}
|
||||
|
||||
impl Default for PayoutMethodData {
|
||||
fn default() -> Self {
|
||||
Self::Card(Card::default())
|
||||
Self::Card(CardPayout::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
|
||||
pub struct Card {
|
||||
pub struct CardPayout {
|
||||
/// The card number
|
||||
#[schema(value_type = String, example = "4242424242424242")]
|
||||
pub card_number: CardNumber,
|
||||
|
||||
@ -440,7 +440,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::GiftCardData,
|
||||
api_models::payments::GiftCardDetails,
|
||||
api_models::payments::Address,
|
||||
api_models::payouts::Card,
|
||||
api_models::payouts::CardPayout,
|
||||
api_models::payouts::Wallet,
|
||||
api_models::payouts::Paypal,
|
||||
api_models::payouts::Venmo,
|
||||
|
||||
@ -1202,7 +1202,7 @@ pub trait CardData {
|
||||
}
|
||||
|
||||
#[cfg(feature = "payouts")]
|
||||
impl CardData for payouts::Card {
|
||||
impl CardData for payouts::CardPayout {
|
||||
fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError> {
|
||||
let binding = self.expiry_year.clone();
|
||||
let year = binding.peek();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
pub use api_models::payouts::{
|
||||
AchBankTransfer, BacsBankTransfer, Bank as BankPayout, Card as CardPayout, PayoutActionRequest,
|
||||
AchBankTransfer, BacsBankTransfer, Bank as BankPayout, CardPayout, PayoutActionRequest,
|
||||
PayoutCreateRequest, PayoutCreateResponse, PayoutListConstraints, PayoutListFilterConstraints,
|
||||
PayoutListFilters, PayoutListResponse, PayoutMethodData, PayoutRequest, PayoutRetrieveBody,
|
||||
PayoutRetrieveRequest, PixBankTransfer, SepaBankTransfer, Wallet as WalletPayout,
|
||||
|
||||
@ -7054,9 +7054,10 @@
|
||||
"type": "object",
|
||||
"required": [
|
||||
"card_number",
|
||||
"expiry_month",
|
||||
"expiry_year",
|
||||
"card_holder_name"
|
||||
"card_exp_month",
|
||||
"card_exp_year",
|
||||
"card_holder_name",
|
||||
"card_cvc"
|
||||
],
|
||||
"properties": {
|
||||
"card_number": {
|
||||
@ -7064,18 +7065,60 @@
|
||||
"description": "The card number",
|
||||
"example": "4242424242424242"
|
||||
},
|
||||
"expiry_month": {
|
||||
"card_exp_month": {
|
||||
"type": "string",
|
||||
"description": "The card's expiry month"
|
||||
"description": "The card's expiry month",
|
||||
"example": "24"
|
||||
},
|
||||
"expiry_year": {
|
||||
"card_exp_year": {
|
||||
"type": "string",
|
||||
"description": "The card's expiry year"
|
||||
"description": "The card's expiry year",
|
||||
"example": "24"
|
||||
},
|
||||
"card_holder_name": {
|
||||
"type": "string",
|
||||
"description": "The card holder's name",
|
||||
"example": "John Doe"
|
||||
"example": "John Test"
|
||||
},
|
||||
"card_cvc": {
|
||||
"type": "string",
|
||||
"description": "The CVC number for the card",
|
||||
"example": "242"
|
||||
},
|
||||
"card_issuer": {
|
||||
"type": "string",
|
||||
"description": "The name of the issuer of card",
|
||||
"example": "chase",
|
||||
"nullable": true
|
||||
},
|
||||
"card_network": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CardNetwork"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"card_type": {
|
||||
"type": "string",
|
||||
"example": "CREDIT",
|
||||
"nullable": true
|
||||
},
|
||||
"card_issuing_country": {
|
||||
"type": "string",
|
||||
"example": "INDIA",
|
||||
"nullable": true
|
||||
},
|
||||
"bank_code": {
|
||||
"type": "string",
|
||||
"example": "JP_AMEX",
|
||||
"nullable": true
|
||||
},
|
||||
"nick_name": {
|
||||
"type": "string",
|
||||
"description": "The card holder's nick name",
|
||||
"example": "John Test",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -7256,6 +7299,35 @@
|
||||
"Maestro"
|
||||
]
|
||||
},
|
||||
"CardPayout": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"card_number",
|
||||
"expiry_month",
|
||||
"expiry_year",
|
||||
"card_holder_name"
|
||||
],
|
||||
"properties": {
|
||||
"card_number": {
|
||||
"type": "string",
|
||||
"description": "The card number",
|
||||
"example": "4242424242424242"
|
||||
},
|
||||
"expiry_month": {
|
||||
"type": "string",
|
||||
"description": "The card's expiry month"
|
||||
},
|
||||
"expiry_year": {
|
||||
"type": "string",
|
||||
"description": "The card's expiry year"
|
||||
},
|
||||
"card_holder_name": {
|
||||
"type": "string",
|
||||
"description": "The card holder's name",
|
||||
"example": "John Doe"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CardRedirectData": {
|
||||
"oneOf": [
|
||||
{
|
||||
@ -16752,7 +16824,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"card": {
|
||||
"$ref": "#/components/schemas/Card"
|
||||
"$ref": "#/components/schemas/CardPayout"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user