forked from stripe/stripe-go
/
topup.go
53 lines (48 loc) · 2.19 KB
/
topup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package stripe
// TopupParams is the set of parameters that can be used when creating or updating a top-up.
// For more details see https://stripe.com/docs/api#create_topup and https://stripe.com/docs/api#update_topup.
type TopupParams struct {
Params `form:"*"`
Amount uint64 `form:"amount"`
Currency Currency `form:"currency"`
Desc string `form:"description"`
Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"
Statement string `form:"statement_descriptor"`
}
// SetSource adds valid sources to a TopupParams object,
// returning an error for unsupported sources.
func (p *TopupParams) SetSource(sp interface{}) error {
source, err := SourceParamsFor(sp)
p.Source = source
return err
}
// TopupListParams is the set of parameters that can be used when listing top-ups.
// For more details see https://stripe.com/docs/api#list_topups.
type TopupListParams struct {
ListParams `form:"*"`
Created int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
}
// TopupList is a list of top-ups as retrieved from a list endpoint.
type TopupList struct {
ListMeta
Values []*Topup `json:"data"`
}
// Topup is the resource representing a Stripe top-up.
// For more details see https://stripe.com/docs/api#topups.
type Topup struct {
Amount uint64 `json:"amount"`
ArrivalDate int64 `json:"arrival_date"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
Desc string `json:"description"`
ExpectedAvailabilityDate int64 `json:"expected_availability_date"`
FailCode string `json:"failure_code"`
FailMsg string `json:"failure_message"`
ID string `json:"id"`
Live bool `json:"livemode"`
Source *PaymentSource `json:"source"`
Statement string `json:"statement_descriptor"`
Status string `json:"status"`
Tx *Transaction `json:"balance_transaction"`
}