[MM-28218] API hookup for updating company info and address in MM app (#15974)

Этот коммит содержится в:
Devin Binnie
2020-10-20 05:46:58 -04:00
коммит произвёл GitHub
родитель c05ee81c9f
Коммит 73a1c95137
4 изменённых файлов: 128 добавлений и 11 удалений

Просмотреть файл

@@ -5686,3 +5686,33 @@ func (c *Client4) GetSubscription() (*Subscription, *Response) {
return subscription, BuildResponse(r)
}
func (c *Client4) UpdateCloudCustomer(customerInfo *CloudCustomerInfo) (*CloudCustomer, *Response) {
customerBytes, _ := json.Marshal(customerInfo)
r, appErr := c.doApiPutBytes(c.GetCloudRoute()+"/customer", customerBytes)
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
var customer *CloudCustomer
json.NewDecoder(r.Body).Decode(&customer)
return customer, BuildResponse(r)
}
func (c *Client4) UpdateCloudCustomerAddress(address *Address) (*CloudCustomer, *Response) {
addressBytes, _ := json.Marshal(address)
r, appErr := c.doApiPutBytes(c.GetCloudRoute()+"/customer/address", addressBytes)
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
var customer *CloudCustomer
json.NewDecoder(r.Body).Decode(&customer)
return customer, BuildResponse(r)
}