## Adjustments Apply

## Requirements
- Python 3.13

## OWS Dependencies

- [ows-abacus-worksheet](https://github.com/theorchard/ows-abacus-worksheet)
- [ows-ledger](https://github.com/theorchard/ows-ledger)
- [ows-royalties](https://github.com/theorchard/ows-royalties)

## Overview

Lambda to apply adjustments to the Calculation for current Statement Period.

## Running

The lambda function can be run locally as a python function or as a container.

### Start Container
```
$ awsume prod
$ docker compose run --rm --build -e ENVIRONMENT=qa -p 9001:8080 function
```
or with a shortcut
```
$ make docker_local_up
```

### Sending a mock event
Run the python function with a mock event:
> make run

Run the dockerized function by first bringing up the container:
> make local_listener

This container will act similar to a web server by listening on a port
for the event data to be POSTed.

POST example data to the lambda:
> make local_event


## Deployment

Make sure that appropriate ECR Container Repository has been created by running the build [pipeline](https://pipeline.theorchard.io/job/create-lambda-ecr-repository/)

Once the ECR Container Repository is created, a new lambda can be terraformed
 [(reference)](https://github.com/theorchard/terraform-infra/blob/master/qa/lambda-abacus/main.tf#L30)

Once the terraform change is applied, deploy your containerized lambda to a live environment.

## Integration testing

OWS services can be added to the `docker-compose.yml` file in order to test
integrations.

