Skip to content

Commit

Permalink
refactor(payment_methods_v2): rename payment_method and `payment_me…
Browse files Browse the repository at this point in the history
…thod_type` fields and use concrete type for `payment_method_data` (#6555)
  • Loading branch information
SanchithHegde authored and Sayak Bhattacharya committed Nov 26, 2024
1 parent b560591 commit 30d3d81
Show file tree
Hide file tree
Showing 31 changed files with 1,169 additions and 496 deletions.
557 changes: 321 additions & 236 deletions api-reference-v2/openapi_spec.json

Large diffs are not rendered by default.

243 changes: 209 additions & 34 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6144,6 +6144,27 @@
],
"description": "Masked payout method details for bank payout method"
},
"BankCodeResponse": {
"type": "object",
"required": [
"bank_name",
"eligible_connectors"
],
"properties": {
"bank_name": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BankNames"
}
},
"eligible_connectors": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"BankDebitAdditionalData": {
"oneOf": [
{
Expand Down Expand Up @@ -6414,6 +6435,20 @@
}
]
},
"BankDebitTypes": {
"type": "object",
"required": [
"eligible_connectors"
],
"properties": {
"eligible_connectors": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"BankHolderType": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -7637,6 +7672,25 @@
}
]
},
"BankTransferTypes": {
"type": "object",
"required": [
"eligible_connectors"
],
"properties": {
"eligible_connectors": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of eligible connectors for a given payment experience",
"example": [
"stripe",
"adyen"
]
}
}
},
"BankType": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -8362,6 +8416,41 @@
"Maestro"
]
},
"CardNetworkTypes": {
"type": "object",
"required": [
"eligible_connectors"
],
"properties": {
"card_network": {
"allOf": [
{
"$ref": "#/components/schemas/CardNetwork"
}
],
"nullable": true
},
"surcharge_details": {
"allOf": [
{
"$ref": "#/components/schemas/SurchargeDetailsResponse"
}
],
"nullable": true
},
"eligible_connectors": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of eligible connectors for a given card network",
"example": [
"stripe",
"adyen"
]
}
}
},
"CardPayout": {
"type": "object",
"required": [
Expand Down Expand Up @@ -15067,6 +15156,33 @@
"collect_otp"
]
},
"PaymentExperienceTypes": {
"type": "object",
"required": [
"eligible_connectors"
],
"properties": {
"payment_experience_type": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentExperience"
}
],
"nullable": true
},
"eligible_connectors": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of eligible connectors for a given payment experience",
"example": [
"stripe",
"adyen"
]
}
}
},
"PaymentLinkConfig": {
"type": "object",
"required": [
Expand Down Expand Up @@ -16067,28 +16183,6 @@
"jp_bacs"
]
},
"PaymentMethodList": {
"type": "object",
"required": [
"payment_method"
],
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
},
"payment_method_types": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentMethodType"
},
"description": "This is a sub-category of payment method.",
"example": [
"credit"
],
"nullable": true
}
}
},
"PaymentMethodListResponse": {
"type": "object",
"required": [
Expand All @@ -16112,19 +16206,9 @@
"payment_methods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentMethodList"
"$ref": "#/components/schemas/ResponsePaymentMethodsEnabled"
},
"description": "Information about the payment method",
"example": [
{
"payment_experience": null,
"payment_method": "wallet",
"payment_method_issuers": [
"labore magna ipsum",
"aute"
]
}
]
"description": "Information about the payment method"
},
"mandate_payment": {
"$ref": "#/components/schemas/MandateType"
Expand Down Expand Up @@ -22388,6 +22472,97 @@
}
}
},
"ResponsePaymentMethodTypes": {
"type": "object",
"required": [
"payment_method_type"
],
"properties": {
"payment_method_type": {
"$ref": "#/components/schemas/PaymentMethodType"
},
"payment_experience": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentExperienceTypes"
},
"description": "The list of payment experiences enabled, if applicable for a payment method type",
"nullable": true
},
"card_networks": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardNetworkTypes"
},
"description": "The list of card networks enabled, if applicable for a payment method type",
"nullable": true
},
"bank_names": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BankCodeResponse"
},
"description": "The list of banks enabled, if applicable for a payment method type",
"nullable": true
},
"bank_debits": {
"allOf": [
{
"$ref": "#/components/schemas/BankDebitTypes"
}
],
"nullable": true
},
"bank_transfers": {
"allOf": [
{
"$ref": "#/components/schemas/BankTransferTypes"
}
],
"nullable": true
},
"required_fields": {
"type": "object",
"description": "Required fields for the payment_method_type.",
"additionalProperties": {
"$ref": "#/components/schemas/RequiredFieldInfo"
},
"nullable": true
},
"surcharge_details": {
"allOf": [
{
"$ref": "#/components/schemas/SurchargeDetailsResponse"
}
],
"nullable": true
},
"pm_auth_connector": {
"type": "string",
"description": "auth service connector label for this payment method type, if exists",
"nullable": true
}
}
},
"ResponsePaymentMethodsEnabled": {
"type": "object",
"required": [
"payment_method",
"payment_method_types"
],
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
},
"payment_method_types": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ResponsePaymentMethodTypes"
},
"description": "The list of payment method types enabled for a connector account"
}
}
},
"RetrieveApiKeyResponse": {
"type": "object",
"description": "The response body for retrieving an API Key.",
Expand Down
4 changes: 2 additions & 2 deletions crates/api_models/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ impl ApiEventMetric for PaymentMethodIntentConfirmInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethod {
payment_method_id: self.id.clone(),
payment_method: Some(self.payment_method),
payment_method_type: Some(self.payment_method_type),
payment_method: Some(self.payment_method_type),
payment_method_type: Some(self.payment_method_subtype),
})
}
}
Expand Down
13 changes: 13 additions & 0 deletions crates/api_models/src/events/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,26 @@ impl ApiEventMetric for PaymentsResponse {
}

impl ApiEventMetric for PaymentMethodResponse {
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "payment_methods_v2")
))]
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethod {
payment_method_id: self.payment_method_id.clone(),
payment_method: self.payment_method,
payment_method_type: self.payment_method_type,
})
}

#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethod {
payment_method_id: self.payment_method_id.clone(),
payment_method: self.payment_method_type,
payment_method_type: self.payment_method_subtype,
})
}
}

impl ApiEventMetric for PaymentMethodUpdate {}
Expand Down
Loading

0 comments on commit 30d3d81

Please sign in to comment.