Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(api_models): rename Card struct for payouts to avoid overrides in auto generated open API spec (#4861)

Kashif7f75f941c18e
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 69c50da79c..2df40bd675 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -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,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 237cddcf94..c15704afa3 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -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,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 6737bbf3af..873e6f18d2 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -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();
diff --git a/crates/router/src/types/api/payouts.rs b/crates/router/src/types/api/payouts.rs
index d4417c5f1c..dfe7e949aa 100644
--- a/crates/router/src/types/api/payouts.rs
+++ b/crates/router/src/types/api/payouts.rs
@@ -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,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index f42481798a..195fb7ed00 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -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"
}
}
},