API Documentation
  • 🦸User
    • 🐔requestDeveloperVerification
    • ☑️Accept Developer verification
    • 🚫Reject developer verification
    • 🆕NEW Authentication Trigger
  • 📧Send emails
  • 📂Projects
    • 📩Invite a new Team member
  • 📔Tasks
    • 💣Cancel Task
    • 🔎Submit task
    • 👨‍💻Assign Task
  • Step 1 taskflow
    • ✅Accept task
    • ❌Reject task
    • ⏳Deadline reached
  • Step 2 taskflow
    • ✅Accept developer (creator)
    • ❌Reject developer (creator)
  • Step 3 taskflow
    • 🚦Submit for review
    • ⏳Review Deadline reached
    • ✅Accept work result
    • ❌Reject work result
  • Step 4 Taskflow
    • 💸Generate Invoice
    • 💸Mark invoice as paid
Powered by GitBook
On this page
  • Input parameters
  • How to call from app
  • Logic (Plan)
  • Implemented Logic
  1. Step 4 Taskflow

Generate Invoice

Generate and send invoice to task creator

PreviousReject work resultNextMark invoice as paid

Last updated 2 years ago

Input parameters

  • TaskID

How to call from app

HTTP request to: /generate-invoice/TASKID

Logic (Plan)

  1. Get all the user data for the assigned person and the task owner.

  2. use the following api to generate a pdf: Example request:

  3. Save the pdf file in the to the storage (Under: "invoices/TaskId")

  4. Get the URL from the the storage and add it to the task document (InvoiceUrl="")

Implemented Logic

  1. get task, developer & owner data

  2. add invoiceSend: true to the task data

  3. create invoice with this details (using invoice-generator.com format so it will be easier if decided to use their service later)

    const invoice = {
        from: `${developerData.firstName} ${developerData.lastName}
        \n${developerStreetAddress}${developerLocation} 
        ${developerPostalCode}`,
        to: `${ownerData.firstName} ${ownerData.lastName}`,
        currency: "eur",
        number: `${taskId}`,
        items: [
          {
            name: `Task #${taskId}`,
            quantity: 1,
            unit_cost: updatedTaskData.price,
          },
        ],
        fields: {
          tax: "%",
        },
        tax: 0,
        projectId: projectDoc.id,
        projectName: projectData.projectName,
        taskId: taskId,
        taskName: updatedTaskData.taskName,
        status: "open",
        updatedAt: updatedTaskData.updatedAt,
        developerEmail: updatedTaskData.assignToEmail,
        taskCreator: updatedTaskData.taskCreator,
      };
  4. save invoice to "invoices/TaskId"

💸
https://invoice-generator.com/developers#create-invoice-pdf
https://app.gitbook.com/o/Rxgn45SRgGRWbR4O7VXE/s/CfpEDb4ZyyJ4bmPlsblL/step-4-taskflow/generate-invoice