Skip to content

Conversation

AmeyWale
Copy link
Contributor

@AmeyWale AmeyWale commented Apr 23, 2025

Type of Change

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

Description

We are removing merchant_reference_id from all API updates, due to possible bugs on merchant side db and HS db as there might be mismatch in their's and our's db records. This exists only in customers and refunds v2 apis, a separate PR has been implemented for refunds update, and this PR is for customers v2 update api.

It was noticed that in the current implementation of customers v2 update flow, the merchant_reference_id field is being accepted by the API but it was never updated in the db. In this PR we are removing merchant_reference_id from being accepted in the customers v2 update request.

Additional Changes

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

Motivation and Context

Upon merging this PR, we will be removing merchant_reference_id from being updated in customer v2 update api.

How did you test it?

  • Create Customer API Call
curl --location 'http://localhost:8080/v2/customers' \
--header 'x-profile-id: pro_saOFnM13wT1ngOuItKJl' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_VAtwaBd0cVItaaxIS8bUTFuPcxa9DkqlmBPvH5fq6IASKSlBxc9cBUygLoCaebFj' \
--data-raw '{   
    "merchant_reference_id": "customer_1748929359",
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "First customer",
    "default_billing_address": null,
    "default_shipping_address": null,
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  • Response from above call
{
    "id": "12345_cus_0197344f74677930a77bfc4c926c3b3e",
    "merchant_reference_id": "customer_1748929312",
    "connector_customer_ids": null,
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "First customer",
    "default_billing_address": null,
    "default_shipping_address": null,
    "created_at": "2025-06-03T05:41:51.849Z",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "default_payment_method_id": null
}
  • Customer Update API call
curl --location --request PUT 'http://localhost:8080/v2/customers/12345_cus_0197344f74677930a77bfc4c926c3b3e' \
--header 'x-profile-id: pro_saOFnM13wT1ngOuItKJl' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_VAtwaBd0cVItaaxIS8bUTFuPcxa9DkqlmBPvH5fq6IASKSlBxc9cBUygLoCaebFj' \
--data-raw '{   
    "name": "Jane Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Second customer",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  • Response from the above call
{
    "id": "12345_cus_0197344f74677930a77bfc4c926c3b3e",
    "merchant_reference_id": "customer_1748929312",
    "connector_customer_ids": null,
    "name": "Jane Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Second customer",
    "default_billing_address": null,
    "default_shipping_address": null,
    "created_at": "2025-06-03T05:41:51.849Z",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "default_payment_method_id": null
}
  • Trying to update merchant_reference_id API call
curl --location --request PUT 'http://localhost:8080/v2/customers/12345_cus_0197344f74677930a77bfc4c926c3b3e' \
--header 'x-profile-id: pro_saOFnM13wT1ngOuItKJl' \
--header 'Content-Type: application/json' \
--header 'Authorization: api-key=dev_VAtwaBd0cVItaaxIS8bUTFuPcxa9DkqlmBPvH5fq6IASKSlBxc9cBUygLoCaebFj' \
--data-raw '{   
    "merchant_reference_id": "customer_1748929499",
    "name": "Jane Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Second customer",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
  • Response from the above call
{
    "error": {
        "error_type": "invalid_request",
        "message": "Json deserialize error: unknown field `merchant_reference_id`, expected one of `name`, `email`, `phone`, `description`, `phone_country_code`, `default_billing_address`, `default_shipping_address`, `metadata`, `default_payment_method_id` at line 2 column 27",
        "code": "IR_06"
    }
}

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 April 23, 2025 09:07
Copy link

semanticdiff-com bot commented Apr 23, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  api-reference-v2/openapi_spec.json  0% smaller
  crates/api_models/src/customers.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Apr 23, 2025
@AmeyWale AmeyWale self-assigned this Apr 23, 2025
@AmeyWale AmeyWale linked an issue Apr 23, 2025 that may be closed by this pull request
@likhinbopanna likhinbopanna added this pull request to the merge queue Jun 9, 2025
Merged via the queue into main with commit d6ad852 Jun 9, 2025
26 of 31 checks passed
@likhinbopanna likhinbopanna deleted the remove-merchant-reference-id-from-customer-v2-update branch June 9, 2025 07:54
pixincreate added a commit that referenced this pull request Jun 9, 2025
…nktransfer

* 'main' of github.com:juspay/hyperswitch: (211 commits)
  feat(tokenio): Add OpenBanking Redirection Flow (#8152)
  fix: Unified scarf setup (#8238)
  feat(health): Health check for Decision engine (#8243)
  chore: Update apple pay currency filter configs (#8217)
  refactor(customers_v2): Remove merchant reference id from v2 customer update (#7879)
  chore(version): 2025.06.09.0
  chore(postman): update Postman collection files
  ci(postman): add tunnel collection to postman tests (#8269)
  feat(connector): Added recurring payments support for split payments in Stripe (#8271)
  feat(connector): [STRIPE] Added Connector Tokenization Flow for Cards (#8248)
  refactor(core): introduce new field in payment_intent to handle longer return_url (#8135)
  fix(connector): [AUTHORIZEDOTNET] Remove country PM filters (#8278)
  refactor(config): redact config urls for hyperswitch vault (#8276)
  feat(vsaas): enable onboarding of Standard Merchant Accounts in Platform Organization (#8231)
  feat(router): add three_ds decision rule execute api (#8148)
  feat(router): Save payment method on payments confirm (V2) (#8090)
  ci(cypress): Add Airwallex Connector Test (#8187)
  feat(payment_methods): add `external_vault_details` for payments v2 sdk session call (#8003)
  fix(connector): [facilitapay] cpf is a required field (#8274)
  fix: Fixed spell check (#8227)
  ...
pixincreate added a commit that referenced this pull request Jun 10, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch: (63 commits)
  feat(connector): [TRUSTPAY] Added Integrity Checks for PSync & RSync flows & Added New Variants in AttemptStatus & IntentStatus (#8096)
  fix(connector): [STRIPE] Throwing Missing Required Field Error if connector_customer is not present (#8309)
  refactor(connectors): [worldpayvantiv] replace sandbox url with pre-live url and fix typo (#8286)
  fix: payment link styling for dynamic classes (#8273)
  feat(core): Make installment_payment_enabled,recurring_enabled Optional (#8201)
  fix(cypress): fix itaubank, datatrans and facilitapay (#8229)
  fix(connector): [jpmorgan] 5xx during payment authorize and `cancellation_reason` (#8282)
  revert(connector): [Worldpay] add root CA certificate (#8224)
  ci(cypress): fix fiuu, fiservemea , paybox and worldpay connector (#8209)
  fix(connector): removed forked josekit dependency from payout connector Nomupay (#8183)
  chore(version): 2025.06.10.0
  feat(tokenio): Add OpenBanking Redirection Flow (#8152)
  fix: Unified scarf setup (#8238)
  feat(health): Health check for Decision engine (#8243)
  chore: Update apple pay currency filter configs (#8217)
  refactor(customers_v2): Remove merchant reference id from v2 customer update (#7879)
  chore(version): 2025.06.09.0
  chore(postman): update Postman collection files
  ci(postman): add tunnel collection to postman tests (#8269)
  feat(connector): Added recurring payments support for split payments in Stripe (#8271)
  ...
pixincreate added a commit that referenced this pull request Jun 10, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch: (63 commits)
  feat(connector): [TRUSTPAY] Added Integrity Checks for PSync & RSync flows & Added New Variants in AttemptStatus & IntentStatus (#8096)
  fix(connector): [STRIPE] Throwing Missing Required Field Error if connector_customer is not present (#8309)
  refactor(connectors): [worldpayvantiv] replace sandbox url with pre-live url and fix typo (#8286)
  fix: payment link styling for dynamic classes (#8273)
  feat(core): Make installment_payment_enabled,recurring_enabled Optional (#8201)
  fix(cypress): fix itaubank, datatrans and facilitapay (#8229)
  fix(connector): [jpmorgan] 5xx during payment authorize and `cancellation_reason` (#8282)
  revert(connector): [Worldpay] add root CA certificate (#8224)
  ci(cypress): fix fiuu, fiservemea , paybox and worldpay connector (#8209)
  fix(connector): removed forked josekit dependency from payout connector Nomupay (#8183)
  chore(version): 2025.06.10.0
  feat(tokenio): Add OpenBanking Redirection Flow (#8152)
  fix: Unified scarf setup (#8238)
  feat(health): Health check for Decision engine (#8243)
  chore: Update apple pay currency filter configs (#8217)
  refactor(customers_v2): Remove merchant reference id from v2 customer update (#7879)
  chore(version): 2025.06.09.0
  chore(postman): update Postman collection files
  ci(postman): add tunnel collection to postman tests (#8269)
  feat(connector): Added recurring payments support for split payments in Stripe (#8271)
  ...
bsayak03 pushed a commit that referenced this pull request Jun 11, 2025
… update (#7879)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] Remove merchant reference id from customers v2 update api
4 participants