[MM-28217] Server API to serve up cloud customer information (#15656)
* [MM-28217] Server API to serve up cloud customer information * Added missing client4 method * merge'd Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
375931a4b9
Коммит
ebd3e6aa49
@@ -5651,6 +5651,19 @@ func (c *Client4) ConfirmCustomerPayment(confirmRequest *ConfirmPaymentMethodReq
|
||||
return BuildResponse(r)
|
||||
}
|
||||
|
||||
func (c *Client4) GetCloudCustomer() (*CloudCustomer, *Response) {
|
||||
r, appErr := c.DoApiGet(c.GetCloudRoute()+"/customer", "")
|
||||
if appErr != nil {
|
||||
return nil, BuildErrorResponse(r, appErr)
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var cloudCustomer *CloudCustomer
|
||||
json.NewDecoder(r.Body).Decode(&cloudCustomer)
|
||||
|
||||
return cloudCustomer, BuildResponse(r)
|
||||
}
|
||||
|
||||
func (c *Client4) GetSubscription() (*Subscription, *Response) {
|
||||
r, appErr := c.DoApiGet(c.GetCloudRoute()+"/subscription", "")
|
||||
if appErr != nil {
|
||||
|
||||
@@ -31,6 +31,41 @@ type ConfirmPaymentMethodRequest struct {
|
||||
StripeSetupIntentID string `json:"stripe_setup_intent_id"`
|
||||
}
|
||||
|
||||
// Customer model represents a customer on the system.
|
||||
type CloudCustomer struct {
|
||||
ID string `json:"id"`
|
||||
CreatorID string `json:"creator_id"`
|
||||
CreateAt int64 `json:"create_at"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
NumEmployees int `json:"num_employees"`
|
||||
ContactFirstName string `json:"contact_first_name"`
|
||||
ContactLastName string `json:"contact_last_name"`
|
||||
BillingAddress *Address `json:"billing_address"`
|
||||
CompanyAddress *Address `json:"company_address"`
|
||||
PaymentMethod *PaymentMethod `json:"payment_method"`
|
||||
}
|
||||
|
||||
// Address model represents a customer's address.
|
||||
type Address struct {
|
||||
City string `json:"city"`
|
||||
Country string `json:"country"`
|
||||
Line1 string `json:"line1"`
|
||||
Line2 string `json:"line2"`
|
||||
PostalCode string `json:"postal_code"`
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
// PaymentMethod represents methods of payment for a customer.
|
||||
type PaymentMethod struct {
|
||||
Type string `json:"type"`
|
||||
LastFour int `json:"last_four"`
|
||||
ExpMonth int `json:"exp_month"`
|
||||
ExpYear int `json:"exp_year"`
|
||||
CardBrand string `json:"card_brand"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Subscription model represents a subscription on the system.
|
||||
type Subscription struct {
|
||||
ID string `json:"id"`
|
||||
|
||||
Ссылка в новой задаче
Block a user