Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(payment_methods_v2): rename payment_method and payment_method_type fields and use concrete type for payment_method_data #6555

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -14973,6 +15062,33 @@
"display_wait_screen"
]
},
"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 @@ -15937,28 +16053,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 @@ -15982,19 +16076,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 @@ -22257,6 +22341,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 @@ -173,8 +173,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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we not changing the field name her?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since renaming the field affects the analytics pipeline, we'd have to include ClickHouse migrations as well.
For now, I'm not including v2 changes in the analytics pipeline.

CC: @ShivanshMathurJuspay @tsdk02

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we renaming payment_method to payment_method_type ?

payment_method_type: self.payment_method_subtype,
})
}
}

impl ApiEventMetric for PaymentMethodUpdate {}
Expand Down
Loading
Loading