-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen: 14 more files #1312
codegen: 14 more files #1312
Changes from 9 commits
179a59c
26cf304
7029417
fcd8b66
883380a
36fdefb
ce94a29
33cc381
bc90d6a
1b6b546
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
// | ||
// | ||
// File generated from our OpenAPI spec | ||
// | ||
// | ||
|
||
package stripe | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
import "encoding/json" | ||
|
||
// CheckoutSessionCustomerDetailsTaxIDsType is the list of allowed values for type | ||
// on the tax_ids inside customer_details of a checkout session. | ||
|
@@ -53,12 +57,22 @@ const ( | |
|
||
type CheckoutSessionAutomaticTaxStatus string | ||
|
||
// List of values that CheckoutSessionAutomaticTaxStatus can take | ||
const ( | ||
CheckoutSessionAutomaticTaxStatusComplete CheckoutSessionAutomaticTaxStatus = "complete" | ||
CheckoutSessionAutomaticTaxStatusFailed CheckoutSessionAutomaticTaxStatus = "failed" | ||
CheckoutSessionAutomaticTaxStatusRequiresLocationInputs CheckoutSessionAutomaticTaxStatus = "requires_location_inputs" | ||
) | ||
|
||
// Describes whether Checkout should collect the customer's billing address. | ||
type CheckoutSessionBillingAddressCollection string | ||
|
||
// List of values that CheckoutSessionBillingAddressCollection can take | ||
const ( | ||
CheckoutSessionBillingAddressCollectionAuto CheckoutSessionBillingAddressCollection = "auto" | ||
CheckoutSessionBillingAddressCollectionRequired CheckoutSessionBillingAddressCollection = "required" | ||
) | ||
|
||
// CheckoutSessionCustomerDetailsTaxExempt is the list of allowed values for | ||
// tax_exempt inside customer_details of a checkout session. | ||
type CheckoutSessionCustomerDetailsTaxExempt string | ||
|
@@ -169,11 +183,11 @@ type CheckoutSessionLineItemPriceDataParams struct { | |
UnitAmount *int64 `form:"unit_amount"` | ||
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` | ||
} | ||
|
||
type CheckoutSessionAutomaticTaxParams struct { | ||
Enabled *bool `form:"enabled"` | ||
} | ||
|
||
// Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when `customer` is provided. | ||
type CheckoutSessionCustomerUpdateParams struct { | ||
Address *string `form:"address"` | ||
Name *string `form:"name"` | ||
|
@@ -310,6 +324,8 @@ type CheckoutSessionSubscriptionDataParams struct { | |
TrialFromPlan *bool `form:"trial_from_plan"` | ||
TrialPeriodDays *int64 `form:"trial_period_days"` | ||
} | ||
|
||
// Controls tax ID collection settings for the session. | ||
type CheckoutSessionTaxIDCollectionParams struct { | ||
Enabled *bool `form:"enabled"` | ||
} | ||
|
@@ -343,11 +359,6 @@ type CheckoutSessionParams struct { | |
TaxIDCollection *CheckoutSessionTaxIDCollectionParams `form:"tax_id_collection"` | ||
} | ||
|
||
type CheckoutSessionAutomaticTax struct { | ||
Enabled bool `json:"enabled"` | ||
Status CheckoutSessionAutomaticTaxStatus `json:"status"` | ||
} | ||
|
||
// CheckoutSessionListLineItemsParams is the set of parameters that can be | ||
// used when listing line items on a session. | ||
type CheckoutSessionListLineItemsParams struct { | ||
|
@@ -363,6 +374,10 @@ type CheckoutSessionListParams struct { | |
PaymentIntent *string `form:"payment_intent"` | ||
Subscription *string `form:"subscription"` | ||
} | ||
type CheckoutSessionAutomaticTax struct { | ||
Enabled bool `json:"enabled"` | ||
Status CheckoutSessionAutomaticTaxStatus `json:"status"` | ||
} | ||
|
||
// CheckoutSessionCustomerDetailsTaxIDs represent customer's tax IDs at the | ||
// time of checkout. | ||
|
@@ -429,7 +444,8 @@ type CheckoutSessionTotalDetailsBreakdownDiscount struct { | |
// CheckoutSessionTotalDetailsBreakdownTax represent the details of tax rate applied to a session. | ||
type CheckoutSessionTotalDetailsBreakdownTax struct { | ||
Amount int64 `json:"amount"` | ||
TaxRate *TaxRate `json:"tax_rate"` | ||
Rate *TaxRate `json:"rate"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah great question, need to call this out in the changelog and should add a comment. This is a bugfix. The json field is https://github.com/stripe/stripe-node/blob/master/types/2020-08-27/Checkout/Sessions.d.ts#L724 |
||
TaxRate *TaxRate `json:"tax_rate"` // Do not use: use `Rate` | ||
} | ||
|
||
// CheckoutSessionTotalDetailsBreakdown is the set of properties detailing a breakdown of taxes and discounts applied to a session if any. | ||
|
@@ -451,14 +467,15 @@ type CheckoutSessionTotalDetails struct { | |
type CheckoutSession struct { | ||
APIResource | ||
AllowPromotionCodes bool `json:"allow_promotion_codes"` | ||
CancelURL string `json:"cancel_url"` | ||
CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"` | ||
AmountSubtotal int64 `json:"amount_subtotal"` | ||
AmountTotal int64 `json:"amount_total"` | ||
AutomaticTax *CheckoutSessionAutomaticTax `json:"automatic_tax"` | ||
BillingAddressCollection CheckoutSessionBillingAddressCollection `json:"billing_address_collection"` | ||
CancelURL string `json:"cancel_url"` | ||
ClientReferenceID string `json:"client_reference_id"` | ||
Currency Currency `json:"currency"` | ||
Customer *Customer `json:"customer"` | ||
CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"` | ||
CustomerEmail string `json:"customer_email"` | ||
Deleted bool `json:"deleted"` | ||
ID string `json:"id"` | ||
|
@@ -475,36 +492,36 @@ type CheckoutSession struct { | |
SetupIntent *SetupIntent `json:"setup_intent"` | ||
Shipping *ShippingDetails `json:"shipping"` | ||
ShippingAddressCollection *CheckoutSessionShippingAddressCollection `json:"shipping_address_collection"` | ||
Subscription *Subscription `json:"subscription"` | ||
SubmitType CheckoutSessionSubmitType `json:"submit_type"` | ||
Subscription *Subscription `json:"subscription"` | ||
SuccessURL string `json:"success_url"` | ||
TaxIDCollection *CheckoutSessionTaxIDCollection `json:"tax_id_collection"` | ||
TotalDetails *CheckoutSessionTotalDetails `json:"total_details"` | ||
URL string `json:"url"` | ||
} | ||
|
||
// CheckoutSessionList is a list of sessions as retrieved from a list endpoint. | ||
type CheckoutSessionList struct { | ||
APIResource | ||
ListMeta | ||
Data []*CheckoutSession `json:"data"` | ||
} | ||
|
||
// UnmarshalJSON handles deserialization of a checkout session. | ||
// UnmarshalJSON handles deserialization of a CheckoutSession. | ||
// This custom unmarshaling is needed because the resulting | ||
// property may be an id or the full struct if it was expanded. | ||
func (p *CheckoutSession) UnmarshalJSON(data []byte) error { | ||
func (c *CheckoutSession) UnmarshalJSON(data []byte) error { | ||
if id, ok := ParseID(data); ok { | ||
p.ID = id | ||
c.ID = id | ||
return nil | ||
} | ||
|
||
type session CheckoutSession | ||
var v session | ||
type checkoutSession CheckoutSession | ||
var v checkoutSession | ||
if err := json.Unmarshal(data, &v); err != nil { | ||
return err | ||
} | ||
|
||
*p = CheckoutSession(v) | ||
*c = CheckoutSession(v) | ||
return nil | ||
} | ||
|
||
// CheckoutSessionList is a list of sessions as retrieved from a list endpoint. | ||
type CheckoutSessionList struct { | ||
APIResource | ||
ListMeta | ||
Data []*CheckoutSession `json:"data"` | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
// | ||
// | ||
// File generated from our OpenAPI spec | ||
// | ||
// | ||
|
||
package stripe | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
import "encoding/json" | ||
|
||
// DisputeReason is the list of allowed values for a discount's reason. | ||
type DisputeReason string | ||
|
@@ -99,18 +103,13 @@ type Dispute struct { | |
IsChargeRefundable bool `json:"is_charge_refundable"` | ||
Livemode bool `json:"livemode"` | ||
Metadata map[string]string `json:"metadata"` | ||
NetworkReasonCode string `json:"network_reason_code"` | ||
Object string `json:"object"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Missing the support for this in the changelog. |
||
PaymentIntent *PaymentIntent `json:"payment_intent"` | ||
Reason DisputeReason `json:"reason"` | ||
Status DisputeStatus `json:"status"` | ||
} | ||
|
||
// DisputeList is a list of disputes as retrieved from a list endpoint. | ||
type DisputeList struct { | ||
APIResource | ||
ListMeta | ||
Data []*Dispute `json:"data"` | ||
} | ||
|
||
// EvidenceDetails is the structure representing more details about | ||
// the dispute. | ||
type EvidenceDetails struct { | ||
|
@@ -154,6 +153,13 @@ type DisputeEvidence struct { | |
UncategorizedText string `json:"uncategorized_text"` | ||
} | ||
|
||
// DisputeList is a list of disputes as retrieved from a list endpoint. | ||
type DisputeList struct { | ||
APIResource | ||
ListMeta | ||
Data []*Dispute `json:"data"` | ||
} | ||
|
||
// UnmarshalJSON handles deserialization of a Dispute. | ||
// This custom unmarshaling is needed because the resulting | ||
// property may be an id or the full struct if it was expanded. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make it a breaking change on existing integrations?
Asking as there's an
Iter
inlineitem.go
and some broken tests at the bottomThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this is breaking as is -- we need to do
type LineItemIter = lineitem.Iter
to make it a transparent type alias and that will fix the test. I thought I had written the correct override for codegen to do this, need to debug.