# Update User source: https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/testing/testcase/test_case_update_user/index.md The **Update User** service allows the Issuer to update enrolled user information in the Carbon Calculator Experience API. ## Pre-requisites {#pre-requisites} Refer to the [Update User](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/use-cases/update_user/index.md) use case details. API Reference: `GET /issuers/users/{userid}`
## Test Cases {#test-cases} ### Test Case: Success - Update User Details {#test-case-success---update-user-details} ##### Request {#request} ```json { "name": { "firstName": "Johnn", "lastName": "Dooe" }, "billingAddress": { "countryCode": "USA", "locality": "Rly Station", "postalCode": "11746", "state": "Huntington", "city": "Brooklyn", "line1": "83 Mayfair Street", "line2": "Main Road", "line3": "Snake Hill Ave", "type": "work" }, "locale": "en-US" } ``` ##### Response {#response} ```json { "userid": "c8b38606-12b2-43c6-a641-be8eb0ab9dec", "cardNumberLastFourDigits": "3150", "status": "ACTIVE" } ``` ### Test Case: Fail - Invalid lastName {#test-case-fail---invalid-lastname} ##### Request {#request-1} ```json { "name": { "firstName": "Johnn", "lastName": "444555454" }, "billingAddress": { "countryCode": "USA", "locality": "Rly Station", "postalCode": "11746", "state": "Huntington", "city": "Brooklyn", "line1": "83 Mayfair Street", "line2": "Main Road", "line3": "Snake Hill Ave", "type": "work" }, "locale": "en-US" } ``` ##### Response {#response-1} ```json { "Errors": { "Error": [ { "Source": "CARBON CALCULATOR EXPERIENCE", "ReasonCode": "INVALID_REQUEST_PARAMETER", "Description": "One of the request parameters is invalid, try again with correct request.", "Recoverable": false, "Details": "Username must only contain alphanumeric (A-Z, a-z, 0-9) and the characters ('), (,) and (')" } ] } } ``` ### Test Case: Fail - Locale invalid format {#test-case-fail---locale-invalid-format} ##### Request {#request-2} ```json { "name": { "firstName": "Johnn", "lastName": "Dooe" }, "billingAddress": { "countryCode": "USA", "locality": "Rly Station", "postalCode": "11746", "state": "Huntington", "city": "Brooklyn", "line1": "83 Mayfair Street", "line2": "Main Road", "line3": "Snake Hill Ave", "type": "work" }, "locale": "455666" } ``` ##### Response {#response-2} ```json { "Errors": { "Error": [ { "Source": "CARBON CALCULATOR EXPERIENCE", "ReasonCode": "INVALID_REQUEST_PARAMETER", "Description": "One of the request parameters is invalid, try again with correct request.", "Recoverable": false, "Details": "Locale must be in the format: \"ab-YZ\"" } ] } } ``` ### Test Case: Fail - The issuer disabled the donation flow at the time of onboarding. {#test-case-fail---the-issuer-disabled-the-donation-flow-at-the-time-of-onboarding} ##### Request {#request-3} ```json { "name": { "firstName": "Johnn", "lastName": "Dooe" }, "billingAddress": { "countryCode": "USA", "locality": "Rly Station", "postalCode": "11746", "state": "Huntington", "city": "Brooklyn", "line1": "83 Mayfair Street", "line2": "Main Road", "line3": "Snake Hill Ave", "type": "work" }, "locale": "455666" } ``` ##### Response {#response-3} ```json { "Errors": { "Error": [ { "Source": "CARBON CALCULATOR EXPERIENCE", "ReasonCode": "UPDATE_USER_NOT_ACCESSIBLE", "Description": "You do not have permission to access this API. The Donate feature for your bank is disabled.", "Recoverable": false, "Details": "You do not have permission to access this API. The Donate feature for your bank is disabled." } ] } } ```