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:
- An application calls getActivityStatementBatch() and provides a batch ID of 0.
- Smile creates a new batch against the USN, and returns a URL to download all activity bound to the subscription.
- The application downloads the activity statements from the URL and persists the last batch ID in the download.
- After a period of time, the application calls getActivityStatementBatch() and provides the persisted last batch ID.
- Smile returns a URL to download all activity statements with a batch ID greater than the provided value.
- 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.