Documentation for a newer release is available. View Latest
Esta página no está disponible actualmente en Español. Si lo necesita, póngase en contacto con el servicio de asistencia de Icon (correo electrónico)

Payment Entry Purging

Purging is performed as part of the Housekeeping. Purging removes documents from the paymententries collection. This process ensures that Payment Entries that are marked as 'done' are deleted from the database.

To enable Purging the following actions are required:

  • Create TTL (Time-To-Live) indexes: This step is mandatory as it allows the database to automatically purge items in the collections. Without these indexes, no purging will occur.

  • Set ttl and expiryDate fields: The application itself sets the ttl field (required for CosmosDB) and the expiryDate field (required for MongoDB) when Housekeeping is triggered. These fields determine the retention period for the items before they are purged; the retention period is configurable and is explained in detail in the Configurable Time To Live (TTL) section.

TTL indexes must be created because the database relies on these indexes to purge entries. Without TTL indexes, Payment Entries will not be purged from the DB.

By default, all indexes are created automatically at application startup and support both MongoDB and Azure CosmosDB for MongoDB. For manual TTL index creation, refer to Manual Creation of TTL Indexes. For all indexes, refer to Indexes.

Configuration

The default Payment Warehouse configuration is detailed on the Configuration page. You can override the values to suit your requirements.

The configuration is not specific to purging, but in order to set up purging you must understand the configuration. For example, if you set create-indexes to false, but still require purging, then you would need to create your own TTL index.

Configurable Time To Live (TTL)

Payment Entries in the Payment Warehouse have a configurable TTL. The value is set using the ipf.core.payment-warehouse.time-to-live configuration key.

The TTL is applied during the Housekeeping operation. The TTL will be added to the date-time that markInstructionIsDone is triggered; this calculated date-time will be the date-time the PaymentEntry will expire (removed from the DB).

For example, if the TTL is 3d and the markInstructionIsDone is called at 01/01/2025, then the PaymentEntry will expire (removed from the DB) on 04/01/2025.

The default TTL is configured for 30 days.
TTL will do nothing if there is no TTL index created.

Manual Creation of TTL Indexes

MongoDB

For MongoDB, create TTL indexes on the expiryDate field, which indicates the exact date an item should be purged. For more details, refer to Expire Documents at a Specific Clock Time.

db.getCollection("paymententries").createIndex({ "expiryDate": 1 }, { expireAfterSeconds: 0 })

ipf.core.payment-warehouse.time-to-live is used to calculate the future date when the document will be deleted.

Azure CosmosDB for MongoDB

For Azure CosmosDB for MongoDB, create TTL indexes on the internal _ts field, which contains a timestamp of the last modification. Additionally, documents need a ttl integer field representing the retention period in seconds. For more information, check out Time to Live (TTL) in Azure Cosmos DB and Expire data with Azure Cosmos DB’s API for MongoDB.

db.getCollection("paymententries").createIndex({"_ts":1}, {expireAfterSeconds: -1})

ipf.core.payment-warehouse.time-to-live is converted to seconds and sets the ttl field. Azure CosmosDB for MongoDB will purge the document after this period.

How to disable purging?

Purging can be disabled by not creating the TTL indexes on paymententries collections.

Make sure that automatic index creation is disabled by setting ipf.core.payment-warehouse.create-indexes to false, otherwise indexes will be created on the next application startup.
By setting ipf.core.payment-warehouse.create-indexes to false, the indexes required for the rest of the Payment Warehouse are required to be created manually.
Even though indexes are dropped, the application will continue to set ttl and expiryDate fields which has no effect on purging until indexes are (re)created.