2022-11-01 09:23:51 +08:00
|
|
|
package channeldb
|
|
|
|
|
|
|
|
// PaymentStatus represent current status of payment.
|
|
|
|
type PaymentStatus byte
|
|
|
|
|
|
|
|
const (
|
2022-11-24 12:26:17 +08:00
|
|
|
// NOTE: PaymentStatus = 0 was previously used for status unknown and
|
|
|
|
// is now deprecated.
|
2022-11-01 09:23:51 +08:00
|
|
|
|
2022-11-24 12:05:48 +08:00
|
|
|
// StatusInitiated is the status where a payment has just been
|
|
|
|
// initiated.
|
|
|
|
StatusInitiated PaymentStatus = 1
|
|
|
|
|
2022-11-01 09:23:51 +08:00
|
|
|
// StatusInFlight is the status where a payment has been initiated, but
|
|
|
|
// a response has not been received.
|
2022-11-24 12:05:48 +08:00
|
|
|
StatusInFlight PaymentStatus = 2
|
2022-11-01 09:23:51 +08:00
|
|
|
|
|
|
|
// StatusSucceeded is the status where a payment has been initiated and
|
|
|
|
// the payment was completed successfully.
|
2022-11-24 12:05:48 +08:00
|
|
|
StatusSucceeded PaymentStatus = 3
|
2022-11-01 09:23:51 +08:00
|
|
|
|
|
|
|
// StatusFailed is the status where a payment has been initiated and a
|
|
|
|
// failure result has come back.
|
2022-11-24 12:05:48 +08:00
|
|
|
StatusFailed PaymentStatus = 4
|
2022-11-01 09:23:51 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// String returns readable representation of payment status.
|
|
|
|
func (ps PaymentStatus) String() string {
|
|
|
|
switch ps {
|
2022-11-24 12:05:48 +08:00
|
|
|
case StatusInitiated:
|
|
|
|
return "Initiated"
|
|
|
|
|
2022-11-01 09:23:51 +08:00
|
|
|
case StatusInFlight:
|
|
|
|
return "In Flight"
|
|
|
|
|
|
|
|
case StatusSucceeded:
|
|
|
|
return "Succeeded"
|
|
|
|
|
|
|
|
case StatusFailed:
|
|
|
|
return "Failed"
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "Unknown"
|
|
|
|
}
|
|
|
|
}
|