本文整理汇总了Golang中github.com/stripe/stripe-go.TransferParams类的典型用法代码示例。如果您正苦于以下问题:Golang TransferParams类的具体用法?Golang TransferParams怎么用?Golang TransferParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransferParams类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Get
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
}
示例2: Cancel
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
}
示例3: New
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
}
示例4: Update
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
}