Giter Club home page Giter Club logo

transaction-processor's Introduction

transaction-processor

Chalice was used for this project https://aws.github.io/chalice/

Requirements

  • python 3.9
  • A account in AWS

Install

clone project and change to created directory.

$ git clone https://github.com/ghap16/transaction-processor.git
$ cd transaction-processor

Inside the new directory you will see a structure like this.

transaction-processor
│   README.md
│   .gitignore    
│
└───assets
│   │   transaction_summary.json
│   │   transaction-example1.csv
│   │   ...
│
└───src
    │   │   config.json   
    └───.chalice
    │   │   config.json
    │   │   policy-dev.json
    │   
    └───chalicelib
    │   │   ...
    │   
    └───tests
    │   │   ...
    │   
    │   app.py
    │   pytest.ini
    │   requirements-dev.txt
    │   requirements.txt
    │   ...

Create virtual environment.

$  python3 -m venv venv

Install requirements.

$  pip install -r requirements-dev.txt
$  pip install -r requirements.txt

Configuration

Verify email

In order to send and receive email within the sandbox, it is necessary to verify the email in AWS SES https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html

Config Bucket and emails

You need to have a bucket and set that bucket in the environment variables inside the src/chalicelib/.chalice/config.json file. In that same file is the configuration for email_to and email_from, these emails should be previously verified in AWS SES

Upload template

Upload the assets/transaction-summary.html file to the configured bucket.

Run

Configure your aws credentials in ~/.aws/config.

Go to src directory.

$  cd src

local

Run following command

$  chalice local --stage dev

Deploy

Run following command

$  chalice deploy --stage dev

When finished, it will return something like the following:

	Creating deployment package.
    Updating policy for IAM role: transaction-processor-dev-api_handler
    Updating lambda function: transaction-processor-dev
    Updating rest API
    Resources deployed:
      - Lambda ARN: arn:aws:lambda:us-east-1:579314821033:function:transaction-processor-dev
      - Rest API URL: https://whmpk53c6j.execute-api.us-east-1.amazonaws.com/api/

Test

Inside the assets directory there is a postman collection, with this it can be loaded and tested by changing only a few variables according to the ones you have.

Develop

UnitTest

$ pytest

Sorting and Formatting

$ isort .
$ black .

transaction-processor's People

Contributors

ghap16 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.