本文整理汇总了Golang中github.com/stripe/stripe-go.RefundParams类的典型用法代码示例。如果您正苦于以下问题:Golang RefundParams类的具体用法?Golang RefundParams怎么用?Golang RefundParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RefundParams类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: New
func (c Client) New(params *stripe.RefundParams) (*stripe.Refund, error) {
body := &url.Values{}
if params.Amount > 0 {
body.Add("amount", strconv.FormatUint(params.Amount, 10))
}
if params.Fee {
body.Add("refund_application_fee", strconv.FormatBool(params.Fee))
}
if params.Transfer {
body.Add("refund_transfer", strconv.FormatBool(params.Transfer))
}
if len(params.Reason) > 0 {
body.Add("reason", string(params.Reason))
}
params.AppendTo(body)
refund := &stripe.Refund{}
err := c.B.Call("POST", fmt.Sprintf("/charges/%v/refunds", params.Charge), c.Key, body, ¶ms.Params, refund)
return refund, err
}
示例2: Get
func (c Client) Get(id string, params *stripe.RefundParams) (*stripe.Refund, error) {
body := &url.Values{}
params.AppendTo(body)
refund := &stripe.Refund{}
err := c.B.Call("GET", fmt.Sprintf("/refunds/%v", id), c.Key, body, ¶ms.Params, refund)
return refund, err
}
示例3: Update
func (c Client) Update(id string, params *stripe.RefundParams) (*stripe.Refund, error) {
body := &url.Values{}
params.AppendTo(body)
refund := &stripe.Refund{}
err := c.B.Call("POST", fmt.Sprintf("/charges/%v/refunds/%v", params.Charge, id), c.Key, body, ¶ms.Params, refund)
return refund, err
}
示例4: Get
func (c Client) Get(id string, params *stripe.RefundParams) (*stripe.Refund, error) {
if params == nil {
return nil, fmt.Errorf("params cannot be nil, and params.Charge must be set")
}
body := &url.Values{}
params.AppendTo(body)
refund := &stripe.Refund{}
err := c.B.Call("GET", fmt.Sprintf("/charges/%v/refunds/%v", params.Charge, id), c.Key, body, ¶ms.Params, refund)
return refund, err
}
示例5: Get
func (c Client) Get(id string, params *stripe.RefundParams) (*stripe.Refund, error) {
var body *stripe.RequestValues
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &stripe.RequestValues{}
params.AppendTo(body)
}
refund := &stripe.Refund{}
err := c.B.Call("GET", "/refunds/"+id, c.Key, body, commonParams, refund)
return refund, err
}