Files

255 lines
5.1 KiB
Go

// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package shared
import (
"encoding/json"
"fmt"
"github.com/formancehq/formance-sdk-go/v2/pkg/utils"
"math/big"
"time"
)
type V2PaymentRaw struct {
}
type Scheme string
const (
SchemeVisa Scheme = "visa"
SchemeMastercard Scheme = "mastercard"
SchemeAmex Scheme = "amex"
SchemeDiners Scheme = "diners"
SchemeDiscover Scheme = "discover"
SchemeJcb Scheme = "jcb"
SchemeUnionpay Scheme = "unionpay"
SchemeSepaDebit Scheme = "sepa debit"
SchemeSepaCredit Scheme = "sepa credit"
SchemeSepa Scheme = "sepa"
SchemeApplePay Scheme = "apple pay"
SchemeGooglePay Scheme = "google pay"
SchemeA2a Scheme = "a2a"
SchemeAchDebit Scheme = "ach debit"
SchemeAch Scheme = "ach"
SchemeRtp Scheme = "rtp"
SchemeUnknown Scheme = "unknown"
SchemeOther Scheme = "other"
)
func (e Scheme) ToPointer() *Scheme {
return &e
}
func (e *Scheme) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "visa":
fallthrough
case "mastercard":
fallthrough
case "amex":
fallthrough
case "diners":
fallthrough
case "discover":
fallthrough
case "jcb":
fallthrough
case "unionpay":
fallthrough
case "sepa debit":
fallthrough
case "sepa credit":
fallthrough
case "sepa":
fallthrough
case "apple pay":
fallthrough
case "google pay":
fallthrough
case "a2a":
fallthrough
case "ach debit":
fallthrough
case "ach":
fallthrough
case "rtp":
fallthrough
case "unknown":
fallthrough
case "other":
*e = Scheme(v)
return nil
default:
return fmt.Errorf("invalid value for Scheme: %v", v)
}
}
type V2PaymentType string
const (
V2PaymentTypePayIn V2PaymentType = "PAY-IN"
V2PaymentTypePayout V2PaymentType = "PAYOUT"
V2PaymentTypeTransfer V2PaymentType = "TRANSFER"
V2PaymentTypeOther V2PaymentType = "OTHER"
)
func (e V2PaymentType) ToPointer() *V2PaymentType {
return &e
}
func (e *V2PaymentType) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "PAY-IN":
fallthrough
case "PAYOUT":
fallthrough
case "TRANSFER":
fallthrough
case "OTHER":
*e = V2PaymentType(v)
return nil
default:
return fmt.Errorf("invalid value for V2PaymentType: %v", v)
}
}
type V2Payment struct {
Adjustments []V2PaymentAdjustment `json:"adjustments"`
Asset string `json:"asset"`
ConnectorID string `json:"connectorID"`
CreatedAt time.Time `json:"createdAt"`
DestinationAccountID string `json:"destinationAccountID"`
ID string `json:"id"`
InitialAmount *big.Int `json:"initialAmount"`
Metadata *V2PaymentMetadata `json:"metadata"`
Provider *V2Connector `json:"provider,omitempty"`
Raw *V2PaymentRaw `json:"raw"`
Reference string `json:"reference"`
Scheme Scheme `json:"scheme"`
SourceAccountID string `json:"sourceAccountID"`
Status V2PaymentStatus `json:"status"`
Type V2PaymentType `json:"type"`
}
func (v V2Payment) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(v, "", false)
}
func (v *V2Payment) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &v, "", false, false); err != nil {
return err
}
return nil
}
func (o *V2Payment) GetAdjustments() []V2PaymentAdjustment {
if o == nil {
return []V2PaymentAdjustment{}
}
return o.Adjustments
}
func (o *V2Payment) GetAsset() string {
if o == nil {
return ""
}
return o.Asset
}
func (o *V2Payment) GetConnectorID() string {
if o == nil {
return ""
}
return o.ConnectorID
}
func (o *V2Payment) GetCreatedAt() time.Time {
if o == nil {
return time.Time{}
}
return o.CreatedAt
}
func (o *V2Payment) GetDestinationAccountID() string {
if o == nil {
return ""
}
return o.DestinationAccountID
}
func (o *V2Payment) GetID() string {
if o == nil {
return ""
}
return o.ID
}
func (o *V2Payment) GetInitialAmount() *big.Int {
if o == nil {
return big.NewInt(0)
}
return o.InitialAmount
}
func (o *V2Payment) GetMetadata() *V2PaymentMetadata {
if o == nil {
return nil
}
return o.Metadata
}
func (o *V2Payment) GetProvider() *V2Connector {
if o == nil {
return nil
}
return o.Provider
}
func (o *V2Payment) GetRaw() *V2PaymentRaw {
if o == nil {
return nil
}
return o.Raw
}
func (o *V2Payment) GetReference() string {
if o == nil {
return ""
}
return o.Reference
}
func (o *V2Payment) GetScheme() Scheme {
if o == nil {
return Scheme("")
}
return o.Scheme
}
func (o *V2Payment) GetSourceAccountID() string {
if o == nil {
return ""
}
return o.SourceAccountID
}
func (o *V2Payment) GetStatus() V2PaymentStatus {
if o == nil {
return V2PaymentStatus("")
}
return o.Status
}
func (o *V2Payment) GetType() V2PaymentType {
if o == nil {
return V2PaymentType("")
}
return o.Type
}