Skip to content

Commit

Permalink
Fix invoice status as string
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Nov 29, 2021
1 parent 644eeab commit 32f4126
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions politeiad/backendv2/tstorebe/plugins/cms/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"fmt"
"io"
"sort"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -62,7 +61,7 @@ func (c *cmsPlugin) cmdSetInvoiceStatus(token []byte, payload string) (string, e
}

// Verify signature
msg := sbs.Token + strconv.FormatUint(uint64(sbs.Status), 10) + sbs.Reason
msg := sbs.Token + string(sbs.Status) + sbs.Reason
err = util.VerifySignature(sbs.Signature, sbs.PublicKey, msg)
if err != nil {
return "", convertSignatureError(err)
Expand Down
18 changes: 9 additions & 9 deletions politeiad/plugins/cms/cms.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,18 +514,18 @@ type InvoiceMetadata struct {

// InvoiceStatusT represents the invoice status of a invoice that has been
// approved by the Decred stakeholders.
type InvoiceStatusT uint32
type InvoiceStatusT string

const (
// InvoiceStatusInvalid is an invalid invoice status.
InvoiceStatusInvalid InvoiceStatusT = 0
InvoiceStatusNotFound InvoiceStatusT = 1 // Invoice not found
InvoiceStatusNew InvoiceStatusT = 2 // Invoice has not been reviewed
InvoiceStatusUpdated InvoiceStatusT = 3 // Invoice has unreviewed changes
InvoiceStatusDisputed InvoiceStatusT = 4 // Invoice has been disputed for some reason
InvoiceStatusRejected InvoiceStatusT = 5 // Invoice fully rejected and closed
InvoiceStatusApproved InvoiceStatusT = 6 // Invoice has been approved
InvoiceStatusPaid InvoiceStatusT = 7 // Invoice has been paid
InvoiceStatusInvalid InvoiceStatusT = "invalid"
InvoiceStatusNotFound InvoiceStatusT = "not found" // Invoice not found
InvoiceStatusNew InvoiceStatusT = "new" // Invoice has not been reviewed
InvoiceStatusUpdated InvoiceStatusT = "updated" // Invoice has unreviewed changes
InvoiceStatusDisputed InvoiceStatusT = "disputed" // Invoice has been disputed for some reason
InvoiceStatusRejected InvoiceStatusT = "rejected" // Invoice fully rejected and closed
InvoiceStatusApproved InvoiceStatusT = "approved" // Invoice has been approved
InvoiceStatusPaid InvoiceStatusT = "paid" // Invoice has been paid
)

type LineItemTypeT int
Expand Down
2 changes: 1 addition & 1 deletion politeiawww/api/cms/v2/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ type LineItemsInput struct {
Expenses uint `json:"expenses"` // Total cost (in USD cents) of line item (if expense or misc)
}

type InvoiceStatusT int
type InvoiceStatusT uint32

const (
// Invoice status codes
Expand Down

0 comments on commit 32f4126

Please sign in to comment.