> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Testing

> Follow these tutorials to learn about advanced testing scenarios on the sandbox.

## Test different data sets

When you connect sample payroll accounts, you can test two different sets of employment data: rideshare/delivery and general data. These represent the different types of users that may use your application.

### Prerequisites

Before testing different data sets, you must:

* Have your sandbox API keys at hand.
* [Connect sample payroll accounts](/legacy/guides/getting-started/sandbox-mode/connect-sample-payroll-accounts).

### Add user data

Within the sandbox environment, there are two slightly different data sets:

* **Rideshare/Delivery** — if you select a gig company like Uber or Doordash, the data will have more activity (duration, distance, etc.) information.
* **General** — if you select any other employer or payroll provider, the data will reflect traditional employment records.

Select different Link item types to experiment with both data sets. Connect a gig Link item to test with a gig data set. Connect a non-gig Link item to test with a payroll/employer data set.

![Searching for employers while connected a sample account in the Sandbox mode of Argyle Link.](https://res.cloudinary.com/argyle-media/image/upload/f_auto/v1/docs-v2/sandbox-01)

## Test deposit switching

After a user connects a payroll account through Argyle Link, you can ask them to:

* Redirect their pay, in whole or in part, to a new or existing bank account
* Add a debit card for instant payouts on their gig platform

This deposit switching process is initiated by including the following two lines in your Argyle Link initialization:

```json theme={}
// apiHost for Sandbox: https://api-sandbox.argyle.com/v1

payDistributionUpdateFlow: true,
payDistributionConfig: "<Your encrypted payDistributionConfig>"
```

The `payDistributionConfig` is an encrypted version of your [DDS configuration](/legacy/api-reference/dds-configurations), which contains the settings that determine which deposit switching screens and settings are shown to the user after they connect a payroll account.

Our [Sandbox testing guide for deposit switching](/legacy/guides/argyle-link/flows/direct-deposit-switching#sandbox-testing) shows how to test a `payDistributionConfig` in Sandbox using [Flows](https://console.argyle.com/flows).

The guide also includes `payDistributionConfig` examples for different use cases that can be copy and pasted into your Argyle Link initialization or Link Flow in Sandbox mode for testing purposes.

## Trigger periodic scans

Periodic scans detect when a user or their employer has updated their employment data. Follow this tutorial to understand how to trigger a scan of sandbox data.

### Prerequisites

Before you triggering a periodic scan, you must:

* Have your sandbox [API keys](https://console.argyle.com/api-keys) at hand.
* [Connect sample payroll accounts](/legacy/guides/getting-started/sandbox-mode/connect-sample-payroll-accounts).

### Periodic scan data

In the production environment, new data for connected payroll accounts is constantly generated and delivered to you—for example: new payouts, activities—during periodic data scans. For testing purposes, you can trigger a periodic scan to get new data for an account that is already connected.

A periodic scan for sandbox accounts returns 1-5 new payouts and activities. A periodic scan can be triggered as many times as you need for testing.

### Trigger a scan of sandbox data

Send a POST request to the following endpoint with an empty body: `https://api-sandbox.argyle.com/v1/accounts/{id}/periodic-scan` to trigger a periodic scan for Sandbox data.

`{id}` must be a sandbox `accounts.id`, otherwise this error is returned:

```json theme={}
// Sandbox periodic scan error

{
    "account": [
        "Periodic scan can be manually scheduled only for sandbox accounts."
    ]
}
```

<Note>
  This endpoint can be used for testing webhook integration and new data arrival.
</Note>

## Trigger errors

Sandbox mode gives you an opportunity to simulate error scenarios, so you understand how and why errors can occur in your implementation. You can also see how these errors appear for your users. You can trigger errors in two ways in the sandbox:

* Directly from Console.
* Programmatically via the Argyle API.

### Prerequisites

Before triggering errors, you must:

* Have your sandbox [API keys](https://console.argyle.com/api-keys) at hand.
* [Connect sample payroll accounts](/legacy/guides/getting-started/sandbox-mode/connect-sample-payroll-accounts).

### Possible errors

You can trigger these errors in the sandbox:

<Accordion title="Account connection errors">
  * account\_inaccessible
  * account\_incomplete
  * account\_disabled
  * expired\_credentials
  * invalid\_account\_type
  * invalid\_auth
  * login\_attempts\_exceeded
  * mfa\_attempts\_exceeded
  * mfa\_exhausted
  * mfa\_not\_configured
  * physical\_mfa\_unsupported
  * platform\_unavailable
  * service\_unavailable
  * system\_error
  * tos\_required
  * trial\_connections\_exhausted
  * trial\_period\_expired
  * unsupported\_auth\_type
  * unsupported\_mfa\_method
</Accordion>

<Accordion title="Pay distribution errors">
  * account\_disconnected
  * bank\_and\_card\_update\_failed
  * card\_update\_failed
  * confirmation\_timeout
  * incompatible\_config
  * invalid\_account\_state
  * mfa\_attempts\_exceeded
  * mfa\_exhausted
  * mfa\_not\_configured
  * missing\_allocation
  * missing\_allocation\_type
  * not\_supported
  * not\_supported\_by\_employer
  * physical\_mfa\_unsupported
  * rejected\_bank\_account
  * rejected\_card
  * rejected\_microdeposit
  * rejected\_routing\_number
  * service\_unavailable
  * system\_error
  * unsupported\_allocation\_type
  * unsupported\_bank\_accounts
  * unsupported\_bank\_account\_country
  * unsupported\_mfa\_method
  * waiting\_period
</Accordion>

<Accordion title="Rescan errors">
  * auth-required
</Accordion>

See the [Account connection errors](/legacy/guides/troubleshooting/account-connection-errors) and [Direct deposit switching errors](/legacy/guides/troubleshooting/direct-deposit-switching-errors) documentation for complete definitions of these errors.

## Trigger errors via Console

You can trigger errors directly in Console using [Flows](https://console.argyle.com/flows). See this video or follow the steps below to learn how to test this feature in Console:

<video width="99%" muted playsInline controls={true}>
  <source src="https://res.cloudinary.com/argyle-media/video/upload/v1661345850/docs-readme/videos/trigger-sandbox-errors-console.mp4" type="video/mp4" muted playsInline />
</video>

1. Toggle the **Simulate an error** option to **ON** and select the error you want to test.
2. Toggle the **Simulate a direct deposit switch** option to test pay distribution errors. Account connection errors are available by default.
3. Copy the generated password and paste it into the Link login password field.
4. Click Connect.

Different error types behave differently at this stage:

* Connection errors occur immediately.
* You must [manually trigger a periodic scan](/legacy/guides/getting-started/sandbox-mode/advanced-testing#trigger-a-scan-of-sandbox-data) for a specific account to trigger a rescan error after successfully connecting an account.

<Accordion title="Some pay distribution errors occur once the account is connected.">
  - account\_disconnected
  - incompatible\_config
  - invalid\_account\_state
  - missing\_allocation
  - missing\_allocation\_type
  - not\_supported
  - not\_supported\_by\_employer
  - unsupported\_allocation\_type
  - unsupported\_bank\_accounts
  - waiting\_period
</Accordion>

<Accordion title="You must confirm a pay distribution update to trigger the remaining pay distribution errors.">
  * bank\_and\_card\_update\_failed
  * card\_update\_failed
  * confirmation\_timeout
  * mfa\_attempts\_exceeded
  * mfa\_exhausted
  * mfa\_not\_configured
  * physical\_mfa\_unsupported
  * rejected\_bank\_account
  * rejected\_card
  * rejected\_microdeposit
  * rejected\_routing\_number
  * service\_unavailable
  * system\_error
  * unsupported\_bank\_account\_country
  * unsupported\_mfa\_method
</Accordion>

This is what you'll see in Console when you trigger the `auth_required` error:

![An auth\_required error shows that the user needs to reconnect their payroll account.](https://res.cloudinary.com/argyle-media/image/upload/f_auto/v1660229735/docs-readme/link-emulator-2)

## Trigger errors via API

You can use an encoded JSON password to trigger errors via the API. See this video or follow the steps below to learn how to test this feature using the API:

<video width="99%" muted playsInline controls={true}>
  <source src="https://res.cloudinary.com/argyle-media/video/upload/v1661345849/docs-readme/videos/trigger-sandbox-errors-api.mp4" type="video/mp4" muted playsInline />
</video>

1. Define a scenario in a JSON format, such as:

   ```json theme={}
   {
       "failure": {
           "fail_on": "connection",     
           "error": "account_disabled"
       }
   }
   ```

You can choose from these `fail_on` values:

* `connection` - Use this value to simulate account connection errors.
* `pay_distribution_update` - Use this value to simulate pay distribution errors.
* `rescan` - Use this value to simulate rescan errors.

See the [possible errors section](/legacy/guides/getting-started/sandbox-mode/advanced-testing#possible-errors) above for a complete list of values for the `error` field.

2. Call the password-encoding endpoint:

   ```json theme={}
   // POST /v1/test-password/encode

   {
       "failure": {
           "fail_on": "connection",     
           "error": "account_disabled"
       }
   }
   ```

3. Receive a JSON response with the encoded password:

   ```json theme={}
   {
       "test_password": "eyJmYWlsdXJlIjogeyJmYWlsX29uIjogImNvbm5lY3Rpb24iLCAiZXJyb3IiOiAiYWNjb3VudF9kaXNhYmxlZCJ9fQ=="
   }
   ```

4. Use the `test_password` that you received in the Link login password field and click **Connect**. Different error types behave differently at this stage:

* Connection errors occur immediately.
* You must [manually trigger a periodic scan](/legacy/guides/getting-started/sandbox-mode/advanced-testing#trigger-a-scan-of-sandbox-data) for a specific account to trigger a rescan error after successfully connecting an account.

<Accordion title="Some pay distribution errors occur once the account is connected.">
  - account\_disconnected
  - incompatible\_config
  - invalid\_account\_state
  - missing\_allocation
  - missing\_allocation\_type
  - not\_supported
  - not\_supported\_by\_employer
  - unsupported\_allocation\_type
  - unsupported\_bank\_accounts
  - waiting\_period
</Accordion>

<Accordion title="You must confirm a pay distribution update to trigger the remaining pay distribution errors.">
  * bank\_and\_card\_update\_failed
  * card\_update\_failed
  * confirmation\_timeout
  * mfa\_attempts\_exceeded
  * mfa\_exhausted
  * mfa\_not\_configured
  * physical\_mfa\_unsupported
  * rejected\_bank\_account
  * rejected\_card
  * rejected\_microdeposit
  * rejected\_routing\_number
  * service\_unavailable
  * system\_error
  * unsupported\_bank\_account\_country
  * unsupported\_mfa\_method
</Accordion>

![Insert the encoded test\_password into the password field of the payroll login screen.](https://res.cloudinary.com/argyle-media/image/upload/f_auto/v1661338537/docs-v2/20220824_advanced_testing_password_1)
