All Projects → asc-lab → Azure Functions Billing

asc-lab / Azure Functions Billing

Licence: apache-2.0
Azure Functions v2 with .NET Core - billing in serverless architecture.

Projects that are alternatives of or similar to Azure Functions Billing

Function Templates
Twilio Function templates for different Voice, SMS, Video, Chat, Sync, etc use cases
Stars: ✭ 120 (+144.9%)
Mutual labels:  serverless, twilio, sendgrid
Serverless Azure Functions
Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
Stars: ✭ 213 (+334.69%)
Mutual labels:  serverless, azure-functions
Sample Stripe Handler
Serverless function that uses the stripe api for a checkout process in a Vue application
Stars: ✭ 155 (+216.33%)
Mutual labels:  serverless, azure-functions
contoso-university
Contoso University demo using asp net core and related technologies
Stars: ✭ 42 (-14.29%)
Mutual labels:  twilio, sendgrid
Serverless Monorepo App
Serverless Monorepo App
Stars: ✭ 136 (+177.55%)
Mutual labels:  serverless, sendgrid
Durablefunctionsmonitor
A monitoring/debugging UI tool for Azure Durable Functions
Stars: ✭ 136 (+177.55%)
Mutual labels:  serverless, azure-functions
Jazz
Platform to develop and manage serverless applications at an enterprise scale!
Stars: ✭ 254 (+418.37%)
Mutual labels:  serverless, azure-functions
Heroes Angular Serverless
TypeScript Node/Express 👉TypeScript Serverless ➕Angular
Stars: ✭ 119 (+142.86%)
Mutual labels:  serverless, azure-functions
Azure Functions Python Samples
Azure Functions Python Sample Codes
Stars: ✭ 266 (+442.86%)
Mutual labels:  serverless, azure-functions
Serverless Microservices Reference Architecture
This reference architecture walks you through the decision-making process involved in designing, developing, and delivering a serverless application using a microservices architecture through hands-on instructions for configuring and deploying all of the architecture's components along the way. The goal is to provide practical hands-on experience in working with several Azure services and the technologies that effectively use them in a cohesive and unified way to build a serverless-based microservices architecture.
Stars: ✭ 270 (+451.02%)
Mutual labels:  serverless, azure-functions
Airform
Functional HTML forms for Front-End Developers.
Stars: ✭ 307 (+526.53%)
Mutual labels:  serverless, sendgrid
Guide
Serverless Guide - An open-source definitive guide to serverless architectures.
Stars: ✭ 421 (+759.18%)
Mutual labels:  serverless, azure-functions
Azure Functions Host
The host/runtime that powers Azure Functions
Stars: ✭ 1,650 (+3267.35%)
Mutual labels:  serverless, azure-functions
Azure Function Express
⚡️Allows Express.js usage with Azure Functions
Stars: ✭ 146 (+197.96%)
Mutual labels:  serverless, azure-functions
Serverlesslibrary
Source code for the Azure Serverless Community Library
Stars: ✭ 119 (+142.86%)
Mutual labels:  serverless, azure-functions
Batch Shipyard
Simplify HPC and Batch workloads on Azure
Stars: ✭ 240 (+389.8%)
Mutual labels:  serverless, azure-functions
Serverless
⚡ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! –
Stars: ✭ 41,584 (+84765.31%)
Mutual labels:  serverless, azure-functions
Serverless Url Shortener
Azure Function for a URL shortening website. Uses serverless functions, Azure Table Storage and Application Insights.
Stars: ✭ 113 (+130.61%)
Mutual labels:  serverless, azure-functions
Dracker
An iOS and React App to track debt and send/receive payments.
Stars: ✭ 22 (-55.1%)
Mutual labels:  twilio, sendgrid
25 Days Of Serverless
Repository responsible for 25 days of Serverless challenges
Stars: ✭ 400 (+716.33%)
Mutual labels:  serverless, azure-functions

Azure Functions v2 with .NET Core

This example shows simplified billing system in serverless architecture.

Comprehensive guide describing exactly the architecture, applied design patterns and technologies can be found on our blog in article Azure Functions 2.0 – real world use case for serverless architecture.

We encourage you to read, because in this README there is only a substitute for all information.

Architecture

  1. User uploads CSV file (with name structure CLIENTCODE_YEAR_MONTH_activeList.txt.) with Beneficiaries (the sample file is located in the data-examples folder) to a specific data storage - active-lists Azure Blob Container.

  2. The above action triggers a function (GenerateBillingItemsFunc) that is responsible for:

    • generating billing items (using prices from an external database - CosmosDB crm database, prices collection) and saving them in the table billingItems;
    • sending message about the need to create a new invoice to invoice-generation-request;
  3. When a new message appears on the queue invoice-generation-request, next function is triggered (GenerateInvoiceFunc). This function creates domain object Invoice and save this object in database (CosmosDB crm database, invoices collection) and send message to queues: invoice-print-request and invoice-notification-request.

  4. When a new message appears on the queue invoice-print-request, function PrintInvoiceFunc is triggered. This function uses external engine to PDF generation - JsReport and saves PDF file in BLOB storage.

  5. When a new message appears on the queue invoice-notification-request, function NotifyInvoiceFunc is triggered. This function uses two external systems - SendGrid to Email sending and Twilio to SMS sending.

Tutorial from scratch to run locally

  1. Install and run Microsoft Azure Storage Emulator.

  2. Install and run CosmosDB Emulator. Check this on https://localhost:8081/_explorer/index.html.

  3. Create in Emulator blob Container active-lists.

  4. Upload ASC_2018_02_activeLists.txt file from data-examples folder to active-lists blob.

  5. Create CosmosDB database crm and in this database create collections: prices, invoices.

  6. Add CosmosDB properties PriceDbUrl and PriceDbAuthKey to local.appsettings.json in PriceDbInitializator and GenerateBillingIemsFunc. You can copy this properties from Azure CosmosDB Emulator - check point 2 (URI and Primary Key).

  7. Run project PriceDbInitializator to init collection prices in crm database.

  8. Add CosmosDB connection string as cosmosDb to local.settings.json in GenerateInvoiceFunc. You can copy this string from Azure CosmosDB Emulator - check point 2 (Primary Connection String).

  9. Create an account in SendGrid and add property SendGridApiKey to local.settings.json in NotifyInvoiceFunc.

  10. Create an account in Twilio and add properties TwilioAccountSid TwilioAuthToken to local.settings.json in NotifyInvoiceFunc.

  11. Run JsReport with Docker: docker run -p 5488:5488 jsreport/jsreport. Check JsReport Studio on localhost:5488.

  12. Add JsReport url as JsReportUrl to local.settings.json in PrintInvoiceFunc project.

  13. Add JsReport template with name INVOICE and content:

<h1>Invoice {{invoiceNumber }}</h1>
<h3>Customer: {{ customer }}</h3>
<h3>Address: 00-101 Warszawa, Chłodna 21</h3>
<h3>Description: {{ description }}</h3>

<h3>Details:</h3>
<table width="90%" border="1" bgcolor="#C0C0C0" align="center">
    <tr>
        <th>Item</th>
        <th>Price</th>
    </tr>

    {{#each lines}}
    <tr>
        <td>{{ itemName }}</td>
        <td align="right">{{ cost }}</td>
    </tr>
    {{/each}}

    <tr>
        <td>
            <strong>Total</strong>
        </td>
        <td align="right">
            <strong>{{ totalCost }}</strong>
        </td>
    </tr>
</table>

Example JSON for INVOICE template:

{
  "customer": "ASC",
  "invoiceNumber": "ASC/10/2018",
  "description": "Invoice for insurance policies for 10/2018",
  "lines": [
    {
      "itemName": "Policy A",
      "cost": 2140.0
    },
    {
      "itemName": "Policy B",
      "cost": 1360.0
    }
  ],
  "totalCost": 3500.0
}

All properties in one local.appsettings.json:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "PriceDbUrl": "https://localhost:8081",
    "PriceDbAuthKey": "AUTH_KEY",
    "cosmosDb": "AccountEndpoint=https://localhost:8081/;AccountKey=AUTH_KEY",
    "JsReportUrl": "http://localhost:5488",
    "SendGridApiKey": "SEND_GRID_API_KEY",
    "TwilioAccountSid ": "TWILIO_ACCOUNT_SID",
    "TwilioAuthToken": "TWILIO_AUTH_TOKEN"
  }
}

Monitoring examples

Application Map for all function in one project:

Application Map 1

Application Map for functions in separated projects:

Application Map 2

End-to-end transaction details:

End to End Transaction Details

Tips & Tricks

  1. CSV file is working for client code ASC (filename: ASC_2018_12_activeList.txt). If you want run functions for another client code, you must simulate prices in database. Check project PriceDbInitializator, file Program.cs, method AddDoc.

  2. Remember that you must use Twilio Test Credentials.

Twilio Test Credentials

  1. Microsoft Azure Storage Emulator with all created storages:

Microsoft Azure Storage Emulator

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