Skip to content

Commit

Permalink
Merge pull request #10 from MITLibraries/IN-731-add-sap
Browse files Browse the repository at this point in the history
In 731 add sap
  • Loading branch information
adamshire123 committed Mar 14, 2023
2 parents 1eccb1f + e156b33 commit 79ab791
Show file tree
Hide file tree
Showing 33 changed files with 7,376 additions and 246 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y git
COPY Pipfile* /
RUN pipenv install

ENTRYPOINT ["pipenv", "run", "sapinvoices"]
ENTRYPOINT ["pipenv", "run", "sap"]
12 changes: 11 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,34 @@ verify_ssl = true
name = "pypi"

[packages]
boto3 = "*"
click = "*"
flatdict ="*"
sentry-sdk = "*"
freezegun = "*"
requests ="*"
paramiko = "*"
fabric = {extras = ["pytest"], version = "*"}

[dev-packages]
bandit = "*"
black = "*"
boto3-stubs = "*"
coverage = "*"
coveralls = "*"
mock-ssh-server = "*"
moto = "*"
mypy = "*"
pylama = {extras = ["all"], version = "*"}
pytest = "*"
pydocstyle = "*"
requests-mock = "*"
types-requests = "*"
types-paramiko = "*"


[requires]
python_version = "3.11"

[scripts]
sap = "python -c \"from sapinvoices.cli import sap; sap()\""
sap = "python -c \"from sapinvoices.cli import main; main()\""
956 changes: 820 additions & 136 deletions Pipfile.lock

Large diffs are not rendered by default.

23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sets trasmitted invoice to paid in Alma
- To update dependencies: `make update`
- To run unit tests: `make test`
- To lint the repo: `make lint`
- To run the app: `pipenv run sapinvoices --help`
- To run the app: `pipenv run sap --help`

## Required ENV
- `ALMA_API_URL` = Base URL for making Alma API calls
Expand All @@ -19,10 +19,27 @@ sets trasmitted invoice to paid in Alma
- `SAP_FINAL_RECIPIENT_EMAIL` = moira list to recieves final run emails
- `SAP_REVIEW_RECIPIENT_EMAIL` = moira list to recieve review run emails
- `SES_SEND_FROM_EMAIL` = email address that SES sends from
- `SSM_PATH` = the path to ssm variables
- `SAP_SEQUENCE_NUM` = the SSM path of the current SAP sequence number
- `WORKSPACE` = Set to `dev` for local development, this will be set to `stage` and `prod` in those environments by Terraform.

## Optional ENV
- `ALMA_API_TIMEOUT`= Request timeout for Alma API calls. Defaults to 30 seconds if not set.
- `LOG_LEVEL` = Set to a valid Python logging level (e.g. DEBUG, case-insensitive) if desired. Can also be passed as an option directly to the ccslips command. Defaults to INFO if not set or passed to the command.
- `SENTRY_DSN` = If set to a valid Sentry DSN, enables Sentry exception monitoring. This is not needed for local development.
- `SENTRY_DSN` = If set to a valid Sentry DSN, enables Sentry exception monitoring. This is not needed for local development.

## Creating sample SAP data
Running the SAP Invoices process during local development or on staging requires that
there be sample invoices ready to be paid in the Alma sandbox. To simplify this, there
is a CLI command that will create four sample invoices in the sandbox. To do this:
1. Run `pipenv run sap create-sandbox-data`. You should get a final log message
saying there are four invoices ready for manual approval in Alma.
2. Go to the Alma sandbox UI > Acquisitions module > Approve (Invoice) > Unassigned
tab. There should be four invoices listed whose numbers start with TestSAPInvoice.
3. For each of those invoices, using the three dots to the right of each invoice, choose "Edit"
and then click "Approve" in the upper right corner.
4. Once the invoices have been approved, they are ready to be paid and will be
retrieved and processed using the llama sap-invoices CLI command.

Note that sample invoices will remain in the Alma sandbox in the "Waiting to be Sent"
status until a "real", "final" sap-invoices process has been run, at which point they
will be marked as paid and new sample invoices will need to be created.
Loading

0 comments on commit 79ab791

Please sign in to comment.