Files
2e03d96084 feat: update speakeasy (#1100)
Co-authored-by: Maxence Maireaux <[email protected]>
Co-authored-by: David Ragot <[email protected]>
2024-01-08 18:23:33 +00:00

51 lines
1.0 KiB
Go

// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package shared
import (
"encoding/json"
"fmt"
)
type PaymentStatus string
const (
PaymentStatusPending PaymentStatus = "PENDING"
PaymentStatusSucceeded PaymentStatus = "SUCCEEDED"
PaymentStatusCancelled PaymentStatus = "CANCELLED"
PaymentStatusFailed PaymentStatus = "FAILED"
PaymentStatusExpired PaymentStatus = "EXPIRED"
PaymentStatusRefunded PaymentStatus = "REFUNDED"
PaymentStatusOther PaymentStatus = "OTHER"
)
func (e PaymentStatus) ToPointer() *PaymentStatus {
return &e
}
func (e *PaymentStatus) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "PENDING":
fallthrough
case "SUCCEEDED":
fallthrough
case "CANCELLED":
fallthrough
case "FAILED":
fallthrough
case "EXPIRED":
fallthrough
case "REFUNDED":
fallthrough
case "OTHER":
*e = PaymentStatus(v)
return nil
default:
return fmt.Errorf("invalid value for PaymentStatus: %v", v)
}
}