M go.mod => go.mod +2 -2
@@ 9,9 9,9 @@ require (
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/go-sql-driver/mysql v1.5.0
- github.com/golang/mock v1.4.3
+ github.com/golang/mock v1.4.4
github.com/google/uuid v1.1.1
github.com/pkg/errors v0.9.1
- github.com/stripe/stripe-go/v71 v71.39.0
+ github.com/stripe/stripe-go/v71 v71.40.0
golang.org/x/sync v0.0.0-20190423024810-112230192c58
)
M go.sum => go.sum +4 -7
@@ 16,8 16,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
-github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw=
-github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
+github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
+github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
@@ 32,8 32,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
-github.com/stripe/stripe-go/v71 v71.39.0 h1:koL28dKJfP5aunjBU7EuCgI/TpMy/sgqrTjK4D3XO5M=
-github.com/stripe/stripe-go/v71 v71.39.0/go.mod h1:BXYwMQe+xjYomcy5/qaTGyoyVMTP3wDCHa7DVFvg8+Y=
+github.com/stripe/stripe-go/v71 v71.40.0 h1:79hmzVGtN1W+THhjghjvZ87CQv+edmuEY9l35rZ8INc=
+github.com/stripe/stripe-go/v71 v71.40.0/go.mod h1:BXYwMQe+xjYomcy5/qaTGyoyVMTP3wDCHa7DVFvg8+Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=
@@ 49,7 49,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
@@ 62,5 61,3 @@ gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXa
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
-rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
M vendor/github.com/stripe/stripe-go/v71/.travis.yml => vendor/github.com/stripe/stripe-go/v71/.travis.yml +1 -1
@@ 44,7 44,7 @@ cache:
env:
global:
# If changing this number, please also change it in `testing/testing.go`.
- - STRIPE_MOCK_VERSION=0.93.0
+ - STRIPE_MOCK_VERSION=0.94.0
go:
- "1.10.x"
M vendor/github.com/stripe/stripe-go/v71/CHANGELOG.md => vendor/github.com/stripe/stripe-go/v71/CHANGELOG.md +10 -0
@@ 1,5 1,15 @@
# Changelog
+## 71.40.0 - 2020-07-29
+* [#1136](https://github.com/stripe/stripe-go/pull/1136) Add support for multiple coupons on Billing APIs
+ * Add support for arrays of expandable API resources otherwise returning an array of strings by default
+ * Add custom deserialization to `Discount` to support expansion of the object
+ * Add support for `Id`, `Invoice` and `InvoiceItem` on `Discount`.
+ * Add support for `Discounts` on `Invoice`, `InvoiceItem` and `InvoiceLineItem`
+ * Add support for `DiscountAmounts` on `CreditNote`, `CreditNoteLineItem`, `InvoiceLineItem`
+ * Add support for `TotalDiscountAmounts` on `Invoice`
+ * Add `Object` to `Invoice`, `InvoiceLine`, `Discount` and `Coupon`
+
## 71.39.0 - 2020-07-27
* [#1142](https://github.com/stripe/stripe-go/pull/1142) Bug fix: Copy the JSON data of ephemeral keys to own buffer
M vendor/github.com/stripe/stripe-go/v71/VERSION => vendor/github.com/stripe/stripe-go/v71/VERSION +1 -1
@@ 1,1 1,1 @@
-71.39.0
+71.40.0
M vendor/github.com/stripe/stripe-go/v71/coupon.go => vendor/github.com/stripe/stripe-go/v71/coupon.go +1 -0
@@ 50,6 50,7 @@ type Coupon struct {
MaxRedemptions int64 `json:"max_redemptions"`
Metadata map[string]string `json:"metadata"`
Name string `json:"name"`
+ Object string `json:"object"`
PercentOff float64 `json:"percent_off"`
RedeemBy int64 `json:"redeem_by"`
TimesRedeemed int64 `json:"times_redeemed"`
M vendor/github.com/stripe/stripe-go/v71/creditnote.go => vendor/github.com/stripe/stripe-go/v71/creditnote.go +27 -13
@@ 118,6 118,12 @@ type CreditNoteVoidParams struct {
Params `form:"*"`
}
+// CreditNoteDiscountAmount represents the aggregate amounts calculated per discount for all line items.
+type CreditNoteDiscountAmount struct {
+ Amount int64 `json:"amount"`
+ Discount *Discount `json:"discount"`
+}
+
// CreditNoteTaxAmount represent the tax amount applied to a credit note.
type CreditNoteTaxAmount struct {
Amount int64 `json:"amount"`
@@ 135,6 141,7 @@ type CreditNote struct {
Customer *Customer `json:"customer"`
CustomerBalanceTransaction *CustomerBalanceTransaction `json:"customer_balance_transaction"`
DiscountAmount int64 `json:"discount_amount"`
+ DiscountAmounts []*CreditNoteDiscountAmount `json:"discount_amounts"`
Invoice *Invoice `json:"invoice"`
ID string `json:"id"`
Lines *CreditNoteLineItemList `json:"lines"`
@@ 155,22 162,29 @@ type CreditNote struct {
VoidedAt int64 `json:"voided_at"`
}
+// CreditNoteLineItemDiscountAmount represents the amount of discount calculated per discount for this line item.
+type CreditNoteLineItemDiscountAmount struct {
+ Amount int64 `json:"amount"`
+ Discount *Discount `json:"discount"`
+}
+
// CreditNoteLineItem is the resource representing a Stripe credit note line item.
// For more details see https://stripe.com/docs/api/credit_notes/line_item
type CreditNoteLineItem struct {
- Amount int64 `json:"amount"`
- Description string `json:"description"`
- DiscountAmount int64 `json:"discount_amount"`
- ID string `json:"id"`
- InvoiceLineItem string `json:"invoice_line_item"`
- Livemode bool `json:"livemode"`
- Object string `json:"object"`
- Quantity int64 `json:"quantity"`
- TaxAmounts []*CreditNoteTaxAmount `json:"tax_amounts"`
- TaxRates []*TaxRate `json:"tax_rates"`
- Type CreditNoteLineItemType `json:"type"`
- UnitAmount int64 `json:"unit_amount"`
- UnitAmountDecimal float64 `json:"unit_amount_decimal,string"`
+ Amount int64 `json:"amount"`
+ Description string `json:"description"`
+ DiscountAmount int64 `json:"discount_amount"`
+ DiscountAmounts []*CreditNoteLineItemDiscountAmount `json:"discount_amounts"`
+ ID string `json:"id"`
+ InvoiceLineItem string `json:"invoice_line_item"`
+ Livemode bool `json:"livemode"`
+ Object string `json:"object"`
+ Quantity int64 `json:"quantity"`
+ TaxAmounts []*CreditNoteTaxAmount `json:"tax_amounts"`
+ TaxRates []*TaxRate `json:"tax_rates"`
+ Type CreditNoteLineItemType `json:"type"`
+ UnitAmount int64 `json:"unit_amount"`
+ UnitAmountDecimal float64 `json:"unit_amount_decimal,string"`
}
// CreditNoteList is a list of credit notes as retrieved from a list endpoint.
M vendor/github.com/stripe/stripe-go/v71/discount.go => vendor/github.com/stripe/stripe-go/v71/discount.go +25 -0
@@ 1,5 1,7 @@
package stripe
+import "encoding/json"
+
// DiscountParams is the set of parameters that can be used when deleting a discount.
type DiscountParams struct {
Params `form:"*"`
@@ 13,6 15,29 @@ type Discount struct {
Customer string `json:"customer"`
Deleted bool `json:"deleted"`
End int64 `json:"end"`
+ ID string `json:"id"`
+ Invoice string `json:"invoice"`
+ InvoiceItem string `json:"invoice_item"`
+ Object string `json:"object"`
Start int64 `json:"start"`
Subscription string `json:"subscription"`
}
+
+// UnmarshalJSON handles deserialization of a Discount.
+// This custom unmarshaling is needed because the resulting
+// property may be an id or the full struct if it was expanded.
+func (s *Discount) UnmarshalJSON(data []byte) error {
+ if id, ok := ParseID(data); ok {
+ s.ID = id
+ return nil
+ }
+
+ type discount Discount
+ var v discount
+ if err := json.Unmarshal(data, &v); err != nil {
+ return err
+ }
+
+ *s = Discount(v)
+ return nil
+}
M vendor/github.com/stripe/stripe-go/v71/invoice.go => vendor/github.com/stripe/stripe-go/v71/invoice.go +45 -19
@@ 64,6 64,7 @@ type InvoiceUpcomingInvoiceItemParams struct {
Currency *string `form:"currency"`
Description *string `form:"description"`
Discountable *bool `form:"discountable"`
+ Discounts []*InvoiceItemDiscountParams `form:"discounts"`
InvoiceItem *string `form:"invoiceitem"`
Period *InvoiceUpcomingInvoiceItemPeriodParams `form:"period"`
Price *string `form:"price"`
@@ 81,6 82,12 @@ type InvoiceCustomFieldParams struct {
Value *string `form:"value"`
}
+// InvoiceDiscountParams represents the parameters associated with the discounts to apply to an invoice.
+type InvoiceDiscountParams struct {
+ Coupon *string `form:"coupon"`
+ Discount *string `form:"discount"`
+}
+
// InvoiceTransferDataParams is the set of parameters allowed for the transfer_data hash.
type InvoiceTransferDataParams struct {
Amount *int64 `form:"amount"`
@@ 101,6 108,7 @@ type InvoiceParams struct {
DefaultSource *string `form:"default_source"`
DefaultTaxRates []*string `form:"default_tax_rates"`
Description *string `form:"description"`
+ Discounts []*InvoiceDiscountParams `form:"discounts"`
DueDate *int64 `form:"due_date"`
Footer *string `form:"footer"`
Paid *bool `form:"paid"`
@@ 242,6 250,7 @@ type Invoice struct {
Deleted bool `json:"deleted"`
Description string `json:"description"`
Discount *Discount `json:"discount"`
+ Discounts []*Discount `json:"discounts"`
DueDate int64 `json:"due_date"`
EndingBalance int64 `json:"ending_balance"`
Footer string `json:"footer"`
@@ 253,6 262,7 @@ type Invoice struct {
Metadata map[string]string `json:"metadata"`
NextPaymentAttempt int64 `json:"next_payment_attempt"`
Number string `json:"number"`
+ Object string `json:"object"`
Paid bool `json:"paid"`
PaymentIntent *PaymentIntent `json:"payment_intent"`
PeriodEnd int64 `json:"period_end"`
@@ 270,6 280,7 @@ type Invoice struct {
Tax int64 `json:"tax"`
ThreasholdReason *InvoiceThresholdReason `json:"threshold_reason"`
Total int64 `json:"total"`
+ TotalDiscountAmounts []*InvoiceDiscountAmount `json:"total_discount_amounts"`
TotalTaxAmounts []*InvoiceTaxAmount `json:"total_tax_amounts"`
TransferData *InvoiceTransferData `json:"transfer_data"`
WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"`
@@ 290,6 301,12 @@ type InvoiceCustomerTaxID struct {
Value string `json:"value"`
}
+// InvoiceDiscountAmount represents the aggregate amounts calculated per discount for all line items.
+type InvoiceDiscountAmount struct {
+ Amount int64 `json:"amount"`
+ Discount *Discount `json:"discount"`
+}
+
// InvoiceTaxAmount is a structure representing one of the tax amounts on an invoice.
type InvoiceTaxAmount struct {
Amount int64 `json:"amount"`
@@ 317,28 334,37 @@ type InvoiceList struct {
Data []*Invoice `json:"data"`
}
+// InvoiceLineDiscountAmount represents the amount of discount calculated per discount for this line item.
+type InvoiceLineDiscountAmount struct {
+ Amount int64 `json:"amount"`
+ Discount *Discount `json:"discount"`
+}
+
// InvoiceLine is the resource representing a Stripe invoice line item.
// For more details see https://stripe.com/docs/api#invoice_line_item_object.
type InvoiceLine struct {
- Amount int64 `json:"amount"`
- Currency Currency `json:"currency"`
- Description string `json:"description"`
- Discountable bool `json:"discountable"`
- ID string `json:"id"`
- InvoiceItem string `json:"invoice_item"`
- Livemode bool `json:"livemode"`
- Metadata map[string]string `json:"metadata"`
- Period *Period `json:"period"`
- Plan *Plan `json:"plan"`
- Price *Price `json:"price"`
- Proration bool `json:"proration"`
- Quantity int64 `json:"quantity"`
- Subscription string `json:"subscription"`
- SubscriptionItem string `json:"subscription_item"`
- TaxAmounts []*InvoiceTaxAmount `json:"tax_amounts"`
- TaxRates []*TaxRate `json:"tax_rates"`
- Type InvoiceLineType `json:"type"`
- UnifiedProration bool `json:"unified_proration"`
+ Amount int64 `json:"amount"`
+ Currency Currency `json:"currency"`
+ Description string `json:"description"`
+ Discountable bool `json:"discountable"`
+ Discounts []*Discount `json:"discounts"`
+ DiscountAmounts []*InvoiceLineDiscountAmount `json:"discount_amounts"`
+ ID string `json:"id"`
+ InvoiceItem string `json:"invoice_item"`
+ Livemode bool `json:"livemode"`
+ Metadata map[string]string `json:"metadata"`
+ Object string `json:"object"`
+ Period *Period `json:"period"`
+ Plan *Plan `json:"plan"`
+ Price *Price `json:"price"`
+ Proration bool `json:"proration"`
+ Quantity int64 `json:"quantity"`
+ Subscription string `json:"subscription"`
+ SubscriptionItem string `json:"subscription_item"`
+ TaxAmounts []*InvoiceTaxAmount `json:"tax_amounts"`
+ TaxRates []*TaxRate `json:"tax_rates"`
+ Type InvoiceLineType `json:"type"`
+ UnifiedProration bool `json:"unified_proration"`
}
// InvoiceTransferData represents the information for the transfer_data associated with an invoice.
M vendor/github.com/stripe/stripe-go/v71/invoiceitem.go => vendor/github.com/stripe/stripe-go/v71/invoiceitem.go +22 -14
@@ 2,6 2,12 @@ package stripe
import "encoding/json"
+// InvoiceItemDiscountParams represents the parameters associated with the discounts to apply to an invoice item.
+type InvoiceItemDiscountParams struct {
+ Coupon *string `form:"coupon"`
+ Discount *string `form:"discount"`
+}
+
// InvoiceItemPeriodParams represents the period associated with that invoice item.
type InvoiceItemPeriodParams struct {
End *int64 `form:"end"`
@@ 20,20 26,21 @@ type InvoiceItemPriceDataParams struct {
// For more details see https://stripe.com/docs/api#create_invoiceitem and https://stripe.com/docs/api#update_invoiceitem.
type InvoiceItemParams struct {
Params `form:"*"`
- Amount *int64 `form:"amount"`
- Currency *string `form:"currency"`
- Customer *string `form:"customer"`
- Description *string `form:"description"`
- Discountable *bool `form:"discountable"`
- Invoice *string `form:"invoice"`
- Period *InvoiceItemPeriodParams `form:"period"`
- Price *string `form:"price"`
- PriceData *InvoiceItemPriceDataParams `form:"price_data"`
- Quantity *int64 `form:"quantity"`
- Subscription *string `form:"subscription"`
- TaxRates []*string `form:"tax_rates"`
- UnitAmount *int64 `form:"unit_amount"`
- UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
+ Amount *int64 `form:"amount"`
+ Currency *string `form:"currency"`
+ Customer *string `form:"customer"`
+ Description *string `form:"description"`
+ Discountable *bool `form:"discountable"`
+ Discounts []*InvoiceItemDiscountParams `form:"discounts"`
+ Invoice *string `form:"invoice"`
+ Period *InvoiceItemPeriodParams `form:"period"`
+ Price *string `form:"price"`
+ PriceData *InvoiceItemPriceDataParams `form:"price_data"`
+ Quantity *int64 `form:"quantity"`
+ Subscription *string `form:"subscription"`
+ TaxRates []*string `form:"tax_rates"`
+ UnitAmount *int64 `form:"unit_amount"`
+ UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}
// InvoiceItemListParams is the set of parameters that can be used when listing invoice items.
@@ 58,6 65,7 @@ type InvoiceItem struct {
Deleted bool `json:"deleted"`
Description string `json:"description"`
Discountable bool `json:"discountable"`
+ Discounts []*Discount `json:"discounts"`
ID string `json:"id"`
Invoice *Invoice `json:"invoice"`
Livemode bool `json:"livemode"`
M vendor/github.com/stripe/stripe-go/v71/stripe.go => vendor/github.com/stripe/stripe-go/v71/stripe.go +1 -1
@@ 994,7 994,7 @@ func StringSlice(v []string) []*string {
const apiURL = "https://api.stripe.com"
// clientversion is the binding version
-const clientversion = "71.39.0"
+const clientversion = "71.40.0"
// defaultHTTPTimeout is the default timeout on the http.Client used by the library.
// This is chosen to be consistent with the other Stripe language libraries and
M vendor/modules.txt => vendor/modules.txt +2 -2
@@ 18,7 18,7 @@ github.com/dgrijalva/jwt-go
# github.com/go-sql-driver/mysql v1.5.0
## explicit
github.com/go-sql-driver/mysql
-# github.com/golang/mock v1.4.3
+# github.com/golang/mock v1.4.4
## explicit
github.com/golang/mock/gomock
# github.com/google/uuid v1.1.1
@@ 31,7 31,7 @@ github.com/kr/text
# github.com/pkg/errors v0.9.1
## explicit
github.com/pkg/errors
-# github.com/stripe/stripe-go/v71 v71.39.0
+# github.com/stripe/stripe-go/v71 v71.40.0
## explicit
github.com/stripe/stripe-go/v71
github.com/stripe/stripe-go/v71/checkout/session