forked from braintree-go/braintree-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subscription.go
61 lines (53 loc) · 3.13 KB
/
subscription.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
54
55
56
57
58
59
60
61
package braintree
import "github.com/processout/braintree-go/nullable"
const (
SubscriptionStatusActive = "Active"
SubscriptionStatusCanceled = "Canceled"
SubscriptionStatusExpired = "Expired"
SubscriptionStatusPastDue = "Past Due"
SubscriptionStatusPending = "Pending"
SubscriptionStatusUnrecognized = "Unrecognized"
)
type Subscription struct {
XMLName string `xml:"subscription"`
Id string `xml:"id,omitempty"`
Balance *Decimal `xml:"balance,omitempty"`
BillingDayOfMonth string `xml:"billing-day-of-month,omitempty"`
BillingPeriodEndDate string `xml:"billing-period-end-date,omitempty"`
BillingPeriodStartDate string `xml:"billing-period-start-date,omitempty"`
CurrentBillingCycle string `xml:"current-billing-cycle,omitempty"`
DaysPastDue string `xml:"days-past-due,omitempty"`
Discounts []interface{} `xml:"discounts,omitempty"`
FailureCount string `xml:"failure-count,omitempty"`
FirstBillingDate string `xml:"first-billing-date,omitempty"`
MerchantAccountId string `xml:"merchant-account-id,omitempty"`
CurrencyISOCode string `xml:"currency-iso-code,omitempty`
NeverExpires *nullable.NullBool `xml:"never-expires,omitempty"`
NextBillAmount *Decimal `xml:"next-bill-amount,omitempty"`
NextBillingPeriodAmount *Decimal `xml:"next-billing-period-amount,omitempty"`
NextBillingDate string `xml:"next-billing-date,omitempty"`
NumberOfBillingCycles *nullable.NullInt64 `xml:"number-of-billing-cycles,omitempty"`
PaidThroughDate string `xml:"paid-through-date,omitempty"`
PaymentMethodToken string `xml:"payment-method-token,omitempty"`
PlanId string `xml:"plan-id,omitempty"`
Price *Decimal `xml:"price,omitempty"`
Status string `xml:"status,omitempty"`
TrialDuration string `xml:"trial-duration,omitempty"`
TrialDurationUnit string `xml:"trial-duration-unit,omitempty"`
TrialPeriod *nullable.NullBool `xml:"trial-period,omitempty"`
Transactions *Transactions `xml:"transactions,omitempty"`
Options *SubscriptionOptions `xml:"options,omitempty"`
// AddOns []interface{} `xml:"add-ons,omitempty"`
// Descriptor interface{} `xml:"descriptor,omitempty"` // struct with name, phone
Descriptor *Descriptor `xml:"descriptor,omitempty"`
}
type Subscriptions struct {
Subscription []*Subscription `xml:"subscription"`
}
type SubscriptionOptions struct {
DoNotInheritAddOnsOrDiscounts bool `xml:"do-not-inherit-add-ons-or-discounts,omitempty"`
ProrateCharges bool `xml:"prorate-charges,omitempty"`
ReplaceAllAddOnsAndDiscounts bool `xml:"replace-all-add-ons-and-discounts,omitempty"`
RevertSubscriptionOnProrationFailure bool `xml:"revert-subscription-on-proration-failure,omitempty"`
StartImmediately bool `xml:"start-immediately,omitempty"`
}