Exemplo n.º 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
}
Exemplo n.º 2
0
func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {
	body := &url.Values{
		"managed":                 {strconv.FormatBool(params.Managed)},
		"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
}
Exemplo n.º 3
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)

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

		params.AppendTo(body)
	}

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

	return acct, err
}