GitHub - pagarme/tldr: A microservice to store and display sales receipts
source link: https://github.com/pagarme/tldr
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
tldr
? A microservice to store and display sales receipts
Table of Contents
Introduction
tldr is Pagar.me's backend for processing, storing and displaying receipts.
Technology
Stuff we use:
- Docker and Docker Compose to create our development and test environments.
- CircleCI for deployment and as general CI.
- AWS SQS as a queue manager to process the receipts.
- Postgres to store our data and Sequelize as a Node.js ORM.
- ejs as a templating language.
- Jest as a framework for tests.
- Yarn as a package manager.
Getting Started
To get started, you should install Docker and Docker Compose.
Then, clone the repository:
$ git clone [email protected]:pagarme/tldr
You should create an .env
file (you can use .env.example
as a reference. Ideally, everything should work out-of-the-box with the example environment variables).
Now, you should set up your database, but only once. In order to do that, run the following:
$ make setup-database
And you should be ready.
Running Locally
To run locally, simply do the following command:
$ make all
This will pull and build all images necessary, as well as starting all containers.
By default, the server is located at localhost:8888
.
Running Tests
To run our tests, do:
$ make test
And everything will be taken care of, and the tests will be ran.
Available Routes
Our default routes are:
GET /api/receipt/:id
Where :id
is the id of the receipt (receipt_id).
This will respond with a json
object.
Response sample:
{ "data": { "transaction_id": 1234567, "receipt_id": "c00l-5tuff", "seller_id": "mycoolshop", "seller_name": "Cool Shop", "transaction_status": "paid", "amount": 12000, "payment_date": "2018-03-02T10:12:25.000Z", "event_date": "2018-03-22T15:12:25.000Z", "card_holder_name": "Senny Bings", "card_number_last_digits": "7782", "card_brand": "visa", "installments": 2, "phone_number": "+5511987654321" } }
Now, the following route will take the information on the previous route, and render it with a template.
GET /receipt/:id
Useful Links
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK