Skip to content
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

Merged
merged 26 commits into from
Aug 1, 2022

Conversation

yejia-stripe
Copy link
Contributor

@yejia-stripe yejia-stripe commented Jan 21, 2022

Changelog

"⚠️" symbol highlights breaking changes.

Added

  • Add CheckoutSessionSetupIntentDataParams.Metadata.
  • Add Invoice UpcomingLines method.
  • Add ShippingCost and ShippingDetails properties to CheckoutSession resource.
  • Add CheckoutSessionShippingCostTax and CheckoutSessionShippingCost classes
  • Add IssuingCardCancellationReasonDesignRejected constant to IssuingCardCancellationReason.
  • Add Validate field to Customer resource.
  • Add Validate field to PaymentSourceParams.
  • Add SetupAttemptPaymentMethodDetailsCardThreeDSecureResultExempted constant in SetupAttemptPaymentMethodDetailsCardThreeDSecureResult.
  • Add SKUPackageDimensionsParams and SKUPackageDimensions.
  • Add dedicated structs for different payment sources and transfers.
  • Add Subscription.DeleteDiscount methods.
  • Add SubscriptionItemUsageRecordSummariesParams
  • Add UsageRecordSummary UsageRecordSummaries, and UsageRecordSummaryList methods in SubscriptionItem
  • Add SubscriptionSchedulePhaseBillingCycleAnchor, SubscriptionSchedulePhaseBillingCycleAnchorAutomatic, and SubscriptionSchedulePhaseBillingCycleAnchorPhaseStart
  • Add SubscriptionSchedulePhaseInvoiceSettings and SubscriptionSchedulePhaseInvoiceSettingsParams
  • TerminalLocation UnmarshalJSON - make TerminalLocation expandable

⚠️ Changed

  • Rename files to be consistent with the library's naming conventions.

    • fee.go to applicationfee.go
    • fee/client.go to applicationfee/client.go
    • sub.go to subscription.go
    • sub/client.go to subscription/client.go
    • subitem.go to subscriptionitem.go
    • subitem/client.go to subscriptionitem/client.go
    • subschedule.go to subscriptionschedule.go
    • subschedule/client.go to subscriptionschedule/client.go
    • reversal.go to transferreversal.go
    • reversal/client.go to transferreversal/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 to ACH
    • Acss to ACSS
    • Bic to BIC
    • Eps to EPS
    • FEDEX to FedEx
    • Iban to IBAN
    • Ideal to IDEAL
    • Sepa to SEPA
    • Wechat to WeChat
    • ExternalAccount to AccountExternalAccount
    • InvoiceLine to InvoiceLineItem
    • Person structs/enums to use Person prefix
    • and others (see Migration guide)
  • Change 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, and Transfer (see Migration guide).

  • Move BalanceTransaction iterator from balance.go to balancetransaction.go

  • Fix BalanceTransactionSource UnmarshalJSON for when BalanceTransactionSource.Type == "transfer_reversal" (previously, we were checking if Type == "reversal", which was always false)

  • For BankAccount and Card client methods, check that exactly one of params.Account and params.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 from discount/client.go to customer/client.go and rename to DeleteDiscount

  • Move DelSub from discount/client.go to subscription/client.go and rename to DeleteDiscount

  • Add separate parameter struct for CreditNote ListPreviewLines (renamed to PreviewLines) method ([CreditNoteLineItemListPreviewParams -> CreditNotePreviewParams].Lines CreditNoteLineParams -> CreditNotePreviewLineParams)

  • Replace FeeRefundParams.ApplicationFee with FeeRefundParams.Fee and FeeRefundParams.ID

  • Add separate parameter struct for Invoice GetNext (renamed to Upcoming) method (InvoiceUpcomingParams, and nested params InvoiceUpcomingLinesInvoiceItemPriceDataParams, InvoiceUpcomingLinesInvoiceItemDiscountParams, InvoiceUpcomingLinesDiscountParams, InvoiceUpcomingLinesInvoiceItemPeriodParams). Upcoming-only fields Coupon, CustomerDetails, InvoiceItems, Subscription, SubscriptionBillingCycleAnchor, Schedule, SubscriptionBillingCycleAnchor, SubscriptionBillingCycleAnchorNow, SubscriptionBillingCycleAnchorUnchanged, SubscriptionCancelAt, SubscriptionCancelAtPeriodEnd, SubscriptionCancelNow, SubscriptionDefaultTaxRates, SubscriptionItems, SubscriptionProrationBehavior, SubscriptionProrationDate, SubscriptionStartDate, SubscriptionTrialEnd, SubscriptionTrialEndNow, and SubscriptionTrialFromPlan are removed from InvoiceParams.

  • Add separate structs for BillingDetails and BillingDetailsParams: PaymentMethodBillingDetails, PaymentMethodBillingDetailsParams

  • Add separate structs for PaymentMethodCardNetwork: PaymentMethodCardNetworksAvailable, PaymentMethodCardNetworksPreferred

Deprecated

⚠️ Removed

  • Remove AccountCapability enum definition. This was not referenced in the library.
  • Remove UnmarshalJSON for resources that are not expandable: BillingPortalSession, Capability, CheckoutSession, FileLink, InvoiceItem, LineItem, Person, WebhookEndpoint
  • Remove AccountRejectReason (was only referenced in account/client_test.go, actual AccountRejectParams.Reason is *string)
  • Remove AccountParams.RequestedCapabilities (use Capabilities instead: https://stripe.com/docs/connect/account-capabilities)
  • Remove AccountSettingsParams.Dashboard and AccountSettingsDashboardParams (Note: Dashboard are still available on AccountSettings, but it's not available as parameters for any of the methods)
  • Remove AccountCompany.RegistrationNumber (Note: RegistrationNumber is still available on AccountCompanyParams, but is not returned in the response)
  • Remove BalanceTransactionStatus. It was meant to be an enum, but none of the enum values were defined, so it was just an alias for string.
  • Remove CardParams.AccountType. AccountType does not exist on any client method for Card. It does on BankAccount, which is similar.
  • Remove id param from CheckoutSessions ListLineItems. Use CheckoutSessionListLineItemsParams.Session instead.
  • Remove CheckoutSessionLineItemPriceDataRecurringParams.AggregateUsage, CheckoutSessionLineItemPriceDataRecurringParams.TrialPeriodDays, and CheckoutSessionLineItemPriceDataRecurringParams.UsageType
  • Remove 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.
  • Remove CheckoutSessionTotalDetailsBreakdownTax.TaxRate. Use CheckoutSessionTotalDetailsBreakdownTax.Rate
  • Remove CheckoutSessionTotalDetailsBreakdownTax.Deleted
  • Remove CustomerParams.Token
  • Remove Discount APIResource embed
  • Remove DiscountParams
  • Remove FilePurposeFoundersStockDocument ("founders_stock_document" option for File.Purpose)
  • Remove InvoiceParams.Paid. Use invoice.status to check for status. invoice.status is a read-only field.
  • Remove InvoiceParams.SubscriptionPlan and InvoiceParams.SubscriptionQuantity (note: these would have been on InvoiceUpcomingParams)
  • Remove InvoiceListLinesParams.Customer and InvoiceListLinesParams.Subscription (these are not available for Invoice ListLines, but are available for List)
  • Remove IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity and IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName (unused enums)
  • Remove IssuingCardSpendingControlsParams.SpendingLimitsCurrency. issuing_card has currency, and issuing_card.spending_controls.spending_limits.amount will use that currency
  • Remove IssuingDisputeEvidenceServiceNotAsDescribed.ProductDescription, IssuingDisputeEvidenceServiceNotAsDescribed.ProductType, IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductDescription, IssuingDisputeEvidenceServiceNotAsDescribedParams.ProductType, and IssuingDisputeEvidenceServiceNotAsDescribedProductType. issuing_dispute.evidence.service_not_as_described does not have product_description or product_type. issuing_dispute.evidence.canceled does.
  • Remove LineItemTax.TaxRate. Use LineItemTax.Rate instead.
  • Remove LineItem.Deleted
  • Remove LoginLink.RedirectURL
  • Remove PaymentIntentOffSession (unused enum)
  • Remove PaymentIntentConfirmParams.PaymentMethodTypes
  • Remove PaymentMethodFPX.TransactionID
  • Remove Payout.BankAccount and Payout.Card (These fields were never populated, use PayoutDestination.BankAccount and PayoutDestination.Card instead)
  • Remove PlanParams.ProductID. Use PlanParams.Product.ID instead.
  • Remove Shipping and ShippingRate properties from CheckoutSession resource. Please use ShippingCost and ShippingDetails properties instead.
  • Remove DefaultCurrency property from Customer resource. Please use Currency property instead.
  • Remove Updated and UpdatedBy from RadarValueList
  • Remove Name from RadarValueListItem
  • Remove ReviewReasonType type from Review resource. Use ReviewReason instead
  • Remove SetupIntentCancellationReasonFailedInvoice and SetupIntentCancellationReasonFraudulent values from SetupIntentCancellationReason
  • Remove SigmaScheduledQueryRun.Query. The field was invalid
  • Remove SKUParams.Description and SKU.Description
  • Remove SourceMandateAcceptanceStatus, SourceMandateAcceptanceStatusAccepted, SourceMandateAcceptanceStatusRefused, SourceMandateNotificationMethod, SourceMandateNotificationMethodEmail, SourceMandateNotificationMethodManual, and SourceMandateNotificationMethodNone
  • Remove 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) and Source.AppendTo method
  • Remove SourceTransaction.CustomerData. The field was deprecated
  • Remove SourceTransaction.TypeData and SourceTransaction.UnmarshalJSON. Use payment specific fields - Remove ACHCreditTransfer, CHFCreditTransfer, GBPCreditTransfer, PaperCheck, and SEPACreditTransfer
  • Remove SubscriptionPaymentBehavior, SubscriptionPaymentBehaviorAllowIncomplete, SubscriptionPaymentBehaviorErrorIfIncomplete, and SubscriptionPaymentBehaviorPendingIfIncomplete
  • Remove SubscriptionProrationBehavior, SubscriptionProrationBehaviorAlwaysInvoice, SubscriptionProrationBehaviorCreateProrations, and SubscriptionProrationBehaviorNone
  • Remove SubscriptionStatusAll
  • Remove SubscriptionParams.Card, SubscriptionParams.Plan, and SubscriptionParams.Quantity
  • Remove Subscription.Plan and Subscription.Quantity
  • Remove SubscriptionItemParams.ID. The field was deprecated
  • Remove SubscriptionSchedulePhaseAddInvoiceItemPriceDataRecurringParams and SubscriptionSchedulePhaseAddInvoiceItemPriceDataParams
  • Remove Del method on TaxRate
  • Remove TerminalReaderGetParams. Use TerminalReaderParams instead.
  • Remove TerminalReaderList.Location and TerminalReaderList.Status (Not available for the list, but is available for individual TerminalReaders in TerminalReaderList.Data)
  • Remove Token.Email and TokenParams.Email
  • Remove TopupParams.SetSource
  • Remove WebhookEndpointListParams.Created and WebhookEndpointListParams.CreatedRange (use StartingAfter from ListParams)
  • Remove WebhookEndpoint.Connected

@yejia-stripe yejia-stripe marked this pull request as draft January 21, 2022 15:01
@yejia-stripe yejia-stripe force-pushed the yejia/major-version branch from 05c1c99 to 15fafde Compare July 22, 2022 22:10
@yejia-stripe yejia-stripe changed the base branch from master to sdk-release/next-major July 22, 2022 22:10
@yejia-stripe yejia-stripe changed the title [Draft] v73 major version Generate with breaking changes Jul 22, 2022
@yejia-stripe yejia-stripe marked this pull request as ready for review July 22, 2022 22:13
@dcr-stripe dcr-stripe closed this Jul 22, 2022
@dcr-stripe dcr-stripe reopened this Jul 22, 2022
@yejia-stripe
Copy link
Contributor Author

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).

@dcr-stripe
Copy link
Contributor

I'll defer this review to @kamil-stripe .

setupintent.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dcr-stripe dcr-stripe left a 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?

WIPv73Changelog.md Outdated Show resolved Hide resolved
WIPv73Changelog.md Outdated Show resolved Hide resolved
WIPv73Changelog.md Outdated Show resolved Hide resolved
@yejia-stripe
Copy link
Contributor Author

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

account.go Outdated Show resolved Hide resolved
account.go Outdated Show resolved Hide resolved
account.go Outdated Show resolved Hide resolved
@@ -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 {
Copy link
Contributor

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.

Copy link
Contributor

@pakrym-stripe pakrym-stripe Aug 1, 2022

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:

type LineItemIter struct {

type LineItemIter struct {

@yejia-stripe yejia-stripe merged commit ddf143b into sdk-release/next-major Aug 1, 2022
@yejia-stripe yejia-stripe deleted the yejia/major-version branch August 1, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants