-
Notifications
You must be signed in to change notification settings - Fork 9
/
vault_type.go
103 lines (95 loc) · 3.39 KB
/
vault_type.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package paypal
import (
"fmt"
"net/url"
)
type CreditCard struct {
// Request body
Number string `json:"number,omitempty"` // required
Type string `json:"type,omitempty"` // required
ExpireMonth string `json:"expire_month,omitempty"` // required
ExpireYear string `json:"expire_year,omitempty"` // required
BillingAddress *BillingAddress `json:"billing_address,omitempty"` // required
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
ExternalCustomerId string `json:"external_customer_id,omitempty"`
MerchantId string `json:"merchant_id,omitempty"`
PayerId string `json:"payer_id,omitempty"`
ExternalCardId string `json:"external_card_id,omitempty"`
Id string `json:"id,omitempty"`
State string `json:"state,omitempty"`
CreateTime string `json:"create_time,omitempty"`
UpdateTime string `json:"update_time,omitempty"`
ValidUntil string `json:"valid_until,omitempty"`
Links []*Link `json:"links,omitempty"`
}
type BillingAddress struct {
Line1 string `json:"line1,omitempty"`
Line2 string `json:"line2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
CountryCode string `json:"country_code,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
Phone string `json:"phone,omitempty"`
NormalizationStatus string `json:"normalization_status,omitempty"`
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
}
type CreditCardToken struct {
CreditCardId string `json:"credit_card_id,omitempty"` // required
PayerId string `json:"payer_id,omitempty"`
Last4 string `json:"last4,omitempty"`
Type string `json:"type,omitempty"`
ExpireMonth string `json:"expire_month,omitempty"`
ExpireYear string `json:"expire_year,omitempty"`
}
type CreditCardListParam struct {
PageSize int
Page int
StartTime string
EndTime string
SortOrder string
SortBy string
MerchantId string
ExternalCardId string
ExternalCustomerId string
TotalRequired bool
}
func (p *CreditCardListParam) QueryString() string {
var v = url.Values{}
if p.PageSize > 0 {
v.Set("page_size", fmt.Sprintf("%d", p.PageSize))
}
if p.Page > 0 {
v.Set("page", fmt.Sprintf("%d", p.Page))
}
if len(p.StartTime) > 0 {
v.Set("start_time", p.StartTime)
}
if len(p.EndTime) > 0 {
v.Set("end_time", p.EndTime)
}
if len(p.SortOrder) > 0 {
v.Set("sort_order", p.SortOrder)
}
if len(p.SortBy) > 0 {
v.Set("sort_by", p.SortBy)
}
if len(p.MerchantId) > 0 {
v.Set("merchant_id", p.MerchantId)
}
if len(p.ExternalCardId) > 0 {
v.Set("external_card_id", p.ExternalCardId)
}
if len(p.ExternalCustomerId) > 0 {
v.Set("external_customer_id", p.ExternalCustomerId)
}
v.Set("total_required", fmt.Sprintf("%t", p.TotalRequired))
return "?" + v.Encode()
}
type CreditCardList struct {
Items []*CreditCard `json:"items,omitempty"`
TotalItems int `json:"total_items,omitempty"`
TotalPages int `json:"total_pages,omitempty"`
Links []*Link `json:"links,omitempty"`
}