Contracts for buyer
This commit is contained in:
@@ -12,6 +12,11 @@ type Company struct {
|
||||
Devices []Device
|
||||
}
|
||||
|
||||
type CompanyShortResponse struct {
|
||||
ID int
|
||||
Name string
|
||||
}
|
||||
|
||||
|
||||
func (Company) Update() (bool, error) {
|
||||
return false, nil
|
||||
|
||||
@@ -21,10 +21,44 @@ type Contract struct {
|
||||
Status string
|
||||
BlockchainID string
|
||||
ContractInfos []ContractInfo
|
||||
BuyerName string `gorm:"-"`
|
||||
NumberOfDevices int `gorm:"-"`
|
||||
}
|
||||
|
||||
const ContractStatusActive = "active"
|
||||
const ContractStatusPending = "pending"
|
||||
const ContractStatusDraft = "draft"
|
||||
const ContractStatusSigned = "signed"
|
||||
const ContractStatusReadyForActivation = "ready_for_activation"
|
||||
const ContractStatusExecuted = "executed"
|
||||
const ContractStatusRevoked = "revoked"
|
||||
|
||||
|
||||
type Status struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func GetContractStatuses() []Status {
|
||||
return []Status{
|
||||
{Key: "Active", Value: "active"},
|
||||
{Key: "Pending signature", Value: "pending"},
|
||||
{Key: "Draft", Value: "draft"},
|
||||
{Key: "Signed", Value: "signed"},
|
||||
{Key: "Ready for Activation", Value: "ready_for_activation"},
|
||||
{Key: "Executed", Value: "executed"},
|
||||
{Key: "Revoked", Value: "revoked"},
|
||||
}
|
||||
}
|
||||
|
||||
type ListContractResponse struct {
|
||||
Status KeyValue `json:"Status"`
|
||||
Buyer CompanyShortResponse `json:"Buyer"`
|
||||
ContractID int
|
||||
NumberOfDevices int
|
||||
DateCreated time.Time
|
||||
|
||||
}
|
||||
|
||||
func (Contract) Update() (bool, error) {
|
||||
return false, nil
|
||||
|
||||
@@ -27,9 +27,33 @@ type Invoice struct {
|
||||
InvoiceDueDate time.Time
|
||||
ContractID uint
|
||||
InvoiceItem [] InvoiceItem
|
||||
Status string
|
||||
}
|
||||
|
||||
|
||||
type ListInvoiceResponse struct {
|
||||
Status KeyValue `json:"Status"`
|
||||
Buyer CompanyShortResponse `json:"Buyer"`
|
||||
ContractID int
|
||||
DateCreated time.Time
|
||||
DueDate time.Time
|
||||
Amount string
|
||||
|
||||
}
|
||||
|
||||
type KeyValue struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
|
||||
|
||||
func GetInvoiceStatuses() []Status {
|
||||
return []Status{
|
||||
{Key: "Insurance claimed", Value: "insurance_claimed"},
|
||||
{Key: "Invoice issued", Value: "invoice_issued"},
|
||||
}
|
||||
}
|
||||
|
||||
func (Invoice) Update() (bool, error) {
|
||||
return false, nil
|
||||
|
||||
Reference in New Issue
Block a user