func (c Client) Get(id string, params *stripe.TransferParams) (*stripe.Transfer, error) { var body *url.Values var commonParams *stripe.Params if params != nil { commonParams = ¶ms.Params body = &url.Values{} params.AppendTo(body) } transfer := &stripe.Transfer{} err := c.B.Call("GET", "/transfers/"+id, c.Key, body, commonParams, transfer) return transfer, err }
func (c Client) Cancel(id string, params *stripe.TransferParams) (*stripe.Transfer, error) { var body *url.Values var commonParams *stripe.Params if params != nil { commonParams = ¶ms.Params body = &url.Values{} params.AppendTo(body) } transfer := &stripe.Transfer{} err := c.B.Call("POST", fmt.Sprintf("/transfers/%v/cancel", id), c.Key, body, commonParams, transfer) return transfer, err }
func (c Client) New(params *stripe.TransferParams) (*stripe.Transfer, error) { body := &stripe.RequestValues{} body.Add("amount", strconv.FormatInt(params.Amount, 10)) body.Add("currency", string(params.Currency)) if len(params.Recipient) > 0 { body.Add("recipient", params.Recipient) } if len(params.Bank) > 0 { body.Add("bank_account", params.Bank) } else if len(params.Card) > 0 { body.Add("card", params.Card) } if len(params.Desc) > 0 { body.Add("description", params.Desc) } if len(params.Statement) > 0 { body.Add("statement_descriptor", params.Statement) } if len(params.Dest) > 0 { body.Add("destination", params.Dest) } if len(params.SourceTx) > 0 { body.Add("source_transaction", params.SourceTx) } if params.Fee > 0 { body.Add("application_fee", strconv.FormatUint(params.Fee, 10)) } if len(params.SourceType) > 0 { body.Add("source_type", string(params.SourceType)) } params.AppendTo(body) transfer := &stripe.Transfer{} err := c.B.Call("POST", "/transfers", c.Key, body, ¶ms.Params, transfer) return transfer, err }
func (c Client) Update(id string, params *stripe.TransferParams) (*stripe.Transfer, error) { var body *url.Values var commonParams *stripe.Params if params != nil { commonParams = ¶ms.Params body = &url.Values{} if len(params.Desc) > 0 { body.Add("description", params.Desc) } params.AppendTo(body) } transfer := &stripe.Transfer{} err := c.B.Call("POST", "/transfers/"+id, c.Key, body, commonParams, transfer) return transfer, err }