Testing

How to approach testing your CrefoTrust integration.

Introduction

To ease the integration of CrefoTrust we provide special systems and services that allow for very targeted testing strategies. These system are only available on our testing environments of course.

Authentication

Currently not needed. We reserve the right to change this at any time. Depending on our observations. Known users will be contacted on short notice if anything changes here.

Preparing A Test

The testing system gives you the opportunity to exactly specify what data CrefoTrust will get from it’s 3rd party integrations. So that you can exactly mimic the different scenarios and monitor the outcome to expect.

Here is an example code snippet. That should help you get started.

  const body = `{
    "selectedCompany": {
      "crefoId": "1673937671",
      "legalName": "testCompany",
      "legalForm": "GmbH",
      "addressLocality": "Köln",
      "addressCountry": "DE",
      "postalCode": "47800",
      "streetAddress": "Waldweg",
      "streetNumber": "12",
      "status": "aktiv",
      "representatives": [
        {
          "crefoId": "4561234567",
          "familyName": "Musterhaus",
          "givenName": "Werni",
          "postalCode": "12345",
          "birthdate": "1991-01-12",
          "birthplace": "Waren"
        },
        {
          "crefoId": "4561234569",
          "familyName": "Onade",
          "givenName": "Lem",
          "postalCode": "12346",
          "birthdate": "1978-11-10",
          "birthplace": "Waren"
        }
      ]
    },
    "searchResults": [
      {
        "crefoId": "1237654321",
        "legalName": "Company One",
        "legalForm": "GmbH",
        "addressLocality": "Köln",
        "addressCountry": "DE",
        "streetAddress": "Sollbrüggenstr.",
        "streetNumber": "14",
        "postalCode": "47800",
        "status": "aktiv",
        "representatives": [
          {
            "crefoId": "1231234567",
            "familyName": "P",
            "givenName": "Dirk",
            "postalCode": "47800",
            "birthdate": "1978-09-30",
            "birthplace": "Waren"
          }
        ]
      },
      {
        "crefoId": "1237654321",
        "legalName": "Company Three",
        "legalForm": "GmbH",
        "addressLocality": "Köln",
        "addressCountry": "DE",
        "streetAddress": "Sollbrüggenstr.",
        "streetNumber": "14",
        "postalCode": "47800",
        "status": "aktiv",
        "representatives": [
          {
            "crefoId": "1231234567",
            "familyName": "F",
            "givenName": "Dirk",
            "postalCode": "47799",
            "birthdate": "1978-09-30",
            "birthplace": "Waren"
          },
          {
            "crefoId": "42312884567",
            "familyName": "J",
            "givenName": "Dirk",
            "postalCode": "66555",
            "birthdate": "1978-10-31",
            "birthplace": "Waren"
          }
        ]
      }
    ]
  }`

  const url = 'https://env-coordinator.cust.dev-cluster.crefotrust.de:3001/prep';
  const resp = await fetch(url, {
    method: 'POST',
    body: body,
    headers: {
      'Content-Type': 'application/json',
    },
  });
  const json = await resp.json();

From the response you will get a verifierID and apiKey that must be used in subsequent calls to the CrefoTrust API as the authentication information. This ensures that your test is properly encapsulated and knows exactly the data you just send it.

Furthermore does the response contain a webhook which can be used in the order you create to engage the CrefoTrust process. This might be useful if you don’t have a backend system in place and want to see what data is send after the process completes. There is a corresponding GET endpoint which will give you the data, that the webhook received.

The involved types are listed here:

export interface Representative {
  crefoId: string;
  familyName: string;
  givenName: string;
  postalCode: string;
  addressLocality?: string;
  addressCountry?: string;
  birthdate: string;
  birthplace: string;
}

export interface Company {
  crefoId: string;
  legalName: string;
  legalForm: string;
  addressLocality: string;
  addressCountry: string;
  streetAddress: string;
  streetNumber: string;
  postalCode: string;
  status: string;
  representatives: Representative[];
}

//body type
export interface PrepReq {
  selectedCompany: Company;
  searchResults: Company[];
}

export interface PrepResp {
  verifierId: string;
  verifierApiKey: string;
  verifierName: string;
  selectedCompany: Company;
  webhook: string;
}

Bear in mind that the data you provide is kept only in memory. It will NOT be stored to disk or database. After a pod restarts, the data will be lost. So in order to smoothly and reliably run tests keep the setup and the actual test run in temporal proximity.

We might open source the testing code at some point in the future. When you need more code examples feel free to contact us and we will happily provide them to you.

Fixed Test-Data

To simplify testing, when it’s not necessary to have full control on the data that is known to CrefoTrust, you can rely on fixed test data, which will be provided to CrefoTrust when no special setup took place.

Running A Test

To actually run a test, you construct an order specific to your use case (with the credentials that you want to receive from your customer). See the main documentation for details.

Then you send this order to the CrefoTrust endpoint either authenticating with the preparation response or your default authentication information. The rest is basically: you going through the CrefoTrust process instead of an actual user.

At one step in the process it is necessary to login or create an account with the Creditreform-SSO-system. The configured system is a test system as well, but it requires an opt-in step, verifying your email address, like the production SSO-system.

In order to proceed here, you can use a fake-mail-server we have set up for exactly this testing purposes: http://fake-mail-server.crefotrust.de/