# Surveys
source: https://developer.mastercard.com/carbon-calculator/documentation/testing/testcase/test_case_surveys/index.md

Allows an issuer to fetch the survey from the server that can be answered by the consumer.

## Pre-requisites {#pre-requisites}

Refer to the [Surveys](https://developer.mastercard.com/carbon-calculator/documentation/use-cases/engagement-services/surveys/index.md) use case.


API Reference: `GET /surveys`

<br />

## Test Cases {#test-cases}

### Test Case: Success-Surveys {#test-case-success-surveys}

##### Response {#response}

```json
{
    "language": "en",
    "type": "survey",
    "id": "onboarding",
    "version": "1.1",
    "survey": {
      "showQuestionNumber": "off",
      "showProgressBar": "top",
      "pages": [
        {
          "name": "page1",
          "questions": [
            {
              "type": "radiogroup",
              "name": "sex",
              "title": "What do you identify as?",
              "description": "",
              "choices": [
                {
                  "value": "demo.m",
                  "text": "Male"
                },
                {
                  "value": "demo.f",
                  "text": "Female"
                }
              ]
            }
          ]
        },
        {
          "name": "page2",
          "questions": [
            {
              "type": "dropdown",
              "name": "age",
              "title": "What age range are you in?",
              "description": "",
              "choices": [
                {
                  "value": "demo.lt10",
                  "text": "0-9"
                },
                {
                  "value": "demo.lt20",
                  "text": "10-19"
                },
                {
                  "value": "demo.lt30",
                  "text": "20-29"
                }
              ]
            }
          ]
        },
        {
          "name": "page3",
          "questions": [
            {
              "type": "dropdown",
              "name": "country",
              "title": "Which is your country of residence?",
              "description": "",
              "choices": [
                {
                  "value": "AF",
                  "text": "Afghanistan"
                },
                {
                  "value": "AX",
                  "text": "Åland Islands"
                },
                {
                  "value": "AL",
                  "text": "Albania"
                }
              ]
            }
          ]
        },
        {
          "name": "page4",
          "questions": [
            {
              "type": "radiogroup",
              "name": "interest",
              "title": "I am curious about my own carbon footprint and how I personally contribute to climate change",
              "description": "",
              "choices": [
                {
                  "value": "stronglyAgree",
                  "text": "Strongly agree"
                },
                {
                  "value": "somewhatAgree",
                  "text": "Somewhat agree"
                },
                {
                  "value": "neutral",
                  "text": "Neutral"
                }
              ]
            }
          ]
        },
        {
          "name": "page5",
          "questions": [
            {
              "type": "radiogroup",
              "name": "knowledge",
              "title": "I have good knowledge about climate change and its effects",
              "description": "",
              "choices": [
                {
                  "value": "stronglyAgree",
                  "text": "Strongly agree"
                },
                {
                  "value": "somewhatAgree",
                  "text": "Somewhat agree"
                },
                {
                  "value": "neutral",
                  "text": "Neutral"
                }
              ]
            }
          ]
        },
        {
          "name": "page6",
          "questions": [
            {
              "type": "radiogroup",
              "name": "diet",
              "title": "What best describes your diet?",
              "description": "",
              "choices": [
                {
                  "value": "diet.all",
                  "text": "I eat everything"
                },
                {
                  "value": "diet.meatlessDay",
                  "text": "One meatless day a week"
                },
                {
                  "value": "diet.avoidRed",
                  "text": "I try to avoid eating red meat"
                },
                {
                  "value": "diet.noRed",
                  "text": "I don't eat red meat"
                }
              ]
            }
          ]
        },
        {
          "name": "page7",
          "questions": [
            {
              "type": "radiogroup",
              "name": "renewableElectricity",
              "title": "Does your household use renewable electricity?",
              "description": "(e.g. solar, wind or hydro)",
              "choices": [
                {
                  "value": "energy.renewable",
                  "text": "Yes, we use a supplier of renewable electricity"
                },
                {
                  "value": "energy.selfProduced",
                  "text": "Yes, we produce our own renewable electricity"
                }
              ]
            }
          ]
        },
        {
          "name": "page8",
          "questions": [
            {
              "type": "radiogroup",
              "name": "haveCar",
              "title": "Do you have a car?",
              "description": "This only refers to cars you drive for personal or family needs, not a company car that is exclusively used professionally.",
              "choices": [
                {
                  "value": "transport.hasCar",
                  "text": "Yes"
                },
                {
                  "value": "transport.noCar",
                  "text": "No"
                }
              ]
            }
          ]
        },
        {
          "name": "page9",
          "visibleIf": "{haveCar} = 'transport.hasCar'",
          "questions": [
            {
              "type": "radiogroup",
              "name": "carFuel",
              "title": "What kind of car is it?",
              "description": "",
              "choices": [
                {
                  "value": "transport.petrol",
                  "text": "Petrol"
                },
                {
                  "value": "transport.diesel",
                  "text": "Diesel"
                },
                {
                  "value": "transport.bio",
                  "text": "Bio-fuel or bio-gas"
                }
              ]
            }
          ]
        },
        {
          "name": "page10",
          "questions": [
            {
              "type": "radiogroup",
              "name": "flyFrequency",
              "title": "How often do you travel by plane for personal or leisure purposes?",
              "description": "Do not include business travels.",
              "choices": [
                {
                  "value": "transport.twice",
                  "text": "A couple of times a year"
                }
              ]
            }
          ]
        }
      ]
    }
}
```

### Test Case: Fail-Service Provider Not Found {#test-case-fail-service-provider-not-found}

##### Response {#response-1}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Service-Provider",
        "ReasonCode": "ACCOUNT_NOT_FOUND",
        "Description": "We cannot find the account which you are using to access this service. Kindly register your account or contact your Mastercard associate if you have already registered with us earlier.",
        "Recoverable": false,
        "Details": ""
      }
    ]
  }
}
```

