Skip to content

Conversation

AmeyWale
Copy link
Contributor

@AmeyWale AmeyWale commented Jan 27, 2025

Type of Change

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

Description

Return redacted customer response instead of error when querying deleted customers.

Motivation and Context

Upon merging this PR, the API will return deleted Customer with redacted values instead of error.
#7126

How did you test it?

  • Create Customer API Call
curl --location 'http://localhost:8080/customers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "First customer",
    "address": {
        "line1": "1467",
        "line2": "Harrison Street",
        "line3": "Harrison Street",
        "city": "San Fransico",
        "state": "California",
        "zip": "94122",
        "country": "US",
        "first_name": "joseph",
        "last_name": "Doe"
    },
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  • Delete API Call for same customer
curl --location --request DELETE 'http://localhost:8080/customers/cus_vl2xIM4vJGaOVanI9rLl' \
--header 'Accept: application/json' \
--header 'api-key: *****'
  • Retrieve Customer API call for the same customer
curl --location 'http://localhost:8080/customers/cus_PEkI9z16lQRq2xAXOol5' \
--header 'Accept: application/json' \
--header 'api-key: dev_CN6BIH4qBtQTtH3smdKKJEwcyuaxiQgu9Yv6houFWmaOmgjhLtSNOGFLEDagthEZ'
  • Response from the above API Call
{"customer_id":"cus_PEkI9z16lQRq2xAXOol5","name":"Redacted","email":"Redacted","phone":"Redacted","phone_country_code":"Redacted","description":"Redacted","address":{"city":"Redacted","country":"US","line1":"Redacted","line2":"Redacted","line3":"Redacted","zip":"Redacted","state":"Redacted","first_name":"Redacted","last_name":"Redacted"},"created_at":"2025-01-28T07:15:35.740Z","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"default_payment_method_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

@AmeyWale AmeyWale requested a review from a team as a code owner January 27, 2025 13:10
Copy link

semanticdiff-com bot commented Jan 27, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/customers.rs  61% smaller

@AmeyWale AmeyWale force-pushed the refactor-customer-redact-response branch from 522d743 to cf39d28 Compare January 28, 2025 07:05
@AmeyWale AmeyWale self-assigned this Jan 28, 2025
@AmeyWale AmeyWale linked an issue Jan 28, 2025 that may be closed by this pull request
@AmeyWale AmeyWale changed the title refactor-customer-redact-response refactor(customer) : Return redacted customer instead of error Jan 28, 2025
@AmeyWale AmeyWale force-pushed the refactor-customer-redact-response branch from 7dbc9df to 53e98b8 Compare January 28, 2025 09:35
@AmeyWale AmeyWale requested a review from a team as a code owner January 28, 2025 09:35
@SanchithHegde SanchithHegde changed the title refactor(customer) : Return redacted customer instead of error refactor(customer): return redacted customer instead of error Jan 28, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 6, 2025
Merged via the queue into main with commit 97e9270 Feb 6, 2025
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the refactor-customer-redact-response branch February 6, 2025 15:04
pixincreate added a commit that referenced this pull request Feb 7, 2025
…unt-configurable

* 'main' of github.com:juspay/hyperswitch: (37 commits)
  refactor(router): add display_name field to connector feature api  (#7121)
  ci(cypress): Add Tests for Customer Deletion and Psync flows (#7158)
  feat(connector): [DataTrans] ADD 3DS Flow (#6026)
  chore(version): 2025.02.07.0
  chore(connectors): [fiuu] update pm_filters for apple pay and google pay (#7182)
  feat(router): add `organization_id` in authentication table and add it in authentication events (#7168)
  fix(dashboard_metadata): mask `poc_email` and `data_value` for DashboardMetadata (#7130)
  feat(core): Add support for v2 payments get intent using merchant reference id (#7123)
  refactor(customer): return redacted customer instead of error (#7122)
  fix(connector): handle unexpected error response from bluesnap connector (#7120)
  feat(routing): Contract based routing integration  (#6761)
  refactor(dynamic_fields): dynamic fields for Adyen and Stripe, renaming klarnaCheckout, WASM for KlarnaCheckout (#7015)
  feat(connector): [COINGATE] Add Template PR  (#7052)
  chore(roles): remove redundant variant from PermissionGroup (#6985)
  refactor(router): store `network_transaction_id` for `off_session` payments irrespective of the `is_connector_agnostic_mit_enabled` config (#7083)
  chore(connector): [Fiuu] log keys in the PSync response (#7189)
  ci(cypress): fix nmi and paypal (#7173)
  chore(version): 2025.02.06.0
  chore(postman): update Postman collection files
  feat(connector): [Deutschebank] Add Access Token Error struct (#7127)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor(customer) : Return redacted customer instead of error.
4 participants