All Projects â†’ pagarme â†’ Tldr

pagarme / Tldr

Licence: mit
📜 A microservice to store and display sales receipts

Programming Languages

javascript
184084 projects - #8 most used programming language

tldr

CircleCI codecov

📜 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 run 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, run the following command:

$ make test

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",
        "cvm_pin": true,
        "payment_method": "credit_card",
        "capture_method": "emv",
        "authorization_code": "4DDP1X",
        "aid": "02199520",
        "application_cryptogram": "5EC8B98ABC8F9E7597647CBCB9A75400",
        "soft_descriptor": "Loja 1 2 3",
        "statement_descriptor": "pg* Loja 1 2 3"
    }
}

Now, the following route will take the information on the previous route, and render it with a template.

GET /receipt/:id

Useful Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].