mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +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)] | #[derive(Debug, Clone, Deserialize, Serialize, ToSchema)] | ||||||
| #[serde(rename_all = "snake_case")] | #[serde(rename_all = "snake_case")] | ||||||
| pub enum PayoutMethodData { | pub enum PayoutMethodData { | ||||||
|     Card(Card), |     Card(CardPayout), | ||||||
|     Bank(Bank), |     Bank(Bank), | ||||||
|     Wallet(Wallet), |     Wallet(Wallet), | ||||||
| } | } | ||||||
|  |  | ||||||
| impl Default for PayoutMethodData { | impl Default for PayoutMethodData { | ||||||
|     fn default() -> Self { |     fn default() -> Self { | ||||||
|         Self::Card(Card::default()) |         Self::Card(CardPayout::default()) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] | #[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)] | ||||||
| pub struct Card { | pub struct CardPayout { | ||||||
|     /// The card number |     /// The card number | ||||||
|     #[schema(value_type = String, example = "4242424242424242")] |     #[schema(value_type = String, example = "4242424242424242")] | ||||||
|     pub card_number: CardNumber, |     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::GiftCardData, | ||||||
|         api_models::payments::GiftCardDetails, |         api_models::payments::GiftCardDetails, | ||||||
|         api_models::payments::Address, |         api_models::payments::Address, | ||||||
|         api_models::payouts::Card, |         api_models::payouts::CardPayout, | ||||||
|         api_models::payouts::Wallet, |         api_models::payouts::Wallet, | ||||||
|         api_models::payouts::Paypal, |         api_models::payouts::Paypal, | ||||||
|         api_models::payouts::Venmo, |         api_models::payouts::Venmo, | ||||||
|  | |||||||
| @ -1202,7 +1202,7 @@ pub trait CardData { | |||||||
| } | } | ||||||
|  |  | ||||||
| #[cfg(feature = "payouts")] | #[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> { |     fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError> { | ||||||
|         let binding = self.expiry_year.clone(); |         let binding = self.expiry_year.clone(); | ||||||
|         let year = binding.peek(); |         let year = binding.peek(); | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| pub use api_models::payouts::{ | 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, |     PayoutCreateRequest, PayoutCreateResponse, PayoutListConstraints, PayoutListFilterConstraints, | ||||||
|     PayoutListFilters, PayoutListResponse, PayoutMethodData, PayoutRequest, PayoutRetrieveBody, |     PayoutListFilters, PayoutListResponse, PayoutMethodData, PayoutRequest, PayoutRetrieveBody, | ||||||
|     PayoutRetrieveRequest, PixBankTransfer, SepaBankTransfer, Wallet as WalletPayout, |     PayoutRetrieveRequest, PixBankTransfer, SepaBankTransfer, Wallet as WalletPayout, | ||||||
|  | |||||||
| @ -7054,9 +7054,10 @@ | |||||||
|         "type": "object", |         "type": "object", | ||||||
|         "required": [ |         "required": [ | ||||||
|           "card_number", |           "card_number", | ||||||
|           "expiry_month", |           "card_exp_month", | ||||||
|           "expiry_year", |           "card_exp_year", | ||||||
|           "card_holder_name" |           "card_holder_name", | ||||||
|  |           "card_cvc" | ||||||
|         ], |         ], | ||||||
|         "properties": { |         "properties": { | ||||||
|           "card_number": { |           "card_number": { | ||||||
| @ -7064,18 +7065,60 @@ | |||||||
|             "description": "The card number", |             "description": "The card number", | ||||||
|             "example": "4242424242424242" |             "example": "4242424242424242" | ||||||
|           }, |           }, | ||||||
|           "expiry_month": { |           "card_exp_month": { | ||||||
|             "type": "string", |             "type": "string", | ||||||
|             "description": "The card's expiry month" |             "description": "The card's expiry month", | ||||||
|  |             "example": "24" | ||||||
|           }, |           }, | ||||||
|           "expiry_year": { |           "card_exp_year": { | ||||||
|             "type": "string", |             "type": "string", | ||||||
|             "description": "The card's expiry year" |             "description": "The card's expiry year", | ||||||
|  |             "example": "24" | ||||||
|           }, |           }, | ||||||
|           "card_holder_name": { |           "card_holder_name": { | ||||||
|             "type": "string", |             "type": "string", | ||||||
|             "description": "The card holder's name", |             "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" |           "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": { |       "CardRedirectData": { | ||||||
|         "oneOf": [ |         "oneOf": [ | ||||||
|           { |           { | ||||||
| @ -16752,7 +16824,7 @@ | |||||||
|             ], |             ], | ||||||
|             "properties": { |             "properties": { | ||||||
|               "card": { |               "card": { | ||||||
|                 "$ref": "#/components/schemas/Card" |                 "$ref": "#/components/schemas/CardPayout" | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|           }, |           }, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Kashif
					Kashif