Skip to content

Conversation

@GauravRawat369
Copy link
Contributor

@GauravRawat369 GauravRawat369 commented Feb 2, 2026

Type of Change

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

Description

This pull request introduces support for routing customer payment method listing requests through a modular service, based on organizational eligibility. The changes add new request and response types, update query parameter handling, and implement conditional logic to determine whether to use the modular service or the legacy flow. Additionally, a new helper function is provided to facilitate modular service calls with appropriate headers.

Modular service integration for customer payment method listing:

  • Added new request (ListCustomerPaymentMethodsV1Request) and response (ListCustomerPaymentMethodsV1Response) types to support modular service calls, including fields for service prefix and guest customer status.
  • Updated query parameter construction to handle optional parameters and include the modular service prefix in API paths. [1] [2] [3]

Conditional routing based on organizational eligibility:

  • Integrated get_organization_eligibility_config_for_pm_modular_service to determine if requests should be routed to the modular service, and updated the main listing logic to branch accordingly. [1] [2] [3]

Helper function for modular service calls:

  • Added list_customer_pml_modular_service_call to build requests, set headers, and invoke the modular service client for payment method listing.

Imports and code organization:

  • Updated imports to support new functionality and helper functions for modular service integration. [1] [2]

Additional Changes

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

Motivation and Context

How did you test it?

Request

curl --location 'http://localhost:8080/customers/12345_cus_019c2328ac127c018b64028fb83b2537/payment_methods' \
--header 'Accept: application/json' \
--header 'api-key: dev_lYlSW9umndQrewmQ4WYPIjNTZzag4bQZtvNKSCfPkULSCGTgJEdAwyrh5uGQEDFs'

Response

{
    "customer_payment_methods": [
        {
            "payment_token": "12345_pm_019c232911937750a630379930170ab7",
            "payment_method_id": "12345_pm_019c232911937750a630379930170ab7",
            "customer_id": "12345_cus_019c2328ac127c018b64028fb83b2537",
            "payment_method": "card",
            "payment_method_type": "credit",
            "payment_method_issuer": null,
            "payment_method_issuer_code": null,
            "recurring_enabled": true,
            "installment_payment_enabled": null,
            "payment_experience": null,
            "card": {
                "scheme": null,
                "issuer_country": null,
                "issuer_country_code": null,
                "last4_digits": "4242",
                "expiry_month": "03",
                "expiry_year": "2028",
                "card_token": null,
                "card_holder_name": "joseph Doe",
                "card_fingerprint": null,
                "nick_name": null,
                "card_network": null,
                "card_isin": null,
                "card_issuer": null,
                "card_type": null,
                "saved_to_locker": true
            },
            "metadata": null,
            "created": "2026-02-03T11:00:19.987Z",
            "bank": null,
            "surcharge_details": null,
            "requires_cvv": true,
            "last_used_at": "2026-02-03T11:00:19.987Z",
            "default_payment_method_set": false,
            "billing": null
        }
    ],
    "is_guest_customer": null
}

Checklist

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

@GauravRawat369 GauravRawat369 requested a review from a team as a code owner February 2, 2026 22:42
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 2, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/payment_methods/src/client/list.rs  82% smaller
  crates/router/src/core/payment_methods/cards.rs  47% smaller
  crates/router/src/core/payment_methods/transformers.rs  3% smaller

@GauravRawat369 GauravRawat369 self-assigned this Feb 2, 2026
@GauravRawat369 GauravRawat369 added S-test-ready Status: This PR is ready for cypress-tests A-payment-methods Area: Payment Methods labels Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-payment-methods Area: Payment Methods S-test-ready Status: This PR is ready for cypress-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant