# Accounting Period Close

## OWS Dependencies:
- [ows-ledger](https://github.com/theorchard/ows-ledger)

## Overview
This lambda will reverse the payee ledger entries on accounting period close event by
1. Using the `target_id` of the received `abacus_event` to determine which `accounting_period`'s ledger payees entries are to be reverse.
2. Request ows-ledger service to get ledger payees by accounting_period_id.
3. Perform the required calculation on each ledger payee row and insert it to the ledger_payee table.

## Running
To run the function with a mock event, execute the command:
> make run

## Deployment
Deployment is managed by [zappa](https://github.com/Miserlou/Zappa).
The scripting is in `deploy.sh`, and the configuration is in `zappa_settings.json`.

## Integration testing
OWS services can be added to the `docker-compose.yml` file in order to test
integrations.
Snowflake data fixtures can be staged in the ROYALTY_ACCOUNTING.TEST schema.
