channeldb: move payment status code into new file
This prepares the following expansion of the payment status codes.
This commit is contained in:
2 files changed
+42
-37
No files matched your search
@@ -0,0 +1,42 @@
|
|||||||
|
package channeldb
|
||||||
|
|
||||||
|
// PaymentStatus represent current status of payment.
|
||||||
|
type PaymentStatus byte
|
||||||
|
|
||||||
|
const (
|
||||||
|
// StatusUnknown is the status where a payment has never been initiated
|
||||||
|
// and hence is unknown.
|
||||||
|
StatusUnknown PaymentStatus = 0
|
||||||
|
|
||||||
|
// StatusInFlight is the status where a payment has been initiated, but
|
||||||
|
// a response has not been received.
|
||||||
|
StatusInFlight PaymentStatus = 1
|
||||||
|
|
||||||
|
// StatusSucceeded is the status where a payment has been initiated and
|
||||||
|
// the payment was completed successfully.
|
||||||
|
StatusSucceeded PaymentStatus = 2
|
||||||
|
|
||||||
|
// StatusFailed is the status where a payment has been initiated and a
|
||||||
|
// failure result has come back.
|
||||||
|
StatusFailed PaymentStatus = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// String returns readable representation of payment status.
|
||||||
|
func (ps PaymentStatus) String() string {
|
||||||
|
switch ps {
|
||||||
|
case StatusUnknown:
|
||||||
|
return "Unknown"
|
||||||
|
|
||||||
|
case StatusInFlight:
|
||||||
|
return "In Flight"
|
||||||
|
|
||||||
|
case StatusSucceeded:
|
||||||
|
return "Succeeded"
|
||||||
|
|
||||||
|
case StatusFailed:
|
||||||
|
return "Failed"
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -175,43 +175,6 @@ func (r FailureReason) String() string {
|
|||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaymentStatus represent current status of payment
|
|
||||||
type PaymentStatus byte
|
|
||||||
|
|
||||||
const (
|
|
||||||
// StatusUnknown is the status where a payment has never been initiated
|
|
||||||
// and hence is unknown.
|
|
||||||
StatusUnknown PaymentStatus = 0
|
|
||||||
|
|
||||||
// StatusInFlight is the status where a payment has been initiated, but
|
|
||||||
// a response has not been received.
|
|
||||||
StatusInFlight PaymentStatus = 1
|
|
||||||
|
|
||||||
// StatusSucceeded is the status where a payment has been initiated and
|
|
||||||
// the payment was completed successfully.
|
|
||||||
StatusSucceeded PaymentStatus = 2
|
|
||||||
|
|
||||||
// StatusFailed is the status where a payment has been initiated and a
|
|
||||||
// failure result has come back.
|
|
||||||
StatusFailed PaymentStatus = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
// String returns readable representation of payment status.
|
|
||||||
func (ps PaymentStatus) String() string {
|
|
||||||
switch ps {
|
|
||||||
case StatusUnknown:
|
|
||||||
return "Unknown"
|
|
||||||
case StatusInFlight:
|
|
||||||
return "In Flight"
|
|
||||||
case StatusSucceeded:
|
|
||||||
return "Succeeded"
|
|
||||||
case StatusFailed:
|
|
||||||
return "Failed"
|
|
||||||
default:
|
|
||||||
return "Unknown"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PaymentCreationInfo is the information necessary to have ready when
|
// PaymentCreationInfo is the information necessary to have ready when
|
||||||
// initiating a payment, moving it into state InFlight.
|
// initiating a payment, moving it into state InFlight.
|
||||||
type PaymentCreationInfo struct {
|
type PaymentCreationInfo struct {
|
||||||
|
|||||||
Reference in new issue
Block a user