-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(payment_methods_v2): add payment methods list endpoint #6938
feat(payment_methods_v2): add payment methods list endpoint #6938
Conversation
…payment methods list" This reverts commit 70cb8a1.
There are conflicts @Narayanbhat166 |
#[cfg(feature = "v2")] | ||
PaymentMethod { | ||
payment_method_id: id_type::GlobalPaymentMethodId, | ||
payment_method_type: Option<common_enums::PaymentMethod>, | ||
payment_method_subtype: Option<common_enums::PaymentMethodType>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also need corresponding ClickHouse migrations. Can we avoid renaming fields in analytics related stuff for the time being?
#[cfg_attr(feature = "v2", derive(Default))] // Configs are read from the config file in config/payout_required_fields.toml | ||
pub struct PayoutRequiredFields(pub HashMap<enums::PaymentMethod, PaymentMethodType>); | ||
|
||
#[derive(Debug, Deserialize, Clone)] | ||
#[cfg_attr(feature = "v2", derive(Default))] // Configs are read from the config file in config/payment_required_fields.toml | ||
pub struct RequiredFields(pub HashMap<enums::PaymentMethod, PaymentMethodType>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is Default
being derived here? Can we remove it if it's not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default is derived because it is mandated in Settings
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#[cfg(feature = "v2")] | ||
trait PerformFilteringOnEnabledPaymentMethods { | ||
fn perform_filtering(self) -> FilteredPaymentMethodsEnabled; | ||
} | ||
|
||
#[cfg(feature = "v2")] | ||
impl PerformFilteringOnEnabledPaymentMethods | ||
for hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled | ||
{ | ||
fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { | ||
FilteredPaymentMethodsEnabled(self.payment_methods_enabled) | ||
} | ||
} | ||
|
||
#[cfg(feature = "v2")] | ||
/// Container for the inputs required for the required fields | ||
struct RequiredFieldsInput { | ||
required_fields_config: settings::RequiredFields, | ||
} | ||
|
||
#[cfg(feature = "v2")] | ||
impl RequiredFieldsInput { | ||
fn new(required_fields_config: settings::RequiredFields) -> Self { | ||
Self { | ||
required_fields_config, | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem to be internal types, can we then move these to crates/router/src/types/payment_methods.rs
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sarthak1799 these types are internal to this module and the types are based around the impls defined on them. These types are not reusable by any other modules. So it is better to be defined in this module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dashboard specific changes looks fine.
Type of Change
Description
This PR adds payment methods list endpoint for payment methods endpoint for payment methods. This will be used to display the list of payment methods that are enabled by the merchant.
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy