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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(docs): open-api fix for payment response (#5103)
chikke srujan2e1167acbcc0
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex d40c6d4e5c..a61bacd91e 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -7520,6 +7520,61 @@}]},+ "CardResponse": {+ "type": "object",+ "properties": {+ "last4": {+ "type": "string",+ "nullable": true+ },+ "card_type": {+ "type": "string",+ "nullable": true+ },+ "card_network": {+ "allOf": [+ {+ "$ref": "#/components/schemas/CardNetwork"+ }+ ],+ "nullable": true+ },+ "card_issuer": {+ "type": "string",+ "nullable": true+ },+ "card_issuing_country": {+ "type": "string",+ "nullable": true+ },+ "card_isin": {+ "type": "string",+ "nullable": true+ },+ "card_extended_bin": {+ "type": "string",+ "nullable": true+ },+ "card_exp_month": {+ "type": "string",+ "nullable": true+ },+ "card_exp_year": {+ "type": "string",+ "nullable": true+ },+ "card_holder_name": {+ "type": "string",+ "nullable": true+ },+ "payment_checks": {+ "nullable": true+ },+ "authentication_data": {+ "nullable": true+ }+ }+ },"CardToken": {"type": "object","required": [@@ -10628,6 +10683,15 @@"KakaoPayRedirection": {"type": "object"},+ "KlarnaSdkPaymentMethodResponse": {+ "type": "object",+ "properties": {+ "payment_type": {+ "type": "string",+ "nullable": true+ }+ }+ },"KlarnaSessionTokenResponse": {"type": "object","required": [@@ -12906,6 +12970,19 @@}}},+ "PaylaterResponse": {+ "type": "object",+ "properties": {+ "klarna_sdk": {+ "allOf": [+ {+ "$ref": "#/components/schemas/KlarnaSdkPaymentMethodResponse"+ }+ ],+ "nullable": true+ }+ }+ },"PaymentAttemptResponse": {"type": "object","required": [@@ -13830,6 +13907,211 @@}]},+ "PaymentMethodDataResponse": {+ "oneOf": [+ {+ "type": "object",+ "required": [+ "card"+ ],+ "properties": {+ "card": {+ "$ref": "#/components/schemas/CardResponse"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "bank_transfer"+ ],+ "properties": {+ "bank_transfer": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "wallet"+ ],+ "properties": {+ "wallet": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "pay_later"+ ],+ "properties": {+ "pay_later": {+ "$ref": "#/components/schemas/PaylaterResponse"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "paypal"+ ],+ "properties": {+ "paypal": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "bank_redirect"+ ],+ "properties": {+ "bank_redirect": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "crypto"+ ],+ "properties": {+ "crypto": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "bank_debit"+ ],+ "properties": {+ "bank_debit": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "mandate_payment"+ ],+ "properties": {+ "mandate_payment": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "reward"+ ],+ "properties": {+ "reward": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "real_time_payment"+ ],+ "properties": {+ "real_time_payment": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "upi"+ ],+ "properties": {+ "upi": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "voucher"+ ],+ "properties": {+ "voucher": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "gift_card"+ ],+ "properties": {+ "gift_card": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "card_redirect"+ ],+ "properties": {+ "card_redirect": {+ "type": "object"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "card_token"+ ],+ "properties": {+ "card_token": {+ "type": "object"+ }+ }+ }+ ]+ },+ "PaymentMethodDataResponseWithBilling": {+ "allOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodDataResponse"+ }+ ],+ "nullable": true+ },+ {+ "type": "object",+ "properties": {+ "billing": {+ "allOf": [+ {+ "$ref": "#/components/schemas/Address"+ }+ ],+ "nullable": true+ }+ }+ }+ ]+ },"PaymentMethodDeleteResponse": {"type": "object","required": [@@ -15830,12 +16112,12 @@"nullable": true},"payment_method": {- "$ref": "#/components/schemas/PaymentMethodType"+ "$ref": "#/components/schemas/PaymentMethod"},"payment_method_data": {"allOf": [{- "$ref": "#/components/schemas/PaymentMethod"+ "$ref": "#/components/schemas/PaymentMethodDataResponseWithBilling"}],"nullable": truediff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 573c977db2..1d4418bee1 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -2662,17 +2662,21 @@ pub struct ApplepayPaymentMethod {pub pm_type: String,}-#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]+#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]pub struct CardResponse {pub last4: Option<String>,pub card_type: Option<String>,+ #[schema(value_type = Option<CardNetwork>, example = "Visa")]pub card_network: Option<api_enums::CardNetwork>,pub card_issuer: Option<String>,pub card_issuing_country: Option<String>,pub card_isin: Option<String>,pub card_extended_bin: Option<String>,+ #[schema(value_type = Option<String>)]pub card_exp_month: Option<Secret<String>>,+ #[schema(value_type = Option<String>)]pub card_exp_year: Option<Secret<String>>,+ #[schema(value_type = Option<String>)]pub card_holder_name: Option<Secret<String>>,pub payment_checks: Option<serde_json::Value>,pub authentication_data: Option<serde_json::Value>,@@ -2799,7 +2803,7 @@ where}}-#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]+#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]#[serde(rename_all = "snake_case")]pub enum PaymentMethodDataResponse {#[serde(rename = "card")]@@ -2821,12 +2825,12 @@ pub enum PaymentMethodDataResponse {CardToken {},}-#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]+#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]pub struct PaylaterResponse {klarna_sdk: Option<KlarnaSdkPaymentMethodResponse>,}-#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]+#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]pub struct KlarnaSdkPaymentMethodResponse {pub payment_type: Option<String>,@@ -3400,12 +3404,12 @@ pub struct PaymentsResponse {pub capture_method: Option<api_enums::CaptureMethod>,/// The payment method that is to be used- #[schema(value_type = PaymentMethodType, example = "bank_transfer")]+ #[schema(value_type = PaymentMethod, example = "bank_transfer")]#[auth_based]pub payment_method: Option<api_enums::PaymentMethod>,/// The payment method information provided for making a payment- #[schema(value_type = Option<PaymentMethod>, example = "bank_transfer")]+ #[schema(value_type = Option<PaymentMethodDataResponseWithBilling>, example = "bank_transfer")]#[auth_based]#[serde(serialize_with = "serialize_payment_method_data_response")]pub payment_method_data: Option<PaymentMethodDataResponseWithBilling>,diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 01ffc01320..0c24fba34c 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -318,6 +318,11 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::SessionTokenInfo,api_models::payments::PaymentProcessingDetailsAt,api_models::payments::PaymentProcessingDetails,+ api_models::payments::PaymentMethodDataResponseWithBilling,+ api_models::payments::PaymentMethodDataResponse,+ api_models::payments::CardResponse,+ api_models::payments::PaylaterResponse,+ api_models::payments::KlarnaSdkPaymentMethodResponse,api_models::payments::SwishQrData,api_models::payments::AirwallexData,api_models::payments::NoonData,