Download activity statements in batches

Downloading activity statements in batches ensures that you download all activity statements associated with a subscription, even if the activity statements are not bound to the subscription in timestamp order. For example, if an upstream provider sends you activity statements in batches, the activity statement may not be bound to the subscription until some time after the activity occurred.

The following process explains how to download activity statements in batches:
  1. An application calls getActivityStatementBatch() and provides a batch ID of 0.
  2. Smile creates a new batch against the USN, and returns a URL to download all activity bound to the subscription.
  3. The application downloads the activity statements from the URL and persists the last batch ID in the download.
  4. After a period of time, the application calls getActivityStatementBatch() and provides the persisted last batch ID.
  5. Smile returns a URL to download all activity statements with a batch ID greater than the provided value.
  6. The application downloads the activity statements from the URL, and persists the new last batch ID in the download.

The following diagram gives you an overview of how to download activity statements in batches.

Figure: Download activity statements in batches

The flowchart explains the process to download activity statements in batches.