spec wrote for recieving funds from customers, just need spec for sending funds to freelancers

This commit is contained in:
MichaelYick 2023-02-23 17:39:38 -06:00
parent 5b49bd5996
commit 585f4de3a0
2 changed files with 69 additions and 40 deletions

View File

@ -21,18 +21,22 @@ node[color=turquoise]
"/freelancer/$freelancer/requests/$requestID/accept"
"/freelancer/$freelancer/requests/$requestID/decline"
"/freelancer/$freelancer/invoice"
"/freelancer/$freelancer/createInvoice"
"/freelancer/login"
"/freelancer/$freelancer/requests/$requestID/finalProduct"
}
subgraph backend {
label = "Backend";
node[color=blue]
"HTML Assembler" [shape=rectangle]
"Oauth2 Authorization Server"
StripeSetup
BTCPayServerSetUp
UpFrontPaymentSetup
UpFrontPaymentWatcher
OnDeliverPaymentSetup
OnDeliverPaymentWatcher
}
subgraph foreign {
@ -53,69 +57,73 @@ subgraph filesystem {
node[color=black]
label = "Filesystem";
"Freelancer Data"
"HTML Templates"
"request database"
"commission database"
}
//Customer Interface
////GET
"Customer" -> {"/" "/customer/$freelancer/template/$templateName"} [label="GET Request"]
{"/" "/customer/$freelancer/template/$templateName"} -> Customer [label="HTML"]
////POST
"Customer" -> {"/customer/$freelancer/template/$templateName/request"} [label = "POST Request"]
{"/customer/$freelancer/template/$templateName/request"} -> "Customer" [label="HTML"]
//Freelancer Interface
"Freelancer" -> {"/freelancer/$freelancer/inbox" "/freelancer/$freelancer/requests/$requestID/accept" "/freelancer/$freelancer/requests/$requestID/decline"} [label="GET Request"]
//Customer Interface Assembly
"HTML Templates" -> "HTML Assembler" [label="HTML Templates to use"]
{"/" "/customer/$freelancer/template/$templateName"} -> "HTML Assembler" [label="Location being requested"]
"HTML Assembler" -> {"/" "/customer/$freelancer/template/$templateName"} [label = "HTML"]
//Freelancer Interface Assembly
{"/freelancer/$freelancer/inbox" "/freelancer/$freelancer/requests/$requestID"} -> "HTML Assembler" [label="Location being requested"]
"HTML Assembler" -> {"/freelancer/$freelancer/inbox" "/freelancer/$freelancer/requests/$requestID"} [label = "HTML"]
////HTML Assembler must get data from the request database
"request database" -> "HTML Assembler" [label = "$freelancer's inbox data"]
{"/freelancer/$freelancer/inbox" "/freelancer/$freelancer/requests/$requestID/accept" "/freelancer/$freelancer/requests/$requestID/decline"} -> "Freelancer" [label="HTML"]
//Populating with Freelancer Data
"Freelancer Data" -> "HTML Assembler" [label = "List of vendors"]
"Freelancer Data" -> "/customer/$freelancer/template/$templateName" [label = "Commission Templates"]
//Template System
"/customer/$freelancer/template/$templateName/request" -> {"request database"} [label = "Notifying $freelancer of new commission request\nThis will also store a $requestID, a $customerEmailAddress, and a $requestMessage"]
"request database" -> "/freelancer/$freelancer/requests/$requestID" [label = "stored $requestID's $customerEmailAddress, $requestMessage, and $templateName, and $currencyPreference"]
"/freelancer/$freelancer/requests/$requestID/accept" -> {"StripeSetup" "BTCPayServerSetUp"} [label = "Depending on $currencyPreference, send $customerEmailAddress, $requestMessage, and $templateName"]
"/freelancer/$freelancer/requests/$requestID/decline" -> "Email Server" [label = "Declining letter"]
{"Email Server"} -> Customer [label = "Email containing decline for job"]
"/customer/$freelancer/template/$templateName/request" -> {"commission database"} [label = "store Commission Request Data"]
"commission database" -> "/freelancer/$freelancer/requests/$requestID" [label = "read Commission Request Data"]
"/freelancer/$freelancer/requests/$requestID/accept" -> "commission database" [label = "change $accepted value to true"]
"/freelancer/$freelancer/requests/$requestID/decline" -> "commission database" [label = "change $accepted value to false"]
"/freelancer/$freelancer/requests/$requestID/decline" -> "Email Server" -> "Customer" [label = "Declining letter"]
//Invoice System
Freelancer -> "/freelancer/$freelancer/invoice" [label = "POST Request"]
"/freelancer/$freelancer/invoice" -> {"StripeSetup" "BTCPayServerSetUp"} [label = "Depending on $currencyPreference, send $customerEmailAddress, $requestMessage, and $templateName"]
Freelancer -> "/freelancer/$freelancer/createInvoice" [label = "POST Request"]
"/freelancer/$freelancer/createInvoice" -> "commission database" [label = "store Commission Request Data"]
//Log in
Freelancer -> "/freelancer/login"
"/freelancer/login" -> "Oauth2 Authorization Server" [label = "POST Request"]
"Oauth2 Authorization Server" -> "Freelancer" [label = "Authorization Token"]
//TODO: add settings for asking for percentages of payment up front or at delivery
//This feature should be a slider basically, allowing 100% up front to 100% on deliver and everything inbetween
//Payment verification
StripeSetup -> Stripe [label = "API request"]
BTCPayServerSetUp -> BTCPayServer [label = "API request"]
"commission database" -> UpFrontPaymentSetup [label="Periodic queries of new approved commissions"]
UpFrontPaymentSetup -> {BTCPayServer Stripe} [label="API request"]
{BTCPayServer Stripe} -> UpFrontPaymentSetup [label="Invoice IDs"]
UpFrontPaymentSetup -> "commission database" [label="write $invoiceID of commission"]
"commission database" -> UpFrontPaymentWatcher [label="periodic queries of $invoiceIDs of unpaid upfront commissions"]
{BTCPayServer Stripe} -> UpFrontPaymentWatcher [label="Payment recieved on invoice"]
UpFrontPaymentWatcher -> Freelancer [label="Notification that payment for commission has been recieved"]
{Stripe BTCPayServer} -> Customer [label = "Email containing invoice data"]
//Should hook up to BTCpay and stripe and query them to see if an invoice has been paid or not
//likely will need a database of some sorts for this
//Once paid, the freelancer should be notified that it was paid and will be told to start working
//Delivery
////Since most of this stuff will consist of files, should have the ability for freelancers to deliver via files
////If doing pay-on-deliver, then paying should instantly release the file. Otherwise, files should be delivered ASAP
////Files should be collected ideally via Email, but other delivery mechanisms will work too (i.e via discord)
////Maybe do an in-app delivery mechanism? However, this would require an account.
////Freelancer Upload
Freelancer -> "/freelancer/$freelancer/requests/$requestID/finalProduct" [label="POST Request"]
"/freelancer/$freelancer/requests/$requestID/finalProduct" -> deliveryHandler [label="notification to start handling the delivery of the product"]
"/freelancer/$freelancer/requests/$requestID/finalProduct" -> "Download Link Maker" [label="Notification to hand the Freelancer a link to his product"]
"Download Link Maker" -> "/freelancer/$freelancer/requests/$requestID/finalProduct" -> Freelancer [label="Link to final product"]
////Conditional on delivery handling
"commission database" -> deliveryHandler [label="check if delivery is pay-on-deliver or not"]
deliveryHandler -> {"Email Server"} -> Customer [label="Final Product delivered directly if not pay-on-deliver"]
deliveryHandler -> OnDeliverPaymentSetup [label="notify that this will require payment on deliver"]
"commission database" -> OnDeliverPaymentSetup -> {BTCPayServer Stripe}[label="Amount owed and who to invoice"]
{BTCPayServer Stripe} -> "Invoice IDs" -> "commission database" [label="write $invoiceID of commission"]
"commission database" -> OnDeliverPaymentWatcher [label="periodic queries of $invoiceIDs of unpaid delivery commissions"]
{BTCPayServer Stripe} -> OnDeliverPaymentWatcher [label="Payment recieved on invoice"]
OnDeliverPaymentWatcher -> Freelancer [label="Notification that payment for commission has been recieved"]
OnDeliverPaymentWatcher -> {"Email Server"} -> Customer [label="Final Product delivered"]
}

View File

@ -1,3 +1,24 @@
Commission request data:
$requestID
$customerEmailAddress
$freelancer
$templateName
$currencyPreference
$priceUpFront
$priceOnDeliver
$requestDescription
$accepted
$upFrontPaid
$onDeliverPaid
$invoiceID
Vendors will be stored ideally in a file, or on a DB if necessary
Vendors will provide contact information to set up a commission and the terms of it (Ideally email will have primacy here)
Vendors can set up "template commissions". These template commissions can just be a link easily embedable anywhere for requesting a quote