Пример #1
0
func (c Client) GetByID(id string, params *stripe.AccountParams) (*stripe.Account, error) {
	var body *url.Values
	var commonParams *stripe.Params

	if params != nil {
		commonParams = &params.Params
		body = &url.Values{}
		params.AppendTo(body)
	}

	account := &stripe.Account{}
	err := c.B.Call("GET", "/accounts/"+id, c.Key, body, commonParams, account)

	return account, err
}
Пример #2
0
func (c Client) Update(id string, params *stripe.AccountParams) (*stripe.Account, error) {
	var body *url.Values
	var commonParams *stripe.Params

	if params != nil {
		commonParams = &params.Params
		body = &url.Values{}

		writeAccountParams(params, body)

		params.AppendTo(body)
	}

	acct := &stripe.Account{}
	err := c.B.Call("POST", "/accounts/"+id, c.Key, body, commonParams, acct)

	return acct, err
}
Пример #3
0
func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {
	body := &url.Values{
		"managed": {strconv.FormatBool(params.Managed)},
	}

	writeAccountParams(params, body)

	if params.TOSAcceptance != nil {
		params.TOSAcceptance.AppendDetails(body)
	}

	params.AppendTo(body)

	acct := &stripe.Account{}
	err := c.B.Call("POST", "/accounts", c.Key, body, &params.Params, acct)

	return acct, err
}
Пример #4
0
func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {
	body := &stripe.RequestValues{}
	body.Add("managed", strconv.FormatBool(params.Managed))
	body.Add("debit_negative_balances", strconv.FormatBool(params.DebitNegativeBal))

	writeAccountParams(params, body)

	if params.TOSAcceptance != nil {
		params.TOSAcceptance.AppendDetails(body)
	}

	params.AppendTo(body)

	acct := &stripe.Account{}
	err := c.B.Call("POST", "/accounts", c.Key, body, &params.Params, acct)

	return acct, err
}
Пример #5
0
func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {
	body := &stripe.RequestValues{}

	if len(params.FromRecipient) == 0 {
		body.Add("managed", strconv.FormatBool(params.Managed))
	}

	writeAccountParams(params, body)

	if params.TOSAcceptance != nil {
		params.TOSAcceptance.AppendDetails(body)
	}

	params.AppendTo(body)

	acct := &stripe.Account{}
	err := c.B.Call("POST", "/accounts", c.Key, body, &params.Params, acct)

	return acct, err
}