currencypayocr v1.2.0
CurrencyPayOcr
This solution provides a service to upload a pdf, in which the pdf contents will be read in, parsed, and generate an invoice within the Currency Pay Portal.
Development Prerequisites
Debian Based Linux OS (Ubuntu 18.04 LTS preferred).
Run the linux.sh script (located in the scripts folder) to install all required software.
user@linux:~/currencypayocr$ ./scripts/linux.sh
Install the following global npm packages:
- yarn
- typescript
- ts-node
- ts-node-dev
Install dependencies by running the following commands:
user@linux:~/currencypayocr$ yarn install
You will also need a instance of Mongo DB running. You can either install the service locally on your machine and use the mongo docker container:
docker pull mongo:latest
Development Mode
MUST HAVE DOCKER INSTALLED
MUST HAVE azure-cli (az) with access to currency.azurecr.io
- After you clone the repo from the root dir run: $ npm install
- If it installs builds and runs test with no errors then $ docker build -t currency.azurecr.io/currencypayocr:latest . *replace tag :latest with qa.qa2,integration
- IF "Successfully built image" $ az acr login --name currency $ docker push currency.azurecr.io/currencypayocr:latest
TO RUN LOCALLY
$ docker run -p : e.g. $ docker run -p 443:443 currency.azurecr.io/currencyfileservice-qa
Running the apps
To begin live development, simply run:
user@linux:~/currencypayocr$ yarn watch
PDF Testing:
You can test mulitple PDFs by using the pdf utils program.
- Paste your pdfs with in the "~/currencypayocr/data/invoices" folder
- Update the 'expects.json' file with any new PDF not currently stored in the "./data/backup" folder.
- Run the pdf utils program
user@linux:~/currencypayocr$ ts-node-dev src/test/pdf.utils.ts
- The results will be outputted to "~/currencypayocr/data/results.csv" file
Create your development Self-Signed SSL Certificate
If you want to test production mode on your local machine, you will need to create the require certs.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./server.key -out ./server.crt
Docker
To create the ocr service docker image, you must have the "softvisionlv/curpay" build image on your machine.
docker pull softvisionlv/curpay:latest
To build:
docker build -t <company>/<name> .
After a successful build, you can create and run a container from it:
docker run -d -p 80:80 -p 443:443 --name <instance name> <company>/<name>:latest
To attach to the container:
docker exec -it <instance name> /bin/bash
Production Test String
- merch ID: p1_mer_5ac3dcbdeda17327854e73c
- login ID: p1_log_5ac3dcbde95da796cfccaa8
- Entity ID: p1_ent_5ac3dcbdea42f939311858c
3 years ago