# Retrieve Custom Features score
source: https://developer.mastercard.com/consumer-credit-analytics/documentation/testing/consumer-enhanced-scores-req-res/index.md

## Pre-requisites {#pre-requisites}

Refer to the [Enhanced Score for Consumers](https://developer.mastercard.com/consumer-credit-analytics/documentation/use-cases/enhanced-consumer-scores/index.md) for use cases.

## Request URL for Sandbox Environment {#request-url-for-sandbox-environment}

    POST https://sandbox.api.mastercard.com/consumer/credit-analytics/bespoke-scores

## Request URL for Production Environment {#request-url-for-production-environment}

    POST https://api.mastercard.com/consumer/credit-analytics/bespoke-scores

## Test Case for Enhanced Score for Consumers {#test-case-for-enhanced-score-for-consumers}

The endpoint allows you to retrieve enhanced score for the consumer.

### Positive test cases {#positive-test-cases}

#### Test case 1: Valid request -- Client 1 with client_code {#test-case-1-valid-request--client-1-with-client_code}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 200
  }
}
```

**Response**

```java
{
    "identifier": "29617141",
    "score": 73,
    "additionalFields": {
        "recommendation": "REVIEW"
    }
}
```

#### Test case 2: Valid request - optional string field with NULL {#test-case-2-valid-request---optional-string-field-with-null}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": null,
    "approved_amount": 200
  }
}
```

**Response**

```java
{
    "identifier": "29617141",
    "score": 73,
    "additionalFields": {
        "recommendation": "REVIEW"
    }
}
```

#### Test case 3: Valid request - optional numeric field with 0 {#test-case-3-valid-request---optional-numeric-field-with-0}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 0
  }
}
```

**Resposne**

```java
{
    "identifier": "29617141",
    "score": 73,
    "additionalFields": {
        "recommendation": "REVIEW"
    }
}
```

#### Test case 4: Valid request - optional numeric field with NULL {#test-case-4-valid-request---optional-numeric-field-with-null}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": null
  }
}
```

**Response**

```java
{
    "identifier": "29617141",
    "score": 73,
    "additionalFields": {
        "recommendation": "REVIEW"
    }
}
```

### Negative test cases {#negative-test-cases}

#### Test case 1: Missing identifier field client_code {#test-case-1-missing-identifier-field-client_code}

**Request**

```java
{
  "clientFeatures": {
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 200
  }
```

**Response**

```java
{
    "Errors": {
        "Error": [
            {
                "Source": "ConsumerCreditAnalytics",
                "ReasonCode": "MISSING_REQUIRED_FIELD",
                "Description": "The parameter is required but not provided.",
                "Recoverable": true,
                "Details": "$.client_code: null found, integer expected"
            }
        ]
    }
}
```

#### Test case 2: Required field value is null {#test-case-2-required-field-value-is-null}

**Request**

```java
{
  "clientFeatures": {
    "client_code":null,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 200
  }
}
```

**Response**

HTTP 400 Bad Request
MISSING_REQUIRED_FIELD

#### Test case 3: Optional field string value is 0 {#test-case-3-optional-field-string-value-is-0}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": 0,
    "approved_amount": 200
  }
}
```

**Response**

```Java
{
    "Errors": {
        "Error": [
            {
                "Source": "ConsumerCreditAnalytics",
                "ReasonCode": "INVALID_FIELD_VALUE",
                "Description": "This error is thrown when an argument passed to the API doesn't pass validation.",
                "Recoverable": true,
                "Details": "$.product_description: integer found, [string, null] expected"
            }
        ]
    }
}
```

#### Test case 4: Extra unknown field in request {#test-case-4-extra-unknown-field-in-request}

**Request**

```java
{
  "clientFeatures": {
    "client_code":29617141,
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 200,
        "age":55
  }
}
```

**Response**

```java
{
    "Errors": {
        "Error": [
            {
                "Source": "ConsumerCreditAnalytics",
                "ReasonCode": "BAD_REQUEST",
                "Description": "This error is thrown when an argument passed to the API is not valid after decryption",
                "Recoverable": true,
                "Details": "$: property 'age' is not defined in the schema and the schema does not allow additional properties"
            }
        ]
    }
}
```

#### Test case 5: Identifier field value is of Invalid data type {#test-case-5-identifier-field-value-is-of-invalid-data-type}

**Request**

```java
{
  "clientFeatures": {
    "client_code":"29617141",
    "score": 791,
    "request_amount": 200,
    "average_salary_8_months": 0,
    "age_in_app": 18,
    "segment": "CONSUMO MASIVO",
    "business_classification": "BANCO INDUSTRIAL, S.A.",
    "bi_product": 0,
    "description_request_status": "SOLICITUD RECHAZADA",
    "business_unit": "DIVISIÓN OPERACIONES",
    "credit_score_segment": "D",
    "category_change_description": 0,
    "product_description": "MASTERCARD UNIVERSITARIA",
    "approved_amount": 200
  }
}
```

**Response**

```java
{
    "Errors": {
        "Error": [
            {
                "Source": "ConsumerCreditAnalytics",
                "ReasonCode": "INVALID_FIELD_VALUE",
                "Description": "This error is thrown when an argument passed to the API doesn't pass validation.",
                "Recoverable": true,
                "Details": "$.client_code: array found, integer expected"
            }
        ]
    }
}
```

