~evanj/cms

ref: 99a3bb7fc511e3f448a358691896ba1300f73a93 cms/vendor/github.com/stripe/stripe-go/v71/oauth.go -rw-r--r-- 5.1 KiB
99a3bb7fEvan M Jones WIP(rbac): Decorator object complete. TODO: Specify role in invite. 1 year, 1 month ago
                                                                                
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package stripe

// OAuthScopeType is the type of OAuth scope.
type OAuthScopeType string

// List of possible values for OAuth scopes.
const (
	OAuthScopeTypeReadOnly  OAuthScopeType = "read_only"
	OAuthScopeTypeReadWrite OAuthScopeType = "read_write"
)

// OAuthTokenType is the type of token. This will always be "bearer."
type OAuthTokenType string

// List of possible OAuthTokenType values.
const (
	OAuthTokenTypeBearer OAuthTokenType = "bearer"
)

// OAuthStripeUserBusinessType is the business type for the Stripe oauth user.
type OAuthStripeUserBusinessType string

// List of supported values for business type.
const (
	OAuthStripeUserBusinessTypeCorporation OAuthStripeUserBusinessType = "corporation"
	OAuthStripeUserBusinessTypeLLC         OAuthStripeUserBusinessType = "llc"
	OAuthStripeUserBusinessTypeNonProfit   OAuthStripeUserBusinessType = "non_profit"
	OAuthStripeUserBusinessTypePartnership OAuthStripeUserBusinessType = "partnership"
	OAuthStripeUserBusinessTypeSoleProp    OAuthStripeUserBusinessType = "sole_prop"
)

// OAuthStripeUserGender of the person who will be filling out a Stripe
// application. (International regulations require either male or female.)
type OAuthStripeUserGender string

// The gender of the person who  will be filling out a Stripe application.
// (International regulations require either male or female.)
const (
	OAuthStripeUserGenderFemale OAuthStripeUserGender = "female"
	OAuthStripeUserGenderMale   OAuthStripeUserGender = "male"
)

// OAuthStripeUserParams for the stripe_user OAuth Authorize params.
type OAuthStripeUserParams struct {
	BlockKana          *string `form:"block_kana"`
	BlockKanji         *string `form:"block_kanji"`
	BuildingKana       *string `form:"building_kana"`
	BuildingKanji      *string `form:"building_kanji"`
	BusinessName       *string `form:"business_name"`
	BusinessType       *string `form:"business_type"`
	City               *string `form:"city"`
	Country            *string `form:"country"`
	Currency           *string `form:"currency"`
	DOBDay             *int64  `form:"dob_day"`
	DOBMonth           *int64  `form:"dob_month"`
	DOBYear            *int64  `form:"dob_year"`
	Email              *string `form:"email"`
	FirstName          *string `form:"first_name"`
	FirstNameKana      *string `form:"first_name_kana"`
	FirstNameKanji     *string `form:"first_name_kanji"`
	Gender             *string `form:"gender"`
	LastName           *string `form:"last_name"`
	LastNameKana       *string `form:"last_name_kana"`
	LastNameKanji      *string `form:"last_name_kanji"`
	PhoneNumber        *string `form:"phone_number"`
	PhysicalProduct    *bool   `form:"physical_product"`
	ProductDescription *string `form:"product_description"`
	State              *string `form:"state"`
	StreetAddress      *string `form:"street_address"`
	URL                *string `form:"url"`
	Zip                *string `form:"zip"`
}

// AuthorizeURLParams for creating OAuth AuthorizeURLs.
type AuthorizeURLParams struct {
	Params                `form:"*"`
	AlwaysPrompt          *bool                  `form:"always_prompt"`
	ClientID              *string                `form:"client_id"`
	RedirectURI           *string                `form:"redirect_uri"`
	ResponseType          *string                `form:"response_type"`
	Scope                 *string                `form:"scope"`
	State                 *string                `form:"state"`
	StripeLanding         *string                `form:"stripe_landing"`
	StripeUser            *OAuthStripeUserParams `form:"stripe_user"`
	SuggestedCapabilities []*string              `form:"suggested_capabilities"`

	// Express is not sent as a parameter, but is used to modify the authorize URL
	// path to use the express OAuth path.
	Express *bool `form:"-"`
}

// DeauthorizeParams for deauthorizing an account.
type DeauthorizeParams struct {
	Params       `form:"*"`
	ClientID     *string `form:"client_id"`
	StripeUserID *string `form:"stripe_user_id"`
}

// OAuthTokenParams is the set of paramaters that can be used to request
// OAuthTokens.
type OAuthTokenParams struct {
	Params             `form:"*"`
	AssertCapabilities []*string `form:"assert_capabilities"`
	ClientSecret       *string   `form:"client_secret"`
	Code               *string   `form:"code"`
	GrantType          *string   `form:"grant_type"`
	RefreshToken       *string   `form:"refresh_token"`
	Scope              *string   `form:"scope"`
}

// OAuthToken is the value of the OAuthToken from OAuth flow.
// https://stripe.com/docs/connect/oauth-reference#post-token
type OAuthToken struct {
	APIResource

	Livemode     bool           `json:"livemode"`
	Scope        OAuthScopeType `json:"scope"`
	StripeUserID string         `json:"stripe_user_id"`
	TokenType    OAuthTokenType `json:"token_type"`

	// Deprecated, please use StripeUserID
	AccessToken          string `json:"access_token"`
	RefreshToken         string `json:"refresh_token"`
	StripePublishableKey string `json:"stripe_publishable_key"`
}

// Deauthorize is the value of the return from deauthorizing.
// https://stripe.com/docs/connect/oauth-reference#post-deauthorize
type Deauthorize struct {
	APIResource
	StripeUserID string `json:"stripe_user_id"`
}