Skip to content

Feat(Customer): Added search Feature to the Customer Page#9619

Merged
Gnanasundari24 merged 48 commits intomainfrom
customer_search
Oct 3, 2025
Merged

Feat(Customer): Added search Feature to the Customer Page#9619
Gnanasundari24 merged 48 commits intomainfrom
customer_search

Conversation

@VenuMadhav2541
Copy link
Contributor

@VenuMadhav2541 VenuMadhav2541 commented Sep 30, 2025

Type of Change

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

Description

This PR introduces improvements to the Customer page API:

Added search bar functionality to filter customers by customer_id.

These changes enhance API usability and improve performance when handling large customer datasets.

Additional Changes

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

Motivation and Context

  • Search functionality allows direct lookup by customer_id, making customer retrieval faster and more user-friendly.

How did you test it?

Executed the following API call to fetch the list of roles:
Before: No search bar for the searching Items.

curl --location 'http://localhost:8080/customers/list?limit=50&offset=0' \
--header 'Accept: application/json' \
--header 'api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-binary '@'

Response:

[
    {
        "customer_id": "cus_123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T08:05:42.489Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_124",
        "name": "Venu Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:34:15.146Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_125",
        "name": "Venu Madhav",
        "email": "guest123@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:34:23.527Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_126",
        "name": "Bandarupalli",
        "email": "guest1@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:34:39.328Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_127",
        "name": "venu 2",
        "email": "guest1@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:06.393Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_128",
        "name": "venu 3",
        "email": "guest2@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:15.853Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_129",
        "name": "venu 4",
        "email": "guest3@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:21.549Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_129",
        "name": "venu 5",
        "email": "guest4@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:27.178Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_130",
        "name": "venu 6",
        "email": "guest6@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:51.674Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_131",
        "name": "venu 7",
        "email": "guest7@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:35:56.948Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_132",
        "name": "venu 8",
        "email": "guest8@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:36:03.017Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_133",
        "name": "venu 9",
        "email": "guest9@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T09:36:08.331Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_134",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "description": null,
        "address": null,
        "created_at": "2025-09-24T10:29:03.242Z",
        "metadata": null,
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_135",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1",
        "description": null,
        "address": null,
        "created_at": "2025-09-24T10:30:14.808Z",
        "metadata": null,
        "default_payment_method_id": "pm_wQqUQeEP9YgJCLpa8NkG",
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_136",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1234",
        "description": null,
        "address": null,
        "created_at": "2025-09-24T13:49:24.111Z",
        "metadata": null,
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_137",
        "name": "venu 10",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-25T13:25:45.670Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_138",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "description": null,
        "address": null,
        "created_at": "2025-09-25T13:39:37.242Z",
        "metadata": null,
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_139",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "description": null,
        "address": null,
        "created_at": "2025-09-25T13:39:54.772Z",
        "metadata": null,
        "default_payment_method_id": null,
        "tax_registration_id": null
    },
    {
        "customer_id": "cus_140",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "description": null,
        "address": null,
        "created_at": "2025-09-25T13:42:24.499Z",
        "metadata": null,
        "default_payment_method_id": null,
        "tax_registration_id": null
    }
]

After adding the customer_id search feature

curl --location 'http://localhost:8080/customers/list?limit=50&offset=0&customer_id=cus_123' \
--header 'Accept: application/json' \
--header 'api-key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-binary '@'

Response

[
    {
        "customer_id": "cus_123",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "description": "First customer",
        "address": null,
        "created_at": "2025-09-24T08:05:42.489Z",
        "metadata": {
            "udf1": "value1",
            "new_customer": "true",
            "login_date": "2019-09-10T10:11:12Z"
        },
        "default_payment_method_id": null,
        "tax_registration_id": 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

@VenuMadhav2541 VenuMadhav2541 self-assigned this Sep 30, 2025
@VenuMadhav2541 VenuMadhav2541 requested review from a team as code owners September 30, 2025 08:46
@VenuMadhav2541 VenuMadhav2541 added the C-feature Category: Feature request or enhancement label Sep 30, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 30, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/diesel_models/src/query/customers.rs  25% smaller
  crates/api_models/src/customers.rs  0% smaller
  crates/hyperswitch_domain_models/src/customer.rs  0% smaller
  crates/router/src/core/customers.rs  0% smaller
  crates/router/src/core/locker_migration.rs  0% smaller

hrithikesh026
hrithikesh026 previously approved these changes Oct 1, 2025
apoorvdixit88
apoorvdixit88 previously approved these changes Oct 1, 2025
Ok(services::ApplicationResponse::Json(customers))
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick* this line can be removed.

tsdk02
tsdk02 previously approved these changes Oct 1, 2025
@hyperswitch-bot hyperswitch-bot bot dismissed stale reviews from tsdk02, apoorvdixit88, and hrithikesh026 via 9460bfc October 1, 2025 10:25
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 3, 2025
@Gnanasundari24 Gnanasundari24 removed this pull request from the merge queue due to a manual request Oct 3, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 3, 2025
Merged via the queue into main with commit e186a0f Oct 3, 2025
29 of 33 checks passed
@Gnanasundari24 Gnanasundari24 deleted the customer_search branch October 3, 2025 10:06
pixincreate added a commit that referenced this pull request Oct 7, 2025
…esouro-googlepay

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [tesouro] apple pay (#9648)
  fix(payments): update error handling for payment void v2 (#9595)
  fix(connectors): [Nexixpay] MIT & order_id fix (#9644)
  chore(version): 2025.10.07.0
  fix(database): percent-encode spaces in Postgres connection URI (#9685)
  chore(version): 2025.10.06.0
  feat(subscriptions): Invoice record back workflow (#9529)
  feat: Implement subscriptions workflow and incoming webhook support (#9400)
  Feat(Customer): Added search Feature to the Customer Page (#9619)
  chore(version): 2025.10.02.0
  feat(subscription): Add support to call payments microservice from subscription service via payments API client (#9590)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-feature Category: Feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: [Customer] Add search support to Customer API by Customer_ID

5 participants