# Enroll User source: https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/testing/testcase/test_case_enroll_user/index.md The **Enroll User** service allows the Issuer to register a consumer in the Carbon Calculator Experience API. ## Pre-requisites {#pre-requisites} Refer to the [Enroll User](https://developer.mastercard.com/priceless-planet-carbon-tracker/documentation/use-cases/enroll_user/index.md) use case details. API Reference: `GET /issuers/users`
## Test Cases {#test-cases} ### Test Case: Success - Enroll User {#test-case-success---enroll-user} ##### Request {#request} ```json { "email": { "type": "home", "value": "johnn.dooe@gmail.com" }, "name": { "firstName": "Johnn", "lastName": "Dooe" }, "cardholderName": "Johnn Dooe", "cardNumber": "2223006448842520", "cardBaseCurrency": "USD", "expiryInfo": { "month": "01", "year": "2039" }, "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 Card Number {#test-case-fail---invalid-card-number} ##### Request {#request-1} ```json { "email": { "type": "home", "value": "johnn.dooe@gmail.com" }, "name": { "firstName": "Johnn", "lastName": "Dooe" }, "cardholderName": "Johnn Dooe", "cardNumber": "22230064488425200", "cardBaseCurrency": "USD", "expiryInfo": { "month": "01", "year": "2039" }, "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": "Card Number must match \"^[0-9]{16}$\"" } ] } } ``` ### Test Case: Success - Card Base Currency invalid format {#test-case-success---card-base-currency-invalid-format} ##### Request {#request-2} ```json { "email": { "type": "home", "value": "johnn.dooe@gmail.com" }, "name": { "firstName": "Johnn", "lastName": "Dooe" }, "cardholderName": "Johnn Dooe", "cardNumber": "2223006448842520", "cardBaseCurrency": "USDA", "expiryInfo": { "month": "01", "year": "2039" }, "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-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": "CardBaseCurrency must be in the format: \"XYZ\"" } ] } } ``` ### Test Case: Success - The issuer disabled the donation flow at the time of onboarding. (In this case, the Billing Address, Name and Locale are not mandatory fields). {#test-case-success---the-issuer-disabled-the-donation-flow-at-the-time-of-onboarding-in-this-case-the-billing-address-name-and-locale-are-not-mandatory-fields} ##### Request {#request-3} ```json { "email": { "type": "home", "value": "johnn.dooe@gmail.com" }, "cardholderName": "Johnn Dooe", "cardNumber": "2223006448842520", "cardBaseCurrency": "USD", "expiryInfo": { "month": "01", "year": "2039" } } ``` ##### Response {#response-3} ```json { "userid": "866e39dd-f95b-4418-9e6a-7b1b96f16908", "cardNumberLastFourDigits": "5800", "status": "ACTIVE" } ```