本文整理汇总了Golang中github.com/stripe/stripe-go.InvoiceParams类的典型用法代码示例。如果您正苦于以下问题:Golang InvoiceParams类的具体用法?Golang InvoiceParams怎么用?Golang InvoiceParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InvoiceParams类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: New
func (c Client) New(params *stripe.InvoiceParams) (*stripe.Invoice, error) {
body := &url.Values{
"customer": {params.Customer},
}
if len(params.Desc) > 0 {
body.Add("description", params.Desc)
}
if len(params.Statement) > 0 {
body.Add("statement_descriptor", params.Statement)
}
if len(params.Sub) > 0 {
body.Add("subscription", params.Sub)
}
params.AppendTo(body)
token := c.Key
if params.Fee > 0 {
body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
}
if params.TaxPercent > 0 {
body.Add("tax_percent", strconv.FormatFloat(params.TaxPercent, 'f', 2, 64))
}
invoice := &stripe.Invoice{}
err := c.B.Call("POST", "/invoices", token, body, ¶ms.Params, invoice)
return invoice, err
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:33,代码来源:client.go
示例2: GetNext
func (c Client) GetNext(params *stripe.InvoiceParams) (*stripe.Invoice, error) {
body := &stripe.RequestValues{}
body.Add("customer", params.Customer)
if len(params.Sub) > 0 {
body.Add("subscription", params.Sub)
}
if len(params.SubPlan) > 0 {
body.Add("subscription_plan", params.SubPlan)
}
if params.SubNoProrate {
body.Add("subscription_prorate", strconv.FormatBool(false))
}
if params.SubProrationDate > 0 {
body.Add("subscription_proration_date", strconv.FormatInt(params.SubProrationDate, 10))
}
if params.SubQuantity > 0 {
body.Add("subscription_quantity", strconv.FormatUint(params.SubQuantity, 10))
}
if params.SubTrialEnd > 0 {
body.Add("subscription_trial_end", strconv.FormatInt(params.SubTrialEnd, 10))
}
params.AppendTo(body)
invoice := &stripe.Invoice{}
err := c.B.Call("GET", "/invoices/upcoming", c.Key, body, ¶ms.Params, invoice)
return invoice, err
}
开发者ID:captain401,项目名称:stripe-go,代码行数:35,代码来源:client.go
示例3: Update
func (c Client) Update(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {
var body *stripe.RequestValues
token := c.Key
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &stripe.RequestValues{}
if len(params.Desc) > 0 {
body.Add("description", params.Desc)
}
if len(params.Statement) > 0 {
body.Add("statement_descriptor", params.Statement)
}
if len(params.Sub) > 0 {
body.Add("subscription", params.Sub)
}
if params.Closed {
body.Add("closed", strconv.FormatBool(true))
} else if params.NoClosed {
body.Add("closed", strconv.FormatBool(false))
}
if params.Forgive {
body.Add("forgiven", strconv.FormatBool(true))
}
if params.Fee > 0 {
body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
}
if params.TaxPercent > 0 {
body.Add("tax_percent", strconv.FormatFloat(params.TaxPercent, 'f', 2, 64))
} else if params.TaxPercentZero {
body.Add("tax_percent", "0")
}
params.AppendTo(body)
}
invoice := &stripe.Invoice{}
err := c.B.Call("POST", "/invoices/"+id, token, body, commonParams, invoice)
return invoice, err
}
开发者ID:captain401,项目名称:stripe-go,代码行数:49,代码来源:client.go
示例4: Pay
func (c Client) Pay(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {
var body *url.Values
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &url.Values{}
params.AppendTo(body)
}
invoice := &stripe.Invoice{}
err := c.B.Call("POST", fmt.Sprintf("/invoices/%v/pay", id), c.Key, body, commonParams, invoice)
return invoice, err
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:15,代码来源:client.go
示例5: Get
func (c Client) Get(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {
var body *url.Values
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &url.Values{}
params.AppendTo(body)
}
invoice := &stripe.Invoice{}
err := c.B.Call("GET", "/invoices/"+id, c.Key, body, commonParams, invoice)
return invoice, err
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:15,代码来源:client.go
示例6: GetNext
func (c Client) GetNext(params *stripe.InvoiceParams) (*stripe.Invoice, error) {
body := &url.Values{
"customer": {params.Customer},
}
if len(params.Sub) > 0 {
body.Add("subscription", params.Sub)
}
params.AppendTo(body)
invoice := &stripe.Invoice{}
err := c.B.Call("GET", "/invoices/upcoming", c.Key, body, ¶ms.Params, invoice)
return invoice, err
}
开发者ID:mousadialo,项目名称:stripe-go,代码行数:16,代码来源:client.go
注:本文中的github.com/stripe/stripe-go.InvoiceParams类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论