Giter Club home page Giter Club logo

invoiceless's Introduction

invoiceless

Invoiceless is a serverless API for sending simple recurring invoices by email using AWS Lambda, API Gateway, CloudWatch Events, and SES.

Deployment Instructions

  1. Make sure you have the AWS CLI installed
  2. Clone the repository
  3. From the top level directory, run

aws cloudformation package --template-file template.yaml --s3-bucket [your s3 bucket] --output-template-file packaged.yaml

aws cloudformation deploy --template-file ./packaged.yaml --stack-name invoiceless --capabilities CAPABILITY_IAM

Using the API

POST /invoices

Sends an invoice immediately to the recipients specified in agreement_info.client_emails.

Notes

agreement_info.verified_sender_arn is optional and only needs to be specified if your AWS SES account is still on probation. You can verify the address in agreement_info.provider_email by following the steps from AWS here.

agreement_info.net specifies the number of days until the invoice is due. It can be any integer from 1 to 120.

Example call

headers = {'content-type': 'application/json'}
url = '[api URL]/invoices/'

body = {
  "agreement_info": {
    "net": 30,
    "client_emails": [
      "[email protected]",
      "
    ],
    "provider_email": "[email protected]",
    "verified_sender_arn": "arn:aws:ses:us-east-1:[account]:identity/[email protected]"
  },
  "client_info": {
    "client_id": "1001",
    "name": "My Client",
    "street": "1 Corporate Pkwy",
    "city": "Bigcity",
    "state": "TX",
    "country": "USA",
    "post_code": "01010"
  },
  "service_provider_info": {
    "name": "My Name",
    "street": "123 Main St",
    "city": "Anywhere",
    "state": "NY",
    "country": "USA",
    "post_code": "12345"
  },
  "line_items": [
    {
      "name": "Widgets",
      "description": "Default widgets",
      "units": 10,
      "unit_price": 125
    },
    {
      "name": "Customized Widgets",
      "description": "Reinforced widgets",
      "units": 10,
      "unit_price": 125
    }
  ]
}

requests.post(url, data=json.dumps(body), headers=headers)


POST invoices/schedule

This call creates a CloudWatch rule that sends your invoice on a recurring schedule that you specify.

The API request looks the same as the example above, except for the addition of a top-level body attribute called schedule_expression:

body = {
  "schedule_expression": "cron(0 12 25 * ? *)",
  "agreement_info": {
    ...

Refer to AWS's schedule expressions syntax guide for help creating your schedule.

The example above will send a recurring invoice on the 25th day of every month at 12:00 PM.

DELETE invoices/schedule/client_id

Removes the CloudWatch Events rule for the specified client ID. Note that Invoiceless only supports one recurring invoice per client at the moment.

Generated Invoices

Invoiceless uses PyInvoice to generate simple invoices that will be sent via email to the destination addresses you specify.

Example Invoice

invoiceless's People

Contributors

forrestbrazeal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.