refactor(customer): refactor customer db with storage utils and move trait to domain_models and impl to storage_model#7538
Merged
Gnanasundari24 merged 29 commits intomainfrom Apr 15, 2025
Merged
Conversation
… avoid conversion of errors in storage_impl
…actor-storage-error
…perswitch into refactor-customer-db
Changed Files
|
jarnura
requested changes
Mar 27, 2025
jarnura
previously approved these changes
Apr 1, 2025
jarnura
requested changes
Apr 10, 2025
jarnura
requested changes
Apr 10, 2025
jarnura
approved these changes
Apr 11, 2025
ShankarSinghC
approved these changes
Apr 11, 2025
pixincreate
added a commit
that referenced
this pull request
Apr 15, 2025
…acilitapay-pix-pmt * 'main' of github.com:juspay/hyperswitch: feat(docker): add webhook notifiers for installation tracking (#7653) refactor(customer): refactor customer db with storage utils and move trait to domain_models and impl to storage_model (#7538) feat(core): Add support for updating metadata after payment has been authorized (#7776) chore(version): 2025.04.14.0 fix: script for one click docker setup (#7762) fix(payment_link): add validation for return_url during payment link creation (#7802) chore: address Rust 1.86.0 clippy lints (#7735) fix(connector): Add network error message support for payment connectors (#7760) feat(webhook): add filter by event class and type (#7275) ci(cypress): verify if card fields are populated on updating card info (#7743) chore(version): 2025.04.11.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Additional Changes
Motivation and Context
As part of Payment method crate seperation, customer DB is required in payment methods so moving it out from router
How did you test it?
Start router service with
cargo rWith KV disabled for the merchant
2. Create Customer
RequestResponse
{
"customer_id": "cus_LcqiGN9t81YjqIyMgKWt",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"address": null,
"created_at": "2025-03-27T09:06:56.214Z",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"default_payment_method_id": null
}
3. Retrieve Customer
Request
Response
4. Update Customer
Request
Response
5. Delete Customer
Request
Response
With KV enabled for a merchant
2. Enable KV for the merchant
Request
Response
3. Create Customer
RequestResponse
{
"customer_id": "cus_hS8uA0hvtVdbBa8ecYOw",
"name": "John Doe",
"email": "guest@example.com",
"phone": "999999999",
"phone_country_code": "+65",
"description": "First customer",
"address": null,
"created_at": "2025-03-27T09:19:49.092Z",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
},
"default_payment_method_id": null
}
4. Retrieve Customer
Request
Response
5. Update Customer
Request
Response
6. Delete Customer
Request
Response
7. Retrieve Customer
Request
Response
Start Drainer
After adding drainer, the KV created customer will be added into db by drainer, so read, update and delete operation should work fine after starting it.
Apply below changes
In docker-compose.yml change drainer as below
Run the drainer with
docker-compose up hyperswitch-drainerWith KV disabled for the same merchant
1. Disable KV for the same merchant
Request
Response
2. Update Customer details
Request
Response
3. Get Customer
Request
curl --location 'http://localhost:8080/customers/cus_hS8uA0hvtVdbBa8ecYOw'
--header 'Accept: application/json'
--header 'api-key: dev_f3M5W0ZyHHsCUekQ6z1mPraNzaUzrb73No6SPnlDbFGUygPOJtOOfCIyyHUGXmwL'
Response
4. Delete Customer
RequestResponse
Checklist
cargo +nightly fmt --allcargo clippy