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

feat: filter out payment_methods which does not support mandates during list api call #1318

Merged
merged 45 commits into from
Jul 14, 2023

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented May 30, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

When a mandate payment is created, sdk makes a payment_method_list api call which lists all the payment_methods. But not all of them support mandate payments.
Added a filter for payment_methods which filters payment methods that doesn't support mandates and list only those which supports, during payment_method_list api call.
Created an hashmap containing info about which payment_methods through which connector, supports mandates. And while listing payment methods, validate between the merchant configured payment_methods and the supported payment_methods.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

crates/router/src/configs/settings.rs

Motivation and Context

List the payment_methods which support mandates filtering out others.

How did you test it?

Postman
Configured payment methods -
Screenshot 2023-05-30 at 4 08 41 PM
Screenshot 2023-05-30 at 4 09 01 PM

Filtered payment methods -
Screenshot 2023-05-30 at 4 10 07 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@Chethan-rao Chethan-rao added C-feature Category: Feature request or enhancement M-configuration-changes Metadata: This PR involves configuration changes R-waiting-on-L1 Review: Waiting on L1 reviewer labels May 30, 2023
@Chethan-rao Chethan-rao added this to the May 2023 Release milestone May 30, 2023
@Chethan-rao Chethan-rao self-assigned this May 30, 2023
@Chethan-rao Chethan-rao requested review from a team as code owners May 30, 2023 10:23
@github-actions github-actions bot added the S-conventions-not-followed Status: This PR does not follow contributing guidelines label May 30, 2023
@Chethan-rao Chethan-rao changed the title feat(filter): filter out payment_methods which doesn't support mandates during list api call feat: filter out payment_methods which doesn't support mandates during list api call May 30, 2023
@Chethan-rao Chethan-rao removed the S-conventions-not-followed Status: This PR does not follow contributing guidelines label May 30, 2023
@github-actions github-actions bot added the S-conventions-not-followed Status: This PR does not follow contributing guidelines label May 30, 2023
@Abhicodes-crypto Abhicodes-crypto changed the title feat: filter out payment_methods which doesn't support mandates during list api call feat: filter out payment_methods which does not support mandates during list api call May 30, 2023
@github-actions github-actions bot removed the S-conventions-not-followed Status: This PR does not follow contributing guidelines label May 30, 2023
@Chethan-rao Chethan-rao added R-waiting-on-L2 Review: Waiting on L2 reviewer and removed R-waiting-on-L1 Review: Waiting on L1 reviewer labels Jul 11, 2023
@Chethan-rao Chethan-rao requested review from jarnura and lsampras and removed request for jarnura, lsampras and NishantJoshi00 July 11, 2023 10:44
@Chethan-rao Chethan-rao requested a review from jarnura July 12, 2023 06:10
@bernard-eugine bernard-eugine added the P-high Priority: High label Jul 13, 2023

#[derive(Debug, Deserialize, Clone)]
pub struct SupportedPaymentMethodsForMandate(
pub HashMap<enums::PaymentMethod, SupportedPaymentMethodTypesForMandate>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this hashmap be built through config or can there be a global static? I understand that having a config based approach will let us turn things on/off during startup, but the config structure keeps getting bloated, which gets cloned, passed to each actix thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that config structure is getting messy, but making it a global static will require re-deploying the application if any changes in the config right?

@jarnura jarnura added this pull request to the merge queue Jul 14, 2023
@jarnura jarnura added S-ready-for-merge and removed R-waiting-on-L2 Review: Waiting on L2 reviewer labels Jul 14, 2023
Merged via the queue into main with commit 07aef53 Jul 14, 2023
@jarnura jarnura deleted the filter_pmd_mandates branch July 14, 2023 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mandates Area: Mandate Flows C-feature Category: Feature request or enhancement M-configuration-changes Metadata: This PR involves configuration changes
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[FEATURE] filter out payment_methods which doesn't support mandates during list api call
10 participants