forked from braintree-go/braintree-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer.go
35 lines (31 loc) · 1.19 KB
/
customer.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
package braintree
import "github.com/lionelbarrow/braintree-go/nullable"
type Customer struct {
XMLName string `xml:"customer"`
Id string `xml:"id,omitempty"`
FirstName string `xml:"first-name,omitempty"`
LastName string `xml:"last-name,omitempty"`
Company string `xml:"company,omitempty"`
Email string `xml:"email,omitempty"`
Phone string `xml:"phone,omitempty"`
Fax string `xml:"fax,omitempty"`
Website string `xml:"website,omitempty"`
CreditCard *CreditCard `xml:"credit-card,omitempty"`
CreditCards *CreditCards `xml:"credit-cards,omitempty"`
}
// DefaultCreditCard returns the default credit card, or nil
func (c *Customer) DefaultCreditCard() *CreditCard {
for _, card := range c.CreditCards.CreditCard {
if card.Default {
return card
}
}
return nil
}
type CustomerSearchResult struct {
XMLName string `xml:"customers"`
CurrentPageNumber *nullable.NullInt64 `xml:"current-page-number"`
PageSize *nullable.NullInt64 `xml:"page-size"`
TotalItems *nullable.NullInt64 `xml:"total-items"`
Customers []*Customer `xml:"customer"`
}