diff --git a/bankaccount/client.go b/bankaccount/client.go index d4fe33a75f..22e84b3e99 100644 --- a/bankaccount/client.go +++ b/bankaccount/client.go @@ -33,7 +33,7 @@ func (c Client) New(params *stripe.BankAccountParams) (*stripe.BankAccount, erro if params.Customer != nil { err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources", stripe.StringValue(params.Customer)), c.Key, body, ¶ms.Params, ba) } else { - err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/bank_accounts", stripe.StringValue(params.Account)), c.Key, body, ¶ms.Params, ba) + err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts", stripe.StringValue(params.Account)), c.Key, body, ¶ms.Params, ba) } return ba, err @@ -58,9 +58,9 @@ func (c Client) Get(id string, params *stripe.BankAccountParams) (*stripe.BankAc var err error if params != nil && params.Customer != nil { - err = c.B.Call("GET", fmt.Sprintf("/customers/%v/bank_accounts/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) + err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) } else if params != nil && params.Account != nil { - err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/bank_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) + err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) } else { err = errors.New("Invalid bank account params: either Customer or Account need to be set") } @@ -87,9 +87,9 @@ func (c Client) Update(id string, params *stripe.BankAccountParams) (*stripe.Ban var err error if params.Customer != nil { - err = c.B.Call("POST", fmt.Sprintf("/customers/%v/bank_accounts/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) + err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) } else if params.Account != nil { - err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/bank_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) + err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) } else { err = errors.New("Invalid bank account params: either Customer or Account need to be set") } @@ -116,9 +116,9 @@ func (c Client) Del(id string, params *stripe.BankAccountParams) (*stripe.BankAc var err error if params.Customer != nil { - err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/bank_accounts/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) + err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba) } else if params.Account != nil { - err = c.B.Call("DELETE", fmt.Sprintf("/accounts/%v/bank_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) + err = c.B.Call("DELETE", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba) } else { err = errors.New("Invalid bank account params: either Customer or Account need to be set") } @@ -145,9 +145,9 @@ func (c Client) List(params *stripe.BankAccountListParams) *Iter { var err error if params.Customer != nil { - err = c.B.Call("GET", fmt.Sprintf("/customers/%v/bank_accounts", stripe.StringValue(params.Customer)), c.Key, b, p, list) + err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources?object=bank_account", stripe.StringValue(params.Customer)), c.Key, b, p, list) } else if params.Account != nil { - err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/bank_accounts", stripe.StringValue(params.Account)), c.Key, b, p, list) + err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts?object=bank_account", stripe.StringValue(params.Account)), c.Key, b, p, list) } else { err = errors.New("Invalid bank account params: either Customer or Account need to be set") } diff --git a/card/client.go b/card/client.go index baf6846095..667d3a0928 100644 --- a/card/client.go +++ b/card/client.go @@ -39,7 +39,7 @@ func (c Client) New(params *stripe.CardParams) (*stripe.Card, error) { if params.Account != nil { err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts", stripe.StringValue(params.Account)), c.Key, body, ¶ms.Params, card) } else if params.Customer != nil { - err = c.B.Call("POST", fmt.Sprintf("/customers/%v/cards", stripe.StringValue(params.Customer)), c.Key, body, ¶ms.Params, card) + err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources", stripe.StringValue(params.Customer)), c.Key, body, ¶ms.Params, card) } else if params.Recipient != nil { err = c.B.Call("POST", fmt.Sprintf("/recipients/%v/cards", stripe.StringValue(params.Recipient)), c.Key, body, ¶ms.Params, card) } else { @@ -75,7 +75,7 @@ func (c Client) Get(id string, params *stripe.CardParams) (*stripe.Card, error) if params.Account != nil { err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card) } else if params.Customer != nil { - err = c.B.Call("GET", fmt.Sprintf("/customers/%v/cards/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card) + err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card) } else if params.Recipient != nil { err = c.B.Call("GET", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card) } else { @@ -105,7 +105,7 @@ func (c Client) Update(id string, params *stripe.CardParams) (*stripe.Card, erro if params.Account != nil { err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, ¶ms.Params, card) } else if params.Customer != nil { - err = c.B.Call("POST", fmt.Sprintf("/customers/%v/cards/%v", stripe.StringValue(params.Customer), id), c.Key, body, ¶ms.Params, card) + err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, ¶ms.Params, card) } else if params.Recipient != nil { err = c.B.Call("POST", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, ¶ms.Params, card) } else { @@ -139,7 +139,7 @@ func (c Client) Del(id string, params *stripe.CardParams) (*stripe.Card, error) if params.Account != nil { err = c.B.Call("DELETE", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card) } else if params.Customer != nil { - err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/cards/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card) + err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card) } else if params.Recipient != nil { err = c.B.Call("DELETE", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card) } else { @@ -175,9 +175,9 @@ func (c Client) List(params *stripe.CardListParams) *Iter { } if params.Account != nil { - err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts", stripe.StringValue(params.Account)), c.Key, b, p, list) + err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts?object=card", stripe.StringValue(params.Account)), c.Key, b, p, list) } else if params.Customer != nil { - err = c.B.Call("GET", fmt.Sprintf("/customers/%v/cards", stripe.StringValue(params.Customer)), c.Key, b, p, list) + err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources?object=card", stripe.StringValue(params.Customer)), c.Key, b, p, list) } else if params.Recipient != nil { err = c.B.Call("GET", fmt.Sprintf("/recipients/%v/cards", stripe.StringValue(params.Recipient)), c.Key, b, p, list) } else {