-
Notifications
You must be signed in to change notification settings - Fork 463
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
Generate with breaking changes #1410
Conversation
a59c2aa
to
05c1c99
Compare
05c1c99
to
15fafde
Compare
r? @dcr-stripe @kamil-stripe @pakrym-stripe Aside from the generated code, also updated the tests (mostly renaming things that were renamed in codegen, and removing some unmarshalling and appendto tests which are no longer applicable). |
I'll defer this review to @kamil-stripe . |
* Merge changelogs * Address feedback
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.
This LGTM overall - amazing work Yejia! I left a few comments on the changelog. Once it's settled is the plan to move it into this PR description so it gets picked up by our release infra and delete the WIP file?
@dcr Yes |
@@ -127,7 +129,22 @@ func (c Client) ListLineItems(id string, listParams *stripe.CheckoutSessionListL | |||
} | |||
} | |||
|
|||
type LineItemIter = lineitem.Iter | |||
// LineItemIter is an iterator for line items. | |||
type LineItemIter struct { |
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.
Still unclear why this moved here.
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.
Generating iterators as part of clients that return them is the standard behavior. We had a special case for this one iterator.
Examples of others:
stripe-go/creditnote/client.go
Line 186 in 13752c6
type LineItemIter struct { |
stripe-go/paymentlink/client.go
Line 133 in b8b156b
type LineItemIter struct { |
Changelog
"⚠️ " symbol highlights breaking changes.
Added
CheckoutSessionSetupIntentDataParams.Metadata
.UpcomingLines
method.ShippingCost
andShippingDetails
properties toCheckoutSession
resource.CheckoutSessionShippingCostTax
andCheckoutSessionShippingCost
classesIssuingCardCancellationReasonDesignRejected
constant toIssuingCardCancellationReason
.Validate
field toCustomer
resource.Validate
field toPaymentSourceParams
.SetupAttemptPaymentMethodDetailsCardThreeDSecureResultExempted
constant inSetupAttemptPaymentMethodDetailsCardThreeDSecureResult
.SKUPackageDimensionsParams
andSKUPackageDimensions
.Subscription.DeleteDiscount
methods.SubscriptionItemUsageRecordSummariesParams
UsageRecordSummary
UsageRecordSummaries
, andUsageRecordSummaryList
methods inSubscriptionItem
SubscriptionSchedulePhaseBillingCycleAnchor
,SubscriptionSchedulePhaseBillingCycleAnchorAutomatic
, andSubscriptionSchedulePhaseBillingCycleAnchorPhaseStart
SubscriptionSchedulePhaseInvoiceSettings
andSubscriptionSchedulePhaseInvoiceSettingsParams
TerminalLocation
UnmarshalJSON
- makeTerminalLocation
expandableRename files to be consistent with the library's naming conventions.
fee.go
toapplicationfee.go
fee/client.go
toapplicationfee/client.go
sub.go
tosubscription.go
sub/client.go
tosubscription/client.go
subitem.go
tosubscriptionitem.go
subitem/client.go
tosubscriptionitem/client.go
subschedule.go
tosubscriptionschedule.go
subschedule/client.go
tosubscriptionschedule/client.go
reversal.go
totransferreversal.go
reversal/client.go
totransferreversal/client.go
Change resource names on
client#API
to be plural to be consistent with the library's naming conventions:Rename structs, fields, enums, and methods to be consistent with the library's naming conventions and with the other Stripe SDKs.
Ach
toACH
Acss
toACSS
Bic
toBIC
Eps
toEPS
FEDEX
toFedEx
Iban
toIBAN
Ideal
toIDEAL
Sepa
toSEPA
Wechat
toWeChat
ExternalAccount
toAccountExternalAccount
InvoiceLine
toInvoiceLineItem
Person
structs/enums to usePerson
prefixChange types of various fields in
Account
,ApplicationFee
,BalanceTransaction
,BillingPortalConfiguration
,Card
,Charge
,Customer
,Discount
,Invoice
,Issuing Card
,Issuing Dispute
,Mandate
,PaymentIntent
,PaymentMethod
,Payout
,Plan
,Plan
,Refund
,SetupIntent
,Source
,Source
,Subscription
,SubscriptionItem
,SubscriptionSchedule
,Terminal ConnectionToken
,Terminal Location
,Terminal Reader
,Topup
, andTransfer
(see Migration guide).Move
BalanceTransaction
iterator frombalance.go
tobalancetransaction.go
Fix
BalanceTransactionSource
UnmarshalJSON
for whenBalanceTransactionSource.Type == "transfer_reversal"
(previously, we were checking ifType == "reversal"
, which was always false)For BankAccount and Card client methods, check that exactly one of
params.Account
andparams.Customer
is set (previously they could both be set, but only one would be used, and it was different between BankAccount and Card)Replace
CardVerification
with field-specific enums (with the same values)Move
Del
fromdiscount/client.go
tocustomer/client.go
and rename toDeleteDiscount
Move
DelSub
fromdiscount/client.go
tosubscription/client.go
and rename toDeleteDiscount
Add separate parameter struct for CreditNote
ListPreviewLines
(renamed toPreviewLines
) method ([CreditNoteLineItemListPreviewParams -> CreditNotePreviewParams].Lines
CreditNoteLineParams
->CreditNotePreviewLineParams
)Replace
FeeRefundParams.ApplicationFee
withFeeRefundParams.Fee
andFeeRefundParams.ID
Add separate parameter struct for Invoice
GetNext
(renamed toUpcoming
) method (InvoiceUpcomingParams
, and nested paramsInvoiceUpcomingLinesInvoiceItemPriceDataParams
,InvoiceUpcomingLinesInvoiceItemDiscountParams
,InvoiceUpcomingLinesDiscountParams
,InvoiceUpcomingLinesInvoiceItemPeriodParams
).Upcoming
-only fieldsCoupon
,CustomerDetails
,InvoiceItems
,Subscription
,SubscriptionBillingCycleAnchor
,Schedule
,SubscriptionBillingCycleAnchor
,SubscriptionBillingCycleAnchorNow
,SubscriptionBillingCycleAnchorUnchanged
,SubscriptionCancelAt
,SubscriptionCancelAtPeriodEnd
,SubscriptionCancelNow
,SubscriptionDefaultTaxRates
,SubscriptionItems
,SubscriptionProrationBehavior
,SubscriptionProrationDate
,SubscriptionStartDate
,SubscriptionTrialEnd
,SubscriptionTrialEndNow
, andSubscriptionTrialFromPlan
are removed fromInvoiceParams
.Add separate structs for
BillingDetails
andBillingDetailsParams
:PaymentMethodBillingDetails
,PaymentMethodBillingDetailsParams
Add separate structs for
PaymentMethodCardNetwork
:PaymentMethodCardNetworksAvailable
,PaymentMethodCardNetworksPreferred
Deprecated
SKU
resource has been deprecated. This will be replaced by https://stripe.com/docs/api/orders_v2.AccountCapability
enum definition. This was not referenced in the library.UnmarshalJSON
for resources that are not expandable:BillingPortalSession
,Capability
,CheckoutSession
,FileLink
,InvoiceItem
,LineItem
,Person
,WebhookEndpoint
AccountRejectReason
(was only referenced inaccount/client_test.go
, actualAccountRejectParams.Reason
is*string
)AccountParams.RequestedCapabilities
(use Capabilities instead: https://stripe.com/docs/connect/account-capabilities)AccountSettingsParams.Dashboard
andAccountSettingsDashboardParams
(Note:Dashboard
are still available onAccountSettings
, but it's not available as parameters for any of the methods)AccountCompany.RegistrationNumber
(Note:RegistrationNumber
is still available onAccountCompanyParams
, but is not returned in the response)BalanceTransactionStatus
. It was meant to be an enum, but none of the enum values were defined, so it was just an alias for string.CardParams.AccountType
.AccountType
does not exist on any client method for Card. It does on BankAccount, which is similar.id
param from CheckoutSessionsListLineItems
. UseCheckoutSessionListLineItemsParams.Session
instead.CheckoutSessionLineItemPriceDataRecurringParams.AggregateUsage
,CheckoutSessionLineItemPriceDataRecurringParams.TrialPeriodDays
, andCheckoutSessionLineItemPriceDataRecurringParams.UsageType
CheckoutSessionPaymentIntentDataParams.Params
,CheckoutSessionSetupIntentDataParams.Params
,CheckoutSessionSubscriptionDataParams.Params
.Params
should only be embedded in root method struct, and has extraneous fields not applicable to child/sub structs.CheckoutSessionTotalDetailsBreakdownTax.TaxRate
. UseCheckoutSessionTotalDetailsBreakdownTax.Rate
CheckoutSessionTotalDetailsBreakdownTax.Deleted
CustomerParams.Token
Discount
APIResource
embedDiscountParams
FilePurposeFoundersStockDocument
("founders_stock_document"
option forFile.Purpose
)InvoiceParams.Paid
. Useinvoice.status
to check for status.invoice.status
is a read-only field.InvoiceParams.SubscriptionPlan
andInvoiceParams.SubscriptionQuantity
(note: these would have been onInvoiceUpcomingParams
)InvoiceListLinesParams.Customer
andInvoiceListLinesParams.Subscription
(these are not available for InvoiceListLines
, but are available forList
)IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity
andIssuingAuthorizationRequestHistoryViolatedAuthorizationControlName
(unused enums)IssuingCardSpendingControlsParams.SpendingLimitsCurrency
.issuing_card
hascurrency
, andissuing_card.spending_controls.spending_limits.amount
will use that currencyIssuingDisputeEvidenceServiceNotAsDescribed.ProductDescription
,IssuingDisputeEvidenceServiceNotAsDescribed.ProductType
,IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductDescription
,IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductType
, andIssuingDisputeEvidenceServiceNotAsDescribedProductType
.issuing_dispute.evidence.service_not_as_described
does not haveproduct_description
orproduct_type
.issuing_dispute.evidence.canceled
does.LineItemTax.TaxRate
. UseLineItemTax.Rate
instead.LineItem.Deleted
LoginLink.RedirectURL
PaymentIntentOffSession
(unused enum)PaymentIntentConfirmParams.PaymentMethodTypes
PaymentMethodFPX.TransactionID
Payout.BankAccount
andPayout.Card
(These fields were never populated, usePayoutDestination.BankAccount
andPayoutDestination.Card
instead)PlanParams.ProductID
. UsePlanParams.Product.ID
instead.Shipping
andShippingRate
properties fromCheckoutSession
resource. Please useShippingCost
andShippingDetails
properties instead.DefaultCurrency
property fromCustomer
resource. Please useCurrency
property instead.Updated
andUpdatedBy
fromRadarValueList
Name
fromRadarValueListItem
ReviewReasonType
type fromReview
resource. UseReviewReason
insteadSetupIntentCancellationReasonFailedInvoice
andSetupIntentCancellationReasonFraudulent
values fromSetupIntentCancellationReason
SigmaScheduledQueryRun.Query
. The field was invalidSKUParams.Description
andSKU.Description
SourceMandateAcceptanceStatus
,SourceMandateAcceptanceStatusAccepted
,SourceMandateAcceptanceStatusRefused
,SourceMandateNotificationMethod
,SourceMandateNotificationMethodEmail
,SourceMandateNotificationMethodManual
, andSourceMandateNotificationMethodNone
Source.TypeData
and SourceParams and replace with payment method-specific fields (AUBECSDebit, Bancontact, Card, CardPresent, EPS, Giropay, IDEAL, Klarna, Multibanco, P24, SEPACreditTransfer, SEPADebit, Sofort, ThreeDSecure, Wechat) andSource.AppendTo
methodSourceTransaction.CustomerData
. The field was deprecatedSourceTransaction.TypeData
andSourceTransaction.UnmarshalJSON
. Use payment specific fields - RemoveACHCreditTransfer
,CHFCreditTransfer
,GBPCreditTransfer
,PaperCheck
, andSEPACreditTransfer
SubscriptionPaymentBehavior
,SubscriptionPaymentBehaviorAllowIncomplete
,SubscriptionPaymentBehaviorErrorIfIncomplete
, andSubscriptionPaymentBehaviorPendingIfIncomplete
SubscriptionProrationBehavior
,SubscriptionProrationBehaviorAlwaysInvoice
,SubscriptionProrationBehaviorCreateProrations
, andSubscriptionProrationBehaviorNone
SubscriptionStatusAll
SubscriptionParams.Card
,SubscriptionParams.Plan
, andSubscriptionParams.Quantity
Subscription.Plan
andSubscription.Quantity
SubscriptionItemParams.ID
. The field was deprecatedSubscriptionSchedulePhaseAddInvoiceItemPriceDataRecurringParams
andSubscriptionSchedulePhaseAddInvoiceItemPriceDataParams
Del
method onTaxRate
TerminalReaderGetParams
. UseTerminalReaderParams
instead.TerminalReaderList.Location
andTerminalReaderList.Status
(Not available for the list, but is available for individualTerminalReader
s inTerminalReaderList.Data
)Token.Email
andTokenParams.Email
TopupParams.SetSource
WebhookEndpointListParams.Created
andWebhookEndpointListParams.CreatedRange
(useStartingAfter
fromListParams
)WebhookEndpoint.Connected