From f272aad0ffc56c9252cea55979d8368281ec92b3 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 19:41:43 +0000 Subject: [PATCH 1/8] Update generated code (#1965) * Update generated code for v1441 * Update generated code for v1455 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- account.go | 56 +++++++++- accountsession.go | 166 ++++++++++++++++++++++++++-- api_version.go | 2 +- billingportal_configuration.go | 2 +- charge.go | 16 +++ checkout_session.go | 19 +++- confirmationtoken.go | 5 + example/generated_examples_test.go | 13 +++ financialconnections_transaction.go | 2 +- paymentintent.go | 9 ++ paymentlink.go | 1 + paymentmethod.go | 10 ++ paymentmethodconfiguration.go | 47 ++++++++ setupintent.go | 10 ++ terminal_configuration.go | 21 ++++ testhelpers_confirmationtoken.go | 5 + treasury/financialaccount/client.go | 13 +++ treasury_financialaccount.go | 43 ++++++- treasury_outboundtransfer.go | 30 ++++- treasury_receivedcredit.go | 15 ++- 21 files changed, 462 insertions(+), 25 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index bf0daa66a7..217ac84ad0 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1412 \ No newline at end of file +v1455 \ No newline at end of file diff --git a/account.go b/account.go index 7bbe506f6e..5e3fa805d1 100644 --- a/account.go +++ b/account.go @@ -32,6 +32,14 @@ const ( AccountCapabilityStatusPending AccountCapabilityStatus = "pending" ) +type AccountCompanyOwnershipExemptionReason string + +// List of values that AccountCompanyOwnershipExemptionReason can take +const ( + AccountCompanyOwnershipExemptionReasonQualifiedEntityExceedsOwnershipThreshold AccountCompanyOwnershipExemptionReason = "qualified_entity_exceeds_ownership_threshold" + AccountCompanyOwnershipExemptionReasonQualifiesAsFinancialInstitution AccountCompanyOwnershipExemptionReason = "qualifies_as_financial_institution" +) + // The category identifying the legal structure of the company or legal entity. See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. type AccountCompanyStructure string @@ -544,6 +552,12 @@ type AccountCapabilitiesP24PaymentsParams struct { Requested *bool `form:"requested"` } +// The pay_by_bank_payments capability. +type AccountCapabilitiesPayByBankPaymentsParams struct { + // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + Requested *bool `form:"requested"` +} + // The payco_payments capability. type AccountCapabilitiesPaycoPaymentsParams struct { // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -727,6 +741,8 @@ type AccountCapabilitiesParams struct { OXXOPayments *AccountCapabilitiesOXXOPaymentsParams `form:"oxxo_payments"` // The p24_payments capability. P24Payments *AccountCapabilitiesP24PaymentsParams `form:"p24_payments"` + // The pay_by_bank_payments capability. + PayByBankPayments *AccountCapabilitiesPayByBankPaymentsParams `form:"pay_by_bank_payments"` // The payco_payments capability. PaycoPayments *AccountCapabilitiesPaycoPaymentsParams `form:"payco_payments"` // The paynow_payments capability. @@ -799,6 +815,16 @@ type AccountCompanyAddressKanjiParams struct { Town *string `form:"town"` } +// This hash is used to attest that the directors information provided to Stripe is both current and correct. +type AccountCompanyDirectorshipDeclarationParams struct { + // The Unix timestamp marking when the directorship declaration attestation was made. + Date *int64 `form:"date"` + // The IP address from which the directorship declaration attestation was made. + IP *string `form:"ip"` + // The user agent of the browser from which the directorship declaration attestation was made. + UserAgent *string `form:"user_agent"` +} + // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. type AccountCompanyOwnershipDeclarationParams struct { // The Unix timestamp marking when the beneficial owner attestation was made. @@ -831,6 +857,8 @@ type AccountCompanyParams struct { AddressKana *AccountCompanyAddressKanaParams `form:"address_kana"` // The Kanji variation of the company's primary address (Japan only). AddressKanji *AccountCompanyAddressKanjiParams `form:"address_kanji"` + // This hash is used to attest that the directors information provided to Stripe is both current and correct. + DirectorshipDeclaration *AccountCompanyDirectorshipDeclarationParams `form:"directorship_declaration"` // Whether the company's directors have been provided. Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/api/persons) for accounts with a `relationship.director` requirement. This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. DirectorsProvided *bool `form:"directors_provided"` // Whether the company's executives have been provided. Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/api/persons) for accounts with a `relationship.executive` requirement. @@ -848,7 +876,8 @@ type AccountCompanyParams struct { // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. OwnershipDeclaration *AccountCompanyOwnershipDeclarationParams `form:"ownership_declaration"` // This parameter can only be used on Token creation. - OwnershipDeclarationShownAndSigned *bool `form:"ownership_declaration_shown_and_signed"` + OwnershipDeclarationShownAndSigned *bool `form:"ownership_declaration_shown_and_signed"` + OwnershipExemptionReason *string `form:"ownership_exemption_reason"` // Whether the company's owners have been provided. Set this Boolean to `true` after creating all the company's owners with [the Persons API](https://stripe.com/api/persons) for accounts with a `relationship.owner` requirement. OwnersProvided *bool `form:"owners_provided"` // The company's phone number (used for verification). @@ -909,6 +938,12 @@ type AccountDocumentsProofOfRegistrationParams struct { Files []*string `form:"files"` } +// One or more documents that demonstrate proof of ultimate beneficial ownership. +type AccountDocumentsProofOfUltimateBeneficialOwnershipParams struct { + // One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. + Files []*string `form:"files"` +} + // Documents that may be submitted to satisfy various informational requests. type AccountDocumentsParams struct { // One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. Must be a document associated with the account's primary active bank account that displays the last 4 digits of the account number, either a statement or a check. @@ -925,6 +960,8 @@ type AccountDocumentsParams struct { CompanyTaxIDVerification *AccountDocumentsCompanyTaxIDVerificationParams `form:"company_tax_id_verification"` // One or more documents showing the company's proof of registration with the national business registry. ProofOfRegistration *AccountDocumentsProofOfRegistrationParams `form:"proof_of_registration"` + // One or more documents that demonstrate proof of ultimate beneficial ownership. + ProofOfUltimateBeneficialOwnership *AccountDocumentsProofOfUltimateBeneficialOwnershipParams `form:"proof_of_ultimate_beneficial_ownership"` } // AccountExternalAccountParams are the parameters allowed to reference an @@ -1290,6 +1327,8 @@ type AccountCapabilities struct { OXXOPayments AccountCapabilityStatus `json:"oxxo_payments"` // The status of the P24 payments capability of the account, or whether the account can directly process P24 charges. P24Payments AccountCapabilityStatus `json:"p24_payments"` + // The status of the pay_by_bank payments capability of the account, or whether the account can directly process pay_by_bank charges. + PayByBankPayments AccountCapabilityStatus `json:"pay_by_bank_payments"` // The status of the Payco capability of the account, or whether the account can directly process Payco payments. PaycoPayments AccountCapabilityStatus `json:"payco_payments"` // The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. @@ -1362,6 +1401,16 @@ type AccountCompanyAddressKanji struct { Town string `json:"town"` } +// This hash is used to attest that the director information provided to Stripe is both current and correct. +type AccountCompanyDirectorshipDeclaration struct { + // The Unix timestamp marking when the directorship declaration attestation was made. + Date int64 `json:"date"` + // The IP address from which the directorship declaration attestation was made. + IP string `json:"ip"` + // The user-agent string from the browser where the directorship declaration attestation was made. + UserAgent string `json:"user_agent"` +} + // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. type AccountCompanyOwnershipDeclaration struct { // The Unix timestamp marking when the beneficial owner attestation was made. @@ -1392,6 +1441,8 @@ type AccountCompany struct { AddressKana *AccountCompanyAddressKana `json:"address_kana"` // The Kanji variation of the company's primary address (Japan only). AddressKanji *AccountCompanyAddressKanji `json:"address_kanji"` + // This hash is used to attest that the director information provided to Stripe is both current and correct. + DirectorshipDeclaration *AccountCompanyDirectorshipDeclaration `json:"directorship_declaration"` // Whether the company's directors have been provided. This Boolean will be `true` if you've manually indicated that all directors are provided via [the `directors_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-directors_provided). DirectorsProvided bool `json:"directors_provided"` // Whether the company's executives have been provided. This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided. @@ -1407,7 +1458,8 @@ type AccountCompany struct { // The Kanji variation of the company's legal name (Japan only). NameKanji string `json:"name_kanji"` // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. - OwnershipDeclaration *AccountCompanyOwnershipDeclaration `json:"ownership_declaration"` + OwnershipDeclaration *AccountCompanyOwnershipDeclaration `json:"ownership_declaration"` + OwnershipExemptionReason AccountCompanyOwnershipExemptionReason `json:"ownership_exemption_reason"` // Whether the company's owners have been provided. This Boolean will be `true` if you've manually indicated that all owners are provided via [the `owners_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-owners_provided), or if Stripe determined that sufficient owners were provided. Stripe determines ownership requirements using both the number of owners provided and their total percent ownership (calculated by adding the `percent_ownership` of each owner together). OwnersProvided bool `json:"owners_provided"` // The company's phone number (used for verification). diff --git a/accountsession.go b/accountsession.go index 9ec8399155..7624e19d95 100644 --- a/accountsession.go +++ b/accountsession.go @@ -71,6 +71,82 @@ type AccountSessionComponentsDocumentsParams struct { Features *AccountSessionComponentsDocumentsFeaturesParams `form:"features"` } +// The list of features enabled in the embedded component. +type AccountSessionComponentsFinancialAccountFeaturesParams struct { + // Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + DisableStripeUserAuthentication *bool `form:"disable_stripe_user_authentication"` + // Whether to allow external accounts to be linked for money transfer. + ExternalAccountCollection *bool `form:"external_account_collection"` + // Whether to allow sending money. + SendMoney *bool `form:"send_money"` + // Whether to allow transferring balance. + TransferBalance *bool `form:"transfer_balance"` +} + +// Configuration for the financial account embedded component. +type AccountSessionComponentsFinancialAccountParams struct { + // Whether the embedded component is enabled. + Enabled *bool `form:"enabled"` + // The list of features enabled in the embedded component. + Features *AccountSessionComponentsFinancialAccountFeaturesParams `form:"features"` +} + +// The list of features enabled in the embedded component. +type AccountSessionComponentsFinancialAccountTransactionsFeaturesParams struct { + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement *bool `form:"card_spend_dispute_management"` +} + +// Configuration for the financial account transactions embedded component. +type AccountSessionComponentsFinancialAccountTransactionsParams struct { + // Whether the embedded component is enabled. + Enabled *bool `form:"enabled"` + // The list of features enabled in the embedded component. + Features *AccountSessionComponentsFinancialAccountTransactionsFeaturesParams `form:"features"` +} + +// The list of features enabled in the embedded component. +type AccountSessionComponentsIssuingCardFeaturesParams struct { + // Whether to allow cardholder management features. + CardholderManagement *bool `form:"cardholder_management"` + // Whether to allow card management features. + CardManagement *bool `form:"card_management"` + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement *bool `form:"card_spend_dispute_management"` + // Whether to allow spend control management features. + SpendControlManagement *bool `form:"spend_control_management"` +} + +// Configuration for the issuing card embedded component. +type AccountSessionComponentsIssuingCardParams struct { + // Whether the embedded component is enabled. + Enabled *bool `form:"enabled"` + // The list of features enabled in the embedded component. + Features *AccountSessionComponentsIssuingCardFeaturesParams `form:"features"` +} + +// The list of features enabled in the embedded component. +type AccountSessionComponentsIssuingCardsListFeaturesParams struct { + // Whether to allow cardholder management features. + CardholderManagement *bool `form:"cardholder_management"` + // Whether to allow card management features. + CardManagement *bool `form:"card_management"` + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement *bool `form:"card_spend_dispute_management"` + // Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. + DisableStripeUserAuthentication *bool `form:"disable_stripe_user_authentication"` + // Whether to allow spend control management features. + SpendControlManagement *bool `form:"spend_control_management"` +} + +// Configuration for the issuing cards list embedded component. +type AccountSessionComponentsIssuingCardsListParams struct { + // Whether the embedded component is enabled. + Enabled *bool `form:"enabled"` + // The list of features enabled in the embedded component. + Features *AccountSessionComponentsIssuingCardsListFeaturesParams `form:"features"` +} + // The list of features enabled in the embedded component. type AccountSessionComponentsNotificationBannerFeaturesParams struct { // Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. @@ -192,6 +268,14 @@ type AccountSessionComponentsParams struct { Balances *AccountSessionComponentsBalancesParams `form:"balances"` // Configuration for the documents embedded component. Documents *AccountSessionComponentsDocumentsParams `form:"documents"` + // Configuration for the financial account embedded component. + FinancialAccount *AccountSessionComponentsFinancialAccountParams `form:"financial_account"` + // Configuration for the financial account transactions embedded component. + FinancialAccountTransactions *AccountSessionComponentsFinancialAccountTransactionsParams `form:"financial_account_transactions"` + // Configuration for the issuing card embedded component. + IssuingCard *AccountSessionComponentsIssuingCardParams `form:"issuing_card"` + // Configuration for the issuing cards list embedded component. + IssuingCardsList *AccountSessionComponentsIssuingCardsListParams `form:"issuing_cards_list"` // Configuration for the notification banner embedded component. NotificationBanner *AccountSessionComponentsNotificationBannerParams `form:"notification_banner"` // Configuration for the payment details embedded component. @@ -269,6 +353,62 @@ type AccountSessionComponentsDocuments struct { Enabled bool `json:"enabled"` Features *AccountSessionComponentsDocumentsFeatures `json:"features"` } +type AccountSessionComponentsFinancialAccountFeatures struct { + // Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + DisableStripeUserAuthentication bool `json:"disable_stripe_user_authentication"` + // Whether to allow external accounts to be linked for money transfer. + ExternalAccountCollection bool `json:"external_account_collection"` + // Whether to allow sending money. + SendMoney bool `json:"send_money"` + // Whether to allow transferring balance. + TransferBalance bool `json:"transfer_balance"` +} +type AccountSessionComponentsFinancialAccount struct { + // Whether the embedded component is enabled. + Enabled bool `json:"enabled"` + Features *AccountSessionComponentsFinancialAccountFeatures `json:"features"` +} +type AccountSessionComponentsFinancialAccountTransactionsFeatures struct { + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement bool `json:"card_spend_dispute_management"` +} +type AccountSessionComponentsFinancialAccountTransactions struct { + // Whether the embedded component is enabled. + Enabled bool `json:"enabled"` + Features *AccountSessionComponentsFinancialAccountTransactionsFeatures `json:"features"` +} +type AccountSessionComponentsIssuingCardFeatures struct { + // Whether to allow cardholder management features. + CardholderManagement bool `json:"cardholder_management"` + // Whether to allow card management features. + CardManagement bool `json:"card_management"` + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement bool `json:"card_spend_dispute_management"` + // Whether to allow spend control management features. + SpendControlManagement bool `json:"spend_control_management"` +} +type AccountSessionComponentsIssuingCard struct { + // Whether the embedded component is enabled. + Enabled bool `json:"enabled"` + Features *AccountSessionComponentsIssuingCardFeatures `json:"features"` +} +type AccountSessionComponentsIssuingCardsListFeatures struct { + // Whether to allow cardholder management features. + CardholderManagement bool `json:"cardholder_management"` + // Whether to allow card management features. + CardManagement bool `json:"card_management"` + // Whether to allow card spend dispute management features. + CardSpendDisputeManagement bool `json:"card_spend_dispute_management"` + // Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. + DisableStripeUserAuthentication bool `json:"disable_stripe_user_authentication"` + // Whether to allow spend control management features. + SpendControlManagement bool `json:"spend_control_management"` +} +type AccountSessionComponentsIssuingCardsList struct { + // Whether the embedded component is enabled. + Enabled bool `json:"enabled"` + Features *AccountSessionComponentsIssuingCardsListFeatures `json:"features"` +} type AccountSessionComponentsNotificationBannerFeatures struct { // Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. DisableStripeUserAuthentication bool `json:"disable_stripe_user_authentication"` @@ -346,17 +486,21 @@ type AccountSessionComponentsTaxSettings struct { Features *AccountSessionComponentsTaxSettingsFeatures `json:"features"` } type AccountSessionComponents struct { - AccountManagement *AccountSessionComponentsAccountManagement `json:"account_management"` - AccountOnboarding *AccountSessionComponentsAccountOnboarding `json:"account_onboarding"` - Balances *AccountSessionComponentsBalances `json:"balances"` - Documents *AccountSessionComponentsDocuments `json:"documents"` - NotificationBanner *AccountSessionComponentsNotificationBanner `json:"notification_banner"` - PaymentDetails *AccountSessionComponentsPaymentDetails `json:"payment_details"` - Payments *AccountSessionComponentsPayments `json:"payments"` - Payouts *AccountSessionComponentsPayouts `json:"payouts"` - PayoutsList *AccountSessionComponentsPayoutsList `json:"payouts_list"` - TaxRegistrations *AccountSessionComponentsTaxRegistrations `json:"tax_registrations"` - TaxSettings *AccountSessionComponentsTaxSettings `json:"tax_settings"` + AccountManagement *AccountSessionComponentsAccountManagement `json:"account_management"` + AccountOnboarding *AccountSessionComponentsAccountOnboarding `json:"account_onboarding"` + Balances *AccountSessionComponentsBalances `json:"balances"` + Documents *AccountSessionComponentsDocuments `json:"documents"` + FinancialAccount *AccountSessionComponentsFinancialAccount `json:"financial_account"` + FinancialAccountTransactions *AccountSessionComponentsFinancialAccountTransactions `json:"financial_account_transactions"` + IssuingCard *AccountSessionComponentsIssuingCard `json:"issuing_card"` + IssuingCardsList *AccountSessionComponentsIssuingCardsList `json:"issuing_cards_list"` + NotificationBanner *AccountSessionComponentsNotificationBanner `json:"notification_banner"` + PaymentDetails *AccountSessionComponentsPaymentDetails `json:"payment_details"` + Payments *AccountSessionComponentsPayments `json:"payments"` + Payouts *AccountSessionComponentsPayouts `json:"payouts"` + PayoutsList *AccountSessionComponentsPayoutsList `json:"payouts_list"` + TaxRegistrations *AccountSessionComponentsTaxRegistrations `json:"tax_registrations"` + TaxSettings *AccountSessionComponentsTaxSettings `json:"tax_settings"` } // An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components. diff --git a/api_version.go b/api_version.go index 1906349c36..29858e550b 100644 --- a/api_version.go +++ b/api_version.go @@ -7,5 +7,5 @@ package stripe const ( - apiVersion string = "2024-12-18.acacia" + apiVersion string = "2025-01-27.acacia" ) diff --git a/billingportal_configuration.go b/billingportal_configuration.go index e50cd657a6..7c3db0f08c 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -146,7 +146,7 @@ type BillingPortalConfigurationFeaturesSubscriptionCancelParams struct { Enabled *bool `form:"enabled"` // Whether to cancel subscriptions immediately or at the end of the billing period. Mode *string `form:"mode"` - // Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + // Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. ProrationBehavior *string `form:"proration_behavior"` } diff --git a/charge.go b/charge.go index d722c50283..6a25738f32 100644 --- a/charge.go +++ b/charge.go @@ -25,6 +25,16 @@ const ( ChargeFraudUserReportSafe ChargeFraudUserReport = "safe" ) +// An enumerated value providing a more detailed explanation on [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines). +type ChargeOutcomeAdviceCode string + +// List of values that ChargeOutcomeAdviceCode can take +const ( + ChargeOutcomeAdviceCodeConfirmCardData ChargeOutcomeAdviceCode = "confirm_card_data" + ChargeOutcomeAdviceCodeDoNotTryAgain ChargeOutcomeAdviceCode = "do_not_try_again" + ChargeOutcomeAdviceCodeTryAgainLater ChargeOutcomeAdviceCode = "try_again_later" +) + // funding type of the underlying payment method. type ChargePaymentMethodDetailsAmazonPayFundingType string @@ -615,6 +625,8 @@ type ChargeOutcomeRule struct { // Details about whether the payment was accepted, and why. See [understanding declines](https://stripe.com/docs/declines) for details. type ChargeOutcome struct { + // An enumerated value providing a more detailed explanation on [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines). + AdviceCode ChargeOutcomeAdviceCode `json:"advice_code"` // For charges declined by the network, a 2 digit code which indicates the advice returned by the network on how to proceed with an error. NetworkAdviceCode string `json:"network_advice_code"` // For charges declined by the network, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. @@ -1242,6 +1254,7 @@ type ChargePaymentMethodDetailsP24 struct { // Przelewy24 rarely provides this information so the attribute is usually empty. VerifiedName string `json:"verified_name"` } +type ChargePaymentMethodDetailsPayByBank struct{} type ChargePaymentMethodDetailsPayco struct { // A unique identifier for the buyer as determined by the local payment processor. BuyerID string `json:"buyer_id"` @@ -1259,6 +1272,8 @@ type ChargePaymentMethodDetailsPaypalSellerProtection struct { Status ChargePaymentMethodDetailsPaypalSellerProtectionStatus `json:"status"` } type ChargePaymentMethodDetailsPaypal struct { + // Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + Country string `json:"country"` // Owner's email. Values are provided by PayPal directly // (if supported) at the time of authorization or settlement. They cannot be set or mutated. PayerEmail string `json:"payer_email"` @@ -1422,6 +1437,7 @@ type ChargePaymentMethodDetails struct { NaverPay *ChargePaymentMethodDetailsNaverPay `json:"naver_pay"` OXXO *ChargePaymentMethodDetailsOXXO `json:"oxxo"` P24 *ChargePaymentMethodDetailsP24 `json:"p24"` + PayByBank *ChargePaymentMethodDetailsPayByBank `json:"pay_by_bank"` Payco *ChargePaymentMethodDetailsPayco `json:"payco"` PayNow *ChargePaymentMethodDetailsPayNow `json:"paynow"` Paypal *ChargePaymentMethodDetailsPaypal `json:"paypal"` diff --git a/checkout_session.go b/checkout_session.go index 5fb4d5e308..9b846ed435 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -1906,6 +1906,9 @@ type CheckoutSessionPaymentMethodOptionsP24Params struct { TOSShownAndAccepted *bool `form:"tos_shown_and_accepted"` } +// contains details about the Pay By Bank payment method options. +type CheckoutSessionPaymentMethodOptionsPayByBankParams struct{} + // contains details about the PAYCO payment method options. type CheckoutSessionPaymentMethodOptionsPaycoParams struct { // Controls when the funds will be captured from the customer's account. @@ -2104,6 +2107,8 @@ type CheckoutSessionPaymentMethodOptionsParams struct { OXXO *CheckoutSessionPaymentMethodOptionsOXXOParams `form:"oxxo"` // contains details about the P24 payment method options. P24 *CheckoutSessionPaymentMethodOptionsP24Params `form:"p24"` + // contains details about the Pay By Bank payment method options. + PayByBank *CheckoutSessionPaymentMethodOptionsPayByBankParams `form:"pay_by_bank"` // contains details about the PAYCO payment method options. Payco *CheckoutSessionPaymentMethodOptionsPaycoParams `form:"payco"` // contains details about the PayNow payment method options. @@ -2134,6 +2139,8 @@ type CheckoutSessionPaymentMethodOptionsParams struct { // before using this feature. Learn more about [collecting phone numbers with Checkout](https://stripe.com/docs/payments/checkout/phone-numbers). type CheckoutSessionPhoneNumberCollectionParams struct { // Set to `true` to enable phone number collection. + // + // Can only be set in `payment` and `subscription` mode. Enabled *bool `form:"enabled"` } @@ -2714,6 +2721,14 @@ type CheckoutSessionCustomerDetails struct { TaxIDs []*CheckoutSessionCustomerDetailsTaxID `json:"tax_ids"` } +// List of coupons and promotion codes attached to the Checkout Session. +type CheckoutSessionDiscount struct { + // Coupon attached to the Checkout Session. + Coupon *Coupon `json:"coupon"` + // Promotion code attached to the Checkout Session. + PromotionCode *PromotionCode `json:"promotion_code"` +} + // Custom fields displayed on the invoice. type CheckoutSessionInvoiceCreationInvoiceDataCustomField struct { // The name of the custom field. @@ -3258,7 +3273,7 @@ type CheckoutSessionSavedPaymentMethodOptions struct { // When set, provides configuration for Checkout to collect a shipping address from a customer. type CheckoutSessionShippingAddressCollection struct { // An array of two-letter ISO country codes representing which countries Checkout should provide as options for - // shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + // shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SY, UM, VI`. AllowedCountries []string `json:"allowed_countries"` } @@ -3412,6 +3427,8 @@ type CheckoutSession struct { // Collect additional information from your customer using custom fields. Up to 3 fields are supported. CustomFields []*CheckoutSessionCustomField `json:"custom_fields"` CustomText *CheckoutSessionCustomText `json:"custom_text"` + // List of coupons and promotion codes attached to the Checkout Session. + Discounts []*CheckoutSessionDiscount `json:"discounts"` // The timestamp at which the Checkout Session will expire. ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. diff --git a/confirmationtoken.go b/confirmationtoken.go index aa35e36311..4bcbd41d43 100644 --- a/confirmationtoken.go +++ b/confirmationtoken.go @@ -351,6 +351,7 @@ const ( ConfirmationTokenPaymentMethodPreviewTypeNaverPay ConfirmationTokenPaymentMethodPreviewType = "naver_pay" ConfirmationTokenPaymentMethodPreviewTypeOXXO ConfirmationTokenPaymentMethodPreviewType = "oxxo" ConfirmationTokenPaymentMethodPreviewTypeP24 ConfirmationTokenPaymentMethodPreviewType = "p24" + ConfirmationTokenPaymentMethodPreviewTypePayByBank ConfirmationTokenPaymentMethodPreviewType = "pay_by_bank" ConfirmationTokenPaymentMethodPreviewTypePayco ConfirmationTokenPaymentMethodPreviewType = "payco" ConfirmationTokenPaymentMethodPreviewTypePayNow ConfirmationTokenPaymentMethodPreviewType = "paynow" ConfirmationTokenPaymentMethodPreviewTypePaypal ConfirmationTokenPaymentMethodPreviewType = "paypal" @@ -899,9 +900,12 @@ type ConfirmationTokenPaymentMethodPreviewP24 struct { // The customer's bank, if provided. Bank ConfirmationTokenPaymentMethodPreviewP24Bank `json:"bank"` } +type ConfirmationTokenPaymentMethodPreviewPayByBank struct{} type ConfirmationTokenPaymentMethodPreviewPayco struct{} type ConfirmationTokenPaymentMethodPreviewPayNow struct{} type ConfirmationTokenPaymentMethodPreviewPaypal struct { + // Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + Country string `json:"country"` // Owner's email. Values are provided by PayPal directly // (if supported) at the time of authorization or settlement. They cannot be set or mutated. PayerEmail string `json:"payer_email"` @@ -1020,6 +1024,7 @@ type ConfirmationTokenPaymentMethodPreview struct { NaverPay *ConfirmationTokenPaymentMethodPreviewNaverPay `json:"naver_pay"` OXXO *ConfirmationTokenPaymentMethodPreviewOXXO `json:"oxxo"` P24 *ConfirmationTokenPaymentMethodPreviewP24 `json:"p24"` + PayByBank *ConfirmationTokenPaymentMethodPreviewPayByBank `json:"pay_by_bank"` Payco *ConfirmationTokenPaymentMethodPreviewPayco `json:"payco"` PayNow *ConfirmationTokenPaymentMethodPreviewPayNow `json:"paynow"` Paypal *ConfirmationTokenPaymentMethodPreviewPaypal `json:"paypal"` diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 320fcfaa0f..28697281f0 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -3070,6 +3070,19 @@ func TestTerminalReadersProcessPaymentIntentPost(t *testing.T) { assert.Nil(t, err) } +func TestTerminalReadersProcessSetupIntentPost(t *testing.T) { + params := &stripe.TerminalReaderProcessSetupIntentParams{ + SetupIntent: stripe.String("seti_xxxxxxxxxxxxx"), + AllowRedisplay: stripe.String("always"), + } + result, err := terminal_reader.ProcessSetupIntent( + "tmr_xxxxxxxxxxxxx", + params, + ) + assert.NotNil(t, result) + assert.Nil(t, err) +} + func TestTestHelpersCustomersFundCashBalancePost(t *testing.T) { params := &stripe.TestHelpersCustomerFundCashBalanceParams{ Amount: stripe.Int64(30), diff --git a/financialconnections_transaction.go b/financialconnections_transaction.go index d44f22d276..6c0ae205d4 100644 --- a/financialconnections_transaction.go +++ b/financialconnections_transaction.go @@ -25,7 +25,7 @@ type FinancialConnectionsTransactionListTransactionRefreshParams struct { // Returns a list of Financial Connections Transaction objects. type FinancialConnectionsTransactionListParams struct { ListParams `form:"*"` - // The ID of the Stripe account whose transactions will be retrieved. + // The ID of the Financial Connections Account whose transactions will be retrieved. Account *string `form:"account"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/paymentintent.go b/paymentintent.go index 1a19d8b626..9f3d53edbf 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -1246,6 +1246,8 @@ type PaymentIntentPaymentMethodDataParams struct { OXXO *PaymentMethodOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. P24 *PaymentMethodP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. + PayByBank *PaymentMethodPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. Payco *PaymentMethodPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. @@ -1969,6 +1971,9 @@ type PaymentIntentPaymentMethodOptionsP24Params struct { TOSShownAndAccepted *bool `form:"tos_shown_and_accepted"` } +// If this is a `pay_by_bank` PaymentMethod, this sub-hash contains details about the PayByBank payment method options. +type PaymentIntentPaymentMethodOptionsPayByBankParams struct{} + // If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options. type PaymentIntentPaymentMethodOptionsPaycoParams struct { // Controls when the funds are captured from the customer's account. @@ -2293,6 +2298,8 @@ type PaymentIntentPaymentMethodOptionsParams struct { OXXO *PaymentIntentPaymentMethodOptionsOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options. P24 *PaymentIntentPaymentMethodOptionsP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this sub-hash contains details about the PayByBank payment method options. + PayByBank *PaymentIntentPaymentMethodOptionsPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options. Payco *PaymentIntentPaymentMethodOptionsPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. @@ -3543,6 +3550,7 @@ type PaymentIntentPaymentMethodOptionsP24 struct { // When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). SetupFutureUsage PaymentIntentPaymentMethodOptionsP24SetupFutureUsage `json:"setup_future_usage"` } +type PaymentIntentPaymentMethodOptionsPayByBank struct{} type PaymentIntentPaymentMethodOptionsPayco struct { // Controls when the funds will be captured from the customer's account. CaptureMethod PaymentIntentPaymentMethodOptionsPaycoCaptureMethod `json:"capture_method"` @@ -3753,6 +3761,7 @@ type PaymentIntentPaymentMethodOptions struct { NaverPay *PaymentIntentPaymentMethodOptionsNaverPay `json:"naver_pay"` OXXO *PaymentIntentPaymentMethodOptionsOXXO `json:"oxxo"` P24 *PaymentIntentPaymentMethodOptionsP24 `json:"p24"` + PayByBank *PaymentIntentPaymentMethodOptionsPayByBank `json:"pay_by_bank"` Payco *PaymentIntentPaymentMethodOptionsPayco `json:"payco"` PayNow *PaymentIntentPaymentMethodOptionsPayNow `json:"paynow"` Paypal *PaymentIntentPaymentMethodOptionsPaypal `json:"paypal"` diff --git a/paymentlink.go b/paymentlink.go index 39c8401805..e0915d65c3 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -156,6 +156,7 @@ const ( PaymentLinkPaymentMethodTypeMultibanco PaymentLinkPaymentMethodType = "multibanco" PaymentLinkPaymentMethodTypeOXXO PaymentLinkPaymentMethodType = "oxxo" PaymentLinkPaymentMethodTypeP24 PaymentLinkPaymentMethodType = "p24" + PaymentLinkPaymentMethodTypePayByBank PaymentLinkPaymentMethodType = "pay_by_bank" PaymentLinkPaymentMethodTypePayNow PaymentLinkPaymentMethodType = "paynow" PaymentLinkPaymentMethodTypePaypal PaymentLinkPaymentMethodType = "paypal" PaymentLinkPaymentMethodTypePix PaymentLinkPaymentMethodType = "pix" diff --git a/paymentmethod.go b/paymentmethod.go index a549e674d3..ecb7b8ce58 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -291,6 +291,7 @@ const ( PaymentMethodTypeNaverPay PaymentMethodType = "naver_pay" PaymentMethodTypeOXXO PaymentMethodType = "oxxo" PaymentMethodTypeP24 PaymentMethodType = "p24" + PaymentMethodTypePayByBank PaymentMethodType = "pay_by_bank" PaymentMethodTypePayco PaymentMethodType = "payco" PaymentMethodTypePayNow PaymentMethodType = "paynow" PaymentMethodTypePaypal PaymentMethodType = "paypal" @@ -553,6 +554,9 @@ type PaymentMethodP24Params struct { Bank *string `form:"bank"` } +// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. +type PaymentMethodPayByBankParams struct{} + // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. type PaymentMethodPaycoParams struct{} @@ -691,6 +695,8 @@ type PaymentMethodParams struct { OXXO *PaymentMethodOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. P24 *PaymentMethodP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. + PayByBank *PaymentMethodPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. Payco *PaymentMethodPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. @@ -1201,9 +1207,12 @@ type PaymentMethodP24 struct { // The customer's bank, if provided. Bank string `json:"bank"` } +type PaymentMethodPayByBank struct{} type PaymentMethodPayco struct{} type PaymentMethodPayNow struct{} type PaymentMethodPaypal struct { + // Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated. + Country string `json:"country"` // Owner's email. Values are provided by PayPal directly // (if supported) at the time of authorization or settlement. They cannot be set or mutated. PayerEmail string `json:"payer_email"` @@ -1343,6 +1352,7 @@ type PaymentMethod struct { Object string `json:"object"` OXXO *PaymentMethodOXXO `json:"oxxo"` P24 *PaymentMethodP24 `json:"p24"` + PayByBank *PaymentMethodPayByBank `json:"pay_by_bank"` Payco *PaymentMethodPayco `json:"payco"` PayNow *PaymentMethodPayNow `json:"paynow"` Paypal *PaymentMethodPaypal `json:"paypal"` diff --git a/paymentmethodconfiguration.go b/paymentmethodconfiguration.go index 9e24fa887e..f4d5c92d42 100644 --- a/paymentmethodconfiguration.go +++ b/paymentmethodconfiguration.go @@ -576,6 +576,25 @@ const ( PaymentMethodConfigurationP24DisplayPreferenceValueOn PaymentMethodConfigurationP24DisplayPreferenceValue = "on" ) +// The account's display preference. +type PaymentMethodConfigurationPayByBankDisplayPreferencePreference string + +// List of values that PaymentMethodConfigurationPayByBankDisplayPreferencePreference can take +const ( + PaymentMethodConfigurationPayByBankDisplayPreferencePreferenceNone PaymentMethodConfigurationPayByBankDisplayPreferencePreference = "none" + PaymentMethodConfigurationPayByBankDisplayPreferencePreferenceOff PaymentMethodConfigurationPayByBankDisplayPreferencePreference = "off" + PaymentMethodConfigurationPayByBankDisplayPreferencePreferenceOn PaymentMethodConfigurationPayByBankDisplayPreferencePreference = "on" +) + +// The effective display preference value. +type PaymentMethodConfigurationPayByBankDisplayPreferenceValue string + +// List of values that PaymentMethodConfigurationPayByBankDisplayPreferenceValue can take +const ( + PaymentMethodConfigurationPayByBankDisplayPreferenceValueOff PaymentMethodConfigurationPayByBankDisplayPreferenceValue = "off" + PaymentMethodConfigurationPayByBankDisplayPreferenceValueOn PaymentMethodConfigurationPayByBankDisplayPreferenceValue = "on" +) + // The account's display preference. type PaymentMethodConfigurationPayNowDisplayPreferencePreference string @@ -1171,6 +1190,18 @@ type PaymentMethodConfigurationP24Params struct { DisplayPreference *PaymentMethodConfigurationP24DisplayPreferenceParams `form:"display_preference"` } +// Whether or not the payment method should be displayed. +type PaymentMethodConfigurationPayByBankDisplayPreferenceParams struct { + // The account's preference for whether or not to display this payment method. + Preference *string `form:"preference"` +} + +// Pay by bank is a redirect payment method backed by bank transfers. A customer is redirected to their bank to authorize a bank transfer for a given amount. This removes a lot of the error risks inherent in waiting for the customer to initiate a transfer themselves, and is less expensive than card payments. +type PaymentMethodConfigurationPayByBankParams struct { + // Whether or not the payment method should be displayed. + DisplayPreference *PaymentMethodConfigurationPayByBankDisplayPreferenceParams `form:"display_preference"` +} + // Whether or not the payment method should be displayed. type PaymentMethodConfigurationPayNowDisplayPreferenceParams struct { // The account's preference for whether or not to display this payment method. @@ -1376,6 +1407,8 @@ type PaymentMethodConfigurationParams struct { P24 *PaymentMethodConfigurationP24Params `form:"p24"` // Configuration's parent configuration. Specify to create a child configuration. Parent *string `form:"parent"` + // Pay by bank is a redirect payment method backed by bank transfers. A customer is redirected to their bank to authorize a bank transfer for a given amount. This removes a lot of the error risks inherent in waiting for the customer to initiate a transfer themselves, and is less expensive than card payments. + PayByBank *PaymentMethodConfigurationPayByBankParams `form:"pay_by_bank"` // PayNow is a Singapore-based payment method that allows customers to make a payment using their preferred app from participating banks and participating non-bank financial institutions. Check this [page](https://stripe.com/docs/payments/paynow) for more details. PayNow *PaymentMethodConfigurationPayNowParams `form:"paynow"` // PayPal, a digital wallet popular with customers in Europe, allows your customers worldwide to pay using their PayPal account. Check this [page](https://stripe.com/docs/payments/paypal) for more details. @@ -1795,6 +1828,19 @@ type PaymentMethodConfigurationP24 struct { Available bool `json:"available"` DisplayPreference *PaymentMethodConfigurationP24DisplayPreference `json:"display_preference"` } +type PaymentMethodConfigurationPayByBankDisplayPreference struct { + // For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + Overridable bool `json:"overridable"` + // The account's display preference. + Preference PaymentMethodConfigurationPayByBankDisplayPreferencePreference `json:"preference"` + // The effective display preference value. + Value PaymentMethodConfigurationPayByBankDisplayPreferenceValue `json:"value"` +} +type PaymentMethodConfigurationPayByBank struct { + // Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + Available bool `json:"available"` + DisplayPreference *PaymentMethodConfigurationPayByBankDisplayPreference `json:"display_preference"` +} type PaymentMethodConfigurationPayNowDisplayPreference struct { // For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. Overridable bool `json:"overridable"` @@ -2001,6 +2047,7 @@ type PaymentMethodConfiguration struct { P24 *PaymentMethodConfigurationP24 `json:"p24"` // For child configs, the configuration's parent configuration. Parent string `json:"parent"` + PayByBank *PaymentMethodConfigurationPayByBank `json:"pay_by_bank"` PayNow *PaymentMethodConfigurationPayNow `json:"paynow"` Paypal *PaymentMethodConfigurationPaypal `json:"paypal"` PromptPay *PaymentMethodConfigurationPromptPay `json:"promptpay"` diff --git a/setupintent.go b/setupintent.go index e02b066b6b..e53ea3fcd9 100644 --- a/setupintent.go +++ b/setupintent.go @@ -451,6 +451,9 @@ type SetupIntentPaymentMethodDataP24Params struct { Bank *string `form:"bank"` } +// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. +type SetupIntentPaymentMethodDataPayByBankParams struct{} + // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. type SetupIntentPaymentMethodDataPaycoParams struct{} @@ -583,6 +586,8 @@ type SetupIntentPaymentMethodDataParams struct { OXXO *SetupIntentPaymentMethodDataOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. P24 *SetupIntentPaymentMethodDataP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. + PayByBank *SetupIntentPaymentMethodDataPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. Payco *SetupIntentPaymentMethodDataPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. @@ -1097,6 +1102,9 @@ type SetupIntentConfirmPaymentMethodDataP24Params struct { Bank *string `form:"bank"` } +// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. +type SetupIntentConfirmPaymentMethodDataPayByBankParams struct{} + // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. type SetupIntentConfirmPaymentMethodDataPaycoParams struct{} @@ -1229,6 +1237,8 @@ type SetupIntentConfirmPaymentMethodDataParams struct { OXXO *SetupIntentConfirmPaymentMethodDataOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. P24 *SetupIntentConfirmPaymentMethodDataP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. + PayByBank *SetupIntentConfirmPaymentMethodDataPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. Payco *SetupIntentConfirmPaymentMethodDataPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. diff --git a/terminal_configuration.go b/terminal_configuration.go index 5687db9c6d..7de9b80484 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -138,6 +138,16 @@ type TerminalConfigurationTippingHKDParams struct { SmartTipThreshold *int64 `form:"smart_tip_threshold"` } +// Tipping configuration for JPY +type TerminalConfigurationTippingJpyParams struct { + // Fixed amounts displayed when collecting a tip + FixedAmounts []*int64 `form:"fixed_amounts"` + // Percentages displayed when collecting a tip + Percentages []*int64 `form:"percentages"` + // Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + SmartTipThreshold *int64 `form:"smart_tip_threshold"` +} + // Tipping configuration for MYR type TerminalConfigurationTippingMYRParams struct { // Fixed amounts displayed when collecting a tip @@ -226,6 +236,8 @@ type TerminalConfigurationTippingParams struct { GBP *TerminalConfigurationTippingGBPParams `form:"gbp"` // Tipping configuration for HKD HKD *TerminalConfigurationTippingHKDParams `form:"hkd"` + // Tipping configuration for JPY + Jpy *TerminalConfigurationTippingJpyParams `form:"jpy"` // Tipping configuration for MYR MYR *TerminalConfigurationTippingMYRParams `form:"myr"` // Tipping configuration for NOK @@ -344,6 +356,14 @@ type TerminalConfigurationTippingHKD struct { // Below this amount, fixed amounts will be displayed; above it, percentages will be displayed SmartTipThreshold int64 `json:"smart_tip_threshold"` } +type TerminalConfigurationTippingJpy struct { + // Fixed amounts displayed when collecting a tip + FixedAmounts []int64 `json:"fixed_amounts"` + // Percentages displayed when collecting a tip + Percentages []int64 `json:"percentages"` + // Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + SmartTipThreshold int64 `json:"smart_tip_threshold"` +} type TerminalConfigurationTippingMYR struct { // Fixed amounts displayed when collecting a tip FixedAmounts []int64 `json:"fixed_amounts"` @@ -409,6 +429,7 @@ type TerminalConfigurationTipping struct { EUR *TerminalConfigurationTippingEUR `json:"eur"` GBP *TerminalConfigurationTippingGBP `json:"gbp"` HKD *TerminalConfigurationTippingHKD `json:"hkd"` + Jpy *TerminalConfigurationTippingJpy `json:"jpy"` MYR *TerminalConfigurationTippingMYR `json:"myr"` NOK *TerminalConfigurationTippingNOK `json:"nok"` NZD *TerminalConfigurationTippingNZD `json:"nzd"` diff --git a/testhelpers_confirmationtoken.go b/testhelpers_confirmationtoken.go index f804780711..394b9eb14a 100644 --- a/testhelpers_confirmationtoken.go +++ b/testhelpers_confirmationtoken.go @@ -155,6 +155,9 @@ type TestHelpersConfirmationTokenPaymentMethodDataP24Params struct { Bank *string `form:"bank"` } +// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. +type TestHelpersConfirmationTokenPaymentMethodDataPayByBankParams struct{} + // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. type TestHelpersConfirmationTokenPaymentMethodDataPaycoParams struct{} @@ -286,6 +289,8 @@ type TestHelpersConfirmationTokenPaymentMethodDataParams struct { OXXO *TestHelpersConfirmationTokenPaymentMethodDataOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. P24 *TestHelpersConfirmationTokenPaymentMethodDataP24Params `form:"p24"` + // If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method. + PayByBank *TestHelpersConfirmationTokenPaymentMethodDataPayByBankParams `form:"pay_by_bank"` // If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. Payco *TestHelpersConfirmationTokenPaymentMethodDataPaycoParams `form:"payco"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. diff --git a/treasury/financialaccount/client.go b/treasury/financialaccount/client.go index 76befd7551..d62ae46e58 100644 --- a/treasury/financialaccount/client.go +++ b/treasury/financialaccount/client.go @@ -64,6 +64,19 @@ func (c Client) Update(id string, params *stripe.TreasuryFinancialAccountParams) return financialaccount, err } +// Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards. +func Close(id string, params *stripe.TreasuryFinancialAccountCloseParams) (*stripe.TreasuryFinancialAccount, error) { + return getC().Close(id, params) +} + +// Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards. +func (c Client) Close(id string, params *stripe.TreasuryFinancialAccountCloseParams) (*stripe.TreasuryFinancialAccount, error) { + path := stripe.FormatURLPath("/v1/treasury/financial_accounts/%s/close", id) + financialaccount := &stripe.TreasuryFinancialAccount{} + err := c.B.Call(http.MethodPost, path, c.Key, params, financialaccount) + return financialaccount, err +} + // Retrieves Features information associated with the FinancialAccount. func RetrieveFeatures(id string, params *stripe.TreasuryFinancialAccountRetrieveFeaturesParams) (*stripe.TreasuryFinancialAccountFeatures, error) { return getC().RetrieveFeatures(id, params) diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index e62408d8dd..bc91e84f9c 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -245,8 +245,12 @@ type TreasuryFinancialAccountParams struct { Expand []*string `form:"expand"` // Encodes whether a FinancialAccount has access to a particular feature, with a status enum and associated `status_details`. Stripe or the platform may control features via the requested field. Features *TreasuryFinancialAccountFeaturesParams `form:"features"` + // A different bank account where funds can be deposited/debited in order to get the closing FA's balance to $0 + ForwardingSettings *TreasuryFinancialAccountForwardingSettingsParams `form:"forwarding_settings"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` + // The nickname for the FinancialAccount. + Nickname *string `form:"nickname"` // The set of functionalities that the platform can restrict on the FinancialAccount. PlatformRestrictions *TreasuryFinancialAccountPlatformRestrictionsParams `form:"platform_restrictions"` // The currencies the FinancialAccount can hold a balance in. @@ -267,6 +271,16 @@ func (p *TreasuryFinancialAccountParams) AddMetadata(key string, value string) { p.Metadata[key] = value } +// A different bank account where funds can be deposited/debited in order to get the closing FA's balance to $0 +type TreasuryFinancialAccountForwardingSettingsParams struct { + // The financial_account id + FinancialAccount *string `form:"financial_account"` + // The payment_method or bank account id. This needs to be a verified bank account. + PaymentMethod *string `form:"payment_method"` + // The type of the bank account provided. This can be either "financial_account" or "payment_method" + Type *string `form:"type"` +} + // Retrieves Features information associated with the FinancialAccount. type TreasuryFinancialAccountRetrieveFeaturesParams struct { Params `form:"*"` @@ -387,6 +401,30 @@ func (p *TreasuryFinancialAccountUpdateFeaturesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) } +// A different bank account where funds can be deposited/debited in order to get the closing FA's balance to $0 +type TreasuryFinancialAccountCloseForwardingSettingsParams struct { + // The financial_account id + FinancialAccount *string `form:"financial_account"` + // The payment_method or bank account id. This needs to be a verified bank account. + PaymentMethod *string `form:"payment_method"` + // The type of the bank account provided. This can be either "financial_account" or "payment_method" + Type *string `form:"type"` +} + +// Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards. +type TreasuryFinancialAccountCloseParams struct { + Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + // A different bank account where funds can be deposited/debited in order to get the closing FA's balance to $0 + ForwardingSettings *TreasuryFinancialAccountCloseForwardingSettingsParams `form:"forwarding_settings"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryFinancialAccountCloseParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Balance information for the FinancialAccount type TreasuryFinancialAccountBalance struct { // Funds the user can spend right now. @@ -457,11 +495,14 @@ type TreasuryFinancialAccount struct { // The set of credentials that resolve to a FinancialAccount. FinancialAddresses []*TreasuryFinancialAccountFinancialAddress `json:"financial_addresses"` // Unique identifier for the object. - ID string `json:"id"` + ID string `json:"id"` + IsDefault bool `json:"is_default"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. Livemode bool `json:"livemode"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` + // The nickname for the FinancialAccount. + Nickname string `json:"nickname"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The array of paths to pending Features in the Features hash. diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index 1b747760e7..c25f755020 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -6,12 +6,21 @@ package stripe +// The rails used to send funds. +type TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetwork string + +// List of values that TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetwork can take +const ( + TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetworkStripe TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetwork = "stripe" +) + // The type of the payment method used in the OutboundTransfer. type TreasuryOutboundTransferDestinationPaymentMethodDetailsType string // List of values that TreasuryOutboundTransferDestinationPaymentMethodDetailsType can take const ( - TreasuryOutboundTransferDestinationPaymentMethodDetailsTypeUSBankAccount TreasuryOutboundTransferDestinationPaymentMethodDetailsType = "us_bank_account" + TreasuryOutboundTransferDestinationPaymentMethodDetailsTypeFinancialAccount TreasuryOutboundTransferDestinationPaymentMethodDetailsType = "financial_account" + TreasuryOutboundTransferDestinationPaymentMethodDetailsTypeUSBankAccount TreasuryOutboundTransferDestinationPaymentMethodDetailsType = "us_bank_account" ) // Account holder type: individual or company. @@ -95,6 +104,14 @@ func (p *TreasuryOutboundTransferListParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) } +// Hash used to generate the PaymentMethod to be used for this OutboundTransfer. Exclusive with `destination_payment_method`. +type TreasuryOutboundTransferDestinationPaymentMethodDataParams struct { + // Required if type is set to `financial_account`. The FinancialAccount ID to send funds to. + FinancialAccount *string `form:"financial_account"` + // The type of the destination. + Type *string `form:"type"` +} + // Optional fields for `us_bank_account`. type TreasuryOutboundTransferDestinationPaymentMethodOptionsUSBankAccountParams struct { // Specifies the network rails to be used. If not set, will default to the PaymentMethod's preferred network. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type. @@ -118,6 +135,8 @@ type TreasuryOutboundTransferParams struct { Description *string `form:"description"` // The PaymentMethod to use as the payment instrument for the OutboundTransfer. DestinationPaymentMethod *string `form:"destination_payment_method"` + // Hash used to generate the PaymentMethod to be used for this OutboundTransfer. Exclusive with `destination_payment_method`. + DestinationPaymentMethodData *TreasuryOutboundTransferDestinationPaymentMethodDataParams `form:"destination_payment_method_data"` // Hash describing payment method configuration details. DestinationPaymentMethodOptions *TreasuryOutboundTransferDestinationPaymentMethodOptionsParams `form:"destination_payment_method_options"` // Specifies which fields in the response should be expanded. @@ -163,6 +182,12 @@ type TreasuryOutboundTransferDestinationPaymentMethodDetailsBillingDetails struc // Full name. Name string `json:"name"` } +type TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccount struct { + // Token of the FinancialAccount. + ID string `json:"id"` + // The rails used to send funds. + Network TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetwork `json:"network"` +} type TreasuryOutboundTransferDestinationPaymentMethodDetailsUSBankAccount struct { // Account holder type: individual or company. AccountHolderType TreasuryOutboundTransferDestinationPaymentMethodDetailsUSBankAccountAccountHolderType `json:"account_holder_type"` @@ -182,7 +207,8 @@ type TreasuryOutboundTransferDestinationPaymentMethodDetailsUSBankAccount struct RoutingNumber string `json:"routing_number"` } type TreasuryOutboundTransferDestinationPaymentMethodDetails struct { - BillingDetails *TreasuryOutboundTransferDestinationPaymentMethodDetailsBillingDetails `json:"billing_details"` + BillingDetails *TreasuryOutboundTransferDestinationPaymentMethodDetailsBillingDetails `json:"billing_details"` + FinancialAccount *TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccount `json:"financial_account"` // The type of the payment method used in the OutboundTransfer. Type TreasuryOutboundTransferDestinationPaymentMethodDetailsType `json:"type"` USBankAccount *TreasuryOutboundTransferDestinationPaymentMethodDetailsUSBankAccount `json:"us_bank_account"` diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 07a9c52947..8d0faf0e22 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -50,10 +50,11 @@ type TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType string // List of values that TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType can take const ( - TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeCreditReversal TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "credit_reversal" - TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOther TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "other" - TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOutboundPayment TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "outbound_payment" - TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypePayout TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "payout" + TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeCreditReversal TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "credit_reversal" + TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOther TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "other" + TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOutboundPayment TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "outbound_payment" + TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypeOutboundTransfer TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "outbound_transfer" + TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsTypePayout TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType = "payout" ) // The rails used to send the funds. @@ -167,6 +168,12 @@ type TreasuryReceivedCreditLinkedFlowsSourceFlowDetails struct { // // Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) OutboundPayment *TreasuryOutboundPayment `json:"outbound_payment"` + // Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. + // + // Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. + // + // Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) + OutboundTransfer *TreasuryOutboundTransfer `json:"outbound_transfer"` // A `Payout` object is created when you receive funds from Stripe, or when you // initiate a payout to either a bank account or debit card of a [connected // Stripe account](https://stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts, From fffcd5634f9e7ce4baf8bb65b0583257495ea6ce Mon Sep 17 00:00:00 2001 From: Helen Ye Date: Mon, 27 Jan 2025 15:21:34 -0500 Subject: [PATCH 2/8] Bump version to 81.3.0 --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ VERSION | 2 +- stripe.go | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbe3d80dc9..3904b3d464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## 81.3.0 - 2025-01-27 +* [#1965](https://github.com/stripe/stripe-go/pull/1965) Update generated code + * Add support for `Close` method on resource `Treasury.FinancialAccount` + * Add support for `PayByBankPayments` on `AccountCapabilitiesParams` and `AccountCapabilities` + * Add support for `DirectorshipDeclaration` and `OwnershipExemptionReason` on `AccountCompanyParams`, `AccountCompany`, and `TokenAccountCompanyParams` + * Add support for `ProofOfUltimateBeneficialOwnership` on `AccountDocumentsParams` + * Add support for `FinancialAccount` on `AccountSessionComponentsParams`, `AccountSessionComponents`, and `TreasuryOutboundTransferDestinationPaymentMethodDetails` + * Add support for `FinancialAccountTransactions`, `IssuingCard`, and `IssuingCardsList` on `AccountSessionComponentsParams` and `AccountSessionComponents` + * Add support for `AdviceCode` on `ChargeOutcome`, `InvoiceLastFinalizationError`, `PaymentIntentLastPaymentError`, `SetupAttemptSetupError`, `SetupIntentLastSetupError`, and `StripeError` + * Add support for `PayByBank` on `ChargePaymentMethodDetails`, `CheckoutSessionPaymentMethodOptionsParams`, `ConfirmationTokenPaymentMethodDataParams`, `ConfirmationTokenPaymentMethodPreview`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodConfigurationParams`, `PaymentMethodConfiguration`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams` + * Add support for `Country` on `ChargePaymentMethodDetailsPaypal`, `ConfirmationTokenPaymentMethodPreviewPaypal`, and `PaymentMethodPaypal` + * Add support for `Discounts` on `CheckoutSession` + * Add support for new value `SD` on enums `CheckoutSessionShippingAddressCollectionAllowedCountries` and `PaymentLinkShippingAddressCollectionAllowedCountries` + * Add support for new value `pay_by_bank` on enums `ConfirmationTokenPaymentMethodPreviewType` and `PaymentMethodType` + * Add support for `PhoneNumberCollection` on `PaymentLinkParams` + * Add support for new value `pay_by_bank` on enum `PaymentLinkPaymentMethodTypes` + * Add support for `Jpy` on `TerminalConfigurationTippingParams` and `TerminalConfigurationTipping` + * Add support for `Nickname` on `TreasuryFinancialAccountParams` and `TreasuryFinancialAccount` + * Add support for `ForwardingSettings` on `TreasuryFinancialAccountParams` + * Add support for `IsDefault` on `TreasuryFinancialAccount` + * Add support for `DestinationPaymentMethodData` on `TreasuryOutboundTransferParams` + * Change type of `TreasuryOutboundTransferDestinationPaymentMethodDetailsType` from `literal('us_bank_account')` to `enum('financial_account'|'us_bank_account')` + * Add support for `OutboundTransfer` on `TreasuryReceivedCreditLinkedFlowsSourceFlowDetails` + * Add support for new value `outbound_transfer` on enum `TreasuryReceivedCreditLinkedFlowsSourceFlowDetailsType` +* [#1970](https://github.com/stripe/stripe-go/pull/1970) fix justfile ordering bug +* [#1969](https://github.com/stripe/stripe-go/pull/1969) pin CI and fix formatting +* [#1964](https://github.com/stripe/stripe-go/pull/1964) add justfile, update readme, remove coveralls +* [#1967](https://github.com/stripe/stripe-go/pull/1967) Added CONTRIBUTING.md file +* [#1962](https://github.com/stripe/stripe-go/pull/1962) Added pull request template + ## 81.2.0 - 2024-12-18 * [#1957](https://github.com/stripe/stripe-go/pull/1957) This release changes the pinned API version to `2024-12-18.acacia`. * Add support for `NetworkAdviceCode` and `NetworkDeclineCode` on `ChargeOutcome`, `InvoiceLastFinalizationError`, `PaymentIntentLastPaymentError`, `SetupAttemptSetupError`, `SetupIntentLastSetupError`, and `StripeError` diff --git a/VERSION b/VERSION index 46e652f904..12d065ab50 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -81.2.0 +81.3.0 diff --git a/stripe.go b/stripe.go index ff7374d517..06598ab344 100644 --- a/stripe.go +++ b/stripe.go @@ -1386,7 +1386,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "81.2.0" +const clientversion = "81.3.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 From db683ea89246543939855228c4e42ec3068ee932 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 15:42:18 +0000 Subject: [PATCH 3/8] Update generated code for v1469 --- OPENAPI_VERSION | 2 +- terminal_configuration.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 679692c030..9dce18a705 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1468 \ No newline at end of file +v1469 \ No newline at end of file diff --git a/terminal_configuration.go b/terminal_configuration.go index e4679c9d64..b5d8829651 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -179,7 +179,7 @@ type TerminalConfigurationTippingNZDParams struct { } // Tipping configuration for PLN -type TerminalConfigurationTippingPLNParams struct { +type TerminalConfigurationTippingPlnParams struct { // Fixed amounts displayed when collecting a tip FixedAmounts []*int64 `form:"fixed_amounts"` // Percentages displayed when collecting a tip @@ -245,7 +245,7 @@ type TerminalConfigurationTippingParams struct { // Tipping configuration for NZD NZD *TerminalConfigurationTippingNZDParams `form:"nzd"` // Tipping configuration for PLN - PLN *TerminalConfigurationTippingPLNParams `form:"pln"` + Pln *TerminalConfigurationTippingPlnParams `form:"pln"` // Tipping configuration for SEK SEK *TerminalConfigurationTippingSEKParams `form:"sek"` // Tipping configuration for SGD @@ -388,7 +388,7 @@ type TerminalConfigurationTippingNZD struct { // Below this amount, fixed amounts will be displayed; above it, percentages will be displayed SmartTipThreshold int64 `json:"smart_tip_threshold"` } -type TerminalConfigurationTippingPLN struct { +type TerminalConfigurationTippingPln struct { // Fixed amounts displayed when collecting a tip FixedAmounts []int64 `json:"fixed_amounts"` // Percentages displayed when collecting a tip @@ -433,7 +433,7 @@ type TerminalConfigurationTipping struct { MYR *TerminalConfigurationTippingMYR `json:"myr"` NOK *TerminalConfigurationTippingNOK `json:"nok"` NZD *TerminalConfigurationTippingNZD `json:"nzd"` - PLN *TerminalConfigurationTippingPLN `json:"pln"` + Pln *TerminalConfigurationTippingPln `json:"pln"` SEK *TerminalConfigurationTippingSEK `json:"sek"` SGD *TerminalConfigurationTippingSGD `json:"sgd"` USD *TerminalConfigurationTippingUSD `json:"usd"` From befdbbb48ebb983c40fcf8bb7e2ae97993a750e9 Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 09:48:28 -0800 Subject: [PATCH 4/8] Update generated code (#1980) * Update generated code for v1466 * Update generated code for v1469 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- accountlink/client.go | 7 +- accountsession/client.go | 7 +- applepaydomain/client.go | 7 +- apps/secret/client.go | 14 +-- bankaccount.go | 5 +- billing/creditbalancesummary/client.go | 7 +- billing/creditgrant/client.go | 7 +- billing/meterevent/client.go | 7 +- billing/metereventadjustment/client.go | 7 +- billing/metereventsummary/client.go | 4 +- billingportal/configuration/client.go | 7 +- billingportal/session/client.go | 7 +- capability/client.go | 17 +--- card.go | 63 ++++++------ cashbalance/client.go | 14 +-- checkout/session/client.go | 12 +-- creditnote/client.go | 18 +--- customer/client.go | 10 +- customerbalancetransaction/client.go | 49 +++------- customercashbalancetransaction/client.go | 18 +--- customersession/client.go | 7 +- entitlements/feature/client.go | 7 +- ephemeralkey/client.go | 7 +- example/generated_examples_test.go | 96 +++++-------------- feerefund/client.go | 18 +--- file.go | 4 +- file/client.go | 3 +- financialconnections/account/client.go | 21 ++-- financialconnections/session/client.go | 7 +- forwarding/request/client.go | 7 +- identity/verificationsession/client.go | 15 +-- invoice/client.go | 18 +--- invoiceitem/client.go | 7 +- invoicelineitem/client.go | 5 +- invoicerenderingtemplate/client.go | 18 +--- issuing/cardholder/client.go | 7 +- issuing/dispute/client.go | 7 +- issuing/personalizationdesign/client.go | 7 +- loginlink/client.go | 4 +- paymentintent/client.go | 19 +--- paymentlink/client.go | 12 +-- paymentmethod/client.go | 7 +- paymentmethodconfiguration/client.go | 21 +--- paymentmethoddomain/client.go | 7 +- paymentsource/client.go | 19 +--- person/client.go | 26 ++--- plan.go | 5 +- productfeature/client.go | 18 +--- promotioncode/client.go | 7 +- quote/client.go | 9 +- radar/valuelist/client.go | 7 +- radar/valuelistitem/client.go | 7 +- reporting/reportrun/client.go | 7 +- setupintent/client.go | 7 +- shippingrate/client.go | 7 +- source/client.go | 8 +- sourcetransaction/client.go | 4 +- subscription/client.go | 7 +- subscriptionitem/client.go | 12 +-- subscriptionschedule/client.go | 7 +- tax/calculation/client.go | 12 +-- tax/registration/client.go | 7 +- tax/transaction/client.go | 19 +--- terminal/configuration/client.go | 7 +- terminal/connectiontoken/client.go | 7 +- terminal/location/client.go | 7 +- terminal/reader/client.go | 15 +-- terminal_configuration.go | 8 +- testhelpers/confirmationtoken/client.go | 7 +- testhelpers/customer/client.go | 11 +-- testhelpers/issuing/authorization/client.go | 31 ++---- testhelpers/issuing/card/client.go | 20 +--- .../issuing/personalizationdesign/client.go | 12 +-- testhelpers/issuing/transaction/client.go | 18 +--- testhelpers/terminal/reader/client.go | 4 +- testhelpers/testclock/client.go | 7 +- .../treasury/inboundtransfer/client.go | 12 +-- .../treasury/outboundpayment/client.go | 16 +--- .../treasury/outboundtransfer/client.go | 16 +--- testhelpers/treasury/receivedcredit/client.go | 7 +- testhelpers/treasury/receiveddebit/client.go | 7 +- transferreversal/client.go | 21 +--- treasury/creditreversal/client.go | 7 +- treasury/debitreversal/client.go | 7 +- treasury/financialaccount/client.go | 22 +---- treasury/inboundtransfer/client.go | 7 +- treasury/outboundpayment/client.go | 7 +- treasury/outboundtransfer/client.go | 7 +- usagerecord/client.go | 5 +- usagerecordsummary/client.go | 5 +- webhookendpoint/client.go | 7 +- 92 files changed, 251 insertions(+), 871 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 217ac84ad0..9dce18a705 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1455 \ No newline at end of file +v1469 \ No newline at end of file diff --git a/accountlink/client.go b/accountlink/client.go index c9714941b9..3dfe9a6bb2 100644 --- a/accountlink/client.go +++ b/accountlink/client.go @@ -28,12 +28,7 @@ func New(params *stripe.AccountLinkParams) (*stripe.AccountLink, error) { func (c Client) New(params *stripe.AccountLinkParams) (*stripe.AccountLink, error) { accountlink := &stripe.AccountLink{} err := c.B.Call( - http.MethodPost, - "/v1/account_links", - c.Key, - params, - accountlink, - ) + http.MethodPost, "/v1/account_links", c.Key, params, accountlink) return accountlink, err } diff --git a/accountsession/client.go b/accountsession/client.go index 360bd90e4b..be7fca5b26 100644 --- a/accountsession/client.go +++ b/accountsession/client.go @@ -28,12 +28,7 @@ func New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) { func (c Client) New(params *stripe.AccountSessionParams) (*stripe.AccountSession, error) { accountsession := &stripe.AccountSession{} err := c.B.Call( - http.MethodPost, - "/v1/account_sessions", - c.Key, - params, - accountsession, - ) + http.MethodPost, "/v1/account_sessions", c.Key, params, accountsession) return accountsession, err } diff --git a/applepaydomain/client.go b/applepaydomain/client.go index 47497fcef4..431beec56d 100644 --- a/applepaydomain/client.go +++ b/applepaydomain/client.go @@ -29,12 +29,7 @@ func New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) { func (c Client) New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) { applepaydomain := &stripe.ApplePayDomain{} err := c.B.Call( - http.MethodPost, - "/v1/apple_pay/domains", - c.Key, - params, - applepaydomain, - ) + http.MethodPost, "/v1/apple_pay/domains", c.Key, params, applepaydomain) return applepaydomain, err } diff --git a/apps/secret/client.go b/apps/secret/client.go index 84e0b02385..cc16379c0b 100644 --- a/apps/secret/client.go +++ b/apps/secret/client.go @@ -41,12 +41,7 @@ func DeleteWhere(params *stripe.AppsSecretDeleteWhereParams) (*stripe.AppsSecret func (c Client) DeleteWhere(params *stripe.AppsSecretDeleteWhereParams) (*stripe.AppsSecret, error) { secret := &stripe.AppsSecret{} err := c.B.Call( - http.MethodPost, - "/v1/apps/secrets/delete", - c.Key, - params, - secret, - ) + http.MethodPost, "/v1/apps/secrets/delete", c.Key, params, secret) return secret, err } @@ -59,12 +54,7 @@ func Find(params *stripe.AppsSecretFindParams) (*stripe.AppsSecret, error) { func (c Client) Find(params *stripe.AppsSecretFindParams) (*stripe.AppsSecret, error) { secret := &stripe.AppsSecret{} err := c.B.Call( - http.MethodGet, - "/v1/apps/secrets/find", - c.Key, - params, - secret, - ) + http.MethodGet, "/v1/apps/secrets/find", c.Key, params, secret) return secret, err } diff --git a/bankaccount.go b/bankaccount.go index b03fee7898..ee20041eef 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -333,9 +333,8 @@ func (p *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) if p.DefaultForCurrency != nil { body.Add( - "default_for_currency", - strconv.FormatBool(BoolValue(p.DefaultForCurrency)), - ) + "default_for_currency", strconv.FormatBool( + BoolValue(p.DefaultForCurrency))) } } else { body.Add(sourceType+"[object]", "bank_account") diff --git a/billing/creditbalancesummary/client.go b/billing/creditbalancesummary/client.go index c70d6f7259..579392d8c6 100644 --- a/billing/creditbalancesummary/client.go +++ b/billing/creditbalancesummary/client.go @@ -28,12 +28,7 @@ func Get(params *stripe.BillingCreditBalanceSummaryParams) (*stripe.BillingCredi func (c Client) Get(params *stripe.BillingCreditBalanceSummaryParams) (*stripe.BillingCreditBalanceSummary, error) { creditbalancesummary := &stripe.BillingCreditBalanceSummary{} err := c.B.Call( - http.MethodGet, - "/v1/billing/credit_balance_summary", - c.Key, - params, - creditbalancesummary, - ) + http.MethodGet, "/v1/billing/credit_balance_summary", c.Key, params, creditbalancesummary) return creditbalancesummary, err } diff --git a/billing/creditgrant/client.go b/billing/creditgrant/client.go index 58c6ff1b10..8a66a5b9a5 100644 --- a/billing/creditgrant/client.go +++ b/billing/creditgrant/client.go @@ -29,12 +29,7 @@ func New(params *stripe.BillingCreditGrantParams) (*stripe.BillingCreditGrant, e func (c Client) New(params *stripe.BillingCreditGrantParams) (*stripe.BillingCreditGrant, error) { creditgrant := &stripe.BillingCreditGrant{} err := c.B.Call( - http.MethodPost, - "/v1/billing/credit_grants", - c.Key, - params, - creditgrant, - ) + http.MethodPost, "/v1/billing/credit_grants", c.Key, params, creditgrant) return creditgrant, err } diff --git a/billing/meterevent/client.go b/billing/meterevent/client.go index ea471e22bf..cb6107d1b0 100644 --- a/billing/meterevent/client.go +++ b/billing/meterevent/client.go @@ -28,12 +28,7 @@ func New(params *stripe.BillingMeterEventParams) (*stripe.BillingMeterEvent, err func (c Client) New(params *stripe.BillingMeterEventParams) (*stripe.BillingMeterEvent, error) { meterevent := &stripe.BillingMeterEvent{} err := c.B.Call( - http.MethodPost, - "/v1/billing/meter_events", - c.Key, - params, - meterevent, - ) + http.MethodPost, "/v1/billing/meter_events", c.Key, params, meterevent) return meterevent, err } diff --git a/billing/metereventadjustment/client.go b/billing/metereventadjustment/client.go index ab13686f73..7c5b537017 100644 --- a/billing/metereventadjustment/client.go +++ b/billing/metereventadjustment/client.go @@ -28,12 +28,7 @@ func New(params *stripe.BillingMeterEventAdjustmentParams) (*stripe.BillingMeter func (c Client) New(params *stripe.BillingMeterEventAdjustmentParams) (*stripe.BillingMeterEventAdjustment, error) { metereventadjustment := &stripe.BillingMeterEventAdjustment{} err := c.B.Call( - http.MethodPost, - "/v1/billing/meter_event_adjustments", - c.Key, - params, - metereventadjustment, - ) + http.MethodPost, "/v1/billing/meter_event_adjustments", c.Key, params, metereventadjustment) return metereventadjustment, err } diff --git a/billing/metereventsummary/client.go b/billing/metereventsummary/client.go index 880706b904..90944d3a76 100644 --- a/billing/metereventsummary/client.go +++ b/billing/metereventsummary/client.go @@ -28,9 +28,7 @@ func List(params *stripe.BillingMeterEventSummaryListParams) *Iter { // Retrieve a list of billing meter event summaries. func (c Client) List(listParams *stripe.BillingMeterEventSummaryListParams) *Iter { path := stripe.FormatURLPath( - "/v1/billing/meters/%s/event_summaries", - stripe.StringValue(listParams.ID), - ) + "/v1/billing/meters/%s/event_summaries", stripe.StringValue(listParams.ID)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.BillingMeterEventSummaryList{} diff --git a/billingportal/configuration/client.go b/billingportal/configuration/client.go index 2091931c5b..bbc9c60085 100644 --- a/billingportal/configuration/client.go +++ b/billingportal/configuration/client.go @@ -29,12 +29,7 @@ func New(params *stripe.BillingPortalConfigurationParams) (*stripe.BillingPortal func (c Client) New(params *stripe.BillingPortalConfigurationParams) (*stripe.BillingPortalConfiguration, error) { configuration := &stripe.BillingPortalConfiguration{} err := c.B.Call( - http.MethodPost, - "/v1/billing_portal/configurations", - c.Key, - params, - configuration, - ) + http.MethodPost, "/v1/billing_portal/configurations", c.Key, params, configuration) return configuration, err } diff --git a/billingportal/session/client.go b/billingportal/session/client.go index b86e84e37e..5d7b442069 100644 --- a/billingportal/session/client.go +++ b/billingportal/session/client.go @@ -28,12 +28,7 @@ func New(params *stripe.BillingPortalSessionParams) (*stripe.BillingPortalSessio func (c Client) New(params *stripe.BillingPortalSessionParams) (*stripe.BillingPortalSession, error) { session := &stripe.BillingPortalSession{} err := c.B.Call( - http.MethodPost, - "/v1/billing_portal/sessions", - c.Key, - params, - session, - ) + http.MethodPost, "/v1/billing_portal/sessions", c.Key, params, session) return session, err } diff --git a/capability/client.go b/capability/client.go index 7d092a121a..8c0e18e559 100644 --- a/capability/client.go +++ b/capability/client.go @@ -30,14 +30,10 @@ func Get(id string, params *stripe.CapabilityParams) (*stripe.Capability, error) func (c Client) Get(id string, params *stripe.CapabilityParams) (*stripe.Capability, error) { if params == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Account must be set", - ) + "params cannot be nil, and params.Account must be set") } path := stripe.FormatURLPath( - "/v1/accounts/%s/capabilities/%s", - stripe.StringValue(params.Account), - id, - ) + "/v1/accounts/%s/capabilities/%s", stripe.StringValue(params.Account), id) capability := &stripe.Capability{} err := c.B.Call(http.MethodGet, path, c.Key, params, capability) return capability, err @@ -51,10 +47,7 @@ func Update(id string, params *stripe.CapabilityParams) (*stripe.Capability, err // Updates an existing Account Capability. Request or remove a capability by updating its requested parameter. func (c Client) Update(id string, params *stripe.CapabilityParams) (*stripe.Capability, error) { path := stripe.FormatURLPath( - "/v1/accounts/%s/capabilities/%s", - stripe.StringValue(params.Account), - id, - ) + "/v1/accounts/%s/capabilities/%s", stripe.StringValue(params.Account), id) capability := &stripe.Capability{} err := c.B.Call(http.MethodPost, path, c.Key, params, capability) return capability, err @@ -68,9 +61,7 @@ func List(params *stripe.CapabilityListParams) *Iter { // Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first. func (c Client) List(listParams *stripe.CapabilityListParams) *Iter { path := stripe.FormatURLPath( - "/v1/accounts/%s/capabilities", - stripe.StringValue(listParams.Account), - ) + "/v1/accounts/%s/capabilities", stripe.StringValue(listParams.Account)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.CapabilityList{} diff --git a/card.go b/card.go index a368bce7f7..34eaa0091b 100644 --- a/card.go +++ b/card.go @@ -177,9 +177,9 @@ func (p *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, ke if p.DefaultForCurrency != nil { body.Add( - form.FormatKey(append(keyParts, "default_for_currency")), - strconv.FormatBool(BoolValue(p.DefaultForCurrency)), - ) + form.FormatKey( + append(keyParts, "default_for_currency")), strconv.FormatBool( + BoolValue(p.DefaultForCurrency))) } if p.Token != nil { @@ -196,69 +196,60 @@ func (p *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, ke } if p.CVC != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "cvc")), - StringValue(p.CVC), - ) + form.FormatKey(append(keyParts, cardSource, "cvc")), StringValue(p.CVC)) } if p.Currency != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "currency")), - StringValue(p.Currency), - ) + form.FormatKey(append(keyParts, cardSource, "currency")), StringValue( + p.Currency)) } if p.ExpMonth != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "exp_month")), - StringValue(p.ExpMonth), - ) + form.FormatKey(append(keyParts, cardSource, "exp_month")), StringValue( + p.ExpMonth)) } if p.ExpYear != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "exp_year")), - StringValue(p.ExpYear), - ) + form.FormatKey(append(keyParts, cardSource, "exp_year")), StringValue( + p.ExpYear)) } if p.Name != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "name")), - StringValue(p.Name), - ) + form.FormatKey(append(keyParts, cardSource, "name")), StringValue(p.Name)) } if p.AddressCity != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_city")), - StringValue(p.AddressCity), - ) + form.FormatKey(append(keyParts, cardSource, "address_city")), StringValue( + p.AddressCity)) } if p.AddressCountry != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_country")), - StringValue(p.AddressCountry), - ) + form.FormatKey( + append(keyParts, cardSource, "address_country")), StringValue( + p.AddressCountry)) } if p.AddressLine1 != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_line1")), - StringValue(p.AddressLine1), - ) + form.FormatKey( + append(keyParts, cardSource, "address_line1")), StringValue( + p.AddressLine1)) } if p.AddressLine2 != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_line2")), - StringValue(p.AddressLine2), - ) + form.FormatKey( + append(keyParts, cardSource, "address_line2")), StringValue( + p.AddressLine2)) } if p.AddressState != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_state")), - StringValue(p.AddressState), - ) + form.FormatKey( + append(keyParts, cardSource, "address_state")), StringValue( + p.AddressState)) } if p.AddressZip != nil { body.Add( - form.FormatKey(append(keyParts, cardSource, "address_zip")), - StringValue(p.AddressZip), - ) + form.FormatKey(append(keyParts, cardSource, "address_zip")), StringValue( + p.AddressZip)) } } diff --git a/cashbalance/client.go b/cashbalance/client.go index be48f63aee..6b90914d91 100644 --- a/cashbalance/client.go +++ b/cashbalance/client.go @@ -29,13 +29,10 @@ func Get(params *stripe.CashBalanceParams) (*stripe.CashBalance, error) { func (c Client) Get(params *stripe.CashBalanceParams) (*stripe.CashBalance, error) { if params == nil || params.Customer == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Customer must be set", - ) + "params cannot be nil, and params.Customer must be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/cash_balance", - stripe.StringValue(params.Customer), - ) + "/v1/customers/%s/cash_balance", stripe.StringValue(params.Customer)) cashbalance := &stripe.CashBalance{} err := c.B.Call(http.MethodGet, path, c.Key, params, cashbalance) return cashbalance, err @@ -50,13 +47,10 @@ func Update(params *stripe.CashBalanceParams) (*stripe.CashBalance, error) { func (c Client) Update(params *stripe.CashBalanceParams) (*stripe.CashBalance, error) { if params == nil || params.Customer == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Customer must be set", - ) + "params cannot be nil, and params.Customer must be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/cash_balance", - stripe.StringValue(params.Customer), - ) + "/v1/customers/%s/cash_balance", stripe.StringValue(params.Customer)) cashbalance := &stripe.CashBalance{} err := c.B.Call(http.MethodPost, path, c.Key, params, cashbalance) return cashbalance, err diff --git a/checkout/session/client.go b/checkout/session/client.go index 6c0e3f6196..a45be7dc23 100644 --- a/checkout/session/client.go +++ b/checkout/session/client.go @@ -29,12 +29,7 @@ func New(params *stripe.CheckoutSessionParams) (*stripe.CheckoutSession, error) func (c Client) New(params *stripe.CheckoutSessionParams) (*stripe.CheckoutSession, error) { session := &stripe.CheckoutSession{} err := c.B.Call( - http.MethodPost, - "/v1/checkout/sessions", - c.Key, - params, - session, - ) + http.MethodPost, "/v1/checkout/sessions", c.Key, params, session) return session, err } @@ -128,9 +123,8 @@ func ListLineItems(params *stripe.CheckoutSessionListLineItemsParams) *LineItemI // When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. func (c Client) ListLineItems(listParams *stripe.CheckoutSessionListLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/checkout/sessions/%s/line_items", - stripe.StringValue(listParams.Session), - ) + "/v1/checkout/sessions/%s/line_items", stripe.StringValue( + listParams.Session)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.LineItemList{} diff --git a/creditnote/client.go b/creditnote/client.go index 9820a80104..c4cfa6f7ed 100644 --- a/creditnote/client.go +++ b/creditnote/client.go @@ -51,12 +51,7 @@ func New(params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { func (c Client) New(params *stripe.CreditNoteParams) (*stripe.CreditNote, error) { creditnote := &stripe.CreditNote{} err := c.B.Call( - http.MethodPost, - "/v1/credit_notes", - c.Key, - params, - creditnote, - ) + http.MethodPost, "/v1/credit_notes", c.Key, params, creditnote) return creditnote, err } @@ -95,12 +90,7 @@ func Preview(params *stripe.CreditNotePreviewParams) (*stripe.CreditNote, error) func (c Client) Preview(params *stripe.CreditNotePreviewParams) (*stripe.CreditNote, error) { creditnote := &stripe.CreditNote{} err := c.B.Call( - http.MethodGet, - "/v1/credit_notes/preview", - c.Key, - params, - creditnote, - ) + http.MethodGet, "/v1/credit_notes/preview", c.Key, params, creditnote) return creditnote, err } @@ -164,9 +154,7 @@ func ListLines(params *stripe.CreditNoteListLinesParams) *LineItemIter { // When retrieving a credit note, you'll get a lines property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. func (c Client) ListLines(listParams *stripe.CreditNoteListLinesParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/credit_notes/%s/lines", - stripe.StringValue(listParams.CreditNote), - ) + "/v1/credit_notes/%s/lines", stripe.StringValue(listParams.CreditNote)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.CreditNoteLineItemList{} diff --git a/customer/client.go b/customer/client.go index 92d8c29b47..67387526b6 100644 --- a/customer/client.go +++ b/customer/client.go @@ -113,10 +113,8 @@ func RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMeth // Retrieves a PaymentMethod object for a given Customer. func (c Client) RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMethodParams) (*stripe.PaymentMethod, error) { path := stripe.FormatURLPath( - "/v1/customers/%s/payment_methods/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/payment_methods/%s", stripe.StringValue( + params.Customer), id) paymentmethod := &stripe.PaymentMethod{} err := c.B.Call(http.MethodGet, path, c.Key, params, paymentmethod) return paymentmethod, err @@ -169,9 +167,7 @@ func ListPaymentMethods(params *stripe.CustomerListPaymentMethodsParams) *Paymen // Returns a list of PaymentMethods for a given Customer func (c Client) ListPaymentMethods(listParams *stripe.CustomerListPaymentMethodsParams) *PaymentMethodIter { path := stripe.FormatURLPath( - "/v1/customers/%s/payment_methods", - stripe.StringValue(listParams.Customer), - ) + "/v1/customers/%s/payment_methods", stripe.StringValue(listParams.Customer)) return &PaymentMethodIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.PaymentMethodList{} diff --git a/customerbalancetransaction/client.go b/customerbalancetransaction/client.go index 76097e7cc6..dff1a5acca 100644 --- a/customerbalancetransaction/client.go +++ b/customerbalancetransaction/client.go @@ -30,21 +30,14 @@ func New(params *stripe.CustomerBalanceTransactionParams) (*stripe.CustomerBalan func (c Client) New(params *stripe.CustomerBalanceTransactionParams) (*stripe.CustomerBalanceTransaction, error) { if params == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Customer must be set", - ) + "params cannot be nil, and params.Customer must be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/balance_transactions", - stripe.StringValue(params.Customer), - ) + "/v1/customers/%s/balance_transactions", stripe.StringValue( + params.Customer)) customerbalancetransaction := &stripe.CustomerBalanceTransaction{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - customerbalancetransaction, - ) + http.MethodPost, path, c.Key, params, customerbalancetransaction) return customerbalancetransaction, err } @@ -57,22 +50,14 @@ func Get(id string, params *stripe.CustomerBalanceTransactionParams) (*stripe.Cu func (c Client) Get(id string, params *stripe.CustomerBalanceTransactionParams) (*stripe.CustomerBalanceTransaction, error) { if params == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Customer must be set", - ) + "params cannot be nil, and params.Customer must be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/balance_transactions/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/balance_transactions/%s", stripe.StringValue( + params.Customer), id) customerbalancetransaction := &stripe.CustomerBalanceTransaction{} err := c.B.Call( - http.MethodGet, - path, - c.Key, - params, - customerbalancetransaction, - ) + http.MethodGet, path, c.Key, params, customerbalancetransaction) return customerbalancetransaction, err } @@ -84,18 +69,11 @@ func Update(id string, params *stripe.CustomerBalanceTransactionParams) (*stripe // Most credit balance transaction fields are immutable, but you may update its description and metadata. func (c Client) Update(id string, params *stripe.CustomerBalanceTransactionParams) (*stripe.CustomerBalanceTransaction, error) { path := stripe.FormatURLPath( - "/v1/customers/%s/balance_transactions/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/balance_transactions/%s", stripe.StringValue( + params.Customer), id) customerbalancetransaction := &stripe.CustomerBalanceTransaction{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - customerbalancetransaction, - ) + http.MethodPost, path, c.Key, params, customerbalancetransaction) return customerbalancetransaction, err } @@ -107,9 +85,8 @@ func List(params *stripe.CustomerBalanceTransactionListParams) *Iter { // Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). func (c Client) List(listParams *stripe.CustomerBalanceTransactionListParams) *Iter { path := stripe.FormatURLPath( - "/v1/customers/%s/balance_transactions", - stripe.StringValue(listParams.Customer), - ) + "/v1/customers/%s/balance_transactions", stripe.StringValue( + listParams.Customer)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.CustomerBalanceTransactionList{} diff --git a/customercashbalancetransaction/client.go b/customercashbalancetransaction/client.go index 53a567115e..4331ed4824 100644 --- a/customercashbalancetransaction/client.go +++ b/customercashbalancetransaction/client.go @@ -28,18 +28,11 @@ func Get(id string, params *stripe.CustomerCashBalanceTransactionParams) (*strip // Retrieves a specific cash balance transaction, which updated the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). func (c Client) Get(id string, params *stripe.CustomerCashBalanceTransactionParams) (*stripe.CustomerCashBalanceTransaction, error) { path := stripe.FormatURLPath( - "/v1/customers/%s/cash_balance_transactions/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/cash_balance_transactions/%s", stripe.StringValue( + params.Customer), id) customercashbalancetransaction := &stripe.CustomerCashBalanceTransaction{} err := c.B.Call( - http.MethodGet, - path, - c.Key, - params, - customercashbalancetransaction, - ) + http.MethodGet, path, c.Key, params, customercashbalancetransaction) return customercashbalancetransaction, err } @@ -51,9 +44,8 @@ func List(params *stripe.CustomerCashBalanceTransactionListParams) *Iter { // Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). func (c Client) List(listParams *stripe.CustomerCashBalanceTransactionListParams) *Iter { path := stripe.FormatURLPath( - "/v1/customers/%s/cash_balance_transactions", - stripe.StringValue(listParams.Customer), - ) + "/v1/customers/%s/cash_balance_transactions", stripe.StringValue( + listParams.Customer)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.CustomerCashBalanceTransactionList{} diff --git a/customersession/client.go b/customersession/client.go index a870597066..a5577d567f 100644 --- a/customersession/client.go +++ b/customersession/client.go @@ -28,12 +28,7 @@ func New(params *stripe.CustomerSessionParams) (*stripe.CustomerSession, error) func (c Client) New(params *stripe.CustomerSessionParams) (*stripe.CustomerSession, error) { customersession := &stripe.CustomerSession{} err := c.B.Call( - http.MethodPost, - "/v1/customer_sessions", - c.Key, - params, - customersession, - ) + http.MethodPost, "/v1/customer_sessions", c.Key, params, customersession) return customersession, err } diff --git a/entitlements/feature/client.go b/entitlements/feature/client.go index 436b2e3763..03e367e515 100644 --- a/entitlements/feature/client.go +++ b/entitlements/feature/client.go @@ -29,12 +29,7 @@ func New(params *stripe.EntitlementsFeatureParams) (*stripe.EntitlementsFeature, func (c Client) New(params *stripe.EntitlementsFeatureParams) (*stripe.EntitlementsFeature, error) { feature := &stripe.EntitlementsFeature{} err := c.B.Call( - http.MethodPost, - "/v1/entitlements/features", - c.Key, - params, - feature, - ) + http.MethodPost, "/v1/entitlements/features", c.Key, params, feature) return feature, err } diff --git a/ephemeralkey/client.go b/ephemeralkey/client.go index c6a819c94d..4528fef300 100644 --- a/ephemeralkey/client.go +++ b/ephemeralkey/client.go @@ -38,12 +38,7 @@ func (c Client) New(params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, er ephemeralkey := &stripe.EphemeralKey{} err := c.B.Call( - http.MethodPost, - "/v1/ephemeral_keys", - c.Key, - params, - ephemeralkey, - ) + http.MethodPost, "/v1/ephemeral_keys", c.Key, params, ephemeralkey) return ephemeralkey, err } diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 28697281f0..1f292aa67f 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -444,9 +444,7 @@ func TestBillingPortalConfigurationsPost2(t *testing.T) { }, } result, err := billingportal_configuration.Update( - "bpc_xxxxxxxxxxxxx", - params, - ) + "bpc_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -705,9 +703,7 @@ func TestCustomersBalanceTransactionsPost2(t *testing.T) { } params.AddMetadata("order_id", "6735") result, err := customerbalancetransaction.Update( - "cbtxn_xxxxxxxxxxxxx", - params, - ) + "cbtxn_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1008,9 +1004,7 @@ func TestFinancialConnectionsAccountsDisconnectPost(t *testing.T) { func TestFinancialConnectionsAccountsDisconnectPost2(t *testing.T) { params := &stripe.FinancialConnectionsAccountDisconnectParams{} result, err := financialconnections_account.Disconnect( - "fca_xxxxxxxxxxxxx", - params, - ) + "fca_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1043,9 +1037,7 @@ func TestFinancialConnectionsAccountsGet3(t *testing.T) { func TestFinancialConnectionsAccountsGet4(t *testing.T) { params := &stripe.FinancialConnectionsAccountParams{} result, err := financialconnections_account.GetByID( - "fca_xxxxxxxxxxxxx", - params, - ) + "fca_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1108,9 +1100,7 @@ func TestFinancialConnectionsSessionsGet(t *testing.T) { func TestFinancialConnectionsSessionsGet2(t *testing.T) { params := &stripe.FinancialConnectionsSessionParams{} result, err := financialconnections_session.Get( - "fcsess_xxxxxxxxxxxxx", - params, - ) + "fcsess_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1183,9 +1173,7 @@ func TestIdentityVerificationReportsGet2(t *testing.T) { func TestIdentityVerificationSessionsCancelPost(t *testing.T) { params := &stripe.IdentityVerificationSessionCancelParams{} result, err := identity_verificationsession.Cancel( - "vs_xxxxxxxxxxxxx", - params, - ) + "vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1219,9 +1207,7 @@ func TestIdentityVerificationSessionsPost2(t *testing.T) { Type: stripe.String(string(stripe.IdentityVerificationSessionTypeIDNumber)), } result, err := identity_verificationsession.Update( - "vs_xxxxxxxxxxxxx", - params, - ) + "vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1229,9 +1215,7 @@ func TestIdentityVerificationSessionsPost2(t *testing.T) { func TestIdentityVerificationSessionsRedactPost(t *testing.T) { params := &stripe.IdentityVerificationSessionRedactParams{} result, err := identity_verificationsession.Redact( - "vs_xxxxxxxxxxxxx", - params, - ) + "vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -1621,9 +1605,7 @@ func TestPaymentIntentsIncrementAuthorizationPost(t *testing.T) { Amount: stripe.Int64(2099), } result, err := paymentintent.IncrementAuthorization( - "pi_xxxxxxxxxxxxx", - params, - ) + "pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -2660,9 +2642,7 @@ func TestSubscriptionSchedulesPost2(t *testing.T) { func TestSubscriptionSchedulesReleasePost(t *testing.T) { params := &stripe.SubscriptionScheduleReleaseParams{} result, err := subscriptionschedule.Release( - "sub_sched_xxxxxxxxxxxxx", - params, - ) + "sub_sched_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3063,9 +3043,7 @@ func TestTerminalReadersProcessPaymentIntentPost(t *testing.T) { PaymentIntent: stripe.String("pi_xxxxxxxxxxxxx"), } result, err := terminal_reader.ProcessPaymentIntent( - "tmr_xxxxxxxxxxxxx", - params, - ) + "tmr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3076,9 +3054,7 @@ func TestTerminalReadersProcessSetupIntentPost(t *testing.T) { AllowRedisplay: stripe.String("always"), } result, err := terminal_reader.ProcessSetupIntent( - "tmr_xxxxxxxxxxxxx", - params, - ) + "tmr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3136,9 +3112,7 @@ func TestTestHelpersIssuingAuthorizationsCapturePost(t *testing.T) { }, } result, err := testhelpers_issuing_authorization.Capture( - "example_authorization", - params, - ) + "example_authorization", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3146,9 +3120,7 @@ func TestTestHelpersIssuingAuthorizationsCapturePost(t *testing.T) { func TestTestHelpersIssuingAuthorizationsExpirePost(t *testing.T) { params := &stripe.TestHelpersIssuingAuthorizationExpireParams{} result, err := testhelpers_issuing_authorization.Expire( - "example_authorization", - params, - ) + "example_authorization", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3159,9 +3131,7 @@ func TestTestHelpersIssuingAuthorizationsIncrementPost(t *testing.T) { IsAmountControllable: stripe.Bool(true), } result, err := testhelpers_issuing_authorization.Increment( - "example_authorization", - params, - ) + "example_authorization", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3208,9 +3178,7 @@ func TestTestHelpersIssuingAuthorizationsReversePost(t *testing.T) { ReverseAmount: stripe.Int64(20), } result, err := testhelpers_issuing_authorization.Reverse( - "example_authorization", - params, - ) + "example_authorization", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3246,9 +3214,7 @@ func TestTestHelpersIssuingCardsShippingShipPost(t *testing.T) { func TestTestHelpersIssuingPersonalizationDesignsActivatePost(t *testing.T) { params := &stripe.TestHelpersIssuingPersonalizationDesignActivateParams{} result, err := testhelpers_issuing_personalizationdesign.Activate( - "pd_xyz", - params, - ) + "pd_xyz", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3256,9 +3222,7 @@ func TestTestHelpersIssuingPersonalizationDesignsActivatePost(t *testing.T) { func TestTestHelpersIssuingPersonalizationDesignsDeactivatePost(t *testing.T) { params := &stripe.TestHelpersIssuingPersonalizationDesignDeactivateParams{} result, err := testhelpers_issuing_personalizationdesign.Deactivate( - "pd_xyz", - params, - ) + "pd_xyz", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3272,9 +3236,7 @@ func TestTestHelpersIssuingPersonalizationDesignsRejectPost(t *testing.T) { }, } result, err := testhelpers_issuing_personalizationdesign.Reject( - "pd_xyz", - params, - ) + "pd_xyz", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3400,9 +3362,7 @@ func TestTestHelpersIssuingTransactionsRefundPost(t *testing.T) { RefundAmount: stripe.Int64(50), } result, err := testhelpers_issuing_transaction.Refund( - "example_transaction", - params, - ) + "example_transaction", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3508,9 +3468,7 @@ func TestTestHelpersTreasuryInboundTransfersFailPost(t *testing.T) { func TestTestHelpersTreasuryInboundTransfersReturnPost(t *testing.T) { params := &stripe.TestHelpersTreasuryInboundTransferReturnInboundTransferParams{} result, err := testhelpers_treasury_inboundtransfer.ReturnInboundTransfer( - "ibt_123", - params, - ) + "ibt_123", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3518,9 +3476,7 @@ func TestTestHelpersTreasuryInboundTransfersReturnPost(t *testing.T) { func TestTestHelpersTreasuryInboundTransfersSucceedPost(t *testing.T) { params := &stripe.TestHelpersTreasuryInboundTransferSucceedParams{} result, err := testhelpers_treasury_inboundtransfer.Succeed( - "ibt_123", - params, - ) + "ibt_123", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3546,9 +3502,7 @@ func TestTestHelpersTreasuryOutboundTransfersReturnPost(t *testing.T) { }, } result, err := testhelpers_treasury_outboundtransfer.ReturnOutboundTransfer( - "obt_123", - params, - ) + "obt_123", params) assert.NotNil(t, result) assert.Nil(t, err) } @@ -3831,9 +3785,7 @@ func TestTreasuryDebitReversalsPost(t *testing.T) { func TestTreasuryFinancialAccountsFeaturesGet(t *testing.T) { params := &stripe.TreasuryFinancialAccountRetrieveFeaturesParams{} result, err := treasury_financialaccount.RetrieveFeatures( - "fa_xxxxxxxxxxxxx", - params, - ) + "fa_xxxxxxxxxxxxx", params) assert.NotNil(t, result) assert.Nil(t, err) } diff --git a/feerefund/client.go b/feerefund/client.go index 72babd48ba..b8e2cb5969 100644 --- a/feerefund/client.go +++ b/feerefund/client.go @@ -51,9 +51,7 @@ func (c Client) New(params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) { return nil, fmt.Errorf("params.ID must be set") } path := stripe.FormatURLPath( - "/v1/application_fees/%s/refunds", - stripe.StringValue(params.ID), - ) + "/v1/application_fees/%s/refunds", stripe.StringValue(params.ID)) feerefund := &stripe.FeeRefund{} err := c.B.Call(http.MethodPost, path, c.Key, params, feerefund) return feerefund, err @@ -73,10 +71,7 @@ func (c Client) Get(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefun return nil, fmt.Errorf("params.Fee must be set") } path := stripe.FormatURLPath( - "/v1/application_fees/%s/refunds/%s", - stripe.StringValue(params.Fee), - id, - ) + "/v1/application_fees/%s/refunds/%s", stripe.StringValue(params.Fee), id) feerefund := &stripe.FeeRefund{} err := c.B.Call(http.MethodGet, path, c.Key, params, feerefund) return feerefund, err @@ -100,10 +95,7 @@ func (c Client) Update(id string, params *stripe.FeeRefundParams) (*stripe.FeeRe return nil, fmt.Errorf("params.Fee must be set") } path := stripe.FormatURLPath( - "/v1/application_fees/%s/refunds/%s", - stripe.StringValue(params.Fee), - id, - ) + "/v1/application_fees/%s/refunds/%s", stripe.StringValue(params.Fee), id) feerefund := &stripe.FeeRefund{} err := c.B.Call(http.MethodPost, path, c.Key, params, feerefund) return feerefund, err @@ -117,9 +109,7 @@ func List(params *stripe.FeeRefundListParams) *Iter { // You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. func (c Client) List(listParams *stripe.FeeRefundListParams) *Iter { path := stripe.FormatURLPath( - "/v1/application_fees/%s/refunds", - stripe.StringValue(listParams.ID), - ) + "/v1/application_fees/%s/refunds", stripe.StringValue(listParams.ID)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.FeeRefundList{} diff --git a/file.go b/file.go index 3aa1e7f359..bcd7de16a6 100644 --- a/file.go +++ b/file.go @@ -156,9 +156,7 @@ func (p *FileParams) GetBody() (*bytes.Buffer, string, error) { if p.FileReader != nil && p.Filename != nil { part, err := writer.CreateFormFile( - "file", - filepath.Base(StringValue(p.Filename)), - ) + "file", filepath.Base(StringValue(p.Filename))) if err != nil { return nil, "", err diff --git a/file/client.go b/file/client.go index a125fd0831..e61244d5ec 100644 --- a/file/client.go +++ b/file/client.go @@ -35,8 +35,7 @@ func New(params *stripe.FileParams) (*stripe.File, error) { func (c Client) New(params *stripe.FileParams) (*stripe.File, error) { if params == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Purpose and params.File must be set", - ) + "params cannot be nil, and params.Purpose and params.File must be set") } bodyBuffer, boundary, err := params.GetBody() diff --git a/financialconnections/account/client.go b/financialconnections/account/client.go index b722d2e1aa..1569126cb3 100644 --- a/financialconnections/account/client.go +++ b/financialconnections/account/client.go @@ -41,9 +41,7 @@ func Disconnect(id string, params *stripe.FinancialConnectionsAccountDisconnectP // Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions). func (c Client) Disconnect(id string, params *stripe.FinancialConnectionsAccountDisconnectParams) (*stripe.FinancialConnectionsAccount, error) { path := stripe.FormatURLPath( - "/v1/financial_connections/accounts/%s/disconnect", - id, - ) + "/v1/financial_connections/accounts/%s/disconnect", id) account := &stripe.FinancialConnectionsAccount{} err := c.B.Call(http.MethodPost, path, c.Key, params, account) return account, err @@ -57,9 +55,7 @@ func Refresh(id string, params *stripe.FinancialConnectionsAccountRefreshParams) // Refreshes the data associated with a Financial Connections Account. func (c Client) Refresh(id string, params *stripe.FinancialConnectionsAccountRefreshParams) (*stripe.FinancialConnectionsAccount, error) { path := stripe.FormatURLPath( - "/v1/financial_connections/accounts/%s/refresh", - id, - ) + "/v1/financial_connections/accounts/%s/refresh", id) account := &stripe.FinancialConnectionsAccount{} err := c.B.Call(http.MethodPost, path, c.Key, params, account) return account, err @@ -73,9 +69,7 @@ func Subscribe(id string, params *stripe.FinancialConnectionsAccountSubscribePar // Subscribes to periodic refreshes of data associated with a Financial Connections Account. func (c Client) Subscribe(id string, params *stripe.FinancialConnectionsAccountSubscribeParams) (*stripe.FinancialConnectionsAccount, error) { path := stripe.FormatURLPath( - "/v1/financial_connections/accounts/%s/subscribe", - id, - ) + "/v1/financial_connections/accounts/%s/subscribe", id) account := &stripe.FinancialConnectionsAccount{} err := c.B.Call(http.MethodPost, path, c.Key, params, account) return account, err @@ -89,9 +83,7 @@ func Unsubscribe(id string, params *stripe.FinancialConnectionsAccountUnsubscrib // Unsubscribes from periodic refreshes of data associated with a Financial Connections Account. func (c Client) Unsubscribe(id string, params *stripe.FinancialConnectionsAccountUnsubscribeParams) (*stripe.FinancialConnectionsAccount, error) { path := stripe.FormatURLPath( - "/v1/financial_connections/accounts/%s/unsubscribe", - id, - ) + "/v1/financial_connections/accounts/%s/unsubscribe", id) account := &stripe.FinancialConnectionsAccount{} err := c.B.Call(http.MethodPost, path, c.Key, params, account) return account, err @@ -144,9 +136,8 @@ func ListOwners(params *stripe.FinancialConnectionsAccountListOwnersParams) *Own // Lists all owners for a given Account func (c Client) ListOwners(listParams *stripe.FinancialConnectionsAccountListOwnersParams) *OwnerIter { path := stripe.FormatURLPath( - "/v1/financial_connections/accounts/%s/owners", - stripe.StringValue(listParams.Account), - ) + "/v1/financial_connections/accounts/%s/owners", stripe.StringValue( + listParams.Account)) return &OwnerIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.FinancialConnectionsAccountOwnerList{} diff --git a/financialconnections/session/client.go b/financialconnections/session/client.go index e08cdc7f2d..b0b0d012d6 100644 --- a/financialconnections/session/client.go +++ b/financialconnections/session/client.go @@ -28,12 +28,7 @@ func New(params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialCon func (c Client) New(params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialConnectionsSession, error) { session := &stripe.FinancialConnectionsSession{} err := c.B.Call( - http.MethodPost, - "/v1/financial_connections/sessions", - c.Key, - params, - session, - ) + http.MethodPost, "/v1/financial_connections/sessions", c.Key, params, session) return session, err } diff --git a/forwarding/request/client.go b/forwarding/request/client.go index ec436eb495..e5560b0d7c 100644 --- a/forwarding/request/client.go +++ b/forwarding/request/client.go @@ -29,12 +29,7 @@ func New(params *stripe.ForwardingRequestParams) (*stripe.ForwardingRequest, err func (c Client) New(params *stripe.ForwardingRequestParams) (*stripe.ForwardingRequest, error) { request := &stripe.ForwardingRequest{} err := c.B.Call( - http.MethodPost, - "/v1/forwarding/requests", - c.Key, - params, - request, - ) + http.MethodPost, "/v1/forwarding/requests", c.Key, params, request) return request, err } diff --git a/identity/verificationsession/client.go b/identity/verificationsession/client.go index 913828d471..149b4d69a0 100644 --- a/identity/verificationsession/client.go +++ b/identity/verificationsession/client.go @@ -41,12 +41,7 @@ func New(params *stripe.IdentityVerificationSessionParams) (*stripe.IdentityVeri func (c Client) New(params *stripe.IdentityVerificationSessionParams) (*stripe.IdentityVerificationSession, error) { verificationsession := &stripe.IdentityVerificationSession{} err := c.B.Call( - http.MethodPost, - "/v1/identity/verification_sessions", - c.Key, - params, - verificationsession, - ) + http.MethodPost, "/v1/identity/verification_sessions", c.Key, params, verificationsession) return verificationsession, err } @@ -100,9 +95,7 @@ func Cancel(id string, params *stripe.IdentityVerificationSessionCancelParams) ( // Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel). func (c Client) Cancel(id string, params *stripe.IdentityVerificationSessionCancelParams) (*stripe.IdentityVerificationSession, error) { path := stripe.FormatURLPath( - "/v1/identity/verification_sessions/%s/cancel", - id, - ) + "/v1/identity/verification_sessions/%s/cancel", id) verificationsession := &stripe.IdentityVerificationSession{} err := c.B.Call(http.MethodPost, path, c.Key, params, verificationsession) return verificationsession, err @@ -152,9 +145,7 @@ func Redact(id string, params *stripe.IdentityVerificationSessionRedactParams) ( // [Learn more](https://stripe.com/docs/identity/verification-sessions#redact). func (c Client) Redact(id string, params *stripe.IdentityVerificationSessionRedactParams) (*stripe.IdentityVerificationSession, error) { path := stripe.FormatURLPath( - "/v1/identity/verification_sessions/%s/redact", - id, - ) + "/v1/identity/verification_sessions/%s/redact", id) verificationsession := &stripe.IdentityVerificationSession{} err := c.B.Call(http.MethodPost, path, c.Key, params, verificationsession) return verificationsession, err diff --git a/invoice/client.go b/invoice/client.go index 6a9a1e7ff0..5aac964d71 100644 --- a/invoice/client.go +++ b/invoice/client.go @@ -115,12 +115,7 @@ func CreatePreview(params *stripe.InvoiceCreatePreviewParams) (*stripe.Invoice, func (c Client) CreatePreview(params *stripe.InvoiceCreatePreviewParams) (*stripe.Invoice, error) { invoice := &stripe.Invoice{} err := c.B.Call( - http.MethodPost, - "/v1/invoices/create_preview", - c.Key, - params, - invoice, - ) + http.MethodPost, "/v1/invoices/create_preview", c.Key, params, invoice) return invoice, err } @@ -214,12 +209,7 @@ func Upcoming(params *stripe.InvoiceUpcomingParams) (*stripe.Invoice, error) { func (c Client) Upcoming(params *stripe.InvoiceUpcomingParams) (*stripe.Invoice, error) { invoice := &stripe.Invoice{} err := c.B.Call( - http.MethodGet, - "/v1/invoices/upcoming", - c.Key, - params, - invoice, - ) + http.MethodGet, "/v1/invoices/upcoming", c.Key, params, invoice) return invoice, err } @@ -300,9 +290,7 @@ func ListLines(params *stripe.InvoiceListLinesParams) *LineItemIter { // When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. func (c Client) ListLines(listParams *stripe.InvoiceListLinesParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/invoices/%s/lines", - stripe.StringValue(listParams.Invoice), - ) + "/v1/invoices/%s/lines", stripe.StringValue(listParams.Invoice)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.InvoiceLineItemList{} diff --git a/invoiceitem/client.go b/invoiceitem/client.go index 84cb31b192..0711b7d42a 100644 --- a/invoiceitem/client.go +++ b/invoiceitem/client.go @@ -29,12 +29,7 @@ func New(params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) { func (c Client) New(params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) { invoiceitem := &stripe.InvoiceItem{} err := c.B.Call( - http.MethodPost, - "/v1/invoiceitems", - c.Key, - params, - invoiceitem, - ) + http.MethodPost, "/v1/invoiceitems", c.Key, params, invoiceitem) return invoiceitem, err } diff --git a/invoicelineitem/client.go b/invoicelineitem/client.go index 87b8a520cf..c1c6f41196 100644 --- a/invoicelineitem/client.go +++ b/invoicelineitem/client.go @@ -33,10 +33,7 @@ func Update(id string, params *stripe.InvoiceLineItemParams) (*stripe.InvoiceLin // Updating an invoice's line item is only possible before the invoice is finalized. func (c Client) Update(id string, params *stripe.InvoiceLineItemParams) (*stripe.InvoiceLineItem, error) { path := stripe.FormatURLPath( - "/v1/invoices/%s/lines/%s", - stripe.StringValue(params.Invoice), - id, - ) + "/v1/invoices/%s/lines/%s", stripe.StringValue(params.Invoice), id) invoicelineitem := &stripe.InvoiceLineItem{} err := c.B.Call(http.MethodPost, path, c.Key, params, invoicelineitem) return invoicelineitem, err diff --git a/invoicerenderingtemplate/client.go b/invoicerenderingtemplate/client.go index 4a9385acfa..a8d4051c28 100644 --- a/invoicerenderingtemplate/client.go +++ b/invoicerenderingtemplate/client.go @@ -43,12 +43,7 @@ func (c Client) Archive(id string, params *stripe.InvoiceRenderingTemplateArchiv path := stripe.FormatURLPath("/v1/invoice_rendering_templates/%s/archive", id) invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - invoicerenderingtemplate, - ) + http.MethodPost, path, c.Key, params, invoicerenderingtemplate) return invoicerenderingtemplate, err } @@ -60,17 +55,10 @@ func Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams // Unarchive an invoice rendering template so it can be used on new Stripe objects again. func (c Client) Unarchive(id string, params *stripe.InvoiceRenderingTemplateUnarchiveParams) (*stripe.InvoiceRenderingTemplate, error) { path := stripe.FormatURLPath( - "/v1/invoice_rendering_templates/%s/unarchive", - id, - ) + "/v1/invoice_rendering_templates/%s/unarchive", id) invoicerenderingtemplate := &stripe.InvoiceRenderingTemplate{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - invoicerenderingtemplate, - ) + http.MethodPost, path, c.Key, params, invoicerenderingtemplate) return invoicerenderingtemplate, err } diff --git a/issuing/cardholder/client.go b/issuing/cardholder/client.go index 7b1300a9a4..de4f23cf3c 100644 --- a/issuing/cardholder/client.go +++ b/issuing/cardholder/client.go @@ -30,12 +30,7 @@ func New(params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, err func (c Client) New(params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) { cardholder := &stripe.IssuingCardholder{} err := c.B.Call( - http.MethodPost, - "/v1/issuing/cardholders", - c.Key, - params, - cardholder, - ) + http.MethodPost, "/v1/issuing/cardholders", c.Key, params, cardholder) return cardholder, err } diff --git a/issuing/dispute/client.go b/issuing/dispute/client.go index f1350f6feb..1e7781598f 100644 --- a/issuing/dispute/client.go +++ b/issuing/dispute/client.go @@ -29,12 +29,7 @@ func New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { func (c Client) New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) { dispute := &stripe.IssuingDispute{} err := c.B.Call( - http.MethodPost, - "/v1/issuing/disputes", - c.Key, - params, - dispute, - ) + http.MethodPost, "/v1/issuing/disputes", c.Key, params, dispute) return dispute, err } diff --git a/issuing/personalizationdesign/client.go b/issuing/personalizationdesign/client.go index bb03049547..dccd4c1cd5 100644 --- a/issuing/personalizationdesign/client.go +++ b/issuing/personalizationdesign/client.go @@ -29,12 +29,7 @@ func New(params *stripe.IssuingPersonalizationDesignParams) (*stripe.IssuingPers func (c Client) New(params *stripe.IssuingPersonalizationDesignParams) (*stripe.IssuingPersonalizationDesign, error) { personalizationdesign := &stripe.IssuingPersonalizationDesign{} err := c.B.Call( - http.MethodPost, - "/v1/issuing/personalization_designs", - c.Key, - params, - personalizationdesign, - ) + http.MethodPost, "/v1/issuing/personalization_designs", c.Key, params, personalizationdesign) return personalizationdesign, err } diff --git a/loginlink/client.go b/loginlink/client.go index 6783149471..c23452be1b 100644 --- a/loginlink/client.go +++ b/loginlink/client.go @@ -35,9 +35,7 @@ func (c Client) New(params *stripe.LoginLinkParams) (*stripe.LoginLink, error) { return nil, fmt.Errorf("Invalid login link params: Account must be set") } path := stripe.FormatURLPath( - "/v1/accounts/%s/login_links", - stripe.StringValue(params.Account), - ) + "/v1/accounts/%s/login_links", stripe.StringValue(params.Account)) loginlink := &stripe.LoginLink{} err := c.B.Call(http.MethodPost, path, c.Key, params, loginlink) return loginlink, err diff --git a/paymentintent/client.go b/paymentintent/client.go index 21aa15ec46..029d8826af 100644 --- a/paymentintent/client.go +++ b/paymentintent/client.go @@ -47,12 +47,7 @@ func New(params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) { func (c Client) New(params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) { paymentintent := &stripe.PaymentIntent{} err := c.B.Call( - http.MethodPost, - "/v1/payment_intents", - c.Key, - params, - paymentintent, - ) + http.MethodPost, "/v1/payment_intents", c.Key, params, paymentintent) return paymentintent, err } @@ -110,9 +105,7 @@ func ApplyCustomerBalance(id string, params *stripe.PaymentIntentApplyCustomerBa // Manually reconcile the remaining amount for a customer_balance PaymentIntent. func (c Client) ApplyCustomerBalance(id string, params *stripe.PaymentIntentApplyCustomerBalanceParams) (*stripe.PaymentIntent, error) { path := stripe.FormatURLPath( - "/v1/payment_intents/%s/apply_customer_balance", - id, - ) + "/v1/payment_intents/%s/apply_customer_balance", id) paymentintent := &stripe.PaymentIntent{} err := c.B.Call(http.MethodPost, path, c.Key, params, paymentintent) return paymentintent, err @@ -275,9 +268,7 @@ func IncrementAuthorization(id string, params *stripe.PaymentIntentIncrementAuth // Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations). func (c Client) IncrementAuthorization(id string, params *stripe.PaymentIntentIncrementAuthorizationParams) (*stripe.PaymentIntent, error) { path := stripe.FormatURLPath( - "/v1/payment_intents/%s/increment_authorization", - id, - ) + "/v1/payment_intents/%s/increment_authorization", id) paymentintent := &stripe.PaymentIntent{} err := c.B.Call(http.MethodPost, path, c.Key, params, paymentintent) return paymentintent, err @@ -291,9 +282,7 @@ func VerifyMicrodeposits(id string, params *stripe.PaymentIntentVerifyMicrodepos // Verifies microdeposits on a PaymentIntent object. func (c Client) VerifyMicrodeposits(id string, params *stripe.PaymentIntentVerifyMicrodepositsParams) (*stripe.PaymentIntent, error) { path := stripe.FormatURLPath( - "/v1/payment_intents/%s/verify_microdeposits", - id, - ) + "/v1/payment_intents/%s/verify_microdeposits", id) paymentintent := &stripe.PaymentIntent{} err := c.B.Call(http.MethodPost, path, c.Key, params, paymentintent) return paymentintent, err diff --git a/paymentlink/client.go b/paymentlink/client.go index 99876332b1..b2c473a385 100644 --- a/paymentlink/client.go +++ b/paymentlink/client.go @@ -29,12 +29,7 @@ func New(params *stripe.PaymentLinkParams) (*stripe.PaymentLink, error) { func (c Client) New(params *stripe.PaymentLinkParams) (*stripe.PaymentLink, error) { paymentlink := &stripe.PaymentLink{} err := c.B.Call( - http.MethodPost, - "/v1/payment_links", - c.Key, - params, - paymentlink, - ) + http.MethodPost, "/v1/payment_links", c.Key, params, paymentlink) return paymentlink, err } @@ -111,9 +106,8 @@ func ListLineItems(params *stripe.PaymentLinkListLineItemsParams) *LineItemIter // When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. func (c Client) ListLineItems(listParams *stripe.PaymentLinkListLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/payment_links/%s/line_items", - stripe.StringValue(listParams.PaymentLink), - ) + "/v1/payment_links/%s/line_items", stripe.StringValue( + listParams.PaymentLink)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.LineItemList{} diff --git a/paymentmethod/client.go b/paymentmethod/client.go index 2d70b62724..44d8ddaa2a 100644 --- a/paymentmethod/client.go +++ b/paymentmethod/client.go @@ -33,12 +33,7 @@ func New(params *stripe.PaymentMethodParams) (*stripe.PaymentMethod, error) { func (c Client) New(params *stripe.PaymentMethodParams) (*stripe.PaymentMethod, error) { paymentmethod := &stripe.PaymentMethod{} err := c.B.Call( - http.MethodPost, - "/v1/payment_methods", - c.Key, - params, - paymentmethod, - ) + http.MethodPost, "/v1/payment_methods", c.Key, params, paymentmethod) return paymentmethod, err } diff --git a/paymentmethodconfiguration/client.go b/paymentmethodconfiguration/client.go index 75bca004db..e96931f17a 100644 --- a/paymentmethodconfiguration/client.go +++ b/paymentmethodconfiguration/client.go @@ -29,12 +29,7 @@ func New(params *stripe.PaymentMethodConfigurationParams) (*stripe.PaymentMethod func (c Client) New(params *stripe.PaymentMethodConfigurationParams) (*stripe.PaymentMethodConfiguration, error) { paymentmethodconfiguration := &stripe.PaymentMethodConfiguration{} err := c.B.Call( - http.MethodPost, - "/v1/payment_method_configurations", - c.Key, - params, - paymentmethodconfiguration, - ) + http.MethodPost, "/v1/payment_method_configurations", c.Key, params, paymentmethodconfiguration) return paymentmethodconfiguration, err } @@ -48,12 +43,7 @@ func (c Client) Get(id string, params *stripe.PaymentMethodConfigurationParams) path := stripe.FormatURLPath("/v1/payment_method_configurations/%s", id) paymentmethodconfiguration := &stripe.PaymentMethodConfiguration{} err := c.B.Call( - http.MethodGet, - path, - c.Key, - params, - paymentmethodconfiguration, - ) + http.MethodGet, path, c.Key, params, paymentmethodconfiguration) return paymentmethodconfiguration, err } @@ -67,12 +57,7 @@ func (c Client) Update(id string, params *stripe.PaymentMethodConfigurationParam path := stripe.FormatURLPath("/v1/payment_method_configurations/%s", id) paymentmethodconfiguration := &stripe.PaymentMethodConfiguration{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - paymentmethodconfiguration, - ) + http.MethodPost, path, c.Key, params, paymentmethodconfiguration) return paymentmethodconfiguration, err } diff --git a/paymentmethoddomain/client.go b/paymentmethoddomain/client.go index b3dfff6834..77347a4557 100644 --- a/paymentmethoddomain/client.go +++ b/paymentmethoddomain/client.go @@ -29,12 +29,7 @@ func New(params *stripe.PaymentMethodDomainParams) (*stripe.PaymentMethodDomain, func (c Client) New(params *stripe.PaymentMethodDomainParams) (*stripe.PaymentMethodDomain, error) { paymentmethoddomain := &stripe.PaymentMethodDomain{} err := c.B.Call( - http.MethodPost, - "/v1/payment_method_domains", - c.Key, - params, - paymentmethoddomain, - ) + http.MethodPost, "/v1/payment_method_domains", c.Key, params, paymentmethoddomain) return paymentmethoddomain, err } diff --git a/paymentsource/client.go b/paymentsource/client.go index 569ff7f97a..599401ad0f 100644 --- a/paymentsource/client.go +++ b/paymentsource/client.go @@ -43,9 +43,7 @@ func (c Client) New(params *stripe.PaymentSourceParams) (*stripe.PaymentSource, return nil, fmt.Errorf("Invalid source params: customer needs to be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/sources", - stripe.StringValue(params.Customer), - ) + "/v1/customers/%s/sources", stripe.StringValue(params.Customer)) paymentsource := &stripe.PaymentSource{} err := c.B.Call(http.MethodPost, path, c.Key, params, paymentsource) return paymentsource, err @@ -65,10 +63,7 @@ func (c Client) Get(id string, params *stripe.PaymentSourceParams) (*stripe.Paym return nil, fmt.Errorf("Invalid source params: customer needs to be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/sources/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id) paymentsource := &stripe.PaymentSource{} err := c.B.Call(http.MethodGet, path, c.Key, params, paymentsource) return paymentsource, err @@ -88,10 +83,7 @@ func (c Client) Update(id string, params *stripe.PaymentSourceParams) (*stripe.P return nil, fmt.Errorf("Invalid source params: customer needs to be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/sources/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id) paymentsource := &stripe.PaymentSource{} err := c.B.Call(http.MethodPost, path, c.Key, params, paymentsource) return paymentsource, err @@ -111,10 +103,7 @@ func (c Client) Del(id string, params *stripe.PaymentSourceParams) (*stripe.Paym return nil, fmt.Errorf("Invalid source params: customer needs to be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/sources/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id) paymentsource := &stripe.PaymentSource{} err := c.B.Call(http.MethodDelete, path, c.Key, params, paymentsource) return paymentsource, err diff --git a/person/client.go b/person/client.go index 863a6ad93d..e85f5fc295 100644 --- a/person/client.go +++ b/person/client.go @@ -29,9 +29,7 @@ func New(params *stripe.PersonParams) (*stripe.Person, error) { // Creates a new person. func (c Client) New(params *stripe.PersonParams) (*stripe.Person, error) { path := stripe.FormatURLPath( - "/v1/accounts/%s/persons", - stripe.StringValue(params.Account), - ) + "/v1/accounts/%s/persons", stripe.StringValue(params.Account)) person := &stripe.Person{} err := c.B.Call(http.MethodPost, path, c.Key, params, person) return person, err @@ -46,14 +44,10 @@ func Get(id string, params *stripe.PersonParams) (*stripe.Person, error) { func (c Client) Get(id string, params *stripe.PersonParams) (*stripe.Person, error) { if params == nil { return nil, fmt.Errorf( - "params cannot be nil, and params.Account must be set", - ) + "params cannot be nil, and params.Account must be set") } path := stripe.FormatURLPath( - "/v1/accounts/%s/persons/%s", - stripe.StringValue(params.Account), - id, - ) + "/v1/accounts/%s/persons/%s", stripe.StringValue(params.Account), id) person := &stripe.Person{} err := c.B.Call(http.MethodGet, path, c.Key, params, person) return person, err @@ -67,10 +61,7 @@ func Update(id string, params *stripe.PersonParams) (*stripe.Person, error) { // Updates an existing person. func (c Client) Update(id string, params *stripe.PersonParams) (*stripe.Person, error) { path := stripe.FormatURLPath( - "/v1/accounts/%s/persons/%s", - stripe.StringValue(params.Account), - id, - ) + "/v1/accounts/%s/persons/%s", stripe.StringValue(params.Account), id) person := &stripe.Person{} err := c.B.Call(http.MethodPost, path, c.Key, params, person) return person, err @@ -84,10 +75,7 @@ func Del(id string, params *stripe.PersonParams) (*stripe.Person, error) { // Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file. func (c Client) Del(id string, params *stripe.PersonParams) (*stripe.Person, error) { path := stripe.FormatURLPath( - "/v1/accounts/%s/persons/%s", - stripe.StringValue(params.Account), - id, - ) + "/v1/accounts/%s/persons/%s", stripe.StringValue(params.Account), id) person := &stripe.Person{} err := c.B.Call(http.MethodDelete, path, c.Key, params, person) return person, err @@ -101,9 +89,7 @@ func List(params *stripe.PersonListParams) *Iter { // Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first. func (c Client) List(listParams *stripe.PersonListParams) *Iter { path := stripe.FormatURLPath( - "/v1/accounts/%s/persons", - stripe.StringValue(listParams.Account), - ) + "/v1/accounts/%s/persons", stripe.StringValue(listParams.Account)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.PersonList{} diff --git a/plan.go b/plan.go index 53c701ec6c..fbf57dae40 100644 --- a/plan.go +++ b/plan.go @@ -199,9 +199,8 @@ func (p *PlanTierParams) AppendTo(body *form.Values, keyParts []string) { body.Add(form.FormatKey(append(keyParts, "up_to")), "inf") } else { body.Add( - form.FormatKey(append(keyParts, "up_to")), - strconv.FormatInt(Int64Value(p.UpTo), 10), - ) + form.FormatKey(append(keyParts, "up_to")), strconv.FormatInt( + Int64Value(p.UpTo), 10)) } } diff --git a/productfeature/client.go b/productfeature/client.go index 74940bbd69..5a889b746d 100644 --- a/productfeature/client.go +++ b/productfeature/client.go @@ -28,9 +28,7 @@ func New(params *stripe.ProductFeatureParams) (*stripe.ProductFeature, error) { // Creates a product_feature, which represents a feature attachment to a product func (c Client) New(params *stripe.ProductFeatureParams) (*stripe.ProductFeature, error) { path := stripe.FormatURLPath( - "/v1/products/%s/features", - stripe.StringValue(params.Product), - ) + "/v1/products/%s/features", stripe.StringValue(params.Product)) productfeature := &stripe.ProductFeature{} err := c.B.Call(http.MethodPost, path, c.Key, params, productfeature) return productfeature, err @@ -44,10 +42,7 @@ func Get(id string, params *stripe.ProductFeatureParams) (*stripe.ProductFeature // Retrieves a product_feature, which represents a feature attachment to a product func (c Client) Get(id string, params *stripe.ProductFeatureParams) (*stripe.ProductFeature, error) { path := stripe.FormatURLPath( - "/v1/products/%s/features/%s", - stripe.StringValue(params.Product), - id, - ) + "/v1/products/%s/features/%s", stripe.StringValue(params.Product), id) productfeature := &stripe.ProductFeature{} err := c.B.Call(http.MethodGet, path, c.Key, params, productfeature) return productfeature, err @@ -61,10 +56,7 @@ func Del(id string, params *stripe.ProductFeatureParams) (*stripe.ProductFeature // Deletes the feature attachment to a product func (c Client) Del(id string, params *stripe.ProductFeatureParams) (*stripe.ProductFeature, error) { path := stripe.FormatURLPath( - "/v1/products/%s/features/%s", - stripe.StringValue(params.Product), - id, - ) + "/v1/products/%s/features/%s", stripe.StringValue(params.Product), id) productfeature := &stripe.ProductFeature{} err := c.B.Call(http.MethodDelete, path, c.Key, params, productfeature) return productfeature, err @@ -78,9 +70,7 @@ func List(params *stripe.ProductFeatureListParams) *Iter { // Retrieve a list of features for a product func (c Client) List(listParams *stripe.ProductFeatureListParams) *Iter { path := stripe.FormatURLPath( - "/v1/products/%s/features", - stripe.StringValue(listParams.Product), - ) + "/v1/products/%s/features", stripe.StringValue(listParams.Product)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.ProductFeatureList{} diff --git a/promotioncode/client.go b/promotioncode/client.go index 2e6a2d071e..251ef5d9b5 100644 --- a/promotioncode/client.go +++ b/promotioncode/client.go @@ -29,12 +29,7 @@ func New(params *stripe.PromotionCodeParams) (*stripe.PromotionCode, error) { func (c Client) New(params *stripe.PromotionCodeParams) (*stripe.PromotionCode, error) { promotioncode := &stripe.PromotionCode{} err := c.B.Call( - http.MethodPost, - "/v1/promotion_codes", - c.Key, - params, - promotioncode, - ) + http.MethodPost, "/v1/promotion_codes", c.Key, params, promotioncode) return promotioncode, err } diff --git a/quote/client.go b/quote/client.go index 9a36dbf303..71d61de0bb 100644 --- a/quote/client.go +++ b/quote/client.go @@ -158,9 +158,8 @@ func ListComputedUpfrontLineItems(params *stripe.QuoteListComputedUpfrontLineIte // When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. func (c Client) ListComputedUpfrontLineItems(listParams *stripe.QuoteListComputedUpfrontLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/quotes/%s/computed_upfront_line_items", - stripe.StringValue(listParams.Quote), - ) + "/v1/quotes/%s/computed_upfront_line_items", stripe.StringValue( + listParams.Quote)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.LineItemList{} @@ -201,9 +200,7 @@ func ListLineItems(params *stripe.QuoteListLineItemsParams) *LineItemIter { // When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. func (c Client) ListLineItems(listParams *stripe.QuoteListLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/quotes/%s/line_items", - stripe.StringValue(listParams.Quote), - ) + "/v1/quotes/%s/line_items", stripe.StringValue(listParams.Quote)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.LineItemList{} diff --git a/radar/valuelist/client.go b/radar/valuelist/client.go index 2b1e7544ab..b596905b0a 100644 --- a/radar/valuelist/client.go +++ b/radar/valuelist/client.go @@ -29,12 +29,7 @@ func New(params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) { func (c Client) New(params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) { valuelist := &stripe.RadarValueList{} err := c.B.Call( - http.MethodPost, - "/v1/radar/value_lists", - c.Key, - params, - valuelist, - ) + http.MethodPost, "/v1/radar/value_lists", c.Key, params, valuelist) return valuelist, err } diff --git a/radar/valuelistitem/client.go b/radar/valuelistitem/client.go index a5cedd3c18..a9225db11c 100644 --- a/radar/valuelistitem/client.go +++ b/radar/valuelistitem/client.go @@ -30,12 +30,7 @@ func New(params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, e func (c Client) New(params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) { valuelistitem := &stripe.RadarValueListItem{} err := c.B.Call( - http.MethodPost, - "/v1/radar/value_list_items", - c.Key, - params, - valuelistitem, - ) + http.MethodPost, "/v1/radar/value_list_items", c.Key, params, valuelistitem) return valuelistitem, err } diff --git a/reporting/reportrun/client.go b/reporting/reportrun/client.go index 4de80b33e1..84bc18e43b 100644 --- a/reporting/reportrun/client.go +++ b/reporting/reportrun/client.go @@ -29,12 +29,7 @@ func New(params *stripe.ReportingReportRunParams) (*stripe.ReportingReportRun, e func (c Client) New(params *stripe.ReportingReportRunParams) (*stripe.ReportingReportRun, error) { reportrun := &stripe.ReportingReportRun{} err := c.B.Call( - http.MethodPost, - "/v1/reporting/report_runs", - c.Key, - params, - reportrun, - ) + http.MethodPost, "/v1/reporting/report_runs", c.Key, params, reportrun) return reportrun, err } diff --git a/setupintent/client.go b/setupintent/client.go index 213cec3db3..58f37ec2d2 100644 --- a/setupintent/client.go +++ b/setupintent/client.go @@ -35,12 +35,7 @@ func New(params *stripe.SetupIntentParams) (*stripe.SetupIntent, error) { func (c Client) New(params *stripe.SetupIntentParams) (*stripe.SetupIntent, error) { setupintent := &stripe.SetupIntent{} err := c.B.Call( - http.MethodPost, - "/v1/setup_intents", - c.Key, - params, - setupintent, - ) + http.MethodPost, "/v1/setup_intents", c.Key, params, setupintent) return setupintent, err } diff --git a/shippingrate/client.go b/shippingrate/client.go index 10d8317314..42b4a13a19 100644 --- a/shippingrate/client.go +++ b/shippingrate/client.go @@ -29,12 +29,7 @@ func New(params *stripe.ShippingRateParams) (*stripe.ShippingRate, error) { func (c Client) New(params *stripe.ShippingRateParams) (*stripe.ShippingRate, error) { shippingrate := &stripe.ShippingRate{} err := c.B.Call( - http.MethodPost, - "/v1/shipping_rates", - c.Key, - params, - shippingrate, - ) + http.MethodPost, "/v1/shipping_rates", c.Key, params, shippingrate) return shippingrate, err } diff --git a/source/client.go b/source/client.go index 71a530bbe1..6a4825e8a7 100644 --- a/source/client.go +++ b/source/client.go @@ -71,14 +71,10 @@ func Detach(id string, params *stripe.SourceDetachParams) (*stripe.Source, error func (c Client) Detach(id string, params *stripe.SourceDetachParams) (*stripe.Source, error) { if params.Customer == nil { return nil, fmt.Errorf( - "Invalid source detach params: Customer needs to be set", - ) + "Invalid source detach params: Customer needs to be set") } path := stripe.FormatURLPath( - "/v1/customers/%s/sources/%s", - stripe.StringValue(params.Customer), - id, - ) + "/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id) source := &stripe.Source{} err := c.B.Call(http.MethodDelete, path, c.Key, params, source) return source, err diff --git a/sourcetransaction/client.go b/sourcetransaction/client.go index 74e3aa10e1..54b3cecdf7 100644 --- a/sourcetransaction/client.go +++ b/sourcetransaction/client.go @@ -37,9 +37,7 @@ func (c Client) List(listParams *stripe.SourceTransactionListParams) *Iter { } } path := stripe.FormatURLPath( - "/v1/sources/%s/source_transactions", - stripe.StringValue(listParams.Source), - ) + "/v1/sources/%s/source_transactions", stripe.StringValue(listParams.Source)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.SourceTransactionList{} diff --git a/subscription/client.go b/subscription/client.go index 74c665d43c..24ad594b1c 100644 --- a/subscription/client.go +++ b/subscription/client.go @@ -41,12 +41,7 @@ func New(params *stripe.SubscriptionParams) (*stripe.Subscription, error) { func (c Client) New(params *stripe.SubscriptionParams) (*stripe.Subscription, error) { subscription := &stripe.Subscription{} err := c.B.Call( - http.MethodPost, - "/v1/subscriptions", - c.Key, - params, - subscription, - ) + http.MethodPost, "/v1/subscriptions", c.Key, params, subscription) return subscription, err } diff --git a/subscriptionitem/client.go b/subscriptionitem/client.go index eb99a9223e..55345dd52b 100644 --- a/subscriptionitem/client.go +++ b/subscriptionitem/client.go @@ -29,12 +29,7 @@ func New(params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error func (c Client) New(params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) { subscriptionitem := &stripe.SubscriptionItem{} err := c.B.Call( - http.MethodPost, - "/v1/subscription_items", - c.Key, - params, - subscriptionitem, - ) + http.MethodPost, "/v1/subscription_items", c.Key, params, subscriptionitem) return subscriptionitem, err } @@ -128,9 +123,8 @@ func UsageRecordSummaries(params *stripe.SubscriptionItemUsageRecordSummariesPar // The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends. func (c Client) UsageRecordSummaries(listParams *stripe.SubscriptionItemUsageRecordSummariesParams) *UsageRecordSummaryIter { path := stripe.FormatURLPath( - "/v1/subscription_items/%s/usage_record_summaries", - stripe.StringValue(listParams.SubscriptionItem), - ) + "/v1/subscription_items/%s/usage_record_summaries", stripe.StringValue( + listParams.SubscriptionItem)) return &UsageRecordSummaryIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.UsageRecordSummaryList{} diff --git a/subscriptionschedule/client.go b/subscriptionschedule/client.go index 442740e610..66a142301f 100644 --- a/subscriptionschedule/client.go +++ b/subscriptionschedule/client.go @@ -29,12 +29,7 @@ func New(params *stripe.SubscriptionScheduleParams) (*stripe.SubscriptionSchedul func (c Client) New(params *stripe.SubscriptionScheduleParams) (*stripe.SubscriptionSchedule, error) { subscriptionschedule := &stripe.SubscriptionSchedule{} err := c.B.Call( - http.MethodPost, - "/v1/subscription_schedules", - c.Key, - params, - subscriptionschedule, - ) + http.MethodPost, "/v1/subscription_schedules", c.Key, params, subscriptionschedule) return subscriptionschedule, err } diff --git a/tax/calculation/client.go b/tax/calculation/client.go index ef1e8b3bf9..b0ddc13935 100644 --- a/tax/calculation/client.go +++ b/tax/calculation/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TaxCalculationParams) (*stripe.TaxCalculation, error) { func (c Client) New(params *stripe.TaxCalculationParams) (*stripe.TaxCalculation, error) { calculation := &stripe.TaxCalculation{} err := c.B.Call( - http.MethodPost, - "/v1/tax/calculations", - c.Key, - params, - calculation, - ) + http.MethodPost, "/v1/tax/calculations", c.Key, params, calculation) return calculation, err } @@ -59,9 +54,8 @@ func ListLineItems(params *stripe.TaxCalculationListLineItemsParams) *LineItemIt // Retrieves the line items of a tax calculation as a collection, if the calculation hasn't expired. func (c Client) ListLineItems(listParams *stripe.TaxCalculationListLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/tax/calculations/%s/line_items", - stripe.StringValue(listParams.Calculation), - ) + "/v1/tax/calculations/%s/line_items", stripe.StringValue( + listParams.Calculation)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.TaxCalculationLineItemList{} diff --git a/tax/registration/client.go b/tax/registration/client.go index 9ca6ab8cee..07b98a9372 100644 --- a/tax/registration/client.go +++ b/tax/registration/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TaxRegistrationParams) (*stripe.TaxRegistration, error) func (c Client) New(params *stripe.TaxRegistrationParams) (*stripe.TaxRegistration, error) { registration := &stripe.TaxRegistration{} err := c.B.Call( - http.MethodPost, - "/v1/tax/registrations", - c.Key, - params, - registration, - ) + http.MethodPost, "/v1/tax/registrations", c.Key, params, registration) return registration, err } diff --git a/tax/transaction/client.go b/tax/transaction/client.go index 52c6f52079..b84e1882a0 100644 --- a/tax/transaction/client.go +++ b/tax/transaction/client.go @@ -42,12 +42,7 @@ func CreateFromCalculation(params *stripe.TaxTransactionCreateFromCalculationPar func (c Client) CreateFromCalculation(params *stripe.TaxTransactionCreateFromCalculationParams) (*stripe.TaxTransaction, error) { transaction := &stripe.TaxTransaction{} err := c.B.Call( - http.MethodPost, - "/v1/tax/transactions/create_from_calculation", - c.Key, - params, - transaction, - ) + http.MethodPost, "/v1/tax/transactions/create_from_calculation", c.Key, params, transaction) return transaction, err } @@ -60,12 +55,7 @@ func CreateReversal(params *stripe.TaxTransactionCreateReversalParams) (*stripe. func (c Client) CreateReversal(params *stripe.TaxTransactionCreateReversalParams) (*stripe.TaxTransaction, error) { transaction := &stripe.TaxTransaction{} err := c.B.Call( - http.MethodPost, - "/v1/tax/transactions/create_reversal", - c.Key, - params, - transaction, - ) + http.MethodPost, "/v1/tax/transactions/create_reversal", c.Key, params, transaction) return transaction, err } @@ -77,9 +67,8 @@ func ListLineItems(params *stripe.TaxTransactionListLineItemsParams) *LineItemIt // Retrieves the line items of a committed standalone transaction as a collection. func (c Client) ListLineItems(listParams *stripe.TaxTransactionListLineItemsParams) *LineItemIter { path := stripe.FormatURLPath( - "/v1/tax/transactions/%s/line_items", - stripe.StringValue(listParams.Transaction), - ) + "/v1/tax/transactions/%s/line_items", stripe.StringValue( + listParams.Transaction)) return &LineItemIter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.TaxTransactionLineItemList{} diff --git a/terminal/configuration/client.go b/terminal/configuration/client.go index a7cb9deb13..5b9ed813ff 100644 --- a/terminal/configuration/client.go +++ b/terminal/configuration/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TerminalConfigurationParams) (*stripe.TerminalConfigurat func (c Client) New(params *stripe.TerminalConfigurationParams) (*stripe.TerminalConfiguration, error) { configuration := &stripe.TerminalConfiguration{} err := c.B.Call( - http.MethodPost, - "/v1/terminal/configurations", - c.Key, - params, - configuration, - ) + http.MethodPost, "/v1/terminal/configurations", c.Key, params, configuration) return configuration, err } diff --git a/terminal/connectiontoken/client.go b/terminal/connectiontoken/client.go index 0560a3637b..d7e9105cdf 100644 --- a/terminal/connectiontoken/client.go +++ b/terminal/connectiontoken/client.go @@ -28,12 +28,7 @@ func New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnecti func (c Client) New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) { connectiontoken := &stripe.TerminalConnectionToken{} err := c.B.Call( - http.MethodPost, - "/v1/terminal/connection_tokens", - c.Key, - params, - connectiontoken, - ) + http.MethodPost, "/v1/terminal/connection_tokens", c.Key, params, connectiontoken) return connectiontoken, err } diff --git a/terminal/location/client.go b/terminal/location/client.go index 922ebf7caa..b6b415c746 100644 --- a/terminal/location/client.go +++ b/terminal/location/client.go @@ -31,12 +31,7 @@ func New(params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error func (c Client) New(params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) { location := &stripe.TerminalLocation{} err := c.B.Call( - http.MethodPost, - "/v1/terminal/locations", - c.Key, - params, - location, - ) + http.MethodPost, "/v1/terminal/locations", c.Key, params, location) return location, err } diff --git a/terminal/reader/client.go b/terminal/reader/client.go index ebf7aabc6c..837f09c774 100644 --- a/terminal/reader/client.go +++ b/terminal/reader/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { func (c Client) New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) { reader := &stripe.TerminalReader{} err := c.B.Call( - http.MethodPost, - "/v1/terminal/readers", - c.Key, - params, - reader, - ) + http.MethodPost, "/v1/terminal/readers", c.Key, params, reader) return reader, err } @@ -98,9 +93,7 @@ func ProcessPaymentIntent(id string, params *stripe.TerminalReaderProcessPayment // Initiates a payment flow on a Reader. func (c Client) ProcessPaymentIntent(id string, params *stripe.TerminalReaderProcessPaymentIntentParams) (*stripe.TerminalReader, error) { path := stripe.FormatURLPath( - "/v1/terminal/readers/%s/process_payment_intent", - id, - ) + "/v1/terminal/readers/%s/process_payment_intent", id) reader := &stripe.TerminalReader{} err := c.B.Call(http.MethodPost, path, c.Key, params, reader) return reader, err @@ -114,9 +107,7 @@ func ProcessSetupIntent(id string, params *stripe.TerminalReaderProcessSetupInte // Initiates a setup intent flow on a Reader. func (c Client) ProcessSetupIntent(id string, params *stripe.TerminalReaderProcessSetupIntentParams) (*stripe.TerminalReader, error) { path := stripe.FormatURLPath( - "/v1/terminal/readers/%s/process_setup_intent", - id, - ) + "/v1/terminal/readers/%s/process_setup_intent", id) reader := &stripe.TerminalReader{} err := c.B.Call(http.MethodPost, path, c.Key, params, reader) return reader, err diff --git a/terminal_configuration.go b/terminal_configuration.go index 7de9b80484..b5d8829651 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -139,7 +139,7 @@ type TerminalConfigurationTippingHKDParams struct { } // Tipping configuration for JPY -type TerminalConfigurationTippingJpyParams struct { +type TerminalConfigurationTippingJPYParams struct { // Fixed amounts displayed when collecting a tip FixedAmounts []*int64 `form:"fixed_amounts"` // Percentages displayed when collecting a tip @@ -237,7 +237,7 @@ type TerminalConfigurationTippingParams struct { // Tipping configuration for HKD HKD *TerminalConfigurationTippingHKDParams `form:"hkd"` // Tipping configuration for JPY - Jpy *TerminalConfigurationTippingJpyParams `form:"jpy"` + JPY *TerminalConfigurationTippingJPYParams `form:"jpy"` // Tipping configuration for MYR MYR *TerminalConfigurationTippingMYRParams `form:"myr"` // Tipping configuration for NOK @@ -356,7 +356,7 @@ type TerminalConfigurationTippingHKD struct { // Below this amount, fixed amounts will be displayed; above it, percentages will be displayed SmartTipThreshold int64 `json:"smart_tip_threshold"` } -type TerminalConfigurationTippingJpy struct { +type TerminalConfigurationTippingJPY struct { // Fixed amounts displayed when collecting a tip FixedAmounts []int64 `json:"fixed_amounts"` // Percentages displayed when collecting a tip @@ -429,7 +429,7 @@ type TerminalConfigurationTipping struct { EUR *TerminalConfigurationTippingEUR `json:"eur"` GBP *TerminalConfigurationTippingGBP `json:"gbp"` HKD *TerminalConfigurationTippingHKD `json:"hkd"` - Jpy *TerminalConfigurationTippingJpy `json:"jpy"` + JPY *TerminalConfigurationTippingJPY `json:"jpy"` MYR *TerminalConfigurationTippingMYR `json:"myr"` NOK *TerminalConfigurationTippingNOK `json:"nok"` NZD *TerminalConfigurationTippingNZD `json:"nzd"` diff --git a/testhelpers/confirmationtoken/client.go b/testhelpers/confirmationtoken/client.go index 390a3c130f..82316ec52f 100644 --- a/testhelpers/confirmationtoken/client.go +++ b/testhelpers/confirmationtoken/client.go @@ -28,12 +28,7 @@ func New(params *stripe.TestHelpersConfirmationTokenParams) (*stripe.Confirmatio func (c Client) New(params *stripe.TestHelpersConfirmationTokenParams) (*stripe.ConfirmationToken, error) { confirmationtoken := &stripe.ConfirmationToken{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/confirmation_tokens", - c.Key, - params, - confirmationtoken, - ) + http.MethodPost, "/v1/test_helpers/confirmation_tokens", c.Key, params, confirmationtoken) return confirmationtoken, err } diff --git a/testhelpers/customer/client.go b/testhelpers/customer/client.go index fcd8eeb99a..6ba3eb3162 100644 --- a/testhelpers/customer/client.go +++ b/testhelpers/customer/client.go @@ -27,17 +27,10 @@ func FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanc // Create an incoming testmode bank transfer func (c Client) FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanceParams) (*stripe.CustomerCashBalanceTransaction, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/customers/%s/fund_cash_balance", - id, - ) + "/v1/test_helpers/customers/%s/fund_cash_balance", id) customercashbalancetransaction := &stripe.CustomerCashBalanceTransaction{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - customercashbalancetransaction, - ) + http.MethodPost, path, c.Key, params, customercashbalancetransaction) return customercashbalancetransaction, err } diff --git a/testhelpers/issuing/authorization/client.go b/testhelpers/issuing/authorization/client.go index 8cb41bfa73..e301507871 100644 --- a/testhelpers/issuing/authorization/client.go +++ b/testhelpers/issuing/authorization/client.go @@ -28,12 +28,7 @@ func New(params *stripe.TestHelpersIssuingAuthorizationParams) (*stripe.IssuingA func (c Client) New(params *stripe.TestHelpersIssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) { authorization := &stripe.IssuingAuthorization{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/issuing/authorizations", - c.Key, - params, - authorization, - ) + http.MethodPost, "/v1/test_helpers/issuing/authorizations", c.Key, params, authorization) return authorization, err } @@ -45,9 +40,7 @@ func Capture(id string, params *stripe.TestHelpersIssuingAuthorizationCapturePar // Capture a test-mode authorization. func (c Client) Capture(id string, params *stripe.TestHelpersIssuingAuthorizationCaptureParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/capture", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/capture", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err @@ -61,9 +54,7 @@ func Expire(id string, params *stripe.TestHelpersIssuingAuthorizationExpireParam // Expire a test-mode Authorization. func (c Client) Expire(id string, params *stripe.TestHelpersIssuingAuthorizationExpireParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/expire", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/expire", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err @@ -77,9 +68,7 @@ func FinalizeAmount(id string, params *stripe.TestHelpersIssuingAuthorizationFin // Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount. func (c Client) FinalizeAmount(id string, params *stripe.TestHelpersIssuingAuthorizationFinalizeAmountParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/finalize_amount", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/finalize_amount", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err @@ -93,9 +82,7 @@ func Increment(id string, params *stripe.TestHelpersIssuingAuthorizationIncremen // Increment a test-mode Authorization. func (c Client) Increment(id string, params *stripe.TestHelpersIssuingAuthorizationIncrementParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/increment", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/increment", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err @@ -109,9 +96,7 @@ func Respond(id string, params *stripe.TestHelpersIssuingAuthorizationRespondPar // Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy. func (c Client) Respond(id string, params *stripe.TestHelpersIssuingAuthorizationRespondParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/fraud_challenges/respond", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/fraud_challenges/respond", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err @@ -125,9 +110,7 @@ func Reverse(id string, params *stripe.TestHelpersIssuingAuthorizationReversePar // Reverse a test-mode Authorization. func (c Client) Reverse(id string, params *stripe.TestHelpersIssuingAuthorizationReverseParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/authorizations/%s/reverse", - id, - ) + "/v1/test_helpers/issuing/authorizations/%s/reverse", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) return authorization, err diff --git a/testhelpers/issuing/card/client.go b/testhelpers/issuing/card/client.go index 7d12259b22..d8e2d1a1fe 100644 --- a/testhelpers/issuing/card/client.go +++ b/testhelpers/issuing/card/client.go @@ -27,9 +27,7 @@ func DeliverCard(id string, params *stripe.TestHelpersIssuingCardDeliverCardPara // Updates the shipping status of the specified Issuing Card object to delivered. func (c Client) DeliverCard(id string, params *stripe.TestHelpersIssuingCardDeliverCardParams) (*stripe.IssuingCard, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/cards/%s/shipping/deliver", - id, - ) + "/v1/test_helpers/issuing/cards/%s/shipping/deliver", id) card := &stripe.IssuingCard{} err := c.B.Call(http.MethodPost, path, c.Key, params, card) return card, err @@ -43,9 +41,7 @@ func FailCard(id string, params *stripe.TestHelpersIssuingCardFailCardParams) (* // Updates the shipping status of the specified Issuing Card object to failure. func (c Client) FailCard(id string, params *stripe.TestHelpersIssuingCardFailCardParams) (*stripe.IssuingCard, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/cards/%s/shipping/fail", - id, - ) + "/v1/test_helpers/issuing/cards/%s/shipping/fail", id) card := &stripe.IssuingCard{} err := c.B.Call(http.MethodPost, path, c.Key, params, card) return card, err @@ -59,9 +55,7 @@ func ReturnCard(id string, params *stripe.TestHelpersIssuingCardReturnCardParams // Updates the shipping status of the specified Issuing Card object to returned. func (c Client) ReturnCard(id string, params *stripe.TestHelpersIssuingCardReturnCardParams) (*stripe.IssuingCard, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/cards/%s/shipping/return", - id, - ) + "/v1/test_helpers/issuing/cards/%s/shipping/return", id) card := &stripe.IssuingCard{} err := c.B.Call(http.MethodPost, path, c.Key, params, card) return card, err @@ -75,9 +69,7 @@ func ShipCard(id string, params *stripe.TestHelpersIssuingCardShipCardParams) (* // Updates the shipping status of the specified Issuing Card object to shipped. func (c Client) ShipCard(id string, params *stripe.TestHelpersIssuingCardShipCardParams) (*stripe.IssuingCard, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/cards/%s/shipping/ship", - id, - ) + "/v1/test_helpers/issuing/cards/%s/shipping/ship", id) card := &stripe.IssuingCard{} err := c.B.Call(http.MethodPost, path, c.Key, params, card) return card, err @@ -91,9 +83,7 @@ func SubmitCard(id string, params *stripe.TestHelpersIssuingCardSubmitCardParams // Updates the shipping status of the specified Issuing Card object to submitted. This method requires Stripe Version ‘2024-09-30.acacia' or later. func (c Client) SubmitCard(id string, params *stripe.TestHelpersIssuingCardSubmitCardParams) (*stripe.IssuingCard, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/cards/%s/shipping/submit", - id, - ) + "/v1/test_helpers/issuing/cards/%s/shipping/submit", id) card := &stripe.IssuingCard{} err := c.B.Call(http.MethodPost, path, c.Key, params, card) return card, err diff --git a/testhelpers/issuing/personalizationdesign/client.go b/testhelpers/issuing/personalizationdesign/client.go index 648d6eb038..ede1002bba 100644 --- a/testhelpers/issuing/personalizationdesign/client.go +++ b/testhelpers/issuing/personalizationdesign/client.go @@ -27,9 +27,7 @@ func Activate(id string, params *stripe.TestHelpersIssuingPersonalizationDesignA // Updates the status of the specified testmode personalization design object to active. func (c Client) Activate(id string, params *stripe.TestHelpersIssuingPersonalizationDesignActivateParams) (*stripe.IssuingPersonalizationDesign, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/personalization_designs/%s/activate", - id, - ) + "/v1/test_helpers/issuing/personalization_designs/%s/activate", id) personalizationdesign := &stripe.IssuingPersonalizationDesign{} err := c.B.Call(http.MethodPost, path, c.Key, params, personalizationdesign) return personalizationdesign, err @@ -43,9 +41,7 @@ func Deactivate(id string, params *stripe.TestHelpersIssuingPersonalizationDesig // Updates the status of the specified testmode personalization design object to inactive. func (c Client) Deactivate(id string, params *stripe.TestHelpersIssuingPersonalizationDesignDeactivateParams) (*stripe.IssuingPersonalizationDesign, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/personalization_designs/%s/deactivate", - id, - ) + "/v1/test_helpers/issuing/personalization_designs/%s/deactivate", id) personalizationdesign := &stripe.IssuingPersonalizationDesign{} err := c.B.Call(http.MethodPost, path, c.Key, params, personalizationdesign) return personalizationdesign, err @@ -59,9 +55,7 @@ func Reject(id string, params *stripe.TestHelpersIssuingPersonalizationDesignRej // Updates the status of the specified testmode personalization design object to rejected. func (c Client) Reject(id string, params *stripe.TestHelpersIssuingPersonalizationDesignRejectParams) (*stripe.IssuingPersonalizationDesign, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/personalization_designs/%s/reject", - id, - ) + "/v1/test_helpers/issuing/personalization_designs/%s/reject", id) personalizationdesign := &stripe.IssuingPersonalizationDesign{} err := c.B.Call(http.MethodPost, path, c.Key, params, personalizationdesign) return personalizationdesign, err diff --git a/testhelpers/issuing/transaction/client.go b/testhelpers/issuing/transaction/client.go index cfb1ec7acf..f313958bab 100644 --- a/testhelpers/issuing/transaction/client.go +++ b/testhelpers/issuing/transaction/client.go @@ -28,12 +28,7 @@ func CreateForceCapture(params *stripe.TestHelpersIssuingTransactionCreateForceC func (c Client) CreateForceCapture(params *stripe.TestHelpersIssuingTransactionCreateForceCaptureParams) (*stripe.IssuingTransaction, error) { transaction := &stripe.IssuingTransaction{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/issuing/transactions/create_force_capture", - c.Key, - params, - transaction, - ) + http.MethodPost, "/v1/test_helpers/issuing/transactions/create_force_capture", c.Key, params, transaction) return transaction, err } @@ -46,12 +41,7 @@ func CreateUnlinkedRefund(params *stripe.TestHelpersIssuingTransactionCreateUnli func (c Client) CreateUnlinkedRefund(params *stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundParams) (*stripe.IssuingTransaction, error) { transaction := &stripe.IssuingTransaction{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/issuing/transactions/create_unlinked_refund", - c.Key, - params, - transaction, - ) + http.MethodPost, "/v1/test_helpers/issuing/transactions/create_unlinked_refund", c.Key, params, transaction) return transaction, err } @@ -63,9 +53,7 @@ func Refund(id string, params *stripe.TestHelpersIssuingTransactionRefundParams) // Refund a test-mode Transaction. func (c Client) Refund(id string, params *stripe.TestHelpersIssuingTransactionRefundParams) (*stripe.IssuingTransaction, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/issuing/transactions/%s/refund", - id, - ) + "/v1/test_helpers/issuing/transactions/%s/refund", id) transaction := &stripe.IssuingTransaction{} err := c.B.Call(http.MethodPost, path, c.Key, params, transaction) return transaction, err diff --git a/testhelpers/terminal/reader/client.go b/testhelpers/terminal/reader/client.go index 726bd50001..5a1db74a9f 100644 --- a/testhelpers/terminal/reader/client.go +++ b/testhelpers/terminal/reader/client.go @@ -27,9 +27,7 @@ func PresentPaymentMethod(id string, params *stripe.TestHelpersTerminalReaderPre // Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction. func (c Client) PresentPaymentMethod(id string, params *stripe.TestHelpersTerminalReaderPresentPaymentMethodParams) (*stripe.TerminalReader, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/terminal/readers/%s/present_payment_method", - id, - ) + "/v1/test_helpers/terminal/readers/%s/present_payment_method", id) reader := &stripe.TerminalReader{} err := c.B.Call(http.MethodPost, path, c.Key, params, reader) return reader, err diff --git a/testhelpers/testclock/client.go b/testhelpers/testclock/client.go index b849b2efff..598e1f6749 100644 --- a/testhelpers/testclock/client.go +++ b/testhelpers/testclock/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TestHelpersTestClockParams) (*stripe.TestHelpersTestCloc func (c Client) New(params *stripe.TestHelpersTestClockParams) (*stripe.TestHelpersTestClock, error) { testclock := &stripe.TestHelpersTestClock{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/test_clocks", - c.Key, - params, - testclock, - ) + http.MethodPost, "/v1/test_helpers/test_clocks", c.Key, params, testclock) return testclock, err } diff --git a/testhelpers/treasury/inboundtransfer/client.go b/testhelpers/treasury/inboundtransfer/client.go index 13e6400219..343f6bbde2 100644 --- a/testhelpers/treasury/inboundtransfer/client.go +++ b/testhelpers/treasury/inboundtransfer/client.go @@ -27,9 +27,7 @@ func Fail(id string, params *stripe.TestHelpersTreasuryInboundTransferFailParams // Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. func (c Client) Fail(id string, params *stripe.TestHelpersTreasuryInboundTransferFailParams) (*stripe.TreasuryInboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/inbound_transfers/%s/fail", - id, - ) + "/v1/test_helpers/treasury/inbound_transfers/%s/fail", id) inboundtransfer := &stripe.TreasuryInboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, inboundtransfer) return inboundtransfer, err @@ -43,9 +41,7 @@ func ReturnInboundTransfer(id string, params *stripe.TestHelpersTreasuryInboundT // Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. func (c Client) ReturnInboundTransfer(id string, params *stripe.TestHelpersTreasuryInboundTransferReturnInboundTransferParams) (*stripe.TreasuryInboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/inbound_transfers/%s/return", - id, - ) + "/v1/test_helpers/treasury/inbound_transfers/%s/return", id) inboundtransfer := &stripe.TreasuryInboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, inboundtransfer) return inboundtransfer, err @@ -59,9 +55,7 @@ func Succeed(id string, params *stripe.TestHelpersTreasuryInboundTransferSucceed // Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. func (c Client) Succeed(id string, params *stripe.TestHelpersTreasuryInboundTransferSucceedParams) (*stripe.TreasuryInboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/inbound_transfers/%s/succeed", - id, - ) + "/v1/test_helpers/treasury/inbound_transfers/%s/succeed", id) inboundtransfer := &stripe.TreasuryInboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, inboundtransfer) return inboundtransfer, err diff --git a/testhelpers/treasury/outboundpayment/client.go b/testhelpers/treasury/outboundpayment/client.go index 5592a2642c..c050c268c8 100644 --- a/testhelpers/treasury/outboundpayment/client.go +++ b/testhelpers/treasury/outboundpayment/client.go @@ -27,9 +27,7 @@ func Update(id string, params *stripe.TestHelpersTreasuryOutboundPaymentParams) // Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states. func (c Client) Update(id string, params *stripe.TestHelpersTreasuryOutboundPaymentParams) (*stripe.TreasuryOutboundPayment, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_payments/%s", - id, - ) + "/v1/test_helpers/treasury/outbound_payments/%s", id) outboundpayment := &stripe.TreasuryOutboundPayment{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundpayment) return outboundpayment, err @@ -43,9 +41,7 @@ func Fail(id string, params *stripe.TestHelpersTreasuryOutboundPaymentFailParams // Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. func (c Client) Fail(id string, params *stripe.TestHelpersTreasuryOutboundPaymentFailParams) (*stripe.TreasuryOutboundPayment, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_payments/%s/fail", - id, - ) + "/v1/test_helpers/treasury/outbound_payments/%s/fail", id) outboundpayment := &stripe.TreasuryOutboundPayment{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundpayment) return outboundpayment, err @@ -59,9 +55,7 @@ func Post(id string, params *stripe.TestHelpersTreasuryOutboundPaymentPostParams // Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. func (c Client) Post(id string, params *stripe.TestHelpersTreasuryOutboundPaymentPostParams) (*stripe.TreasuryOutboundPayment, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_payments/%s/post", - id, - ) + "/v1/test_helpers/treasury/outbound_payments/%s/post", id) outboundpayment := &stripe.TreasuryOutboundPayment{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundpayment) return outboundpayment, err @@ -75,9 +69,7 @@ func ReturnOutboundPayment(id string, params *stripe.TestHelpersTreasuryOutbound // Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. func (c Client) ReturnOutboundPayment(id string, params *stripe.TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) (*stripe.TreasuryOutboundPayment, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_payments/%s/return", - id, - ) + "/v1/test_helpers/treasury/outbound_payments/%s/return", id) outboundpayment := &stripe.TreasuryOutboundPayment{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundpayment) return outboundpayment, err diff --git a/testhelpers/treasury/outboundtransfer/client.go b/testhelpers/treasury/outboundtransfer/client.go index 9a2d50eef8..985b353bf3 100644 --- a/testhelpers/treasury/outboundtransfer/client.go +++ b/testhelpers/treasury/outboundtransfer/client.go @@ -27,9 +27,7 @@ func Update(id string, params *stripe.TestHelpersTreasuryOutboundTransferParams) // Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. func (c Client) Update(id string, params *stripe.TestHelpersTreasuryOutboundTransferParams) (*stripe.TreasuryOutboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_transfers/%s", - id, - ) + "/v1/test_helpers/treasury/outbound_transfers/%s", id) outboundtransfer := &stripe.TreasuryOutboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundtransfer) return outboundtransfer, err @@ -43,9 +41,7 @@ func Fail(id string, params *stripe.TestHelpersTreasuryOutboundTransferFailParam // Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. func (c Client) Fail(id string, params *stripe.TestHelpersTreasuryOutboundTransferFailParams) (*stripe.TreasuryOutboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_transfers/%s/fail", - id, - ) + "/v1/test_helpers/treasury/outbound_transfers/%s/fail", id) outboundtransfer := &stripe.TreasuryOutboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundtransfer) return outboundtransfer, err @@ -59,9 +55,7 @@ func Post(id string, params *stripe.TestHelpersTreasuryOutboundTransferPostParam // Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. func (c Client) Post(id string, params *stripe.TestHelpersTreasuryOutboundTransferPostParams) (*stripe.TreasuryOutboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_transfers/%s/post", - id, - ) + "/v1/test_helpers/treasury/outbound_transfers/%s/post", id) outboundtransfer := &stripe.TreasuryOutboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundtransfer) return outboundtransfer, err @@ -75,9 +69,7 @@ func ReturnOutboundTransfer(id string, params *stripe.TestHelpersTreasuryOutboun // Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. func (c Client) ReturnOutboundTransfer(id string, params *stripe.TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) (*stripe.TreasuryOutboundTransfer, error) { path := stripe.FormatURLPath( - "/v1/test_helpers/treasury/outbound_transfers/%s/return", - id, - ) + "/v1/test_helpers/treasury/outbound_transfers/%s/return", id) outboundtransfer := &stripe.TreasuryOutboundTransfer{} err := c.B.Call(http.MethodPost, path, c.Key, params, outboundtransfer) return outboundtransfer, err diff --git a/testhelpers/treasury/receivedcredit/client.go b/testhelpers/treasury/receivedcredit/client.go index 51ad58c95c..4ef0d5fdc4 100644 --- a/testhelpers/treasury/receivedcredit/client.go +++ b/testhelpers/treasury/receivedcredit/client.go @@ -28,12 +28,7 @@ func New(params *stripe.TestHelpersTreasuryReceivedCreditParams) (*stripe.Treasu func (c Client) New(params *stripe.TestHelpersTreasuryReceivedCreditParams) (*stripe.TreasuryReceivedCredit, error) { receivedcredit := &stripe.TreasuryReceivedCredit{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/treasury/received_credits", - c.Key, - params, - receivedcredit, - ) + http.MethodPost, "/v1/test_helpers/treasury/received_credits", c.Key, params, receivedcredit) return receivedcredit, err } diff --git a/testhelpers/treasury/receiveddebit/client.go b/testhelpers/treasury/receiveddebit/client.go index d03263b2f9..219f3d6f43 100644 --- a/testhelpers/treasury/receiveddebit/client.go +++ b/testhelpers/treasury/receiveddebit/client.go @@ -28,12 +28,7 @@ func New(params *stripe.TestHelpersTreasuryReceivedDebitParams) (*stripe.Treasur func (c Client) New(params *stripe.TestHelpersTreasuryReceivedDebitParams) (*stripe.TreasuryReceivedDebit, error) { receiveddebit := &stripe.TreasuryReceivedDebit{} err := c.B.Call( - http.MethodPost, - "/v1/test_helpers/treasury/received_debits", - c.Key, - params, - receiveddebit, - ) + http.MethodPost, "/v1/test_helpers/treasury/received_debits", c.Key, params, receiveddebit) return receiveddebit, err } diff --git a/transferreversal/client.go b/transferreversal/client.go index af0d165021..c48970cbcb 100644 --- a/transferreversal/client.go +++ b/transferreversal/client.go @@ -37,9 +37,7 @@ func New(params *stripe.TransferReversalParams) (*stripe.TransferReversal, error // Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer. func (c Client) New(params *stripe.TransferReversalParams) (*stripe.TransferReversal, error) { path := stripe.FormatURLPath( - "/v1/transfers/%s/reversals", - stripe.StringValue(params.ID), - ) + "/v1/transfers/%s/reversals", stripe.StringValue(params.ID)) transferreversal := &stripe.TransferReversal{} err := c.B.Call(http.MethodPost, path, c.Key, params, transferreversal) return transferreversal, err @@ -54,14 +52,10 @@ func Get(id string, params *stripe.TransferReversalParams) (*stripe.TransferReve func (c Client) Get(id string, params *stripe.TransferReversalParams) (*stripe.TransferReversal, error) { if params == nil { return nil, fmt.Errorf( - "params cannnot be nil, and params.Transfer must be set", - ) + "params cannnot be nil, and params.Transfer must be set") } path := stripe.FormatURLPath( - "/v1/transfers/%s/reversals/%s", - stripe.StringValue(params.ID), - id, - ) + "/v1/transfers/%s/reversals/%s", stripe.StringValue(params.ID), id) transferreversal := &stripe.TransferReversal{} err := c.B.Call(http.MethodGet, path, c.Key, params, transferreversal) return transferreversal, err @@ -79,10 +73,7 @@ func Update(id string, params *stripe.TransferReversalParams) (*stripe.TransferR // This request only accepts metadata and description as arguments. func (c Client) Update(id string, params *stripe.TransferReversalParams) (*stripe.TransferReversal, error) { path := stripe.FormatURLPath( - "/v1/transfers/%s/reversals/%s", - stripe.StringValue(params.ID), - id, - ) + "/v1/transfers/%s/reversals/%s", stripe.StringValue(params.ID), id) transferreversal := &stripe.TransferReversal{} err := c.B.Call(http.MethodPost, path, c.Key, params, transferreversal) return transferreversal, err @@ -96,9 +87,7 @@ func List(params *stripe.TransferReversalListParams) *Iter { // You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. func (c Client) List(listParams *stripe.TransferReversalListParams) *Iter { path := stripe.FormatURLPath( - "/v1/transfers/%s/reversals", - stripe.StringValue(listParams.ID), - ) + "/v1/transfers/%s/reversals", stripe.StringValue(listParams.ID)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.TransferReversalList{} diff --git a/treasury/creditreversal/client.go b/treasury/creditreversal/client.go index 2a98186ede..0c865f6161 100644 --- a/treasury/creditreversal/client.go +++ b/treasury/creditreversal/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryCreditReversalParams) (*stripe.TreasuryCreditRev func (c Client) New(params *stripe.TreasuryCreditReversalParams) (*stripe.TreasuryCreditReversal, error) { creditreversal := &stripe.TreasuryCreditReversal{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/credit_reversals", - c.Key, - params, - creditreversal, - ) + http.MethodPost, "/v1/treasury/credit_reversals", c.Key, params, creditreversal) return creditreversal, err } diff --git a/treasury/debitreversal/client.go b/treasury/debitreversal/client.go index e59b905f51..3670915495 100644 --- a/treasury/debitreversal/client.go +++ b/treasury/debitreversal/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryDebitReversalParams) (*stripe.TreasuryDebitRever func (c Client) New(params *stripe.TreasuryDebitReversalParams) (*stripe.TreasuryDebitReversal, error) { debitreversal := &stripe.TreasuryDebitReversal{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/debit_reversals", - c.Key, - params, - debitreversal, - ) + http.MethodPost, "/v1/treasury/debit_reversals", c.Key, params, debitreversal) return debitreversal, err } diff --git a/treasury/financialaccount/client.go b/treasury/financialaccount/client.go index d62ae46e58..c80661da38 100644 --- a/treasury/financialaccount/client.go +++ b/treasury/financialaccount/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryFinancialAccountParams) (*stripe.TreasuryFinanci func (c Client) New(params *stripe.TreasuryFinancialAccountParams) (*stripe.TreasuryFinancialAccount, error) { financialaccount := &stripe.TreasuryFinancialAccount{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/financial_accounts", - c.Key, - params, - financialaccount, - ) + http.MethodPost, "/v1/treasury/financial_accounts", c.Key, params, financialaccount) return financialaccount, err } @@ -85,9 +80,7 @@ func RetrieveFeatures(id string, params *stripe.TreasuryFinancialAccountRetrieve // Retrieves Features information associated with the FinancialAccount. func (c Client) RetrieveFeatures(id string, params *stripe.TreasuryFinancialAccountRetrieveFeaturesParams) (*stripe.TreasuryFinancialAccountFeatures, error) { path := stripe.FormatURLPath( - "/v1/treasury/financial_accounts/%s/features", - id, - ) + "/v1/treasury/financial_accounts/%s/features", id) financialaccountfeatures := &stripe.TreasuryFinancialAccountFeatures{} err := c.B.Call(http.MethodGet, path, c.Key, params, financialaccountfeatures) return financialaccountfeatures, err @@ -101,17 +94,10 @@ func UpdateFeatures(id string, params *stripe.TreasuryFinancialAccountUpdateFeat // Updates the Features associated with a FinancialAccount. func (c Client) UpdateFeatures(id string, params *stripe.TreasuryFinancialAccountUpdateFeaturesParams) (*stripe.TreasuryFinancialAccountFeatures, error) { path := stripe.FormatURLPath( - "/v1/treasury/financial_accounts/%s/features", - id, - ) + "/v1/treasury/financial_accounts/%s/features", id) financialaccountfeatures := &stripe.TreasuryFinancialAccountFeatures{} err := c.B.Call( - http.MethodPost, - path, - c.Key, - params, - financialaccountfeatures, - ) + http.MethodPost, path, c.Key, params, financialaccountfeatures) return financialaccountfeatures, err } diff --git a/treasury/inboundtransfer/client.go b/treasury/inboundtransfer/client.go index 194d2808fd..ec996abd10 100644 --- a/treasury/inboundtransfer/client.go +++ b/treasury/inboundtransfer/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryInboundTransferParams) (*stripe.TreasuryInboundT func (c Client) New(params *stripe.TreasuryInboundTransferParams) (*stripe.TreasuryInboundTransfer, error) { inboundtransfer := &stripe.TreasuryInboundTransfer{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/inbound_transfers", - c.Key, - params, - inboundtransfer, - ) + http.MethodPost, "/v1/treasury/inbound_transfers", c.Key, params, inboundtransfer) return inboundtransfer, err } diff --git a/treasury/outboundpayment/client.go b/treasury/outboundpayment/client.go index 04236c2eba..ef3beb5fdd 100644 --- a/treasury/outboundpayment/client.go +++ b/treasury/outboundpayment/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryOutboundPaymentParams) (*stripe.TreasuryOutbound func (c Client) New(params *stripe.TreasuryOutboundPaymentParams) (*stripe.TreasuryOutboundPayment, error) { outboundpayment := &stripe.TreasuryOutboundPayment{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/outbound_payments", - c.Key, - params, - outboundpayment, - ) + http.MethodPost, "/v1/treasury/outbound_payments", c.Key, params, outboundpayment) return outboundpayment, err } diff --git a/treasury/outboundtransfer/client.go b/treasury/outboundtransfer/client.go index 9a3fcbd580..55f99aacd1 100644 --- a/treasury/outboundtransfer/client.go +++ b/treasury/outboundtransfer/client.go @@ -29,12 +29,7 @@ func New(params *stripe.TreasuryOutboundTransferParams) (*stripe.TreasuryOutboun func (c Client) New(params *stripe.TreasuryOutboundTransferParams) (*stripe.TreasuryOutboundTransfer, error) { outboundtransfer := &stripe.TreasuryOutboundTransfer{} err := c.B.Call( - http.MethodPost, - "/v1/treasury/outbound_transfers", - c.Key, - params, - outboundtransfer, - ) + http.MethodPost, "/v1/treasury/outbound_transfers", c.Key, params, outboundtransfer) return outboundtransfer, err } diff --git a/usagerecord/client.go b/usagerecord/client.go index f0271054d3..517a2d71e4 100644 --- a/usagerecord/client.go +++ b/usagerecord/client.go @@ -39,9 +39,8 @@ func New(params *stripe.UsageRecordParams) (*stripe.UsageRecord, error) { // The default pricing model for metered billing is [per-unit pricing. For finer granularity, you can configure metered billing to have a tiered pricing](https://stripe.com/docs/api/plans/object#plan_object-billing_scheme) model. func (c Client) New(params *stripe.UsageRecordParams) (*stripe.UsageRecord, error) { path := stripe.FormatURLPath( - "/v1/subscription_items/%s/usage_records", - stripe.StringValue(params.SubscriptionItem), - ) + "/v1/subscription_items/%s/usage_records", stripe.StringValue( + params.SubscriptionItem)) usagerecord := &stripe.UsageRecord{} err := c.B.Call(http.MethodPost, path, c.Key, params, usagerecord) return usagerecord, err diff --git a/usagerecordsummary/client.go b/usagerecordsummary/client.go index 40c5f116bd..680f127671 100644 --- a/usagerecordsummary/client.go +++ b/usagerecordsummary/client.go @@ -32,9 +32,8 @@ func List(params *stripe.UsageRecordSummaryListParams) *Iter { // The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends. func (c Client) List(listParams *stripe.UsageRecordSummaryListParams) *Iter { path := stripe.FormatURLPath( - "/v1/subscription_items/%s/usage_record_summaries", - stripe.StringValue(listParams.SubscriptionItem), - ) + "/v1/subscription_items/%s/usage_record_summaries", stripe.StringValue( + listParams.SubscriptionItem)) return &Iter{ Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { list := &stripe.UsageRecordSummaryList{} diff --git a/webhookendpoint/client.go b/webhookendpoint/client.go index 054553a828..e956a359db 100644 --- a/webhookendpoint/client.go +++ b/webhookendpoint/client.go @@ -29,12 +29,7 @@ func New(params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) func (c Client) New(params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) { webhookendpoint := &stripe.WebhookEndpoint{} err := c.B.Call( - http.MethodPost, - "/v1/webhook_endpoints", - c.Key, - params, - webhookendpoint, - ) + http.MethodPost, "/v1/webhook_endpoints", c.Key, params, webhookendpoint) return webhookendpoint, err } From dda57d0e92b9e8ff209445863ea3f5d12abb4a07 Mon Sep 17 00:00:00 2001 From: Helen Ye Date: Mon, 3 Feb 2025 12:58:56 -0500 Subject: [PATCH 5/8] Bump version to 81.3.1 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- stripe.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3904b3d464..f5d32b1e3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 81.3.1 - 2025-02-03 +* [#1980](https://github.com/stripe/stripe-go/pull/1980) Update generated code + * ⚠️ Fix acronym `JPY` in TerminalConfiguration that were not correctly capitalized + ## 81.3.0 - 2025-01-27 * [#1965](https://github.com/stripe/stripe-go/pull/1965) Update generated code * Add support for `Close` method on resource `Treasury.FinancialAccount` diff --git a/VERSION b/VERSION index 12d065ab50..5eb0ee09fb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -81.3.0 +81.3.1 diff --git a/stripe.go b/stripe.go index 06598ab344..caaee67fa2 100644 --- a/stripe.go +++ b/stripe.go @@ -1386,7 +1386,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "81.3.0" +const clientversion = "81.3.1" // 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 From b60fef75995dd044f15592cd2e854c639c97585e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 01:09:16 +0000 Subject: [PATCH 6/8] Update generated code for v1471 --- OPENAPI_VERSION | 2 +- account.go | 306 +------ accountlink.go | 49 +- accountnotice.go | 57 +- accountsession.go | 43 +- applepaydomain.go | 47 +- applicationfee.go | 34 +- apps_secret.go | 51 +- balancetransaction.go | 40 +- billing_alerttriggered.go | 43 +- billing_creditbalancetransaction.go | 40 +- billing_creditgrant.go | 62 +- billing_meter.go | 78 +- billing_metererrorreport.go | 49 +- billing_meterevent.go | 51 +- billing_metereventsummary.go | 53 +- billingportal_configuration.go | 40 +- billingportal_session.go | 43 +- capability.go | 119 +-- capital_financingoffer.go | 49 +- capital_financingtransaction.go | 43 +- charge.go | 188 +---- checkout_session.go | 93 +-- climate_order.go | 111 +-- climate_product.go | 34 +- confirmationtoken.go | 163 +--- coupon.go | 42 +- creditnote.go | 52 +- customer.go | 34 +- customerbalancetransaction.go | 34 +- customercashbalancetransaction.go | 34 +- customersession.go | 49 +- discount.go | 40 +- dispute.go | 72 +- ephemeralkey.go | 45 +- event.go | 39 +- example/generated_examples_test.go | 28 +- feerefund.go | 34 +- file.go | 38 +- filelink.go | 54 +- financialconnections_account.go | 257 +----- ...ncialconnections_accountinferredbalance.go | 43 +- financialconnections_accountowner.go | 43 +- financialconnections_accountownership.go | 34 +- financialconnections_transaction.go | 93 +-- forwarding_request.go | 43 +- giftcards_card.go | 43 +- giftcards_transaction.go | 49 +- identity_verificationreport.go | 34 +- identity_verificationsession.go | 43 +- invoice.go | 432 +++------- invoiceitem.go | 42 +- invoicelineitem.go | 8 +- invoicepayment.go | 87 +- invoicerenderingtemplate.go | 43 +- issuing_authorization.go | 78 +- issuing_card.go | 72 +- issuing_cardholder.go | 74 +- issuing_creditunderwritingrecord.go | 103 +-- issuing_dispute.go | 226 +----- issuing_disputesettlementdetail.go | 43 +- issuing_fraudliabilitydebit.go | 43 +- issuing_personalizationdesign.go | 34 +- issuing_settlement.go | 40 +- issuing_token.go | 40 +- issuing_transaction.go | 110 +-- loginlink.go | 43 +- mandate.go | 43 +- margin.go | 40 +- order.go | 43 +- paymentattemptrecord.go | 43 +- paymentintent.go | 744 ++---------------- paymentmethod.go | 148 +--- paymentmethoddomain.go | 43 +- paymentrecord.go | 48 +- payout.go | 40 +- person.go | 83 +- plan.go | 30 +- price.go | 70 +- product.go | 36 +- promotioncode.go | 42 +- quote.go | 492 +----------- quoteline.go | 245 +----- quotepreviewinvoice.go | 229 +----- quotepreviewsubscriptionschedule.go | 351 +-------- radar_earlyfraudwarning.go | 43 +- radar_valuelist.go | 43 +- radar_valuelistitem.go | 43 +- refund.go | 110 +-- reporting_reportrun.go | 97 +-- reporting_reporttype.go | 55 +- review.go | 34 +- setupattempt.go | 72 +- setupintent.go | 160 +--- shippingrate.go | 34 +- sigma_scheduledqueryrun.go | 55 +- source.go | 47 +- sourcetransaction.go | 43 +- subscription.go | 278 +------ subscriptionitem.go | 40 +- subscriptionschedule.go | 372 +-------- tax_calculation.go | 51 +- tax_form.go | 72 +- tax_registration.go | 64 +- tax_transaction.go | 57 +- taxdeductedatsource.go | 40 +- taxid.go | 34 +- taxrate.go | 34 +- terminal_readercollecteddata.go | 43 +- testhelpers_testclock.go | 90 +-- testhelpersissuing_authorization.go | 6 +- testhelpersissuing_transaction.go | 10 +- token.go | 43 +- topup.go | 40 +- transfer.go | 34 +- transferreversal.go | 34 +- treasury_creditreversal.go | 81 +- treasury_debitreversal.go | 81 +- treasury_financialaccount.go | 43 +- treasury_inboundtransfer.go | 93 +-- treasury_outboundpayment.go | 105 +-- treasury_outboundtransfer.go | 105 +-- treasury_receivedcredit.go | 81 +- treasury_receiveddebit.go | 81 +- treasury_transaction.go | 78 +- treasury_transactionentry.go | 49 +- usagerecord.go | 48 +- webhookendpoint.go | 45 +- 128 files changed, 856 insertions(+), 9665 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 602766a618..d991242e27 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1470 \ No newline at end of file +v1471 \ No newline at end of file diff --git a/account.go b/account.go index 7b354c3956..4fb2ef3a2c 100644 --- a/account.go +++ b/account.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // The business type. After you create an [Account Link](https://stripe.com/api/account_links) or [Account Session](https://stripe.com/api/account_sessions), this property is only returned for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. @@ -936,7 +935,7 @@ type AccountCompanyAddressKanjiParams struct { // This hash is used to attest that the directors information provided to Stripe is both current and correct. type AccountCompanyDirectorshipDeclarationParams struct { // The Unix timestamp marking when the directorship declaration attestation was made. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the directorship declaration attestation was made. IP *string `form:"ip"` // The user agent of the browser from which the directorship declaration attestation was made. @@ -946,7 +945,7 @@ type AccountCompanyDirectorshipDeclarationParams struct { // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. type AccountCompanyOwnershipDeclarationParams struct { // The Unix timestamp marking when the beneficial owner attestation was made. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the beneficial owner attestation was made. IP *string `form:"ip"` // The user agent of the browser from which the beneficial owner attestation was made. @@ -1181,7 +1180,7 @@ type AccountSettingsCapitalParams struct { // Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/issuing/connect/tos_acceptance). type AccountSettingsCardIssuingTOSAcceptanceParams struct { // The Unix timestamp marking when the account representative accepted the service agreement. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the account representative accepted the service agreement. IP *string `form:"ip"` // The user agent of the browser from which the account representative accepted the service agreement. @@ -1269,7 +1268,7 @@ type AccountSettingsTaxFormsParams struct { // Details on the account's acceptance of the Stripe Treasury Services Agreement. type AccountSettingsTreasuryTOSAcceptanceParams struct { // The Unix timestamp marking when the account representative accepted the service agreement. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the account representative accepted the service agreement. IP *string `form:"ip"` // The user agent of the browser from which the account representative accepted the service agreement. @@ -1311,7 +1310,7 @@ type AccountSettingsParams struct { // Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/connect/updating-accounts#tos-acceptance). This property can only be updated for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. This property defaults to a `full` service agreement when empty. type AccountTOSAcceptanceParams struct { // The Unix timestamp marking when the account representative accepted their service agreement. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the account representative accepted their service agreement. IP *string `form:"ip"` // The user's service agreement type. @@ -1618,7 +1617,7 @@ type AccountCompanyAddressKanji struct { // This hash is used to attest that the director information provided to Stripe is both current and correct. type AccountCompanyDirectorshipDeclaration struct { // The Unix timestamp marking when the directorship declaration attestation was made. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the directorship declaration attestation was made. IP string `json:"ip"` // The user-agent string from the browser where the directorship declaration attestation was made. @@ -1628,7 +1627,7 @@ type AccountCompanyDirectorshipDeclaration struct { // This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. type AccountCompanyOwnershipDeclaration struct { // The Unix timestamp marking when the beneficial owner attestation was made. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the beneficial owner attestation was made. IP string `json:"ip"` // The user-agent string from the browser where the beneficial owner attestation was made. @@ -1748,7 +1747,7 @@ type AccountFutureRequirements struct { // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. Alternatives []*AccountFutureRequirementsAlternative `json:"alternatives"` // Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on its enablement state prior to transitioning. - CurrentDeadline time.Time `json:"current_deadline"` + CurrentDeadline int64 `json:"current_deadline"` // Fields that need to be collected to keep the account enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash. CurrentlyDue []string `json:"currently_due"` // This is typed as an enum for consistency with `requirements.disabled_reason`. @@ -1790,7 +1789,7 @@ type AccountRequirements struct { // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. Alternatives []*AccountRequirementsAlternative `json:"alternatives"` // Date by which the fields in `currently_due` must be collected to keep the account enabled. These fields may disable the account sooner if the next threshold is reached before they are collected. - CurrentDeadline time.Time `json:"current_deadline"` + CurrentDeadline int64 `json:"current_deadline"` // Fields that need to be collected to keep the account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. CurrentlyDue []string `json:"currently_due"` // If the account is disabled, this enum describes why. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification). @@ -1846,7 +1845,7 @@ type AccountSettingsCapital struct { } type AccountSettingsCardIssuingTOSAcceptance struct { // The Unix timestamp marking when the account representative accepted the service agreement. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the account representative accepted the service agreement. IP string `json:"ip"` // The user agent of the browser from which the account representative accepted the service agreement. @@ -1919,7 +1918,7 @@ type AccountSettingsTaxForms struct { } type AccountSettingsTreasuryTOSAcceptance struct { // The Unix timestamp marking when the account representative accepted the service agreement. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the account representative accepted the service agreement. IP string `json:"ip"` // The user agent of the browser from which the account representative accepted the service agreement. @@ -1947,7 +1946,7 @@ type AccountSettings struct { } type AccountTOSAcceptance struct { // The Unix timestamp marking when the account representative accepted their service agreement - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the account representative accepted their service agreement IP string `json:"ip"` // The user's service agreement type @@ -1982,7 +1981,7 @@ type Account struct { // The account's country. Country string `json:"country"` // Time at which the account was connected. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). DefaultCurrency Currency `json:"default_currency"` Deleted bool `json:"deleted"` @@ -2053,17 +2052,12 @@ func (a *Account) UnmarshalJSON(data []byte) error { } type account Account - v := struct { - Created int64 `json:"created"` - *account - }{ - account: (*account)(a), - } + var v account if err := json.Unmarshal(data, &v); err != nil { return err } - a.Created = time.Unix(v.Created, 0) + *a = Account(v) return nil } @@ -2093,273 +2087,3 @@ func (a *AccountExternalAccount) UnmarshalJSON(data []byte) error { } return err } - -// UnmarshalJSON handles deserialization of an AccountCompanyDirectorshipDeclaration. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountCompanyDirectorshipDeclaration) UnmarshalJSON(data []byte) error { - type accountCompanyDirectorshipDeclaration AccountCompanyDirectorshipDeclaration - v := struct { - Date int64 `json:"date"` - *accountCompanyDirectorshipDeclaration - }{ - accountCompanyDirectorshipDeclaration: (*accountCompanyDirectorshipDeclaration)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Date = time.Unix(v.Date, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountCompanyOwnershipDeclaration. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountCompanyOwnershipDeclaration) UnmarshalJSON(data []byte) error { - type accountCompanyOwnershipDeclaration AccountCompanyOwnershipDeclaration - v := struct { - Date int64 `json:"date"` - *accountCompanyOwnershipDeclaration - }{ - accountCompanyOwnershipDeclaration: (*accountCompanyOwnershipDeclaration)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Date = time.Unix(v.Date, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountFutureRequirements. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountFutureRequirements) UnmarshalJSON(data []byte) error { - type accountFutureRequirements AccountFutureRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - *accountFutureRequirements - }{ - accountFutureRequirements: (*accountFutureRequirements)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.CurrentDeadline = time.Unix(v.CurrentDeadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountRequirements. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountRequirements) UnmarshalJSON(data []byte) error { - type accountRequirements AccountRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - *accountRequirements - }{ - accountRequirements: (*accountRequirements)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.CurrentDeadline = time.Unix(v.CurrentDeadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountSettingsCardIssuingTOSAcceptance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountSettingsCardIssuingTOSAcceptance) UnmarshalJSON(data []byte) error { - type accountSettingsCardIssuingTOSAcceptance AccountSettingsCardIssuingTOSAcceptance - v := struct { - Date int64 `json:"date"` - *accountSettingsCardIssuingTOSAcceptance - }{ - accountSettingsCardIssuingTOSAcceptance: (*accountSettingsCardIssuingTOSAcceptance)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Date = time.Unix(v.Date, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountSettingsTreasuryTOSAcceptance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountSettingsTreasuryTOSAcceptance) UnmarshalJSON(data []byte) error { - type accountSettingsTreasuryTOSAcceptance AccountSettingsTreasuryTOSAcceptance - v := struct { - Date int64 `json:"date"` - *accountSettingsTreasuryTOSAcceptance - }{ - accountSettingsTreasuryTOSAcceptance: (*accountSettingsTreasuryTOSAcceptance)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Date = time.Unix(v.Date, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an AccountTOSAcceptance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountTOSAcceptance) UnmarshalJSON(data []byte) error { - type accountTOSAcceptance AccountTOSAcceptance - v := struct { - Date int64 `json:"date"` - *accountTOSAcceptance - }{ - accountTOSAcceptance: (*accountTOSAcceptance)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Date = time.Unix(v.Date, 0) - return nil -} - -// MarshalJSON handles serialization of an AccountCompanyDirectorshipDeclaration. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountCompanyDirectorshipDeclaration) MarshalJSON() ([]byte, error) { - type accountCompanyDirectorshipDeclaration AccountCompanyDirectorshipDeclaration - v := struct { - Date int64 `json:"date"` - accountCompanyDirectorshipDeclaration - }{ - accountCompanyDirectorshipDeclaration: (accountCompanyDirectorshipDeclaration)(a), - Date: a.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountCompanyOwnershipDeclaration. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountCompanyOwnershipDeclaration) MarshalJSON() ([]byte, error) { - type accountCompanyOwnershipDeclaration AccountCompanyOwnershipDeclaration - v := struct { - Date int64 `json:"date"` - accountCompanyOwnershipDeclaration - }{ - accountCompanyOwnershipDeclaration: (accountCompanyOwnershipDeclaration)(a), - Date: a.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountFutureRequirements. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountFutureRequirements) MarshalJSON() ([]byte, error) { - type accountFutureRequirements AccountFutureRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - accountFutureRequirements - }{ - accountFutureRequirements: (accountFutureRequirements)(a), - CurrentDeadline: a.CurrentDeadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountRequirements. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountRequirements) MarshalJSON() ([]byte, error) { - type accountRequirements AccountRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - accountRequirements - }{ - accountRequirements: (accountRequirements)(a), - CurrentDeadline: a.CurrentDeadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountSettingsCardIssuingTOSAcceptance. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountSettingsCardIssuingTOSAcceptance) MarshalJSON() ([]byte, error) { - type accountSettingsCardIssuingTOSAcceptance AccountSettingsCardIssuingTOSAcceptance - v := struct { - Date int64 `json:"date"` - accountSettingsCardIssuingTOSAcceptance - }{ - accountSettingsCardIssuingTOSAcceptance: (accountSettingsCardIssuingTOSAcceptance)(a), - Date: a.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountSettingsTreasuryTOSAcceptance. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountSettingsTreasuryTOSAcceptance) MarshalJSON() ([]byte, error) { - type accountSettingsTreasuryTOSAcceptance AccountSettingsTreasuryTOSAcceptance - v := struct { - Date int64 `json:"date"` - accountSettingsTreasuryTOSAcceptance - }{ - accountSettingsTreasuryTOSAcceptance: (accountSettingsTreasuryTOSAcceptance)(a), - Date: a.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an AccountTOSAcceptance. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountTOSAcceptance) MarshalJSON() ([]byte, error) { - type accountTOSAcceptance AccountTOSAcceptance - v := struct { - Date int64 `json:"date"` - accountTOSAcceptance - }{ - accountTOSAcceptance: (accountTOSAcceptance)(a), - Date: a.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an Account. -// This custom marshaling is needed to handle the time fields correctly. -func (a Account) MarshalJSON() ([]byte, error) { - type account Account - v := struct { - Created int64 `json:"created"` - account - }{ - account: (account)(a), - Created: a.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/accountlink.go b/accountlink.go index 6b4e9fec87..8db8768bce 100644 --- a/accountlink.go +++ b/accountlink.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow. type AccountLinkCollectionOptionsParams struct { // Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). If you don't specify `collection_options`, the default value is `currently_due`. @@ -68,51 +63,11 @@ func (p *AccountLinkParams) AddExpand(f string) { type AccountLink struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The timestamp at which this account link will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The URL for the account link. URL string `json:"url"` } - -// UnmarshalJSON handles deserialization of an AccountLink. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountLink) UnmarshalJSON(data []byte) error { - type accountLink AccountLink - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *accountLink - }{ - accountLink: (*accountLink)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Created = time.Unix(v.Created, 0) - a.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of an AccountLink. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountLink) MarshalJSON() ([]byte, error) { - type accountLink AccountLink - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - accountLink - }{ - accountLink: (accountLink)(a), - Created: a.Created.Unix(), - ExpiresAt: a.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/accountnotice.go b/accountnotice.go index 65d31f8c40..58d301824c 100644 --- a/accountnotice.go +++ b/accountnotice.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Reason the notice is being sent. The reason determines what copy the notice must contain. See the [regulated customer notices](https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices) guide. All reasons might not apply to your integration, and Stripe might add new reasons in the future, so we recommend an internal warning when you receive an unknown reason. type AccountNoticeReason string @@ -55,7 +50,7 @@ type AccountNoticeParams struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` // Date when you sent the notice. - SentAt *time.Time `form:"sent_at"` + SentAt *int64 `form:"sent_at"` } // AddExpand appends a new field to expand. @@ -108,9 +103,9 @@ type AccountNoticeLinkedObjects struct { type AccountNotice struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // When present, the deadline for sending the notice to meet the relevant regulations. - Deadline time.Time `json:"deadline"` + Deadline int64 `json:"deadline"` // Information about the email when sent. Email *AccountNoticeEmail `json:"email"` // Unique identifier for the object. @@ -126,7 +121,7 @@ type AccountNotice struct { // Reason the notice is being sent. The reason determines what copy the notice must contain. See the [regulated customer notices](https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices) guide. All reasons might not apply to your integration, and Stripe might add new reasons in the future, so we recommend an internal warning when you receive an unknown reason. Reason AccountNoticeReason `json:"reason"` // Date when the notice was sent. When absent, you must send the notice, update the content of the email and date when it was sent. - SentAt time.Time `json:"sent_at"` + SentAt int64 `json:"sent_at"` } // AccountNoticeList is a list of AccountNotices as retrieved from a list endpoint. @@ -135,47 +130,3 @@ type AccountNoticeList struct { ListMeta Data []*AccountNotice `json:"data"` } - -// UnmarshalJSON handles deserialization of an AccountNotice. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountNotice) UnmarshalJSON(data []byte) error { - type accountNotice AccountNotice - v := struct { - Created int64 `json:"created"` - Deadline int64 `json:"deadline"` - SentAt int64 `json:"sent_at"` - *accountNotice - }{ - accountNotice: (*accountNotice)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Created = time.Unix(v.Created, 0) - a.Deadline = time.Unix(v.Deadline, 0) - a.SentAt = time.Unix(v.SentAt, 0) - return nil -} - -// MarshalJSON handles serialization of an AccountNotice. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountNotice) MarshalJSON() ([]byte, error) { - type accountNotice AccountNotice - v := struct { - Created int64 `json:"created"` - Deadline int64 `json:"deadline"` - SentAt int64 `json:"sent_at"` - accountNotice - }{ - accountNotice: (accountNotice)(a), - Created: a.Created.Unix(), - Deadline: a.Deadline.Unix(), - SentAt: a.SentAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/accountsession.go b/accountsession.go index 7487c5365f..1bc965406d 100644 --- a/accountsession.go +++ b/accountsession.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The list of features enabled in the embedded component. type AccountSessionComponentsAccountManagementFeaturesParams struct { // Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. @@ -684,45 +679,9 @@ type AccountSession struct { ClientSecret string `json:"client_secret"` Components *AccountSessionComponents `json:"components"` // The timestamp at which this AccountSession will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. Livemode bool `json:"livemode"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` } - -// UnmarshalJSON handles deserialization of an AccountSession. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AccountSession) UnmarshalJSON(data []byte) error { - type accountSession AccountSession - v := struct { - ExpiresAt int64 `json:"expires_at"` - *accountSession - }{ - accountSession: (*accountSession)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of an AccountSession. -// This custom marshaling is needed to handle the time fields correctly. -func (a AccountSession) MarshalJSON() ([]byte, error) { - type accountSession AccountSession - v := struct { - ExpiresAt int64 `json:"expires_at"` - accountSession - }{ - accountSession: (accountSession)(a), - ExpiresAt: a.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/applepaydomain.go b/applepaydomain.go index e318368110..cd5424de51 100644 --- a/applepaydomain.go +++ b/applepaydomain.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Delete an apple pay domain. type ApplePayDomainParams struct { Params `form:"*"` @@ -40,9 +35,9 @@ func (p *ApplePayDomainListParams) AddExpand(f string) { type ApplePayDomain struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` - Deleted bool `json:"deleted"` - DomainName string `json:"domain_name"` + Created int64 `json:"created"` + Deleted bool `json:"deleted"` + DomainName string `json:"domain_name"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -57,39 +52,3 @@ type ApplePayDomainList struct { ListMeta Data []*ApplePayDomain `json:"data"` } - -// UnmarshalJSON handles deserialization of an ApplePayDomain. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *ApplePayDomain) UnmarshalJSON(data []byte) error { - type applePayDomain ApplePayDomain - v := struct { - Created int64 `json:"created"` - *applePayDomain - }{ - applePayDomain: (*applePayDomain)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an ApplePayDomain. -// This custom marshaling is needed to handle the time fields correctly. -func (a ApplePayDomain) MarshalJSON() ([]byte, error) { - type applePayDomain ApplePayDomain - v := struct { - Created int64 `json:"created"` - applePayDomain - }{ - applePayDomain: (applePayDomain)(a), - Created: a.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/applicationfee.go b/applicationfee.go index b4b7ec08bd..5067c53512 100644 --- a/applicationfee.go +++ b/applicationfee.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Type of object that created the application fee, either `charge` or `payout`. type ApplicationFeeFeeSourceType string @@ -74,7 +71,7 @@ type ApplicationFee struct { // ID of the charge that the application fee was taken from. Charge *Charge `json:"charge"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Polymorphic source of the application fee. Includes the ID of the object the application fee was created from. @@ -110,34 +107,11 @@ func (a *ApplicationFee) UnmarshalJSON(data []byte) error { } type applicationFee ApplicationFee - v := struct { - Created int64 `json:"created"` - *applicationFee - }{ - applicationFee: (*applicationFee)(a), - } + var v applicationFee if err := json.Unmarshal(data, &v); err != nil { return err } - a.Created = time.Unix(v.Created, 0) + *a = ApplicationFee(v) return nil } - -// MarshalJSON handles serialization of an ApplicationFee. -// This custom marshaling is needed to handle the time fields correctly. -func (a ApplicationFee) MarshalJSON() ([]byte, error) { - type applicationFee ApplicationFee - v := struct { - Created int64 `json:"created"` - applicationFee - }{ - applicationFee: (applicationFee)(a), - Created: a.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/apps_secret.go b/apps_secret.go index e05ea1e08f..ce2af32544 100644 --- a/apps_secret.go +++ b/apps_secret.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The secret scope type. type AppsSecretScopeType string @@ -56,7 +51,7 @@ type AppsSecretParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The Unix timestamp for the expiry time of the secret, after which the secret deletes. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // A name for the secret that's unique within the scope. Name *string `form:"name"` // The plaintext secret value to be stored. @@ -137,11 +132,11 @@ type AppsSecretScope struct { type AppsSecret struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // If true, indicates that this secret has been deleted Deleted bool `json:"deleted"` // The Unix timestamp for the expiry time of the secret, after which the secret deletes. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -161,43 +156,3 @@ type AppsSecretList struct { ListMeta Data []*AppsSecret `json:"data"` } - -// UnmarshalJSON handles deserialization of an AppsSecret. -// This custom unmarshaling is needed to handle the time fields correctly. -func (a *AppsSecret) UnmarshalJSON(data []byte) error { - type appsSecret AppsSecret - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *appsSecret - }{ - appsSecret: (*appsSecret)(a), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - a.Created = time.Unix(v.Created, 0) - a.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of an AppsSecret. -// This custom marshaling is needed to handle the time fields correctly. -func (a AppsSecret) MarshalJSON() ([]byte, error) { - type appsSecret AppsSecret - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - appsSecret - }{ - appsSecret: (appsSecret)(a), - Created: a.Created.Unix(), - ExpiresAt: a.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/balancetransaction.go b/balancetransaction.go index 5baa08ca3e..e76f72a458 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective. type BalanceTransactionReportingCategory string @@ -187,9 +184,9 @@ type BalanceTransaction struct { // Gross amount of this transaction (in cents (or local equivalent)). A positive value represents funds charged to another party, and a negative value represents funds sent to another party. Amount int64 `json:"amount"` // The date that the transaction's net funds become available in the Stripe balance. - AvailableOn time.Time `json:"available_on"` + AvailableOn int64 `json:"available_on"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -254,19 +251,12 @@ func (b *BalanceTransaction) UnmarshalJSON(data []byte) error { } type balanceTransaction BalanceTransaction - v := struct { - AvailableOn int64 `json:"available_on"` - Created int64 `json:"created"` - *balanceTransaction - }{ - balanceTransaction: (*balanceTransaction)(b), - } + var v balanceTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - b.AvailableOn = time.Unix(v.AvailableOn, 0) - b.Created = time.Unix(v.Created, 0) + *b = BalanceTransaction(v) return nil } @@ -324,23 +314,3 @@ func (b *BalanceTransactionSource) UnmarshalJSON(data []byte) error { } return err } - -// MarshalJSON handles serialization of a BalanceTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (b BalanceTransaction) MarshalJSON() ([]byte, error) { - type balanceTransaction BalanceTransaction - v := struct { - AvailableOn int64 `json:"available_on"` - Created int64 `json:"created"` - balanceTransaction - }{ - balanceTransaction: (balanceTransaction)(b), - AvailableOn: b.AvailableOn.Unix(), - Created: b.Created.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billing_alerttriggered.go b/billing_alerttriggered.go index 79140dfd00..06554a4bc9 100644 --- a/billing_alerttriggered.go +++ b/billing_alerttriggered.go @@ -6,16 +6,11 @@ package stripe -import ( - "encoding/json" - "time" -) - type BillingAlertTriggered struct { // A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests. Alert *BillingAlert `json:"alert"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // ID of customer for which the alert triggered Customer string `json:"customer"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -25,39 +20,3 @@ type BillingAlertTriggered struct { // The value triggering the alert Value int64 `json:"value"` } - -// UnmarshalJSON handles deserialization of a BillingAlertTriggered. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingAlertTriggered) UnmarshalJSON(data []byte) error { - type billingAlertTriggered BillingAlertTriggered - v := struct { - Created int64 `json:"created"` - *billingAlertTriggered - }{ - billingAlertTriggered: (*billingAlertTriggered)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a BillingAlertTriggered. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingAlertTriggered) MarshalJSON() ([]byte, error) { - type billingAlertTriggered BillingAlertTriggered - v := struct { - Created int64 `json:"created"` - billingAlertTriggered - }{ - billingAlertTriggered: (billingAlertTriggered)(b), - Created: b.Created.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billing_creditbalancetransaction.go b/billing_creditbalancetransaction.go index 4ce3c9a4ee..5127b2be75 100644 --- a/billing_creditbalancetransaction.go +++ b/billing_creditbalancetransaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The type of this amount. We currently only support `monetary` billing credits. type BillingCreditBalanceTransactionCreditAmountType string @@ -149,7 +146,7 @@ type BillingCreditBalanceTransactionDebit struct { type BillingCreditBalanceTransaction struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Credit details for this credit balance transaction. Only present if type is `credit`. Credit *BillingCreditBalanceTransactionCredit `json:"credit"` // The credit grant associated with this credit balance transaction. @@ -157,7 +154,7 @@ type BillingCreditBalanceTransaction struct { // Debit details for this credit balance transaction. Only present if type is `debit`. Debit *BillingCreditBalanceTransactionDebit `json:"debit"` // The effective time of this credit balance transaction. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -187,38 +184,11 @@ func (b *BillingCreditBalanceTransaction) UnmarshalJSON(data []byte) error { } type billingCreditBalanceTransaction BillingCreditBalanceTransaction - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - *billingCreditBalanceTransaction - }{ - billingCreditBalanceTransaction: (*billingCreditBalanceTransaction)(b), - } + var v billingCreditBalanceTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - b.Created = time.Unix(v.Created, 0) - b.EffectiveAt = time.Unix(v.EffectiveAt, 0) + *b = BillingCreditBalanceTransaction(v) return nil } - -// MarshalJSON handles serialization of a BillingCreditBalanceTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingCreditBalanceTransaction) MarshalJSON() ([]byte, error) { - type billingCreditBalanceTransaction BillingCreditBalanceTransaction - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - billingCreditBalanceTransaction - }{ - billingCreditBalanceTransaction: (billingCreditBalanceTransaction)(b), - Created: b.Created.Unix(), - EffectiveAt: b.EffectiveAt.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billing_creditgrant.go b/billing_creditgrant.go index 00dd7e6682..179dca83af 100644 --- a/billing_creditgrant.go +++ b/billing_creditgrant.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The type of this amount. We currently only support `monetary` billing credits. type BillingCreditGrantAmountType string @@ -90,11 +87,11 @@ type BillingCreditGrantParams struct { // ID of the customer to receive the billing credits. Customer *string `form:"customer"` // The time when the billing credits become effective-when they're eligible for use. It defaults to the current timestamp if not specified. - EffectiveAt *time.Time `form:"effective_at"` + EffectiveAt *int64 `form:"effective_at"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The time when the billing credits created by this credit grant expire. If set to empty, the billing credits never expire. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // Set of key-value pairs that you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format. Metadata map[string]string `form:"metadata"` // A descriptive name shown in the Dashboard. @@ -170,13 +167,13 @@ type BillingCreditGrant struct { // The category of this credit grant. This is for tracking purposes and isn't displayed to the customer. Category BillingCreditGrantCategory `json:"category"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // ID of the customer receiving the billing credits. Customer *Customer `json:"customer"` // The time when the billing credits become effective-when they're eligible for use. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // The time when the billing credits expire. If not present, the billing credits don't expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -190,9 +187,9 @@ type BillingCreditGrant struct { // ID of the test clock this credit grant belongs to. TestClock *TestHelpersTestClock `json:"test_clock"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` // The time when this credit grant was voided. If not present, the credit grant hasn't been voided. - VoidedAt time.Time `json:"voided_at"` + VoidedAt int64 `json:"voided_at"` } // BillingCreditGrantList is a list of CreditGrants as retrieved from a list endpoint. @@ -212,50 +209,11 @@ func (b *BillingCreditGrant) UnmarshalJSON(data []byte) error { } type billingCreditGrant BillingCreditGrant - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - ExpiresAt int64 `json:"expires_at"` - Updated int64 `json:"updated"` - VoidedAt int64 `json:"voided_at"` - *billingCreditGrant - }{ - billingCreditGrant: (*billingCreditGrant)(b), - } + var v billingCreditGrant if err := json.Unmarshal(data, &v); err != nil { return err } - b.Created = time.Unix(v.Created, 0) - b.EffectiveAt = time.Unix(v.EffectiveAt, 0) - b.ExpiresAt = time.Unix(v.ExpiresAt, 0) - b.Updated = time.Unix(v.Updated, 0) - b.VoidedAt = time.Unix(v.VoidedAt, 0) + *b = BillingCreditGrant(v) return nil } - -// MarshalJSON handles serialization of a BillingCreditGrant. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingCreditGrant) MarshalJSON() ([]byte, error) { - type billingCreditGrant BillingCreditGrant - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - ExpiresAt int64 `json:"expires_at"` - Updated int64 `json:"updated"` - VoidedAt int64 `json:"voided_at"` - billingCreditGrant - }{ - billingCreditGrant: (billingCreditGrant)(b), - Created: b.Created.Unix(), - EffectiveAt: b.EffectiveAt.Unix(), - ExpiresAt: b.ExpiresAt.Unix(), - Updated: b.Updated.Unix(), - VoidedAt: b.VoidedAt.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billing_meter.go b/billing_meter.go index d25011ab0d..f6f53bf4f2 100644 --- a/billing_meter.go +++ b/billing_meter.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The method for mapping a meter event to a customer. type BillingMeterCustomerMappingType string @@ -140,7 +137,7 @@ type BillingMeterDefaultAggregation struct { } type BillingMeterStatusTransitions struct { // The time the meter was deactivated, if any. Measured in seconds since Unix epoch. - DeactivatedAt time.Time `json:"deactivated_at"` + DeactivatedAt int64 `json:"deactivated_at"` } type BillingMeterValueSettings struct { // The key in the meter event payload to use as the value for this meter. @@ -153,7 +150,7 @@ type BillingMeterValueSettings struct { type BillingMeter struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` CustomerMapping *BillingMeterCustomerMapping `json:"customer_mapping"` DefaultAggregation *BillingMeterDefaultAggregation `json:"default_aggregation"` // The meter's name. @@ -172,7 +169,7 @@ type BillingMeter struct { Status BillingMeterStatus `json:"status"` StatusTransitions *BillingMeterStatusTransitions `json:"status_transitions"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` ValueSettings *BillingMeterValueSettings `json:"value_settings"` } @@ -193,74 +190,11 @@ func (b *BillingMeter) UnmarshalJSON(data []byte) error { } type billingMeter BillingMeter - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - *billingMeter - }{ - billingMeter: (*billingMeter)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.Created = time.Unix(v.Created, 0) - b.Updated = time.Unix(v.Updated, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a BillingMeterStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingMeterStatusTransitions) UnmarshalJSON(data []byte) error { - type billingMeterStatusTransitions BillingMeterStatusTransitions - v := struct { - DeactivatedAt int64 `json:"deactivated_at"` - *billingMeterStatusTransitions - }{ - billingMeterStatusTransitions: (*billingMeterStatusTransitions)(b), - } + var v billingMeter if err := json.Unmarshal(data, &v); err != nil { return err } - b.DeactivatedAt = time.Unix(v.DeactivatedAt, 0) + *b = BillingMeter(v) return nil } - -// MarshalJSON handles serialization of a BillingMeterStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingMeterStatusTransitions) MarshalJSON() ([]byte, error) { - type billingMeterStatusTransitions BillingMeterStatusTransitions - v := struct { - DeactivatedAt int64 `json:"deactivated_at"` - billingMeterStatusTransitions - }{ - billingMeterStatusTransitions: (billingMeterStatusTransitions)(b), - DeactivatedAt: b.DeactivatedAt.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} - -// MarshalJSON handles serialization of a BillingMeter. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingMeter) MarshalJSON() ([]byte, error) { - type billingMeter BillingMeter - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - billingMeter - }{ - billingMeter: (billingMeter)(b), - Created: b.Created.Unix(), - Updated: b.Updated.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billing_metererrorreport.go b/billing_metererrorreport.go index a969c7565a..057bb0bc2c 100644 --- a/billing_metererrorreport.go +++ b/billing_metererrorreport.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - type BillingMeterErrorReportReasonErrorTypeSampleErrorAPIRequest struct { // Unique identifier for the object. ID string `json:"id"` @@ -54,47 +49,7 @@ type BillingMeterErrorReport struct { // Summary of invalid events Summary string `json:"summary"` // Time when validation ended. Measured in seconds since the Unix epoch - ValidationEnd time.Time `json:"validation_end"` + ValidationEnd int64 `json:"validation_end"` // Time when validation started. Measured in seconds since the Unix epoch - ValidationStart time.Time `json:"validation_start"` -} - -// UnmarshalJSON handles deserialization of a BillingMeterErrorReport. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingMeterErrorReport) UnmarshalJSON(data []byte) error { - type billingMeterErrorReport BillingMeterErrorReport - v := struct { - ValidationEnd int64 `json:"validation_end"` - ValidationStart int64 `json:"validation_start"` - *billingMeterErrorReport - }{ - billingMeterErrorReport: (*billingMeterErrorReport)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.ValidationEnd = time.Unix(v.ValidationEnd, 0) - b.ValidationStart = time.Unix(v.ValidationStart, 0) - return nil -} - -// MarshalJSON handles serialization of a BillingMeterErrorReport. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingMeterErrorReport) MarshalJSON() ([]byte, error) { - type billingMeterErrorReport BillingMeterErrorReport - v := struct { - ValidationEnd int64 `json:"validation_end"` - ValidationStart int64 `json:"validation_start"` - billingMeterErrorReport - }{ - billingMeterErrorReport: (billingMeterErrorReport)(b), - ValidationEnd: b.ValidationEnd.Unix(), - ValidationStart: b.ValidationStart.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err + ValidationStart int64 `json:"validation_start"` } diff --git a/billing_meterevent.go b/billing_meterevent.go index f68bbaae83..e16178f892 100644 --- a/billing_meterevent.go +++ b/billing_meterevent.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Creates a billing meter event. type BillingMeterEventParams struct { Params `form:"*"` @@ -23,7 +18,7 @@ type BillingMeterEventParams struct { // The payload of the event. This must contain the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). Payload map[string]string `form:"payload"` // The time of the event. Measured in seconds since the Unix epoch. Must be within the past 35 calendar days or up to 5 minutes in the future. Defaults to current timestamp if not specified. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` } // AddExpand appends a new field to expand. @@ -35,7 +30,7 @@ func (p *BillingMeterEventParams) AddExpand(f string) { type BillingMeterEvent struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The name of the meter event. Corresponds with the `event_name` field on a meter. EventName string `json:"event_name"` // A unique identifier for the event. @@ -47,45 +42,5 @@ type BillingMeterEvent struct { // The payload of the event. This contains the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://stripe.com/docs/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). Payload map[string]string `json:"payload"` // The timestamp passed in when creating the event. Measured in seconds since the Unix epoch. - Timestamp time.Time `json:"timestamp"` -} - -// UnmarshalJSON handles deserialization of a BillingMeterEvent. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingMeterEvent) UnmarshalJSON(data []byte) error { - type billingMeterEvent BillingMeterEvent - v := struct { - Created int64 `json:"created"` - Timestamp int64 `json:"timestamp"` - *billingMeterEvent - }{ - billingMeterEvent: (*billingMeterEvent)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.Created = time.Unix(v.Created, 0) - b.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// MarshalJSON handles serialization of a BillingMeterEvent. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingMeterEvent) MarshalJSON() ([]byte, error) { - type billingMeterEvent BillingMeterEvent - v := struct { - Created int64 `json:"created"` - Timestamp int64 `json:"timestamp"` - billingMeterEvent - }{ - billingMeterEvent: (billingMeterEvent)(b), - Created: b.Created.Unix(), - Timestamp: b.Timestamp.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err + Timestamp int64 `json:"timestamp"` } diff --git a/billing_metereventsummary.go b/billing_metereventsummary.go index eb4a612288..c66ca6f069 100644 --- a/billing_metereventsummary.go +++ b/billing_metereventsummary.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Retrieve a list of billing meter event summaries. type BillingMeterEventSummaryListParams struct { ListParams `form:"*"` @@ -18,11 +13,11 @@ type BillingMeterEventSummaryListParams struct { // The customer for which to fetch event summaries. Customer *string `form:"customer"` // The timestamp from when to stop aggregating meter events (exclusive). Must be aligned with minute boundaries. - EndTime *time.Time `form:"end_time"` + EndTime *int64 `form:"end_time"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The timestamp from when to start aggregating meter events (inclusive). Must be aligned with minute boundaries. - StartTime *time.Time `form:"start_time"` + StartTime *int64 `form:"start_time"` // Specifies what granularity to use when generating event summaries. If not specified, a single event summary would be returned for the specified time range. For hourly granularity, start and end times must align with hour boundaries (e.g., 00:00, 01:00, ..., 23:00). For daily granularity, start and end times must align with UTC day boundaries (00:00 UTC). ValueGroupingWindow *string `form:"value_grouping_window"` } @@ -40,7 +35,7 @@ type BillingMeterEventSummary struct { // Aggregated value of all the events within `start_time` (inclusive) and `end_time` (inclusive). The aggregation strategy is defined on meter via `default_aggregation`. AggregatedValue float64 `json:"aggregated_value"` // End timestamp for this event summary (exclusive). Must be aligned with minute boundaries. - EndTime time.Time `json:"end_time"` + EndTime int64 `json:"end_time"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -50,7 +45,7 @@ type BillingMeterEventSummary struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Start timestamp for this event summary (inclusive). Must be aligned with minute boundaries. - StartTime time.Time `json:"start_time"` + StartTime int64 `json:"start_time"` } // BillingMeterEventSummaryList is a list of MeterEventSummaries as retrieved from a list endpoint. @@ -59,43 +54,3 @@ type BillingMeterEventSummaryList struct { ListMeta Data []*BillingMeterEventSummary `json:"data"` } - -// UnmarshalJSON handles deserialization of a BillingMeterEventSummary. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingMeterEventSummary) UnmarshalJSON(data []byte) error { - type billingMeterEventSummary BillingMeterEventSummary - v := struct { - EndTime int64 `json:"end_time"` - StartTime int64 `json:"start_time"` - *billingMeterEventSummary - }{ - billingMeterEventSummary: (*billingMeterEventSummary)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.EndTime = time.Unix(v.EndTime, 0) - b.StartTime = time.Unix(v.StartTime, 0) - return nil -} - -// MarshalJSON handles serialization of a BillingMeterEventSummary. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingMeterEventSummary) MarshalJSON() ([]byte, error) { - type billingMeterEventSummary BillingMeterEventSummary - v := struct { - EndTime int64 `json:"end_time"` - StartTime int64 `json:"start_time"` - billingMeterEventSummary - }{ - billingMeterEventSummary: (billingMeterEventSummary)(b), - EndTime: b.EndTime.Unix(), - StartTime: b.StartTime.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billingportal_configuration.go b/billingportal_configuration.go index db48ca5618..7c3db0f08c 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The types of customer updates that are supported. When empty, customers are not updateable. type BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate string @@ -333,7 +330,7 @@ type BillingPortalConfiguration struct { Application *Application `json:"application"` BusinessProfile *BillingPortalConfigurationBusinessProfile `json:"business_profile"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. DefaultReturnURL string `json:"default_return_url"` Features *BillingPortalConfigurationFeatures `json:"features"` @@ -349,7 +346,7 @@ type BillingPortalConfiguration struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` } // BillingPortalConfigurationList is a list of Configurations as retrieved from a list endpoint. @@ -369,38 +366,11 @@ func (b *BillingPortalConfiguration) UnmarshalJSON(data []byte) error { } type billingPortalConfiguration BillingPortalConfiguration - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - *billingPortalConfiguration - }{ - billingPortalConfiguration: (*billingPortalConfiguration)(b), - } + var v billingPortalConfiguration if err := json.Unmarshal(data, &v); err != nil { return err } - b.Created = time.Unix(v.Created, 0) - b.Updated = time.Unix(v.Updated, 0) + *b = BillingPortalConfiguration(v) return nil } - -// MarshalJSON handles serialization of a BillingPortalConfiguration. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingPortalConfiguration) MarshalJSON() ([]byte, error) { - type billingPortalConfiguration BillingPortalConfiguration - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - billingPortalConfiguration - }{ - billingPortalConfiguration: (billingPortalConfiguration)(b), - Created: b.Created.Unix(), - Updated: b.Updated.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/billingportal_session.go b/billingportal_session.go index 62f1f8a0bf..07ef744de6 100644 --- a/billingportal_session.go +++ b/billingportal_session.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The specified type of behavior after the flow is completed. type BillingPortalSessionFlowAfterCompletionType string @@ -264,7 +259,7 @@ type BillingPortalSession struct { // The configuration used by this session, describing the features available. Configuration *BillingPortalConfiguration `json:"configuration"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The ID of the customer for this session. Customer string `json:"customer"` // Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. @@ -284,39 +279,3 @@ type BillingPortalSession struct { // The short-lived URL of the session that gives customers access to the customer portal. URL string `json:"url"` } - -// UnmarshalJSON handles deserialization of a BillingPortalSession. -// This custom unmarshaling is needed to handle the time fields correctly. -func (b *BillingPortalSession) UnmarshalJSON(data []byte) error { - type billingPortalSession BillingPortalSession - v := struct { - Created int64 `json:"created"` - *billingPortalSession - }{ - billingPortalSession: (*billingPortalSession)(b), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - b.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a BillingPortalSession. -// This custom marshaling is needed to handle the time fields correctly. -func (b BillingPortalSession) MarshalJSON() ([]byte, error) { - type billingPortalSession BillingPortalSession - v := struct { - Created int64 `json:"created"` - billingPortalSession - }{ - billingPortalSession: (billingPortalSession)(b), - Created: b.Created.Unix(), - } - bb, err := json.Marshal(v) - if err != nil { - return nil, err - } - return bb, err -} diff --git a/capability.go b/capability.go index 27f7adaff0..f0bdbc5a0f 100644 --- a/capability.go +++ b/capability.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // This is typed as an enum for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is null because fields in `future_requirements` will never disable the account. type CapabilityFutureRequirementsDisabledReason string @@ -108,7 +103,7 @@ type CapabilityFutureRequirements struct { // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. Alternatives []*CapabilityFutureRequirementsAlternative `json:"alternatives"` // Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning. - CurrentDeadline time.Time `json:"current_deadline"` + CurrentDeadline int64 `json:"current_deadline"` // Fields that need to be collected to keep the capability enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash. CurrentlyDue []string `json:"currently_due"` // This is typed as an enum for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is null because fields in `future_requirements` will never disable the account. @@ -134,7 +129,7 @@ type CapabilityRequirements struct { // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. Alternatives []*CapabilityRequirementsAlternative `json:"alternatives"` // Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account. These fields may disable the capability sooner if the next threshold is reached before they are collected. - CurrentDeadline time.Time `json:"current_deadline"` + CurrentDeadline int64 `json:"current_deadline"` // Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled. CurrentlyDue []string `json:"currently_due"` // Description of why the capability is disabled. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification). @@ -164,7 +159,7 @@ type Capability struct { // Whether the capability has been requested. Requested bool `json:"requested"` // Time at which the capability was requested. Measured in seconds since the Unix epoch. - RequestedAt time.Time `json:"requested_at"` + RequestedAt int64 `json:"requested_at"` Requirements *CapabilityRequirements `json:"requirements"` // The status of the capability. Status CapabilityStatus `json:"status"` @@ -176,111 +171,3 @@ type CapabilityList struct { ListMeta Data []*Capability `json:"data"` } - -// UnmarshalJSON handles deserialization of a CapabilityFutureRequirements. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CapabilityFutureRequirements) UnmarshalJSON(data []byte) error { - type capabilityFutureRequirements CapabilityFutureRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - *capabilityFutureRequirements - }{ - capabilityFutureRequirements: (*capabilityFutureRequirements)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CurrentDeadline = time.Unix(v.CurrentDeadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a CapabilityRequirements. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CapabilityRequirements) UnmarshalJSON(data []byte) error { - type capabilityRequirements CapabilityRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - *capabilityRequirements - }{ - capabilityRequirements: (*capabilityRequirements)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CurrentDeadline = time.Unix(v.CurrentDeadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a Capability. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *Capability) UnmarshalJSON(data []byte) error { - type capability Capability - v := struct { - RequestedAt int64 `json:"requested_at"` - *capability - }{ - capability: (*capability)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.RequestedAt = time.Unix(v.RequestedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a CapabilityFutureRequirements. -// This custom marshaling is needed to handle the time fields correctly. -func (c CapabilityFutureRequirements) MarshalJSON() ([]byte, error) { - type capabilityFutureRequirements CapabilityFutureRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - capabilityFutureRequirements - }{ - capabilityFutureRequirements: (capabilityFutureRequirements)(c), - CurrentDeadline: c.CurrentDeadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a CapabilityRequirements. -// This custom marshaling is needed to handle the time fields correctly. -func (c CapabilityRequirements) MarshalJSON() ([]byte, error) { - type capabilityRequirements CapabilityRequirements - v := struct { - CurrentDeadline int64 `json:"current_deadline"` - capabilityRequirements - }{ - capabilityRequirements: (capabilityRequirements)(c), - CurrentDeadline: c.CurrentDeadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Capability. -// This custom marshaling is needed to handle the time fields correctly. -func (c Capability) MarshalJSON() ([]byte, error) { - type capability Capability - v := struct { - RequestedAt int64 `json:"requested_at"` - capability - }{ - capability: (capability)(c), - RequestedAt: c.RequestedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/capital_financingoffer.go b/capital_financingoffer.go index a137005374..9fd88ea1a5 100644 --- a/capital_financingoffer.go +++ b/capital_financingoffer.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of financing being offered. type CapitalFinancingOfferFinancingType string @@ -161,9 +156,9 @@ type CapitalFinancingOffer struct { // The ID of the merchant associated with this financing object. Account string `json:"account"` // The time at which this financing offer was charged off, if applicable. Given in seconds since unix epoch. - ChargedOffAt time.Time `json:"charged_off_at"` + ChargedOffAt int64 `json:"charged_off_at"` // Time at which the offer was created. Given in seconds since unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Time at which the offer expires. Given in seconds since unix epoch. ExpiresAfter float64 `json:"expires_after"` // The type of financing being offered. @@ -198,43 +193,3 @@ type CapitalFinancingOfferList struct { ListMeta Data []*CapitalFinancingOffer `json:"data"` } - -// UnmarshalJSON handles deserialization of a CapitalFinancingOffer. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CapitalFinancingOffer) UnmarshalJSON(data []byte) error { - type capitalFinancingOffer CapitalFinancingOffer - v := struct { - ChargedOffAt int64 `json:"charged_off_at"` - Created int64 `json:"created"` - *capitalFinancingOffer - }{ - capitalFinancingOffer: (*capitalFinancingOffer)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.ChargedOffAt = time.Unix(v.ChargedOffAt, 0) - c.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a CapitalFinancingOffer. -// This custom marshaling is needed to handle the time fields correctly. -func (c CapitalFinancingOffer) MarshalJSON() ([]byte, error) { - type capitalFinancingOffer CapitalFinancingOffer - v := struct { - ChargedOffAt int64 `json:"charged_off_at"` - Created int64 `json:"created"` - capitalFinancingOffer - }{ - capitalFinancingOffer: (capitalFinancingOffer)(c), - ChargedOffAt: c.ChargedOffAt.Unix(), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/capital_financingtransaction.go b/capital_financingtransaction.go index f7df8857ee..634b60dfe5 100644 --- a/capital_financingtransaction.go +++ b/capital_financingtransaction.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The reason for the financing transaction (if applicable). type CapitalFinancingTransactionDetailsReason string @@ -104,7 +99,7 @@ type CapitalFinancingTransaction struct { // The ID of the merchant associated with this financing transaction. Account string `json:"account"` // Time at which the financing transaction was created. Given in seconds since unix epoch. - CreatedAt time.Time `json:"created_at"` + CreatedAt int64 `json:"created_at"` // This is an object representing a transaction on a Capital financing offer. Details *CapitalFinancingTransactionDetails `json:"details"` // The Capital financing offer for this financing transaction. @@ -131,39 +126,3 @@ type CapitalFinancingTransactionList struct { ListMeta Data []*CapitalFinancingTransaction `json:"data"` } - -// UnmarshalJSON handles deserialization of a CapitalFinancingTransaction. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CapitalFinancingTransaction) UnmarshalJSON(data []byte) error { - type capitalFinancingTransaction CapitalFinancingTransaction - v := struct { - CreatedAt int64 `json:"created_at"` - *capitalFinancingTransaction - }{ - capitalFinancingTransaction: (*capitalFinancingTransaction)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CreatedAt = time.Unix(v.CreatedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a CapitalFinancingTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (c CapitalFinancingTransaction) MarshalJSON() ([]byte, error) { - type capitalFinancingTransaction CapitalFinancingTransaction - v := struct { - CreatedAt int64 `json:"created_at"` - capitalFinancingTransaction - }{ - capitalFinancingTransaction: (capitalFinancingTransaction)(c), - CreatedAt: c.CreatedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/charge.go b/charge.go index 4c85852dcc..95d4c1b8e7 100644 --- a/charge.go +++ b/charge.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Assessments from Stripe. If set, the value is `fraudulent`. type ChargeFraudStripeReport string @@ -616,7 +613,7 @@ type ChargePaymentDetailsCarRentalParams struct { // Car pick-up address. PickupAddress *AddressParams `form:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt *time.Time `form:"pickup_at"` + PickupAt *int64 `form:"pickup_at"` // Rental rate. RateAmount *int64 `form:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -626,7 +623,7 @@ type ChargePaymentDetailsCarRentalParams struct { // Car return address. ReturnAddress *AddressParams `form:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt *time.Time `form:"return_at"` + ReturnAt *int64 `form:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt *bool `form:"tax_exempt"` } @@ -668,13 +665,13 @@ type ChargePaymentDetailsEventDetailsParams struct { // Delivery details for this purchase. Delivery *ChargePaymentDetailsEventDetailsDeliveryParams `form:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre *string `form:"genre"` // The name of the event. Name *string `form:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Affiliate details for this purchase. @@ -714,11 +711,11 @@ type ChargePaymentDetailsFlightSegmentParams struct { // The International Air Transport Association (IATA) airport code for the arrival airport. ArrivalAirport *string `form:"arrival_airport"` // The arrival time for the flight segment. Measured in seconds since the Unix epoch. - ArrivesAt *time.Time `form:"arrives_at"` + ArrivesAt *int64 `form:"arrives_at"` // The International Air Transport Association (IATA) carrier code of the carrier operating the flight segment. Carrier *string `form:"carrier"` // The departure time for the flight segment. Measured in seconds since the Unix epoch. - DepartsAt *time.Time `form:"departs_at"` + DepartsAt *int64 `form:"departs_at"` // The International Air Transport Association (IATA) airport code for the departure airport. DepartureAirport *string `form:"departure_airport"` // The flight number associated with the segment @@ -790,9 +787,9 @@ type ChargePaymentDetailsLodgingParams struct { // The lodging category Category *string `form:"category"` // Loding check-in time. Measured in seconds since the Unix epoch. - CheckinAt *time.Time `form:"checkin_at"` + CheckinAt *int64 `form:"checkin_at"` // Lodging check-out time. Measured in seconds since the Unix epoch. - CheckoutAt *time.Time `form:"checkout_at"` + CheckoutAt *int64 `form:"checkout_at"` // The customer service phone number of the lodging company. CustomerServicePhoneNumber *string `form:"customer_service_phone_number"` // The daily lodging room rate. @@ -846,11 +843,11 @@ type ChargePaymentDetailsSubscriptionParams struct { // Subscription billing details for this purchase. BillingInterval *ChargePaymentDetailsSubscriptionBillingIntervalParams `form:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription Name *string `form:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Provides industry-specific information about the charge. @@ -943,7 +940,7 @@ type ChargeCapturePaymentDetailsCarRentalParams struct { // Car pick-up address. PickupAddress *AddressParams `form:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt *time.Time `form:"pickup_at"` + PickupAt *int64 `form:"pickup_at"` // Rental rate. RateAmount *int64 `form:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -953,7 +950,7 @@ type ChargeCapturePaymentDetailsCarRentalParams struct { // Car return address. ReturnAddress *AddressParams `form:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt *time.Time `form:"return_at"` + ReturnAt *int64 `form:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt *bool `form:"tax_exempt"` } @@ -995,13 +992,13 @@ type ChargeCapturePaymentDetailsEventDetailsParams struct { // Delivery details for this purchase. Delivery *ChargeCapturePaymentDetailsEventDetailsDeliveryParams `form:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre *string `form:"genre"` // The name of the event. Name *string `form:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Affiliate details for this purchase. @@ -1041,11 +1038,11 @@ type ChargeCapturePaymentDetailsFlightSegmentParams struct { // The International Air Transport Association (IATA) airport code for the arrival airport. ArrivalAirport *string `form:"arrival_airport"` // The arrival time for the flight segment. Measured in seconds since the Unix epoch. - ArrivesAt *time.Time `form:"arrives_at"` + ArrivesAt *int64 `form:"arrives_at"` // The International Air Transport Association (IATA) carrier code of the carrier operating the flight segment. Carrier *string `form:"carrier"` // The departure time for the flight segment. Measured in seconds since the Unix epoch. - DepartsAt *time.Time `form:"departs_at"` + DepartsAt *int64 `form:"departs_at"` // The International Air Transport Association (IATA) airport code for the departure airport. DepartureAirport *string `form:"departure_airport"` // The flight number associated with the segment @@ -1117,9 +1114,9 @@ type ChargeCapturePaymentDetailsLodgingParams struct { // The lodging category Category *string `form:"category"` // Loding check-in time. Measured in seconds since the Unix epoch. - CheckinAt *time.Time `form:"checkin_at"` + CheckinAt *int64 `form:"checkin_at"` // Lodging check-out time. Measured in seconds since the Unix epoch. - CheckoutAt *time.Time `form:"checkout_at"` + CheckoutAt *int64 `form:"checkout_at"` // The customer service phone number of the lodging company. CustomerServicePhoneNumber *string `form:"customer_service_phone_number"` // The daily lodging room rate. @@ -1173,11 +1170,11 @@ type ChargeCapturePaymentDetailsSubscriptionParams struct { // Subscription billing details for this purchase. BillingInterval *ChargeCapturePaymentDetailsSubscriptionBillingIntervalParams `form:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription Name *string `form:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Provides industry-specific information about the charge. @@ -1577,7 +1574,7 @@ type ChargePaymentMethodDetailsCard struct { // Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. Brand PaymentMethodCardBrand `json:"brand"` // When using manual capture, a future timestamp at which the charge will be automatically refunded if uncaptured. - CaptureBefore time.Time `json:"capture_before"` + CaptureBefore int64 `json:"capture_before"` // Check results by Card networks on Card address and CVC at time of payment. Checks *ChargePaymentMethodDetailsCardChecks `json:"checks"` // Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. @@ -1633,7 +1630,7 @@ type ChargePaymentMethodDetailsCard struct { // Details about payments collected offline. type ChargePaymentMethodDetailsCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type ChargePaymentMethodDetailsCardPresentOfflineType `json:"type"` } @@ -1671,7 +1668,7 @@ type ChargePaymentMethodDetailsCardPresent struct { // The [product code](https://stripe.com/docs/card-product-codes) that identifies the specific program or product associated with a card. BrandProduct string `json:"brand_product"` // When using manual capture, a future timestamp after which the charge will be automatically refunded if uncaptured. - CaptureBefore time.Time `json:"capture_before"` + CaptureBefore int64 `json:"capture_before"` // The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. CardholderName string `json:"cardholder_name"` // Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. @@ -2226,7 +2223,7 @@ type Charge struct { // If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured. Captured bool `json:"captured"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // ID of the customer this charge is for if one exists. @@ -2326,142 +2323,11 @@ func (c *Charge) UnmarshalJSON(data []byte) error { } type charge Charge - v := struct { - Created int64 `json:"created"` - *charge - }{ - charge: (*charge)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ChargePaymentMethodDetailsCard. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ChargePaymentMethodDetailsCard) UnmarshalJSON(data []byte) error { - type chargePaymentMethodDetailsCard ChargePaymentMethodDetailsCard - v := struct { - CaptureBefore int64 `json:"capture_before"` - *chargePaymentMethodDetailsCard - }{ - chargePaymentMethodDetailsCard: (*chargePaymentMethodDetailsCard)(c), - } + var v charge if err := json.Unmarshal(data, &v); err != nil { return err } - c.CaptureBefore = time.Unix(v.CaptureBefore, 0) + *c = Charge(v) return nil } - -// UnmarshalJSON handles deserialization of a ChargePaymentMethodDetailsCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ChargePaymentMethodDetailsCardPresentOffline) UnmarshalJSON(data []byte) error { - type chargePaymentMethodDetailsCardPresentOffline ChargePaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *chargePaymentMethodDetailsCardPresentOffline - }{ - chargePaymentMethodDetailsCardPresentOffline: (*chargePaymentMethodDetailsCardPresentOffline)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.StoredAt = time.Unix(v.StoredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ChargePaymentMethodDetailsCardPresent. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ChargePaymentMethodDetailsCardPresent) UnmarshalJSON(data []byte) error { - type chargePaymentMethodDetailsCardPresent ChargePaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - *chargePaymentMethodDetailsCardPresent - }{ - chargePaymentMethodDetailsCardPresent: (*chargePaymentMethodDetailsCardPresent)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CaptureBefore = time.Unix(v.CaptureBefore, 0) - return nil -} - -// MarshalJSON handles serialization of a ChargePaymentMethodDetailsCard. -// This custom marshaling is needed to handle the time fields correctly. -func (c ChargePaymentMethodDetailsCard) MarshalJSON() ([]byte, error) { - type chargePaymentMethodDetailsCard ChargePaymentMethodDetailsCard - v := struct { - CaptureBefore int64 `json:"capture_before"` - chargePaymentMethodDetailsCard - }{ - chargePaymentMethodDetailsCard: (chargePaymentMethodDetailsCard)(c), - CaptureBefore: c.CaptureBefore.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ChargePaymentMethodDetailsCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (c ChargePaymentMethodDetailsCardPresentOffline) MarshalJSON() ([]byte, error) { - type chargePaymentMethodDetailsCardPresentOffline ChargePaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - chargePaymentMethodDetailsCardPresentOffline - }{ - chargePaymentMethodDetailsCardPresentOffline: (chargePaymentMethodDetailsCardPresentOffline)(c), - StoredAt: c.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ChargePaymentMethodDetailsCardPresent. -// This custom marshaling is needed to handle the time fields correctly. -func (c ChargePaymentMethodDetailsCardPresent) MarshalJSON() ([]byte, error) { - type chargePaymentMethodDetailsCardPresent ChargePaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - chargePaymentMethodDetailsCardPresent - }{ - chargePaymentMethodDetailsCardPresent: (chargePaymentMethodDetailsCardPresent)(c), - CaptureBefore: c.CaptureBefore.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Charge. -// This custom marshaling is needed to handle the time fields correctly. -func (c Charge) MarshalJSON() ([]byte, error) { - type charge Charge - v := struct { - Created int64 `json:"created"` - charge - }{ - charge: (charge)(c), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/checkout_session.go b/checkout_session.go index 9a2fc94555..6409706b8f 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Type of the account referenced. type CheckoutSessionAutomaticTaxLiabilityType string @@ -2587,7 +2582,7 @@ type CheckoutSessionSubscriptionDataParams struct { // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. To use an application fee percent, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions). ApplicationFeePercent *float64 `form:"application_fee_percent"` // A future timestamp to anchor the subscription's billing cycle for new subscriptions. - BillingCycleAnchor *time.Time `form:"billing_cycle_anchor"` + BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` // The tax rates that will apply to any subscription item that does not have // `tax_rates` set. Invoices created will have their `default_tax_rates` populated // from the subscription. @@ -2609,7 +2604,7 @@ type CheckoutSessionSubscriptionDataParams struct { // Unix timestamp representing the end of the trial period the customer // will get before being charged for the first time. Has to be at least // 48 hours in the future. - TrialEnd *time.Time `form:"trial_end"` + TrialEnd *int64 `form:"trial_end"` // Integer representing the number of trial period days before the // customer is charged for the first time. Has to be at least 1. TrialPeriodDays *int64 `form:"trial_period_days"` @@ -2698,7 +2693,7 @@ type CheckoutSessionParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // Generate a post-purchase Invoice for one-time payments. InvoiceCreation *CheckoutSessionInvoiceCreationParams `form:"invoice_creation"` // A list of items the customer is purchasing. @@ -2859,7 +2854,7 @@ type CheckoutSessionAfterExpirationRecovery struct { // Checkout Session object upon expiration. Enabled bool `json:"enabled"` // The timestamp at which the recovery URL will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // URL that creates a new Checkout Session when clicked that is a copy of this expired Checkout Session URL string `json:"url"` } @@ -3811,7 +3806,7 @@ type CheckoutSession struct { // When set, provides configuration for the Checkout Session to gather active consent from customers. ConsentCollection *CheckoutSessionConsentCollection `json:"consent_collection"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Currency conversion details for [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing) sessions @@ -3838,7 +3833,7 @@ type CheckoutSession struct { // List of coupons and promotion codes attached to the Checkout Session. Discounts []*CheckoutSessionDiscount `json:"discounts"` // The timestamp at which the Checkout Session will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // ID of the invoice created by the Checkout Session, if it exists. @@ -3923,79 +3918,3 @@ type CheckoutSessionList struct { ListMeta Data []*CheckoutSession `json:"data"` } - -// UnmarshalJSON handles deserialization of a CheckoutSessionAfterExpirationRecovery. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CheckoutSessionAfterExpirationRecovery) UnmarshalJSON(data []byte) error { - type checkoutSessionAfterExpirationRecovery CheckoutSessionAfterExpirationRecovery - v := struct { - ExpiresAt int64 `json:"expires_at"` - *checkoutSessionAfterExpirationRecovery - }{ - checkoutSessionAfterExpirationRecovery: (*checkoutSessionAfterExpirationRecovery)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a CheckoutSession. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CheckoutSession) UnmarshalJSON(data []byte) error { - type checkoutSession CheckoutSession - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *checkoutSession - }{ - checkoutSession: (*checkoutSession)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.Created = time.Unix(v.Created, 0) - c.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a CheckoutSessionAfterExpirationRecovery. -// This custom marshaling is needed to handle the time fields correctly. -func (c CheckoutSessionAfterExpirationRecovery) MarshalJSON() ([]byte, error) { - type checkoutSessionAfterExpirationRecovery CheckoutSessionAfterExpirationRecovery - v := struct { - ExpiresAt int64 `json:"expires_at"` - checkoutSessionAfterExpirationRecovery - }{ - checkoutSessionAfterExpirationRecovery: (checkoutSessionAfterExpirationRecovery)(c), - ExpiresAt: c.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a CheckoutSession. -// This custom marshaling is needed to handle the time fields correctly. -func (c CheckoutSession) MarshalJSON() ([]byte, error) { - type checkoutSession CheckoutSession - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - checkoutSession - }{ - checkoutSession: (checkoutSession)(c), - Created: c.Created.Unix(), - ExpiresAt: c.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/climate_order.go b/climate_order.go index f2ce13cb01..3fb9867c80 100644 --- a/climate_order.go +++ b/climate_order.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Reason for the cancellation of this order. type ClimateOrderCancellationReason string @@ -123,7 +118,7 @@ type ClimateOrderDeliveryDetailLocation struct { // Details about the delivery of carbon removal for this order. type ClimateOrderDeliveryDetail struct { // Time at which the delivery occurred. Measured in seconds since the Unix epoch. - DeliveredAt time.Time `json:"delivered_at"` + DeliveredAt int64 `json:"delivered_at"` // Specific location of this delivery. Location *ClimateOrderDeliveryDetailLocation `json:"location"` // Quantity of carbon removal supplied by this delivery. @@ -146,21 +141,21 @@ type ClimateOrder struct { AmountTotal int64 `json:"amount_total"` Beneficiary *ClimateOrderBeneficiary `json:"beneficiary"` // Time at which the order was canceled. Measured in seconds since the Unix epoch. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Reason for the cancellation of this order. CancellationReason ClimateOrderCancellationReason `json:"cancellation_reason"` // For delivered orders, a URL to a delivery certificate for the order. Certificate string `json:"certificate"` // Time at which the order was confirmed. Measured in seconds since the Unix epoch. - ConfirmedAt time.Time `json:"confirmed_at"` + ConfirmedAt int64 `json:"confirmed_at"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order. Currency Currency `json:"currency"` // Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch. - DelayedAt time.Time `json:"delayed_at"` + DelayedAt int64 `json:"delayed_at"` // Time at which the order was delivered. Measured in seconds since the Unix epoch. - DeliveredAt time.Time `json:"delivered_at"` + DeliveredAt int64 `json:"delivered_at"` // Details about the delivery of carbon removal for this order. DeliveryDetails []*ClimateOrderDeliveryDetail `json:"delivery_details"` // The year this order is expected to be delivered. @@ -178,7 +173,7 @@ type ClimateOrder struct { // Unique ID for the Climate `Product` this order is purchasing. Product *ClimateProduct `json:"product"` // Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch. - ProductSubstitutedAt time.Time `json:"product_substituted_at"` + ProductSubstitutedAt int64 `json:"product_substituted_at"` // The current status of this order. Status ClimateOrderStatus `json:"status"` } @@ -189,95 +184,3 @@ type ClimateOrderList struct { ListMeta Data []*ClimateOrder `json:"data"` } - -// UnmarshalJSON handles deserialization of a ClimateOrderDeliveryDetail. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ClimateOrderDeliveryDetail) UnmarshalJSON(data []byte) error { - type climateOrderDeliveryDetail ClimateOrderDeliveryDetail - v := struct { - DeliveredAt int64 `json:"delivered_at"` - *climateOrderDeliveryDetail - }{ - climateOrderDeliveryDetail: (*climateOrderDeliveryDetail)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.DeliveredAt = time.Unix(v.DeliveredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ClimateOrder. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ClimateOrder) UnmarshalJSON(data []byte) error { - type climateOrder ClimateOrder - v := struct { - CanceledAt int64 `json:"canceled_at"` - ConfirmedAt int64 `json:"confirmed_at"` - Created int64 `json:"created"` - DelayedAt int64 `json:"delayed_at"` - DeliveredAt int64 `json:"delivered_at"` - ProductSubstitutedAt int64 `json:"product_substituted_at"` - *climateOrder - }{ - climateOrder: (*climateOrder)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CanceledAt = time.Unix(v.CanceledAt, 0) - c.ConfirmedAt = time.Unix(v.ConfirmedAt, 0) - c.Created = time.Unix(v.Created, 0) - c.DelayedAt = time.Unix(v.DelayedAt, 0) - c.DeliveredAt = time.Unix(v.DeliveredAt, 0) - c.ProductSubstitutedAt = time.Unix(v.ProductSubstitutedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a ClimateOrderDeliveryDetail. -// This custom marshaling is needed to handle the time fields correctly. -func (c ClimateOrderDeliveryDetail) MarshalJSON() ([]byte, error) { - type climateOrderDeliveryDetail ClimateOrderDeliveryDetail - v := struct { - DeliveredAt int64 `json:"delivered_at"` - climateOrderDeliveryDetail - }{ - climateOrderDeliveryDetail: (climateOrderDeliveryDetail)(c), - DeliveredAt: c.DeliveredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ClimateOrder. -// This custom marshaling is needed to handle the time fields correctly. -func (c ClimateOrder) MarshalJSON() ([]byte, error) { - type climateOrder ClimateOrder - v := struct { - CanceledAt int64 `json:"canceled_at"` - ConfirmedAt int64 `json:"confirmed_at"` - Created int64 `json:"created"` - DelayedAt int64 `json:"delayed_at"` - DeliveredAt int64 `json:"delivered_at"` - ProductSubstitutedAt int64 `json:"product_substituted_at"` - climateOrder - }{ - climateOrder: (climateOrder)(c), - CanceledAt: c.CanceledAt.Unix(), - ConfirmedAt: c.ConfirmedAt.Unix(), - Created: c.Created.Unix(), - DelayedAt: c.DelayedAt.Unix(), - DeliveredAt: c.DeliveredAt.Unix(), - ProductSubstitutedAt: c.ProductSubstitutedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/climate_product.go b/climate_product.go index 9929a36562..433cd79bf0 100644 --- a/climate_product.go +++ b/climate_product.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Lists all available Climate product objects. type ClimateProductListParams struct { @@ -50,7 +47,7 @@ type ClimateProductCurrentPricesPerMetricTon struct { type ClimateProduct struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Current prices for a metric ton of carbon removal in a currency's smallest unit. CurrentPricesPerMetricTon map[string]*ClimateProductCurrentPricesPerMetricTon `json:"current_prices_per_metric_ton"` // The year in which the carbon removal is expected to be delivered. @@ -88,34 +85,11 @@ func (c *ClimateProduct) UnmarshalJSON(data []byte) error { } type climateProduct ClimateProduct - v := struct { - Created int64 `json:"created"` - *climateProduct - }{ - climateProduct: (*climateProduct)(c), - } + var v climateProduct if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) + *c = ClimateProduct(v) return nil } - -// MarshalJSON handles serialization of a ClimateProduct. -// This custom marshaling is needed to handle the time fields correctly. -func (c ClimateProduct) MarshalJSON() ([]byte, error) { - type climateProduct ClimateProduct - v := struct { - Created int64 `json:"created"` - climateProduct - }{ - climateProduct: (climateProduct)(c), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/confirmationtoken.go b/confirmationtoken.go index 8ce5686e62..b048c319f2 100644 --- a/confirmationtoken.go +++ b/confirmationtoken.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. type ConfirmationTokenPaymentMethodPreviewAllowRedisplay string @@ -569,7 +564,7 @@ type ConfirmationTokenPaymentMethodPreviewCardChecks struct { // Details about payments collected offline. type ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOfflineType `json:"type"` } @@ -607,7 +602,7 @@ type ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsC // The [product code](https://stripe.com/docs/card-product-codes) that identifies the specific program or product associated with a card. BrandProduct string `json:"brand_product"` // When using manual capture, a future timestamp after which the charge will be automatically refunded if uncaptured. - CaptureBefore time.Time `json:"capture_before"` + CaptureBefore int64 `json:"capture_before"` // The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. CardholderName string `json:"cardholder_name"` // Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. @@ -773,7 +768,7 @@ type ConfirmationTokenPaymentMethodPreviewCardPresentNetworks struct { // Details about payment methods collected offline. type ConfirmationTokenPaymentMethodPreviewCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type ConfirmationTokenPaymentMethodPreviewCardPresentOfflineType `json:"type"` } @@ -1128,9 +1123,9 @@ type ConfirmationTokenShipping struct { type ConfirmationToken struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Time at which this ConfirmationToken expires and can no longer be used to confirm a PaymentIntent or SetupIntent. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -1158,151 +1153,3 @@ type ConfirmationToken struct { // Indicates whether the Stripe SDK is used to handle confirmation flow. Defaults to `true` on ConfirmationToken. UseStripeSDK bool `json:"use_stripe_sdk"` } - -// UnmarshalJSON handles deserialization of a ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline) UnmarshalJSON(data []byte) error { - type confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline - }{ - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline: (*confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.StoredAt = time.Unix(v.StoredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent) UnmarshalJSON(data []byte) error { - type confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - *confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent - }{ - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent: (*confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.CaptureBefore = time.Unix(v.CaptureBefore, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ConfirmationTokenPaymentMethodPreviewCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ConfirmationTokenPaymentMethodPreviewCardPresentOffline) UnmarshalJSON(data []byte) error { - type confirmationTokenPaymentMethodPreviewCardPresentOffline ConfirmationTokenPaymentMethodPreviewCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *confirmationTokenPaymentMethodPreviewCardPresentOffline - }{ - confirmationTokenPaymentMethodPreviewCardPresentOffline: (*confirmationTokenPaymentMethodPreviewCardPresentOffline)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.StoredAt = time.Unix(v.StoredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ConfirmationToken. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *ConfirmationToken) UnmarshalJSON(data []byte) error { - type confirmationToken ConfirmationToken - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *confirmationToken - }{ - confirmationToken: (*confirmationToken)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.Created = time.Unix(v.Created, 0) - c.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (c ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline) MarshalJSON() ([]byte, error) { - type confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline - }{ - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline: (confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresentOffline)(c), - StoredAt: c.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent. -// This custom marshaling is needed to handle the time fields correctly. -func (c ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent) MarshalJSON() ([]byte, error) { - type confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent - }{ - confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent: (confirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent)(c), - CaptureBefore: c.CaptureBefore.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ConfirmationTokenPaymentMethodPreviewCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (c ConfirmationTokenPaymentMethodPreviewCardPresentOffline) MarshalJSON() ([]byte, error) { - type confirmationTokenPaymentMethodPreviewCardPresentOffline ConfirmationTokenPaymentMethodPreviewCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - confirmationTokenPaymentMethodPreviewCardPresentOffline - }{ - confirmationTokenPaymentMethodPreviewCardPresentOffline: (confirmationTokenPaymentMethodPreviewCardPresentOffline)(c), - StoredAt: c.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ConfirmationToken. -// This custom marshaling is needed to handle the time fields correctly. -func (c ConfirmationToken) MarshalJSON() ([]byte, error) { - type confirmationToken ConfirmationToken - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - confirmationToken - }{ - confirmationToken: (confirmationToken)(c), - Created: c.Created.Unix(), - ExpiresAt: c.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/coupon.go b/coupon.go index 0823123e93..7603233120 100644 --- a/coupon.go +++ b/coupon.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // One of `forever`, `once`, and `repeating`. Describes how long a customer who applies this coupon will get the discount. type CouponDuration string @@ -50,7 +47,7 @@ type CouponParams struct { // A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed). PercentOff *float64 `form:"percent_off"` // Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers. - RedeemBy *time.Time `form:"redeem_by"` + RedeemBy *int64 `form:"redeem_by"` } // AddExpand appends a new field to expand. @@ -114,7 +111,7 @@ type Coupon struct { AmountOff int64 `json:"amount_off"` AppliesTo *CouponAppliesTo `json:"applies_to"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off. Currency Currency `json:"currency"` // Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). @@ -139,7 +136,7 @@ type Coupon struct { // Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a $ (or local equivalent)100 invoice $ (or local equivalent)50 instead. PercentOff float64 `json:"percent_off"` // Date after which the coupon can no longer be redeemed. - RedeemBy time.Time `json:"redeem_by"` + RedeemBy int64 `json:"redeem_by"` // Number of times this coupon has been applied to a customer. TimesRedeemed int64 `json:"times_redeemed"` // Taking account of the above properties, whether this coupon can still be applied to a customer. @@ -163,38 +160,11 @@ func (c *Coupon) UnmarshalJSON(data []byte) error { } type coupon Coupon - v := struct { - Created int64 `json:"created"` - RedeemBy int64 `json:"redeem_by"` - *coupon - }{ - coupon: (*coupon)(c), - } + var v coupon if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) - c.RedeemBy = time.Unix(v.RedeemBy, 0) + *c = Coupon(v) return nil } - -// MarshalJSON handles serialization of a Coupon. -// This custom marshaling is needed to handle the time fields correctly. -func (c Coupon) MarshalJSON() ([]byte, error) { - type coupon Coupon - v := struct { - Created int64 `json:"created"` - RedeemBy int64 `json:"redeem_by"` - coupon - }{ - coupon: (coupon)(c), - Created: c.Created.Unix(), - RedeemBy: c.RedeemBy.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/creditnote.go b/creditnote.go index ca987f58d3..8dfd8aaf16 100644 --- a/creditnote.go +++ b/creditnote.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Type of the pretax credit amount referenced. type CreditNotePretaxCreditAmountType string @@ -178,7 +175,7 @@ type CreditNoteParams struct { // The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice. CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. - EffectiveAt *time.Time `form:"effective_at"` + EffectiveAt *int64 `form:"effective_at"` // Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`. EmailType *string `form:"email_type"` // Specifies which fields in the response should be expanded. @@ -273,7 +270,7 @@ type CreditNotePreviewParams struct { // The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice. CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. - EffectiveAt *time.Time `form:"effective_at"` + EffectiveAt *int64 `form:"effective_at"` // Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`. EmailType *string `form:"email_type"` // Specifies which fields in the response should be expanded. @@ -368,7 +365,7 @@ type CreditNotePreviewLinesParams struct { // The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice. CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. - EffectiveAt *time.Time `form:"effective_at"` + EffectiveAt *int64 `form:"effective_at"` // Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`. EmailType *string `form:"email_type"` // Specifies which fields in the response should be expanded. @@ -514,7 +511,7 @@ type CreditNote struct { // This is the sum of all the shipping amounts. AmountShipping int64 `json:"amount_shipping"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // ID of the customer. @@ -526,7 +523,7 @@ type CreditNote struct { // The aggregate amounts calculated per discount for all line items. DiscountAmounts []*CreditNoteDiscountAmount `json:"discount_amounts"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // Unique identifier for the object. ID string `json:"id"` // ID of the invoice. @@ -574,7 +571,7 @@ type CreditNote struct { // Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid. Type CreditNoteType `json:"type"` // The time that the credit note was voided. - VoidedAt time.Time `json:"voided_at"` + VoidedAt int64 `json:"voided_at"` } // CreditNoteList is a list of CreditNotes as retrieved from a list endpoint. @@ -594,42 +591,11 @@ func (c *CreditNote) UnmarshalJSON(data []byte) error { } type creditNote CreditNote - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - VoidedAt int64 `json:"voided_at"` - *creditNote - }{ - creditNote: (*creditNote)(c), - } + var v creditNote if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) - c.EffectiveAt = time.Unix(v.EffectiveAt, 0) - c.VoidedAt = time.Unix(v.VoidedAt, 0) + *c = CreditNote(v) return nil } - -// MarshalJSON handles serialization of a CreditNote. -// This custom marshaling is needed to handle the time fields correctly. -func (c CreditNote) MarshalJSON() ([]byte, error) { - type creditNote CreditNote - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - VoidedAt int64 `json:"voided_at"` - creditNote - }{ - creditNote: (creditNote)(c), - Created: c.Created.Unix(), - EffectiveAt: c.EffectiveAt.Unix(), - VoidedAt: c.VoidedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/customer.go b/customer.go index 883ef7c36f..b43bdf5847 100644 --- a/customer.go +++ b/customer.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Surfaces if automatic tax computation is possible given the current customer location information. type CustomerTaxAutomaticTax string @@ -343,7 +340,7 @@ type Customer struct { // The current funds being held by Stripe on behalf of the customer. You can apply these funds towards payment intents when the source is "cash_balance". The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically. CashBalance *CashBalance `json:"cash_balance"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes. Currency Currency `json:"currency"` // ID of the default payment source for the customer. @@ -422,34 +419,11 @@ func (c *Customer) UnmarshalJSON(data []byte) error { } type customer Customer - v := struct { - Created int64 `json:"created"` - *customer - }{ - customer: (*customer)(c), - } + var v customer if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) + *c = Customer(v) return nil } - -// MarshalJSON handles serialization of a Customer. -// This custom marshaling is needed to handle the time fields correctly. -func (c Customer) MarshalJSON() ([]byte, error) { - type customer Customer - v := struct { - Created int64 `json:"created"` - customer - }{ - customer: (customer)(c), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/customerbalancetransaction.go b/customerbalancetransaction.go index fde8544460..f6e610c72c 100644 --- a/customerbalancetransaction.go +++ b/customerbalancetransaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Transaction type: `adjustment`, `applied_to_invoice`, `credit_note`, `initial`, `invoice_overpaid`, `invoice_too_large`, `invoice_too_small`, `unspent_receiver_credit`, or `unapplied_from_invoice`. See the [Customer Balance page](https://stripe.com/docs/billing/customer/balance#types) to learn more about transaction types. type CustomerBalanceTransactionType string @@ -82,7 +79,7 @@ type CustomerBalanceTransaction struct { // The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's `balance`. Amount int64 `json:"amount"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The ID of the credit note (if any) related to the transaction. CreditNote *CreditNote `json:"credit_note"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). @@ -124,34 +121,11 @@ func (c *CustomerBalanceTransaction) UnmarshalJSON(data []byte) error { } type customerBalanceTransaction CustomerBalanceTransaction - v := struct { - Created int64 `json:"created"` - *customerBalanceTransaction - }{ - customerBalanceTransaction: (*customerBalanceTransaction)(c), - } + var v customerBalanceTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) + *c = CustomerBalanceTransaction(v) return nil } - -// MarshalJSON handles serialization of a CustomerBalanceTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (c CustomerBalanceTransaction) MarshalJSON() ([]byte, error) { - type customerBalanceTransaction CustomerBalanceTransaction - v := struct { - Created int64 `json:"created"` - customerBalanceTransaction - }{ - customerBalanceTransaction: (customerBalanceTransaction)(c), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/customercashbalancetransaction.go b/customercashbalancetransaction.go index 852eac61e2..5ff50e549d 100644 --- a/customercashbalancetransaction.go +++ b/customercashbalancetransaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The funding method type used to fund the customer balance. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. type CustomerCashBalanceTransactionFundedBankTransferType string @@ -150,7 +147,7 @@ type CustomerCashBalanceTransaction struct { AdjustedForOverdraft *CustomerCashBalanceTransactionAdjustedForOverdraft `json:"adjusted_for_overdraft"` AppliedToPayment *CustomerCashBalanceTransactionAppliedToPayment `json:"applied_to_payment"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The customer whose available cash balance changed as a result of this transaction. @@ -190,34 +187,11 @@ func (c *CustomerCashBalanceTransaction) UnmarshalJSON(data []byte) error { } type customerCashBalanceTransaction CustomerCashBalanceTransaction - v := struct { - Created int64 `json:"created"` - *customerCashBalanceTransaction - }{ - customerCashBalanceTransaction: (*customerCashBalanceTransaction)(c), - } + var v customerCashBalanceTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - c.Created = time.Unix(v.Created, 0) + *c = CustomerCashBalanceTransaction(v) return nil } - -// MarshalJSON handles serialization of a CustomerCashBalanceTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (c CustomerCashBalanceTransaction) MarshalJSON() ([]byte, error) { - type customerCashBalanceTransaction CustomerCashBalanceTransaction - v := struct { - Created int64 `json:"created"` - customerCashBalanceTransaction - }{ - customerCashBalanceTransaction: (customerCashBalanceTransaction)(c), - Created: c.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/customersession.go b/customersession.go index eb5de3b6ef..be63c10e4d 100644 --- a/customersession.go +++ b/customersession.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // A list of [`allow_redisplay`](https://docs.stripe.com/api/payment_methods/object#payment_method_object-allow_redisplay) values that controls which saved payment methods the Payment Element displays by filtering to only show payment methods with an `allow_redisplay` value that is present in this list. // // If not specified, defaults to ["always"]. In order to display all saved payment methods, specify ["always", "limited", "unspecified"]. @@ -204,53 +199,13 @@ type CustomerSession struct { // Configuration for the components supported by this Customer Session. Components *CustomerSessionComponents `json:"components"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The Customer the Customer Session was created for. Customer *Customer `json:"customer"` // The timestamp at which this Customer Session will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. Livemode bool `json:"livemode"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` } - -// UnmarshalJSON handles deserialization of a CustomerSession. -// This custom unmarshaling is needed to handle the time fields correctly. -func (c *CustomerSession) UnmarshalJSON(data []byte) error { - type customerSession CustomerSession - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *customerSession - }{ - customerSession: (*customerSession)(c), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - c.Created = time.Unix(v.Created, 0) - c.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a CustomerSession. -// This custom marshaling is needed to handle the time fields correctly. -func (c CustomerSession) MarshalJSON() ([]byte, error) { - type customerSession CustomerSession - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - customerSession - }{ - customerSession: (customerSession)(c), - Created: c.Created.Unix(), - ExpiresAt: c.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/discount.go b/discount.go index 562a53d0d9..c671330fcc 100644 --- a/discount.go +++ b/discount.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). // It contains information about when the discount began, when it will end, and what it is applied to. @@ -26,7 +23,7 @@ type Discount struct { Customer *Customer `json:"customer"` Deleted bool `json:"deleted"` // If the coupon has a duration of `repeating`, the date that this discount will end. If the coupon has a duration of `once` or `forever`, this attribute will be null. - End time.Time `json:"end"` + End int64 `json:"end"` // The ID of the discount object. Discounts cannot be fetched by ID. Use `expand[]=discounts` in API calls to expand discount IDs in an array. ID string `json:"id"` // The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice. @@ -38,7 +35,7 @@ type Discount struct { // The promotion code applied to create this discount. PromotionCode *PromotionCode `json:"promotion_code"` // Date that the coupon was applied. - Start time.Time `json:"start"` + Start int64 `json:"start"` // The subscription that this coupon is applied to, if it is applied to a particular subscription. Subscription string `json:"subscription"` // The subscription item that this coupon is applied to, if it is applied to a particular subscription item. @@ -55,38 +52,11 @@ func (d *Discount) UnmarshalJSON(data []byte) error { } type discount Discount - v := struct { - End int64 `json:"end"` - Start int64 `json:"start"` - *discount - }{ - discount: (*discount)(d), - } + var v discount if err := json.Unmarshal(data, &v); err != nil { return err } - d.End = time.Unix(v.End, 0) - d.Start = time.Unix(v.Start, 0) + *d = Discount(v) return nil } - -// MarshalJSON handles serialization of a Discount. -// This custom marshaling is needed to handle the time fields correctly. -func (d Discount) MarshalJSON() ([]byte, error) { - type discount Discount - v := struct { - End int64 `json:"end"` - Start int64 `json:"start"` - discount - }{ - discount: (discount)(d), - End: d.End.Unix(), - Start: d.Start.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/dispute.go b/dispute.go index fe5238e220..2dd2a78b49 100644 --- a/dispute.go +++ b/dispute.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // List of eligibility types that are included in `enhanced_evidence`. type DisputeEnhancedEligibilityType string @@ -418,7 +415,7 @@ type DisputeEvidenceDetailsEnhancedEligibility struct { } type DisputeEvidenceDetails struct { // Date by which evidence must be submitted in order to successfully challenge dispute. Will be 0 if the customer's bank or credit card company doesn't allow a response for this particular dispute. - DueBy time.Time `json:"due_by"` + DueBy int64 `json:"due_by"` EnhancedEligibility *DisputeEvidenceDetailsEnhancedEligibility `json:"enhanced_eligibility"` // Whether evidence has been staged for this dispute. HasEvidence bool `json:"has_evidence"` @@ -472,7 +469,7 @@ type Dispute struct { // ID of the charge that's disputed. Charge *Charge `json:"charge"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // List of eligibility types that are included in `enhanced_evidence`. @@ -517,70 +514,11 @@ func (d *Dispute) UnmarshalJSON(data []byte) error { } type dispute Dispute - v := struct { - Created int64 `json:"created"` - *dispute - }{ - dispute: (*dispute)(d), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - d.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a DisputeEvidenceDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (d *DisputeEvidenceDetails) UnmarshalJSON(data []byte) error { - type disputeEvidenceDetails DisputeEvidenceDetails - v := struct { - DueBy int64 `json:"due_by"` - *disputeEvidenceDetails - }{ - disputeEvidenceDetails: (*disputeEvidenceDetails)(d), - } + var v dispute if err := json.Unmarshal(data, &v); err != nil { return err } - d.DueBy = time.Unix(v.DueBy, 0) + *d = Dispute(v) return nil } - -// MarshalJSON handles serialization of a DisputeEvidenceDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (d DisputeEvidenceDetails) MarshalJSON() ([]byte, error) { - type disputeEvidenceDetails DisputeEvidenceDetails - v := struct { - DueBy int64 `json:"due_by"` - disputeEvidenceDetails - }{ - disputeEvidenceDetails: (disputeEvidenceDetails)(d), - DueBy: d.DueBy.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Dispute. -// This custom marshaling is needed to handle the time fields correctly. -func (d Dispute) MarshalJSON() ([]byte, error) { - type dispute Dispute - v := struct { - Created int64 `json:"created"` - dispute - }{ - dispute: (dispute)(d), - Created: d.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/ephemeralkey.go b/ephemeralkey.go index 66ace25bac..dfba39c04f 100644 --- a/ephemeralkey.go +++ b/ephemeralkey.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Invalidates a short-lived API key for a given resource. type EphemeralKeyParams struct { @@ -35,9 +32,9 @@ func (p *EphemeralKeyParams) AddExpand(f string) { type EphemeralKey struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Time at which the key will expire. Measured in seconds since the Unix epoch. - Expires time.Time `json:"expires"` + Expires int64 `json:"expires"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -61,19 +58,11 @@ type EphemeralKey struct { func (e *EphemeralKey) UnmarshalJSON(data []byte) error { type ephemeralKey EphemeralKey - v := struct { - Created int64 `json:"created"` - Expires int64 `json:"expires"` - *ephemeralKey - }{ - ephemeralKey: (*ephemeralKey)(e), + var ee ephemeralKey + err := json.Unmarshal(data, &ee) + if err == nil { + *e = EphemeralKey(ee) } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - e.Created = time.Unix(v.Created, 0) - e.Expires = time.Unix(v.Expires, 0) // Go does guarantee the longevity of `data`, so copy when assigning `RawJSON` // See https://golang.org/pkg/encoding/json/#Unmarshaler @@ -82,23 +71,3 @@ func (e *EphemeralKey) UnmarshalJSON(data []byte) error { return nil } - -// MarshalJSON handles serialization of an EphemeralKey. -// This custom marshaling is needed to handle the time fields correctly. -func (e EphemeralKey) MarshalJSON() ([]byte, error) { - type ephemeralKey EphemeralKey - v := struct { - Created int64 `json:"created"` - Expires int64 `json:"expires"` - ephemeralKey - }{ - ephemeralKey: (ephemeralKey)(e), - Created: e.Created.Unix(), - Expires: e.Expires.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/event.go b/event.go index efc579f31f..d2e3ae4aa3 100644 --- a/event.go +++ b/event.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "strconv" - "time" ) // The type of the `automation_action`. @@ -433,7 +432,7 @@ type Event struct { // The Stripe API version used to render `data`. This property is populated only for events on or after October 31, 2014. APIVersion string `json:"api_version"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` Data *EventData `json:"data"` // Unique identifier for the object. ID string `json:"id"` @@ -517,39 +516,3 @@ func getValue(m map[string]interface{}, keys []string) string { return fmt.Sprintf("%v", node) } - -// UnmarshalJSON handles deserialization of an Event. -// This custom unmarshaling is needed to handle the time fields correctly. -func (e *Event) UnmarshalJSON(data []byte) error { - type event Event - v := struct { - Created int64 `json:"created"` - *event - }{ - event: (*event)(e), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - e.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an Event. -// This custom marshaling is needed to handle the time fields correctly. -func (e Event) MarshalJSON() ([]byte, error) { - type event Event - v := struct { - Created int64 `json:"created"` - event - }{ - event: (event)(e), - Created: e.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 91a2bcb76e..66af11dde0 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -2320,8 +2320,8 @@ func TestReportingReportRunsPost(t *testing.T) { params := &stripe.ReportingReportRunParams{ ReportType: stripe.String("balance.summary.1"), Parameters: &stripe.ReportingReportRunParametersParams{ - IntervalStart: stripe.UnixTime(1522540800), - IntervalEnd: stripe.UnixTime(1525132800), + IntervalStart: stripe.Int64(1522540800), + IntervalEnd: stripe.Int64(1525132800), }, } result, err := reporting_reportrun.New(params) @@ -2589,7 +2589,7 @@ func TestSubscriptionItemsUsageRecordSummariesGet(t *testing.T) { func TestSubscriptionItemsUsageRecordsPost(t *testing.T) { params := &stripe.UsageRecordParams{ Quantity: stripe.Int64(100), - Timestamp: stripe.UnixTime(1571252444), + Timestamp: stripe.Int64(1571252444), SubscriptionItem: stripe.String("si_xxxxxxxxxxxxx"), } result, err := usagerecord.New(params) @@ -2622,7 +2622,7 @@ func TestSubscriptionSchedulesGet2(t *testing.T) { func TestSubscriptionSchedulesPost(t *testing.T) { params := &stripe.SubscriptionScheduleParams{ Customer: stripe.String("cus_xxxxxxxxxxxxx"), - StartDate: stripe.UnixTime(1676070661), + StartDate: stripe.Int64(1676070661), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { @@ -3093,7 +3093,7 @@ func TestTestHelpersIssuingAuthorizationsCapturePost(t *testing.T) { CloseAuthorization: stripe.Bool(true), PurchaseDetails: &stripe.TestHelpersIssuingAuthorizationCapturePurchaseDetailsParams{ Flight: &stripe.TestHelpersIssuingAuthorizationCapturePurchaseDetailsFlightParams{ - DepartureAt: stripe.UnixTime(1633651200), + DepartureAt: stripe.Int64(1633651200), PassengerName: stripe.String("John Doe"), Refundable: stripe.Bool(true), Segments: []*stripe.TestHelpersIssuingAuthorizationCapturePurchaseDetailsFlightSegmentParams{ @@ -3115,7 +3115,7 @@ func TestTestHelpersIssuingAuthorizationsCapturePost(t *testing.T) { QuantityDecimal: stripe.Float64(10), }, Lodging: &stripe.TestHelpersIssuingAuthorizationCapturePurchaseDetailsLodgingParams{ - CheckInAt: stripe.UnixTime(1633651200), + CheckInAt: stripe.Int64(1633651200), Nights: stripe.Int64(2), }, Receipt: []*stripe.TestHelpersIssuingAuthorizationCapturePurchaseDetailsReceiptParams{ @@ -3276,7 +3276,7 @@ func TestTestHelpersIssuingTransactionsCreateForceCapturePost(t *testing.T) { }, PurchaseDetails: &stripe.TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsParams{ Flight: &stripe.TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsFlightParams{ - DepartureAt: stripe.UnixTime(1633651200), + DepartureAt: stripe.Int64(1633651200), PassengerName: stripe.String("John Doe"), Refundable: stripe.Bool(true), Segments: []*stripe.TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsFlightSegmentParams{ @@ -3298,7 +3298,7 @@ func TestTestHelpersIssuingTransactionsCreateForceCapturePost(t *testing.T) { QuantityDecimal: stripe.Float64(10), }, Lodging: &stripe.TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsLodgingParams{ - CheckInAt: stripe.UnixTime(1533651200), + CheckInAt: stripe.Int64(1533651200), Nights: stripe.Int64(2), }, Receipt: []*stripe.TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsReceiptParams{ @@ -3334,7 +3334,7 @@ func TestTestHelpersIssuingTransactionsCreateUnlinkedRefundPost(t *testing.T) { }, PurchaseDetails: &stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsParams{ Flight: &stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsFlightParams{ - DepartureAt: stripe.UnixTime(1533651200), + DepartureAt: stripe.Int64(1533651200), PassengerName: stripe.String("John Doe"), Refundable: stripe.Bool(true), Segments: []*stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsFlightSegmentParams{ @@ -3356,7 +3356,7 @@ func TestTestHelpersIssuingTransactionsCreateUnlinkedRefundPost(t *testing.T) { QuantityDecimal: stripe.Float64(10), }, Lodging: &stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsLodgingParams{ - CheckInAt: stripe.UnixTime(1533651200), + CheckInAt: stripe.Int64(1533651200), Nights: stripe.Int64(2), }, Receipt: []*stripe.TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsReceiptParams{ @@ -3394,7 +3394,7 @@ func TestTestHelpersRefundsExpirePost(t *testing.T) { func TestTestHelpersTestClocksAdvancePost(t *testing.T) { params := &stripe.TestHelpersTestClockAdvanceParams{ - FrozenTime: stripe.UnixTime(142), + FrozenTime: stripe.Int64(142), } result, err := testhelpers_testclock.Advance("clock_xyz", params) assert.NotNil(t, result) @@ -3403,7 +3403,7 @@ func TestTestHelpersTestClocksAdvancePost(t *testing.T) { func TestTestHelpersTestClocksAdvancePost2(t *testing.T) { params := &stripe.TestHelpersTestClockAdvanceParams{ - FrozenTime: stripe.UnixTime(1675552261), + FrozenTime: stripe.Int64(1675552261), } result, err := testhelpers_testclock.Advance("clock_xxxxxxxxxxxxx", params) assert.NotNil(t, result) @@ -3455,7 +3455,7 @@ func TestTestHelpersTestClocksGet4(t *testing.T) { func TestTestHelpersTestClocksPost(t *testing.T) { params := &stripe.TestHelpersTestClockParams{ - FrozenTime: stripe.UnixTime(123), + FrozenTime: stripe.Int64(123), Name: stripe.String("cogsworth"), } result, err := testhelpers_testclock.New(params) @@ -3465,7 +3465,7 @@ func TestTestHelpersTestClocksPost(t *testing.T) { func TestTestHelpersTestClocksPost2(t *testing.T) { params := &stripe.TestHelpersTestClockParams{ - FrozenTime: stripe.UnixTime(1577836800), + FrozenTime: stripe.Int64(1577836800), } result, err := testhelpers_testclock.New(params) assert.NotNil(t, result) diff --git a/feerefund.go b/feerefund.go index c436b8657c..183d1290a6 100644 --- a/feerefund.go +++ b/feerefund.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee. type FeeRefundParams struct { @@ -63,7 +60,7 @@ type FeeRefund struct { // Balance transaction that describes the impact on your account balance. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // ID of the application fee that was refunded. @@ -93,34 +90,11 @@ func (f *FeeRefund) UnmarshalJSON(data []byte) error { } type feeRefund FeeRefund - v := struct { - Created int64 `json:"created"` - *feeRefund - }{ - feeRefund: (*feeRefund)(f), - } + var v feeRefund if err := json.Unmarshal(data, &v); err != nil { return err } - f.Created = time.Unix(v.Created, 0) + *f = FeeRefund(v) return nil } - -// MarshalJSON handles serialization of a FeeRefund. -// This custom marshaling is needed to handle the time fields correctly. -func (f FeeRefund) MarshalJSON() ([]byte, error) { - type feeRefund FeeRefund - v := struct { - Created int64 `json:"created"` - feeRefund - }{ - feeRefund: (feeRefund)(f), - Created: f.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/file.go b/file.go index 95cdad281c..bcd7de16a6 100644 --- a/file.go +++ b/file.go @@ -14,7 +14,6 @@ import ( "mime/multipart" "net/url" "path/filepath" - "time" ) // The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file. @@ -65,7 +64,7 @@ type FileFileLinkDataParams struct { // Set this to `true` to create a file link for the newly created file. Creating a link is only possible when the file's `purpose` is one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `issuing_regulatory_reporting`, `pci_document`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. Create *bool `form:"create"` // The link isn't available after this future timestamp. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` } @@ -112,9 +111,9 @@ func (p *FileParams) AddExpand(f string) { type File struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The file expires and isn't available at this time in epoch seconds. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The suitable name for saving the file to a filesystem. Filename string `json:"filename"` // Unique identifier for the object. @@ -203,38 +202,11 @@ func (f *File) UnmarshalJSON(data []byte) error { } type file File - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *file - }{ - file: (*file)(f), - } + var v file if err := json.Unmarshal(data, &v); err != nil { return err } - f.Created = time.Unix(v.Created, 0) - f.ExpiresAt = time.Unix(v.ExpiresAt, 0) + *f = File(v) return nil } - -// MarshalJSON handles serialization of a File. -// This custom marshaling is needed to handle the time fields correctly. -func (f File) MarshalJSON() ([]byte, error) { - type file File - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - file - }{ - file: (file)(f), - Created: f.Created.Unix(), - ExpiresAt: f.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/filelink.go b/filelink.go index cbe37f9e1e..4c5ae8608d 100644 --- a/filelink.go +++ b/filelink.go @@ -6,11 +6,7 @@ package stripe -import ( - "encoding/json" - "github.com/stripe/stripe-go/v81/form" - "time" -) +import "github.com/stripe/stripe-go/v81/form" // Returns a list of file links. type FileLinkListParams struct { @@ -38,8 +34,8 @@ type FileLinkParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. - ExpiresAt *time.Time `form:"expires_at"` - ExpiresAtNow *bool `form:"-"` // See custom AppendTo + ExpiresAt *int64 `form:"expires_at"` + ExpiresAtNow *bool `form:"-"` // See custom AppendTo // The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. File *string `form:"file"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. @@ -73,11 +69,11 @@ func (p *FileLinkParams) AppendTo(body *form.Values, keyParts []string) { type FileLink struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Returns if the link is already expired. Expired bool `json:"expired"` // Time that the link expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The file object this link points to. File *File `json:"file"` // Unique identifier for the object. @@ -98,43 +94,3 @@ type FileLinkList struct { ListMeta Data []*FileLink `json:"data"` } - -// UnmarshalJSON handles deserialization of a FileLink. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FileLink) UnmarshalJSON(data []byte) error { - type fileLink FileLink - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *fileLink - }{ - fileLink: (*fileLink)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.Created = time.Unix(v.Created, 0) - f.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a FileLink. -// This custom marshaling is needed to handle the time fields correctly. -func (f FileLink) MarshalJSON() ([]byte, error) { - type fileLink FileLink - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - fileLink - }{ - fileLink: (fileLink)(f), - Created: f.Created.Unix(), - ExpiresAt: f.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/financialconnections_account.go b/financialconnections_account.go index cbdef98fcd..afdf403334 100644 --- a/financialconnections_account.go +++ b/financialconnections_account.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Type of account holder that this account belongs to. type FinancialConnectionsAccountAccountHolderType string @@ -280,7 +275,7 @@ type FinancialConnectionsAccountBalanceCredit struct { // The most recent information about the account's balance. type FinancialConnectionsAccountBalance struct { // The time that the external institution calculated this balance. Measured in seconds since the Unix epoch. - AsOf time.Time `json:"as_of"` + AsOf int64 `json:"as_of"` Cash *FinancialConnectionsAccountBalanceCash `json:"cash"` Credit *FinancialConnectionsAccountBalanceCredit `json:"credit"` // The balances owed to (or by) the account holder, before subtracting any outbound pending transactions or adding any inbound pending transactions. @@ -296,9 +291,9 @@ type FinancialConnectionsAccountBalance struct { // The state of the most recent attempt to refresh the account balance. type FinancialConnectionsAccountBalanceRefresh struct { // The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. - LastAttemptedAt time.Time `json:"last_attempted_at"` + LastAttemptedAt int64 `json:"last_attempted_at"` // Time at which the next balance refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch. - NextRefreshAvailableAt time.Time `json:"next_refresh_available_at"` + NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` // The status of the last refresh attempt. Status FinancialConnectionsAccountBalanceRefreshStatus `json:"status"` } @@ -306,9 +301,9 @@ type FinancialConnectionsAccountBalanceRefresh struct { // The state of the most recent attempt to refresh the account's inferred balance history. type FinancialConnectionsAccountInferredBalancesRefresh struct { // The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. - LastAttemptedAt time.Time `json:"last_attempted_at"` + LastAttemptedAt int64 `json:"last_attempted_at"` // Time at which the next inferred balance refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch. - NextRefreshAvailableAt time.Time `json:"next_refresh_available_at"` + NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` // The status of the last refresh attempt. Status FinancialConnectionsAccountInferredBalancesRefreshStatus `json:"status"` } @@ -316,9 +311,9 @@ type FinancialConnectionsAccountInferredBalancesRefresh struct { // The state of the most recent attempt to refresh the account owners. type FinancialConnectionsAccountOwnershipRefresh struct { // The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. - LastAttemptedAt time.Time `json:"last_attempted_at"` + LastAttemptedAt int64 `json:"last_attempted_at"` // Time at which the next ownership refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch. - NextRefreshAvailableAt time.Time `json:"next_refresh_available_at"` + NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` // The status of the last refresh attempt. Status FinancialConnectionsAccountOwnershipRefreshStatus `json:"status"` } @@ -328,9 +323,9 @@ type FinancialConnectionsAccountTransactionRefresh struct { // Unique identifier for the object. ID string `json:"id"` // The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch. - LastAttemptedAt time.Time `json:"last_attempted_at"` + LastAttemptedAt int64 `json:"last_attempted_at"` // Time at which the next transaction refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch. - NextRefreshAvailableAt time.Time `json:"next_refresh_available_at"` + NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` // The status of the last refresh attempt. Status FinancialConnectionsAccountTransactionRefreshStatus `json:"status"` } @@ -347,7 +342,7 @@ type FinancialConnectionsAccount struct { // The type of the account. Account category is further divided in `subcategory`. Category FinancialConnectionsAccountCategory `json:"category"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // A human-readable name that has been assigned to this account, either by the account holder or by the institution. DisplayName string `json:"display_name"` // Unique identifier for the object. @@ -399,235 +394,3 @@ type FinancialConnectionsAccountList struct { ListMeta Data []*FinancialConnectionsAccount `json:"data"` } - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountBalance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountBalance) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountBalance FinancialConnectionsAccountBalance - v := struct { - AsOf int64 `json:"as_of"` - *financialConnectionsAccountBalance - }{ - financialConnectionsAccountBalance: (*financialConnectionsAccountBalance)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.AsOf = time.Unix(v.AsOf, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountBalanceRefresh. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountBalanceRefresh) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountBalanceRefresh FinancialConnectionsAccountBalanceRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - *financialConnectionsAccountBalanceRefresh - }{ - financialConnectionsAccountBalanceRefresh: (*financialConnectionsAccountBalanceRefresh)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.LastAttemptedAt = time.Unix(v.LastAttemptedAt, 0) - f.NextRefreshAvailableAt = time.Unix(v.NextRefreshAvailableAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountInferredBalancesRefresh. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountInferredBalancesRefresh) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountInferredBalancesRefresh FinancialConnectionsAccountInferredBalancesRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - *financialConnectionsAccountInferredBalancesRefresh - }{ - financialConnectionsAccountInferredBalancesRefresh: (*financialConnectionsAccountInferredBalancesRefresh)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.LastAttemptedAt = time.Unix(v.LastAttemptedAt, 0) - f.NextRefreshAvailableAt = time.Unix(v.NextRefreshAvailableAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountOwnershipRefresh. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountOwnershipRefresh) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountOwnershipRefresh FinancialConnectionsAccountOwnershipRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - *financialConnectionsAccountOwnershipRefresh - }{ - financialConnectionsAccountOwnershipRefresh: (*financialConnectionsAccountOwnershipRefresh)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.LastAttemptedAt = time.Unix(v.LastAttemptedAt, 0) - f.NextRefreshAvailableAt = time.Unix(v.NextRefreshAvailableAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountTransactionRefresh. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountTransactionRefresh) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountTransactionRefresh FinancialConnectionsAccountTransactionRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - *financialConnectionsAccountTransactionRefresh - }{ - financialConnectionsAccountTransactionRefresh: (*financialConnectionsAccountTransactionRefresh)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.LastAttemptedAt = time.Unix(v.LastAttemptedAt, 0) - f.NextRefreshAvailableAt = time.Unix(v.NextRefreshAvailableAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccount. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccount) UnmarshalJSON(data []byte) error { - type financialConnectionsAccount FinancialConnectionsAccount - v := struct { - Created int64 `json:"created"` - *financialConnectionsAccount - }{ - financialConnectionsAccount: (*financialConnectionsAccount)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountBalance. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountBalance) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountBalance FinancialConnectionsAccountBalance - v := struct { - AsOf int64 `json:"as_of"` - financialConnectionsAccountBalance - }{ - financialConnectionsAccountBalance: (financialConnectionsAccountBalance)(f), - AsOf: f.AsOf.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountBalanceRefresh. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountBalanceRefresh) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountBalanceRefresh FinancialConnectionsAccountBalanceRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - financialConnectionsAccountBalanceRefresh - }{ - financialConnectionsAccountBalanceRefresh: (financialConnectionsAccountBalanceRefresh)(f), - LastAttemptedAt: f.LastAttemptedAt.Unix(), - NextRefreshAvailableAt: f.NextRefreshAvailableAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountInferredBalancesRefresh. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountInferredBalancesRefresh) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountInferredBalancesRefresh FinancialConnectionsAccountInferredBalancesRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - financialConnectionsAccountInferredBalancesRefresh - }{ - financialConnectionsAccountInferredBalancesRefresh: (financialConnectionsAccountInferredBalancesRefresh)(f), - LastAttemptedAt: f.LastAttemptedAt.Unix(), - NextRefreshAvailableAt: f.NextRefreshAvailableAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountOwnershipRefresh. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountOwnershipRefresh) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountOwnershipRefresh FinancialConnectionsAccountOwnershipRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - financialConnectionsAccountOwnershipRefresh - }{ - financialConnectionsAccountOwnershipRefresh: (financialConnectionsAccountOwnershipRefresh)(f), - LastAttemptedAt: f.LastAttemptedAt.Unix(), - NextRefreshAvailableAt: f.NextRefreshAvailableAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountTransactionRefresh. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountTransactionRefresh) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountTransactionRefresh FinancialConnectionsAccountTransactionRefresh - v := struct { - LastAttemptedAt int64 `json:"last_attempted_at"` - NextRefreshAvailableAt int64 `json:"next_refresh_available_at"` - financialConnectionsAccountTransactionRefresh - }{ - financialConnectionsAccountTransactionRefresh: (financialConnectionsAccountTransactionRefresh)(f), - LastAttemptedAt: f.LastAttemptedAt.Unix(), - NextRefreshAvailableAt: f.NextRefreshAvailableAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccount. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccount) MarshalJSON() ([]byte, error) { - type financialConnectionsAccount FinancialConnectionsAccount - v := struct { - Created int64 `json:"created"` - financialConnectionsAccount - }{ - financialConnectionsAccount: (financialConnectionsAccount)(f), - Created: f.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/financialconnections_accountinferredbalance.go b/financialconnections_accountinferredbalance.go index 4f4130321f..bf9afbbcc7 100644 --- a/financialconnections_accountinferredbalance.go +++ b/financialconnections_accountinferredbalance.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Lists the recorded inferred balances for a Financial Connections Account. type FinancialConnectionsAccountInferredBalanceListParams struct { ListParams `form:"*"` @@ -27,7 +22,7 @@ func (p *FinancialConnectionsAccountInferredBalanceListParams) AddExpand(f strin // A historical balance for the account on a particular day. It may be sourced from a balance snapshot provided by a financial institution, or inferred using transactions data. type FinancialConnectionsAccountInferredBalance struct { // The time for which this balance was calculated, measured in seconds since the Unix epoch. If the balance was computed by Stripe and not provided directly by a financial institution, it will always be 23:59:59 UTC. - AsOf time.Time `json:"as_of"` + AsOf int64 `json:"as_of"` // The balances owed to (or by) the account holder, before subtracting any outbound pending transactions or adding any inbound pending transactions. // // Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -46,39 +41,3 @@ type FinancialConnectionsAccountInferredBalanceList struct { ListMeta Data []*FinancialConnectionsAccountInferredBalance `json:"data"` } - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountInferredBalance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountInferredBalance) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountInferredBalance FinancialConnectionsAccountInferredBalance - v := struct { - AsOf int64 `json:"as_of"` - *financialConnectionsAccountInferredBalance - }{ - financialConnectionsAccountInferredBalance: (*financialConnectionsAccountInferredBalance)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.AsOf = time.Unix(v.AsOf, 0) - return nil -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountInferredBalance. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountInferredBalance) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountInferredBalance FinancialConnectionsAccountInferredBalance - v := struct { - AsOf int64 `json:"as_of"` - financialConnectionsAccountInferredBalance - }{ - financialConnectionsAccountInferredBalance: (financialConnectionsAccountInferredBalance)(f), - AsOf: f.AsOf.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/financialconnections_accountowner.go b/financialconnections_accountowner.go index fe20b3620a..49fca19ada 100644 --- a/financialconnections_accountowner.go +++ b/financialconnections_accountowner.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Describes an owner of an account. type FinancialConnectionsAccountOwner struct { // The email address of the owner. @@ -28,7 +23,7 @@ type FinancialConnectionsAccountOwner struct { // The raw physical address of the owner. RawAddress string `json:"raw_address"` // The timestamp of the refresh that updated this owner. - RefreshedAt time.Time `json:"refreshed_at"` + RefreshedAt int64 `json:"refreshed_at"` } // FinancialConnectionsAccountOwnerList is a list of AccountOwners as retrieved from a list endpoint. @@ -37,39 +32,3 @@ type FinancialConnectionsAccountOwnerList struct { ListMeta Data []*FinancialConnectionsAccountOwner `json:"data"` } - -// UnmarshalJSON handles deserialization of a FinancialConnectionsAccountOwner. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsAccountOwner) UnmarshalJSON(data []byte) error { - type financialConnectionsAccountOwner FinancialConnectionsAccountOwner - v := struct { - RefreshedAt int64 `json:"refreshed_at"` - *financialConnectionsAccountOwner - }{ - financialConnectionsAccountOwner: (*financialConnectionsAccountOwner)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.RefreshedAt = time.Unix(v.RefreshedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a FinancialConnectionsAccountOwner. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountOwner) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountOwner FinancialConnectionsAccountOwner - v := struct { - RefreshedAt int64 `json:"refreshed_at"` - financialConnectionsAccountOwner - }{ - financialConnectionsAccountOwner: (financialConnectionsAccountOwner)(f), - RefreshedAt: f.RefreshedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/financialconnections_accountownership.go b/financialconnections_accountownership.go index 69215d1282..1b642879e7 100644 --- a/financialconnections_accountownership.go +++ b/financialconnections_accountownership.go @@ -6,15 +6,12 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Describes a snapshot of the owners of an account at a particular point in time. type FinancialConnectionsAccountOwnership struct { // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // String representing the object's type. Objects of the same type share the same value. @@ -33,34 +30,11 @@ func (f *FinancialConnectionsAccountOwnership) UnmarshalJSON(data []byte) error } type financialConnectionsAccountOwnership FinancialConnectionsAccountOwnership - v := struct { - Created int64 `json:"created"` - *financialConnectionsAccountOwnership - }{ - financialConnectionsAccountOwnership: (*financialConnectionsAccountOwnership)(f), - } + var v financialConnectionsAccountOwnership if err := json.Unmarshal(data, &v); err != nil { return err } - f.Created = time.Unix(v.Created, 0) + *f = FinancialConnectionsAccountOwnership(v) return nil } - -// MarshalJSON handles serialization of a FinancialConnectionsAccountOwnership. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsAccountOwnership) MarshalJSON() ([]byte, error) { - type financialConnectionsAccountOwnership FinancialConnectionsAccountOwnership - v := struct { - Created int64 `json:"created"` - financialConnectionsAccountOwnership - }{ - financialConnectionsAccountOwnership: (financialConnectionsAccountOwnership)(f), - Created: f.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/financialconnections_transaction.go b/financialconnections_transaction.go index 090cba2dac..6c0ae205d4 100644 --- a/financialconnections_transaction.go +++ b/financialconnections_transaction.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The status of the transaction. type FinancialConnectionsTransactionStatus string @@ -61,9 +56,9 @@ func (p *FinancialConnectionsTransactionParams) AddExpand(f string) { type FinancialConnectionsTransactionStatusTransitions struct { // Time at which this transaction posted. Measured in seconds since the Unix epoch. - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` // Time at which this transaction was voided. Measured in seconds since the Unix epoch. - VoidAt time.Time `json:"void_at"` + VoidAt int64 `json:"void_at"` } // A Transaction represents a real transaction that affects a Financial Connections Account balance. @@ -87,11 +82,11 @@ type FinancialConnectionsTransaction struct { Status FinancialConnectionsTransactionStatus `json:"status"` StatusTransitions *FinancialConnectionsTransactionStatusTransitions `json:"status_transitions"` // Time at which the transaction was transacted. Measured in seconds since the Unix epoch. - TransactedAt time.Time `json:"transacted_at"` + TransactedAt int64 `json:"transacted_at"` // The token of the transaction refresh that last updated or created this transaction. TransactionRefresh string `json:"transaction_refresh"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` } // FinancialConnectionsTransactionList is a list of Transactions as retrieved from a list endpoint. @@ -100,83 +95,3 @@ type FinancialConnectionsTransactionList struct { ListMeta Data []*FinancialConnectionsTransaction `json:"data"` } - -// UnmarshalJSON handles deserialization of a FinancialConnectionsTransactionStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsTransactionStatusTransitions) UnmarshalJSON(data []byte) error { - type financialConnectionsTransactionStatusTransitions FinancialConnectionsTransactionStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - VoidAt int64 `json:"void_at"` - *financialConnectionsTransactionStatusTransitions - }{ - financialConnectionsTransactionStatusTransitions: (*financialConnectionsTransactionStatusTransitions)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.PostedAt = time.Unix(v.PostedAt, 0) - f.VoidAt = time.Unix(v.VoidAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a FinancialConnectionsTransaction. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *FinancialConnectionsTransaction) UnmarshalJSON(data []byte) error { - type financialConnectionsTransaction FinancialConnectionsTransaction - v := struct { - TransactedAt int64 `json:"transacted_at"` - Updated int64 `json:"updated"` - *financialConnectionsTransaction - }{ - financialConnectionsTransaction: (*financialConnectionsTransaction)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.TransactedAt = time.Unix(v.TransactedAt, 0) - f.Updated = time.Unix(v.Updated, 0) - return nil -} - -// MarshalJSON handles serialization of a FinancialConnectionsTransactionStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsTransactionStatusTransitions) MarshalJSON() ([]byte, error) { - type financialConnectionsTransactionStatusTransitions FinancialConnectionsTransactionStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - VoidAt int64 `json:"void_at"` - financialConnectionsTransactionStatusTransitions - }{ - financialConnectionsTransactionStatusTransitions: (financialConnectionsTransactionStatusTransitions)(f), - PostedAt: f.PostedAt.Unix(), - VoidAt: f.VoidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a FinancialConnectionsTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (f FinancialConnectionsTransaction) MarshalJSON() ([]byte, error) { - type financialConnectionsTransaction FinancialConnectionsTransaction - v := struct { - TransactedAt int64 `json:"transacted_at"` - Updated int64 `json:"updated"` - financialConnectionsTransaction - }{ - financialConnectionsTransaction: (financialConnectionsTransaction)(f), - TransactedAt: f.TransactedAt.Unix(), - Updated: f.Updated.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/forwarding_request.go b/forwarding_request.go index e604d0b1bb..bb2bdd8989 100644 --- a/forwarding_request.go +++ b/forwarding_request.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The field kinds to be replaced in the forwarded request. type ForwardingRequestReplacement string @@ -155,7 +150,7 @@ type ForwardingRequestResponseDetails struct { type ForwardingRequest struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -184,39 +179,3 @@ type ForwardingRequestList struct { ListMeta Data []*ForwardingRequest `json:"data"` } - -// UnmarshalJSON handles deserialization of a ForwardingRequest. -// This custom unmarshaling is needed to handle the time fields correctly. -func (f *ForwardingRequest) UnmarshalJSON(data []byte) error { - type forwardingRequest ForwardingRequest - v := struct { - Created int64 `json:"created"` - *forwardingRequest - }{ - forwardingRequest: (*forwardingRequest)(f), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - f.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a ForwardingRequest. -// This custom marshaling is needed to handle the time fields correctly. -func (f ForwardingRequest) MarshalJSON() ([]byte, error) { - type forwardingRequest ForwardingRequest - v := struct { - Created int64 `json:"created"` - forwardingRequest - }{ - forwardingRequest: (forwardingRequest)(f), - Created: f.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/giftcards_card.go b/giftcards_card.go index d60aab2a53..87a907f755 100644 --- a/giftcards_card.go +++ b/giftcards_card.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of event that created this object. type GiftCardsCardCreatedByType string @@ -133,7 +128,7 @@ type GiftCardsCard struct { // Code used to redeem this gift card. Code string `json:"code"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The related Stripe objects that created this gift card. CreatedBy *GiftCardsCardCreatedBy `json:"created_by"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). @@ -154,39 +149,3 @@ type GiftCardsCardList struct { ListMeta Data []*GiftCardsCard `json:"data"` } - -// UnmarshalJSON handles deserialization of a GiftCardsCard. -// This custom unmarshaling is needed to handle the time fields correctly. -func (g *GiftCardsCard) UnmarshalJSON(data []byte) error { - type giftCardsCard GiftCardsCard - v := struct { - Created int64 `json:"created"` - *giftCardsCard - }{ - giftCardsCard: (*giftCardsCard)(g), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - g.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a GiftCardsCard. -// This custom marshaling is needed to handle the time fields correctly. -func (g GiftCardsCard) MarshalJSON() ([]byte, error) { - type giftCardsCard GiftCardsCard - v := struct { - Created int64 `json:"created"` - giftCardsCard - }{ - giftCardsCard: (giftCardsCard)(g), - Created: g.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/giftcards_transaction.go b/giftcards_transaction.go index bf06a89b8f..575882b5c9 100644 --- a/giftcards_transaction.go +++ b/giftcards_transaction.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of event that created this object. type GiftCardsTransactionCreatedByType string @@ -160,9 +155,9 @@ type GiftCardsTransaction struct { // The amount of this transaction. A positive value indicates that funds were added to the gift card. A negative value indicates that funds were removed from the gift card. Amount int64 `json:"amount"` // Time at which the transaction was confirmed. Measured in seconds since the Unix epoch. - ConfirmedAt time.Time `json:"confirmed_at"` + ConfirmedAt int64 `json:"confirmed_at"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The related Stripe objects that created this gift card transaction. CreatedBy *GiftCardsTransactionCreatedBy `json:"created_by"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). @@ -189,43 +184,3 @@ type GiftCardsTransactionList struct { ListMeta Data []*GiftCardsTransaction `json:"data"` } - -// UnmarshalJSON handles deserialization of a GiftCardsTransaction. -// This custom unmarshaling is needed to handle the time fields correctly. -func (g *GiftCardsTransaction) UnmarshalJSON(data []byte) error { - type giftCardsTransaction GiftCardsTransaction - v := struct { - ConfirmedAt int64 `json:"confirmed_at"` - Created int64 `json:"created"` - *giftCardsTransaction - }{ - giftCardsTransaction: (*giftCardsTransaction)(g), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - g.ConfirmedAt = time.Unix(v.ConfirmedAt, 0) - g.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a GiftCardsTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (g GiftCardsTransaction) MarshalJSON() ([]byte, error) { - type giftCardsTransaction GiftCardsTransaction - v := struct { - ConfirmedAt int64 `json:"confirmed_at"` - Created int64 `json:"created"` - giftCardsTransaction - }{ - giftCardsTransaction: (giftCardsTransaction)(g), - ConfirmedAt: g.ConfirmedAt.Unix(), - Created: g.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/identity_verificationreport.go b/identity_verificationreport.go index 5c210b5025..ec90020791 100644 --- a/identity_verificationreport.go +++ b/identity_verificationreport.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // A short machine-readable string giving the reason for the verification failure. type IdentityVerificationReportDocumentErrorCode string @@ -368,7 +365,7 @@ type IdentityVerificationReport struct { // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. ClientReferenceID string `json:"client_reference_id"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Result from a document check Document *IdentityVerificationReportDocument `json:"document"` // Result from a email check @@ -411,34 +408,11 @@ func (i *IdentityVerificationReport) UnmarshalJSON(data []byte) error { } type identityVerificationReport IdentityVerificationReport - v := struct { - Created int64 `json:"created"` - *identityVerificationReport - }{ - identityVerificationReport: (*identityVerificationReport)(i), - } + var v identityVerificationReport if err := json.Unmarshal(data, &v); err != nil { return err } - i.Created = time.Unix(v.Created, 0) + *i = IdentityVerificationReport(v) return nil } - -// MarshalJSON handles serialization of an IdentityVerificationReport. -// This custom marshaling is needed to handle the time fields correctly. -func (i IdentityVerificationReport) MarshalJSON() ([]byte, error) { - type identityVerificationReport IdentityVerificationReport - v := struct { - Created int64 `json:"created"` - identityVerificationReport - }{ - identityVerificationReport: (identityVerificationReport)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/identity_verificationsession.go b/identity_verificationsession.go index 2424314c80..e838cff98d 100644 --- a/identity_verificationsession.go +++ b/identity_verificationsession.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // A short machine-readable string giving the reason for the verification or user-session failure. type IdentityVerificationSessionLastErrorCode string @@ -318,7 +313,7 @@ type IdentityVerificationSession struct { // The short-lived client secret used by Stripe.js to [show a verification modal](https://stripe.com/docs/js/identity/modal) inside your app. This client secret expires after 24 hours and can only be used once. Don't store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on [passing the client secret to the frontend](https://stripe.com/docs/identity/verification-sessions#client-secret) to learn more. ClientSecret string `json:"client_secret"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // If present, this property tells you the last error encountered when processing the verification. @@ -357,39 +352,3 @@ type IdentityVerificationSessionList struct { ListMeta Data []*IdentityVerificationSession `json:"data"` } - -// UnmarshalJSON handles deserialization of an IdentityVerificationSession. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IdentityVerificationSession) UnmarshalJSON(data []byte) error { - type identityVerificationSession IdentityVerificationSession - v := struct { - Created int64 `json:"created"` - *identityVerificationSession - }{ - identityVerificationSession: (*identityVerificationSession)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an IdentityVerificationSession. -// This custom marshaling is needed to handle the time fields correctly. -func (i IdentityVerificationSession) MarshalJSON() ([]byte, error) { - type identityVerificationSession IdentityVerificationSession - v := struct { - Created int64 `json:"created"` - identityVerificationSession - }{ - identityVerificationSession: (identityVerificationSession)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/invoice.go b/invoice.go index 5d6012b790..9b3ab91e20 100644 --- a/invoice.go +++ b/invoice.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // The status of the payment, one of `open`, `paid`, or `past_due` @@ -312,7 +311,7 @@ type InvoiceParams struct { // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. AutoAdvance *bool `form:"auto_advance"` // The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. To turn off automatic finalization, set `auto_advance` to false. - AutomaticallyFinalizesAt *time.Time `form:"automatically_finalizes_at"` + AutomaticallyFinalizesAt *int64 `form:"automatically_finalizes_at"` // Settings for automatic tax lookup for this invoice. AutomaticTax *InvoiceAutomaticTaxParams `form:"automatic_tax"` // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults to `charge_automatically`. @@ -338,9 +337,9 @@ type InvoiceParams struct { // The coupons and promotion codes to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*InvoiceDiscountParams `form:"discounts"` // The date on which payment for this invoice is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices. - DueDate *time.Time `form:"due_date"` + DueDate *int64 `form:"due_date"` // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. - EffectiveAt *time.Time `form:"effective_at"` + EffectiveAt *int64 `form:"effective_at"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // Footer to be displayed on the invoice. @@ -396,7 +395,7 @@ type InvoiceAmountsDueParams struct { // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` // Date on which a payment plan's payment is due. - DueDate *time.Time `form:"due_date"` + DueDate *int64 `form:"due_date"` } // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account. @@ -436,7 +435,7 @@ type InvoiceDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -811,9 +810,9 @@ type InvoiceUpcomingCustomerDetailsParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceUpcomingInvoiceItemPeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // List of invoice items to add or update in the upcoming invoice preview (up to 250). @@ -890,7 +889,7 @@ type InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndParams struct { // Time span for the amendment starting from the `amendment_start`. Duration *InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"` // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_end`. Type *string `form:"type"` } @@ -914,7 +913,7 @@ type InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartParams struct { // Use the `end` time of a given discount. DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"` // A precise Unix timestamp for the amendment to start. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_start`. Type *string `form:"type"` } @@ -984,7 +983,7 @@ type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndPara // Time span for the redeemed discount. Duration *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1053,7 +1052,7 @@ type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndPara // Time span for the redeemed discount. Duration *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1190,7 +1189,7 @@ type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams // Time span for the redeemed discount. Duration *InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1272,7 +1271,7 @@ type InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1326,7 +1325,7 @@ type InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1459,8 +1458,8 @@ type InvoiceUpcomingScheduleDetailsPhaseParams struct { // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*InvoiceUpcomingScheduleDetailsPhaseDiscountParams `form:"discounts"` // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. - EndDate *time.Time `form:"end_date"` - EndDateNow *bool `form:"-"` // See custom AppendTo + EndDate *int64 `form:"end_date"` + EndDateNow *bool `form:"-"` // See custom AppendTo // All invoices will be billed using the specified settings. InvoiceSettings *InvoiceUpcomingScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"` // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. @@ -1476,8 +1475,8 @@ type InvoiceUpcomingScheduleDetailsPhaseParams struct { // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. ProrationBehavior *string `form:"proration_behavior"` // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase. - StartDate *time.Time `form:"start_date"` - StartDateNow *bool `form:"-"` // See custom AppendTo + StartDate *int64 `form:"start_date"` + StartDateNow *bool `form:"-"` // See custom AppendTo // The data with which to automatically create a Transfer for each of the associated subscription's invoices. TransferData *InvoiceUpcomingScheduleDetailsPhaseTransferDataParams `form:"transfer_data"` // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. @@ -1485,8 +1484,8 @@ type InvoiceUpcomingScheduleDetailsPhaseParams struct { // Specify trial behavior when crossing phase boundaries TrialContinuation *string `form:"trial_continuation"` // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo // Settings related to subscription trials. TrialSettings *InvoiceUpcomingScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"` } @@ -1534,7 +1533,7 @@ type InvoiceUpcomingScheduleDetailsPrebillingBillUntilParams struct { // Time span for prebilling, starting from `bill_from`. Duration *InvoiceUpcomingScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"` // End the prebilled period at a precise integer timestamp, starting from the Unix epoch. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of several ways to pass the `bill_until` value. Type *string `form:"type"` } @@ -1582,7 +1581,7 @@ type InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1667,11 +1666,11 @@ type InvoiceUpcomingSubscriptionDetailsPrebillingParams struct { // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields. type InvoiceUpcomingSubscriptionDetailsParams struct { // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. - BillingCycleAnchor *time.Time `form:"billing_cycle_anchor"` - BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo - BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo + BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` + BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo + BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. - CancelAt *time.Time `form:"cancel_at"` + CancelAt *int64 `form:"cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. CancelAtPeriodEnd *bool `form:"cancel_at_period_end"` // This simulates the subscription being canceled or expired immediately. @@ -1685,14 +1684,14 @@ type InvoiceUpcomingSubscriptionDetailsParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If previewing an update to a subscription, and doing proration, `subscription_details.proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_details.items`, or `subscription_details.trial_end` are required. Also, `subscription_details.proration_behavior` cannot be set to 'none'. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. ResumeAt *string `form:"resume_at"` // Date a subscription is intended to start (can be future or past). - StartDate *time.Time `form:"start_date"` + StartDate *int64 `form:"start_date"` // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_details.items` or `subscription` is required. - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo } // AppendTo implements custom encoding logic for InvoiceUpcomingSubscriptionDetailsParams. @@ -1752,11 +1751,11 @@ type InvoiceUpcomingParams struct { // The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a `subscription_details.items` is provided, you will preview creating a subscription with those items. If neither `subscription` nor `subscription_details.items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. Subscription *string `form:"subscription"` // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.billing_cycle_anchor` instead. - SubscriptionBillingCycleAnchor *time.Time `form:"subscription_billing_cycle_anchor"` - SubscriptionBillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo - SubscriptionBillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo + SubscriptionBillingCycleAnchor *int64 `form:"subscription_billing_cycle_anchor"` + SubscriptionBillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo + SubscriptionBillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at` instead. - SubscriptionCancelAt *time.Time `form:"subscription_cancel_at"` + SubscriptionCancelAt *int64 `form:"subscription_cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at_period_end` instead. SubscriptionCancelAtPeriodEnd *bool `form:"subscription_cancel_at_period_end"` // This simulates the subscription being canceled or expired immediately. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_now` instead. @@ -1772,14 +1771,14 @@ type InvoiceUpcomingParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_behavior` instead. SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"` // If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. Also, `subscription_proration_behavior` cannot be set to 'none'. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_date` instead. - SubscriptionProrationDate *time.Time `form:"subscription_proration_date"` + SubscriptionProrationDate *int64 `form:"subscription_proration_date"` // For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. This field has been deprecated and will be removed in a future API version. Use `subscription_details.resume_at` instead. SubscriptionResumeAt *string `form:"subscription_resume_at"` // Date a subscription is intended to start (can be future or past). This field has been deprecated and will be removed in a future API version. Use `subscription_details.start_date` instead. - SubscriptionStartDate *time.Time `form:"subscription_start_date"` + SubscriptionStartDate *int64 `form:"subscription_start_date"` // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version. Use `subscription_details.trial_end` instead. - SubscriptionTrialEnd *time.Time `form:"subscription_trial_end"` - SubscriptionTrialEndNow *bool `form:"-"` // See custom AppendTo + SubscriptionTrialEnd *int64 `form:"subscription_trial_end"` + SubscriptionTrialEndNow *bool `form:"-"` // See custom AppendTo // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } @@ -1869,7 +1868,7 @@ type InvoiceUpcomingLinesDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1899,7 +1898,7 @@ type InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -1919,9 +1918,9 @@ type InvoiceUpcomingLinesInvoiceItemDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceUpcomingLinesInvoiceItemPeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. @@ -2012,7 +2011,7 @@ type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndParams struct { // Time span for the amendment starting from the `amendment_start`. Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"` // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_end`. Type *string `form:"type"` } @@ -2036,7 +2035,7 @@ type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartParams struct { // Use the `end` time of a given discount. DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"` // A precise Unix timestamp for the amendment to start. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_start`. Type *string `form:"type"` } @@ -2106,7 +2105,7 @@ type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEn // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2175,7 +2174,7 @@ type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEn // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2312,7 +2311,7 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndPa // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2394,7 +2393,7 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2448,7 +2447,7 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndParams struc // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2581,8 +2580,8 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseParams struct { // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*InvoiceUpcomingLinesScheduleDetailsPhaseDiscountParams `form:"discounts"` // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. - EndDate *time.Time `form:"end_date"` - EndDateNow *bool `form:"-"` // See custom AppendTo + EndDate *int64 `form:"end_date"` + EndDateNow *bool `form:"-"` // See custom AppendTo // All invoices will be billed using the specified settings. InvoiceSettings *InvoiceUpcomingLinesScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"` // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. @@ -2598,8 +2597,8 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseParams struct { // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. ProrationBehavior *string `form:"proration_behavior"` // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase. - StartDate *time.Time `form:"start_date"` - StartDateNow *bool `form:"-"` // See custom AppendTo + StartDate *int64 `form:"start_date"` + StartDateNow *bool `form:"-"` // See custom AppendTo // The data with which to automatically create a Transfer for each of the associated subscription's invoices. TransferData *InvoiceUpcomingLinesScheduleDetailsPhaseTransferDataParams `form:"transfer_data"` // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. @@ -2607,8 +2606,8 @@ type InvoiceUpcomingLinesScheduleDetailsPhaseParams struct { // Specify trial behavior when crossing phase boundaries TrialContinuation *string `form:"trial_continuation"` // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo // Settings related to subscription trials. TrialSettings *InvoiceUpcomingLinesScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"` } @@ -2656,7 +2655,7 @@ type InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilParams struct { // Time span for prebilling, starting from `bill_from`. Duration *InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"` // End the prebilled period at a precise integer timestamp, starting from the Unix epoch. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of several ways to pass the `bill_until` value. Type *string `form:"type"` } @@ -2704,7 +2703,7 @@ type InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndParams struct // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2789,11 +2788,11 @@ type InvoiceUpcomingLinesSubscriptionDetailsPrebillingParams struct { // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields. type InvoiceUpcomingLinesSubscriptionDetailsParams struct { // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. - BillingCycleAnchor *time.Time `form:"billing_cycle_anchor"` - BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo - BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo + BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` + BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo + BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. - CancelAt *time.Time `form:"cancel_at"` + CancelAt *int64 `form:"cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. CancelAtPeriodEnd *bool `form:"cancel_at_period_end"` // This simulates the subscription being canceled or expired immediately. @@ -2807,14 +2806,14 @@ type InvoiceUpcomingLinesSubscriptionDetailsParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If previewing an update to a subscription, and doing proration, `subscription_details.proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_details.items`, or `subscription_details.trial_end` are required. Also, `subscription_details.proration_behavior` cannot be set to 'none'. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. ResumeAt *string `form:"resume_at"` // Date a subscription is intended to start (can be future or past). - StartDate *time.Time `form:"start_date"` + StartDate *int64 `form:"start_date"` // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_details.items` or `subscription` is required. - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo } // AppendTo implements custom encoding logic for InvoiceUpcomingLinesSubscriptionDetailsParams. @@ -2849,7 +2848,7 @@ type InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -2963,11 +2962,11 @@ type InvoiceUpcomingLinesParams struct { // The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a `subscription_details.items` is provided, you will preview creating a subscription with those items. If neither `subscription` nor `subscription_details.items` is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions. Subscription *string `form:"subscription"` // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.billing_cycle_anchor` instead. - SubscriptionBillingCycleAnchor *time.Time `form:"subscription_billing_cycle_anchor"` - SubscriptionBillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo - SubscriptionBillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo + SubscriptionBillingCycleAnchor *int64 `form:"subscription_billing_cycle_anchor"` + SubscriptionBillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo + SubscriptionBillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at` instead. - SubscriptionCancelAt *time.Time `form:"subscription_cancel_at"` + SubscriptionCancelAt *int64 `form:"subscription_cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at_period_end` instead. SubscriptionCancelAtPeriodEnd *bool `form:"subscription_cancel_at_period_end"` // This simulates the subscription being canceled or expired immediately. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_now` instead. @@ -2983,14 +2982,14 @@ type InvoiceUpcomingLinesParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_behavior` instead. SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"` // If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. Also, `subscription_proration_behavior` cannot be set to 'none'. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_date` instead. - SubscriptionProrationDate *time.Time `form:"subscription_proration_date"` + SubscriptionProrationDate *int64 `form:"subscription_proration_date"` // For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. This field has been deprecated and will be removed in a future API version. Use `subscription_details.resume_at` instead. SubscriptionResumeAt *string `form:"subscription_resume_at"` // Date a subscription is intended to start (can be future or past). This field has been deprecated and will be removed in a future API version. Use `subscription_details.start_date` instead. - SubscriptionStartDate *time.Time `form:"subscription_start_date"` + SubscriptionStartDate *int64 `form:"subscription_start_date"` // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version. Use `subscription_details.trial_end` instead. - SubscriptionTrialEnd *time.Time `form:"subscription_trial_end"` - SubscriptionTrialEndNow *bool `form:"-"` // See custom AppendTo + SubscriptionTrialEnd *int64 `form:"subscription_trial_end"` + SubscriptionTrialEndNow *bool `form:"-"` // See custom AppendTo // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } @@ -3026,7 +3025,7 @@ type InvoiceAddLinesLineDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceAddLinesLineDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -3046,9 +3045,9 @@ type InvoiceAddLinesLineDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceAddLinesLinePeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new product object inline. One of `product` or `product_data` is required. @@ -3190,7 +3189,7 @@ type InvoiceAttachPaymentPaymentRecordDataParams struct { // The type of money movement for this out of band payment record. MoneyMovementType *string `form:"money_movement_type"` // The timestamp when this out of band payment was paid. - PaidAt *time.Time `form:"paid_at"` + PaidAt *int64 `form:"paid_at"` // The reference for this out of band payment record. PaymentReference *string `form:"payment_reference"` } @@ -3363,7 +3362,7 @@ type InvoiceUpdateLinesLineDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceUpdateLinesLineDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -3383,9 +3382,9 @@ type InvoiceUpdateLinesLineDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceUpdateLinesLinePeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new product object inline. One of `product` or `product_data` is required. @@ -3597,7 +3596,7 @@ type InvoiceCreatePreviewDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceCreatePreviewDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -3627,7 +3626,7 @@ type InvoiceCreatePreviewInvoiceItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceCreatePreviewInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -3647,9 +3646,9 @@ type InvoiceCreatePreviewInvoiceItemDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceCreatePreviewInvoiceItemPeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. @@ -3740,7 +3739,7 @@ type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndParams struct { // Time span for the amendment starting from the `amendment_start`. Duration *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"` // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_end`. Type *string `form:"type"` } @@ -3764,7 +3763,7 @@ type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartParams struct { // Use the `end` time of a given discount. DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"` // A precise Unix timestamp for the amendment to start. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_start`. Type *string `form:"type"` } @@ -3834,7 +3833,7 @@ type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEn // Time span for the redeemed discount. Duration *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -3903,7 +3902,7 @@ type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEn // Time span for the redeemed discount. Duration *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -4040,7 +4039,7 @@ type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndPa // Time span for the redeemed discount. Duration *InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -4122,7 +4121,7 @@ type InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -4176,7 +4175,7 @@ type InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndParams struc // Time span for the redeemed discount. Duration *InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -4309,8 +4308,8 @@ type InvoiceCreatePreviewScheduleDetailsPhaseParams struct { // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*InvoiceCreatePreviewScheduleDetailsPhaseDiscountParams `form:"discounts"` // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. - EndDate *time.Time `form:"end_date"` - EndDateNow *bool `form:"-"` // See custom AppendTo + EndDate *int64 `form:"end_date"` + EndDateNow *bool `form:"-"` // See custom AppendTo // All invoices will be billed using the specified settings. InvoiceSettings *InvoiceCreatePreviewScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"` // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. @@ -4326,8 +4325,8 @@ type InvoiceCreatePreviewScheduleDetailsPhaseParams struct { // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. ProrationBehavior *string `form:"proration_behavior"` // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase. - StartDate *time.Time `form:"start_date"` - StartDateNow *bool `form:"-"` // See custom AppendTo + StartDate *int64 `form:"start_date"` + StartDateNow *bool `form:"-"` // See custom AppendTo // The data with which to automatically create a Transfer for each of the associated subscription's invoices. TransferData *InvoiceCreatePreviewScheduleDetailsPhaseTransferDataParams `form:"transfer_data"` // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. @@ -4335,8 +4334,8 @@ type InvoiceCreatePreviewScheduleDetailsPhaseParams struct { // Specify trial behavior when crossing phase boundaries TrialContinuation *string `form:"trial_continuation"` // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo // Settings related to subscription trials. TrialSettings *InvoiceCreatePreviewScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"` } @@ -4384,7 +4383,7 @@ type InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilParams struct { // Time span for prebilling, starting from `bill_from`. Duration *InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"` // End the prebilled period at a precise integer timestamp, starting from the Unix epoch. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of several ways to pass the `bill_until` value. Type *string `form:"type"` } @@ -4432,7 +4431,7 @@ type InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndParams struct // Time span for the redeemed discount. Duration *InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -4517,11 +4516,11 @@ type InvoiceCreatePreviewSubscriptionDetailsPrebillingParams struct { // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields. type InvoiceCreatePreviewSubscriptionDetailsParams struct { // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`. - BillingCycleAnchor *time.Time `form:"billing_cycle_anchor"` - BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo - BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo + BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` + BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo + BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. - CancelAt *time.Time `form:"cancel_at"` + CancelAt *int64 `form:"cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. CancelAtPeriodEnd *bool `form:"cancel_at_period_end"` // This simulates the subscription being canceled or expired immediately. @@ -4535,14 +4534,14 @@ type InvoiceCreatePreviewSubscriptionDetailsParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If previewing an update to a subscription, and doing proration, `subscription_details.proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_details.items`, or `subscription_details.trial_end` are required. Also, `subscription_details.proration_behavior` cannot be set to 'none'. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. ResumeAt *string `form:"resume_at"` // Date a subscription is intended to start (can be future or past). - StartDate *time.Time `form:"start_date"` + StartDate *int64 `form:"start_date"` // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_details.items` or `subscription` is required. - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo } // AppendTo implements custom encoding logic for InvoiceCreatePreviewSubscriptionDetailsParams. @@ -4630,9 +4629,9 @@ type InvoiceAmountsDue struct { // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` // Date on which a payment plan's payment is due. - DueDate time.Time `json:"due_date"` + DueDate int64 `json:"due_date"` // Timestamp when the payment was paid. - PaidAt time.Time `json:"paid_at"` + PaidAt int64 `json:"paid_at"` // The status of the payment, one of `open`, `paid`, or `past_due` Status InvoiceAmountsDueStatus `json:"status"` } @@ -4833,13 +4832,13 @@ type InvoiceShippingCost struct { } type InvoiceStatusTransitions struct { // The time that the invoice draft was finalized. - FinalizedAt time.Time `json:"finalized_at"` + FinalizedAt int64 `json:"finalized_at"` // The time that the invoice was marked uncollectible. - MarkedUncollectibleAt time.Time `json:"marked_uncollectible_at"` + MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` // The time that the invoice was paid. - PaidAt time.Time `json:"paid_at"` + PaidAt int64 `json:"paid_at"` // The time that the invoice was voided. - VoidedAt time.Time `json:"voided_at"` + VoidedAt int64 `json:"voided_at"` } // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment). @@ -4847,7 +4846,7 @@ type InvoiceSubscriptionDetailsPauseCollection struct { // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`. Behavior InvoiceSubscriptionDetailsPauseCollectionBehavior `json:"behavior"` // The time after which the subscription will resume collecting payments. - ResumesAt time.Time `json:"resumes_at"` + ResumesAt int64 `json:"resumes_at"` } // Details about the subscription that created this invoice. @@ -4988,7 +4987,7 @@ type Invoice struct { // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. AutoAdvance bool `json:"auto_advance"` // The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. - AutomaticallyFinalizesAt time.Time `json:"automatically_finalizes_at"` + AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` AutomaticTax *InvoiceAutomaticTax `json:"automatic_tax"` // Indicates the reason why the invoice was created. // @@ -5005,7 +5004,7 @@ type Invoice struct { // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. CollectionMethod InvoiceCollectionMethod `json:"collection_method"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The ID of the customer who will be billed. @@ -5042,9 +5041,9 @@ type Invoice struct { // The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount. Discounts []*Discount `json:"discounts"` // The date on which payment for this invoice is due. This value will be `null` for invoices where `collection_method=charge_automatically`. - DueDate time.Time `json:"due_date"` + DueDate int64 `json:"due_date"` // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. EndingBalance int64 `json:"ending_balance"` // Footer displayed on the invoice. @@ -5069,7 +5068,7 @@ type Invoice struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` // The time at which payment will next be attempted. This value will be `null` for invoices where `collection_method=send_invoice`. - NextPaymentAttempt time.Time `json:"next_payment_attempt"` + NextPaymentAttempt int64 `json:"next_payment_attempt"` // A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. Number string `json:"number"` // String representing the object's type. Objects of the same type share the same value. @@ -5086,9 +5085,9 @@ type Invoice struct { Payments *InvoicePaymentList `json:"payments"` PaymentSettings *InvoicePaymentSettings `json:"payment_settings"` // End of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // Start of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // Total amount of all post-payment credit notes issued for this invoice. PostPaymentCreditNotesAmount int64 `json:"post_payment_credit_notes_amount"` // Total amount of all pre-payment credit notes issued for this invoice. @@ -5115,7 +5114,7 @@ type Invoice struct { // Details about the subscription that created this invoice. SubscriptionDetails *InvoiceSubscriptionDetails `json:"subscription_details"` // Only set for upcoming invoices that preview prorations. The time used to calculate prorations. - SubscriptionProrationDate time.Time `json:"subscription_proration_date"` + SubscriptionProrationDate int64 `json:"subscription_proration_date"` // Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated Subtotal int64 `json:"subtotal"` // The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated @@ -5140,7 +5139,7 @@ type Invoice struct { // The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. TransferData *InvoiceTransferData `json:"transfer_data"` // Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have [been exhausted](https://stripe.com/docs/billing/webhooks#understand). This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. - WebhooksDeliveredAt time.Time `json:"webhooks_delivered_at"` + WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` } // InvoiceList is a list of Invoices as retrieved from a list endpoint. @@ -5167,190 +5166,11 @@ func (i *Invoice) UnmarshalJSON(data []byte) error { } type invoice Invoice - v := struct { - AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` - Created int64 `json:"created"` - DueDate int64 `json:"due_date"` - EffectiveAt int64 `json:"effective_at"` - NextPaymentAttempt int64 `json:"next_payment_attempt"` - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - SubscriptionProrationDate int64 `json:"subscription_proration_date"` - WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` - *invoice - }{ - invoice: (*invoice)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.AutomaticallyFinalizesAt = time.Unix(v.AutomaticallyFinalizesAt, 0) - i.Created = time.Unix(v.Created, 0) - i.DueDate = time.Unix(v.DueDate, 0) - i.EffectiveAt = time.Unix(v.EffectiveAt, 0) - i.NextPaymentAttempt = time.Unix(v.NextPaymentAttempt, 0) - i.PeriodEnd = time.Unix(v.PeriodEnd, 0) - i.PeriodStart = time.Unix(v.PeriodStart, 0) - i.SubscriptionProrationDate = time.Unix(v.SubscriptionProrationDate, 0) - i.WebhooksDeliveredAt = time.Unix(v.WebhooksDeliveredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an InvoiceAmountsDue. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoiceAmountsDue) UnmarshalJSON(data []byte) error { - type invoiceAmountsDue InvoiceAmountsDue - v := struct { - DueDate int64 `json:"due_date"` - PaidAt int64 `json:"paid_at"` - *invoiceAmountsDue - }{ - invoiceAmountsDue: (*invoiceAmountsDue)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.DueDate = time.Unix(v.DueDate, 0) - i.PaidAt = time.Unix(v.PaidAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an InvoiceStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoiceStatusTransitions) UnmarshalJSON(data []byte) error { - type invoiceStatusTransitions InvoiceStatusTransitions - v := struct { - FinalizedAt int64 `json:"finalized_at"` - MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` - PaidAt int64 `json:"paid_at"` - VoidedAt int64 `json:"voided_at"` - *invoiceStatusTransitions - }{ - invoiceStatusTransitions: (*invoiceStatusTransitions)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.FinalizedAt = time.Unix(v.FinalizedAt, 0) - i.MarkedUncollectibleAt = time.Unix(v.MarkedUncollectibleAt, 0) - i.PaidAt = time.Unix(v.PaidAt, 0) - i.VoidedAt = time.Unix(v.VoidedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an InvoiceSubscriptionDetailsPauseCollection. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoiceSubscriptionDetailsPauseCollection) UnmarshalJSON(data []byte) error { - type invoiceSubscriptionDetailsPauseCollection InvoiceSubscriptionDetailsPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - *invoiceSubscriptionDetailsPauseCollection - }{ - invoiceSubscriptionDetailsPauseCollection: (*invoiceSubscriptionDetailsPauseCollection)(i), - } + var v invoice if err := json.Unmarshal(data, &v); err != nil { return err } - i.ResumesAt = time.Unix(v.ResumesAt, 0) + *i = Invoice(v) return nil } - -// MarshalJSON handles serialization of an InvoiceAmountsDue. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoiceAmountsDue) MarshalJSON() ([]byte, error) { - type invoiceAmountsDue InvoiceAmountsDue - v := struct { - DueDate int64 `json:"due_date"` - PaidAt int64 `json:"paid_at"` - invoiceAmountsDue - }{ - invoiceAmountsDue: (invoiceAmountsDue)(i), - DueDate: i.DueDate.Unix(), - PaidAt: i.PaidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an InvoiceStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoiceStatusTransitions) MarshalJSON() ([]byte, error) { - type invoiceStatusTransitions InvoiceStatusTransitions - v := struct { - FinalizedAt int64 `json:"finalized_at"` - MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` - PaidAt int64 `json:"paid_at"` - VoidedAt int64 `json:"voided_at"` - invoiceStatusTransitions - }{ - invoiceStatusTransitions: (invoiceStatusTransitions)(i), - FinalizedAt: i.FinalizedAt.Unix(), - MarkedUncollectibleAt: i.MarkedUncollectibleAt.Unix(), - PaidAt: i.PaidAt.Unix(), - VoidedAt: i.VoidedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an InvoiceSubscriptionDetailsPauseCollection. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoiceSubscriptionDetailsPauseCollection) MarshalJSON() ([]byte, error) { - type invoiceSubscriptionDetailsPauseCollection InvoiceSubscriptionDetailsPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - invoiceSubscriptionDetailsPauseCollection - }{ - invoiceSubscriptionDetailsPauseCollection: (invoiceSubscriptionDetailsPauseCollection)(i), - ResumesAt: i.ResumesAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an Invoice. -// This custom marshaling is needed to handle the time fields correctly. -func (i Invoice) MarshalJSON() ([]byte, error) { - type invoice Invoice - v := struct { - AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` - Created int64 `json:"created"` - DueDate int64 `json:"due_date"` - EffectiveAt int64 `json:"effective_at"` - NextPaymentAttempt int64 `json:"next_payment_attempt"` - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - SubscriptionProrationDate int64 `json:"subscription_proration_date"` - WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` - invoice - }{ - invoice: (invoice)(i), - AutomaticallyFinalizesAt: i.AutomaticallyFinalizesAt.Unix(), - Created: i.Created.Unix(), - DueDate: i.DueDate.Unix(), - EffectiveAt: i.EffectiveAt.Unix(), - NextPaymentAttempt: i.NextPaymentAttempt.Unix(), - PeriodEnd: i.PeriodEnd.Unix(), - PeriodStart: i.PeriodStart.Unix(), - SubscriptionProrationDate: i.SubscriptionProrationDate.Unix(), - WebhooksDeliveredAt: i.WebhooksDeliveredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/invoiceitem.go b/invoiceitem.go index 979e192226..e558a2954e 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they're not attached to invoices, or if it's attached to a draft invoice. type InvoiceItemParams struct { @@ -83,7 +80,7 @@ type InvoiceItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -103,9 +100,9 @@ type InvoiceItemDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceItemPeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. @@ -164,8 +161,8 @@ type InvoiceItem struct { // The ID of the customer who will be billed when this invoice item is billed. Customer *Customer `json:"customer"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Date time.Time `json:"date"` - Deleted bool `json:"deleted"` + Date int64 `json:"date"` + Deleted bool `json:"deleted"` // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` // If true, discounts will apply to this invoice item. Always false for prorations. @@ -224,34 +221,11 @@ func (i *InvoiceItem) UnmarshalJSON(data []byte) error { } type invoiceItem InvoiceItem - v := struct { - Date int64 `json:"date"` - *invoiceItem - }{ - invoiceItem: (*invoiceItem)(i), - } + var v invoiceItem if err := json.Unmarshal(data, &v); err != nil { return err } - i.Date = time.Unix(v.Date, 0) + *i = InvoiceItem(v) return nil } - -// MarshalJSON handles serialization of an InvoiceItem. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoiceItem) MarshalJSON() ([]byte, error) { - type invoiceItem InvoiceItem - v := struct { - Date int64 `json:"date"` - invoiceItem - }{ - invoiceItem: (invoiceItem)(i), - Date: i.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/invoicelineitem.go b/invoicelineitem.go index ed4449cd14..88529ea614 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -6,8 +6,6 @@ package stripe -import "time" - // Type of the pretax credit amount referenced. type InvoiceLineItemPretaxCreditAmountType string @@ -40,7 +38,7 @@ type InvoiceLineItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *InvoiceLineItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -60,9 +58,9 @@ type InvoiceLineItemDiscountParams struct { // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. type InvoiceLineItemPeriodParams struct { // The end of the period, which must be greater than or equal to the start. This value is inclusive. - End *time.Time `form:"end"` + End *int64 `form:"end"` // The start of the period. This value is inclusive. - Start *time.Time `form:"start"` + Start *int64 `form:"start"` } // Data used to generate a new product object inline. One of `product` or `product_data` is required. diff --git a/invoicepayment.go b/invoicepayment.go index e02a062289..1bd107f18e 100644 --- a/invoicepayment.go +++ b/invoicepayment.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Type of payment object associated with this invoice payment. type InvoicePaymentPaymentType string @@ -60,9 +55,9 @@ type InvoicePaymentPayment struct { } type InvoicePaymentStatusTransitions struct { // The time that the payment was canceled. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // The time that the payment succeeded. - PaidAt time.Time `json:"paid_at"` + PaidAt int64 `json:"paid_at"` } // The invoice payment object @@ -75,7 +70,7 @@ type InvoicePayment struct { // Amount intended to be paid toward this invoice, in cents (or local equivalent) AmountRequested int64 `json:"amount_requested"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Unique identifier for the object. @@ -100,79 +95,3 @@ type InvoicePaymentList struct { ListMeta Data []*InvoicePayment `json:"data"` } - -// UnmarshalJSON handles deserialization of an InvoicePaymentStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoicePaymentStatusTransitions) UnmarshalJSON(data []byte) error { - type invoicePaymentStatusTransitions InvoicePaymentStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - PaidAt int64 `json:"paid_at"` - *invoicePaymentStatusTransitions - }{ - invoicePaymentStatusTransitions: (*invoicePaymentStatusTransitions)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.CanceledAt = time.Unix(v.CanceledAt, 0) - i.PaidAt = time.Unix(v.PaidAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an InvoicePayment. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoicePayment) UnmarshalJSON(data []byte) error { - type invoicePayment InvoicePayment - v := struct { - Created int64 `json:"created"` - *invoicePayment - }{ - invoicePayment: (*invoicePayment)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an InvoicePaymentStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoicePaymentStatusTransitions) MarshalJSON() ([]byte, error) { - type invoicePaymentStatusTransitions InvoicePaymentStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - PaidAt int64 `json:"paid_at"` - invoicePaymentStatusTransitions - }{ - invoicePaymentStatusTransitions: (invoicePaymentStatusTransitions)(i), - CanceledAt: i.CanceledAt.Unix(), - PaidAt: i.PaidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an InvoicePayment. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoicePayment) MarshalJSON() ([]byte, error) { - type invoicePayment InvoicePayment - v := struct { - Created int64 `json:"created"` - invoicePayment - }{ - invoicePayment: (invoicePayment)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/invoicerenderingtemplate.go b/invoicerenderingtemplate.go index 499d8ecb23..e797719c45 100644 --- a/invoicerenderingtemplate.go +++ b/invoicerenderingtemplate.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The status of the template, one of `active` or `archived`. type InvoiceRenderingTemplateStatus string @@ -75,7 +70,7 @@ func (p *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { type InvoiceRenderingTemplate struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -98,39 +93,3 @@ type InvoiceRenderingTemplateList struct { ListMeta Data []*InvoiceRenderingTemplate `json:"data"` } - -// UnmarshalJSON handles deserialization of an InvoiceRenderingTemplate. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *InvoiceRenderingTemplate) UnmarshalJSON(data []byte) error { - type invoiceRenderingTemplate InvoiceRenderingTemplate - v := struct { - Created int64 `json:"created"` - *invoiceRenderingTemplate - }{ - invoiceRenderingTemplate: (*invoiceRenderingTemplate)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an InvoiceRenderingTemplate. -// This custom marshaling is needed to handle the time fields correctly. -func (i InvoiceRenderingTemplate) MarshalJSON() ([]byte, error) { - type invoiceRenderingTemplate InvoiceRenderingTemplate - v := struct { - Created int64 `json:"created"` - invoiceRenderingTemplate - }{ - invoiceRenderingTemplate: (invoiceRenderingTemplate)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_authorization.go b/issuing_authorization.go index bc2ef2719f..273bedd612 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // How the card details were provided. type IssuingAuthorizationAuthorizationMethod string @@ -435,7 +432,7 @@ type IssuingAuthorizationRequestHistory struct { // A code created by Stripe which is shared with the merchant to validate the authorization. This field will be populated if the authorization message was approved. The code typically starts with the letter "S", followed by a six-digit number. For example, "S498162". Please note that the code is not guaranteed to be unique across authorizations. AuthorizationCode string `json:"authorization_code"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The `pending_request.merchant_amount` at the time of the request, presented in the `merchant_currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -449,7 +446,7 @@ type IssuingAuthorizationRequestHistory struct { // If the `request_history.reason` is `webhook_error` because the direct webhook response is invalid (for example, parsing errors or missing parameters), we surface a more detailed error message via this field. ReasonMessage string `json:"reason_message"` // Time when the card network received an authorization request from the acquirer in UTC. Referred to by networks as transmission time. - RequestedAt time.Time `json:"requested_at"` + RequestedAt int64 `json:"requested_at"` } // [Treasury](https://stripe.com/docs/api/treasury) details related to this authorization if it was created on a [FinancialAccount](https://stripe.com/docs/api/treasury/financial_accounts). @@ -514,7 +511,7 @@ type IssuingAuthorization struct { // The cardholder to whom this authorization belongs. Cardholder *IssuingCardholder `json:"cardholder"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The currency of the cardholder. This currency can be different from the currency presented at authorization and the `merchant_currency` field on this authorization. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Fleet-specific information for authorizations using Fleet cards. @@ -574,74 +571,11 @@ func (i *IssuingAuthorization) UnmarshalJSON(data []byte) error { } type issuingAuthorization IssuingAuthorization - v := struct { - Created int64 `json:"created"` - *issuingAuthorization - }{ - issuingAuthorization: (*issuingAuthorization)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingAuthorizationRequestHistory. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingAuthorizationRequestHistory) UnmarshalJSON(data []byte) error { - type issuingAuthorizationRequestHistory IssuingAuthorizationRequestHistory - v := struct { - Created int64 `json:"created"` - RequestedAt int64 `json:"requested_at"` - *issuingAuthorizationRequestHistory - }{ - issuingAuthorizationRequestHistory: (*issuingAuthorizationRequestHistory)(i), - } + var v issuingAuthorization if err := json.Unmarshal(data, &v); err != nil { return err } - i.Created = time.Unix(v.Created, 0) - i.RequestedAt = time.Unix(v.RequestedAt, 0) + *i = IssuingAuthorization(v) return nil } - -// MarshalJSON handles serialization of an IssuingAuthorizationRequestHistory. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingAuthorizationRequestHistory) MarshalJSON() ([]byte, error) { - type issuingAuthorizationRequestHistory IssuingAuthorizationRequestHistory - v := struct { - Created int64 `json:"created"` - RequestedAt int64 `json:"requested_at"` - issuingAuthorizationRequestHistory - }{ - issuingAuthorizationRequestHistory: (issuingAuthorizationRequestHistory)(i), - Created: i.Created.Unix(), - RequestedAt: i.RequestedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingAuthorization. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingAuthorization) MarshalJSON() ([]byte, error) { - type issuingAuthorization IssuingAuthorization - v := struct { - Created int64 `json:"created"` - issuingAuthorization - }{ - issuingAuthorization: (issuingAuthorization)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_card.go b/issuing_card.go index 77406d0fc2..425afaded7 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The reason why the card was canceled. type IssuingCardCancellationReason string @@ -314,7 +311,7 @@ type IssuingCardShipping struct { // Additional information that may be required for clearing customs. Customs *IssuingCardShippingCustoms `json:"customs"` // A unix timestamp representing a best estimate of when the card will be delivered. - ETA time.Time `json:"eta"` + ETA int64 `json:"eta"` // Recipient name. Name string `json:"name"` // The phone number of the receiver of the shipment. Our courier partners will use this number to contact you in the event of card delivery issues. For individual shipments to the EU/UK, if this field is empty, we will provide them with the phone number provided when the cardholder was initially created. @@ -389,7 +386,7 @@ type IssuingCard struct { // Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards/virtual/issue-cards#create-cardholder) Cardholder *IssuingCardholder `json:"cardholder"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Supported currencies are `usd` in the US, `eur` in the EU, and `gbp` in the UK. Currency Currency `json:"currency"` // The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with [the `expand` parameter](https://stripe.com/docs/api/expanding_objects). Additionally, it's only available via the ["Retrieve a card" endpoint](https://stripe.com/docs/api/issuing/cards/retrieve), not via "List all cards" or any other endpoint. @@ -448,70 +445,11 @@ func (i *IssuingCard) UnmarshalJSON(data []byte) error { } type issuingCard IssuingCard - v := struct { - Created int64 `json:"created"` - *issuingCard - }{ - issuingCard: (*issuingCard)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingCardShipping. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingCardShipping) UnmarshalJSON(data []byte) error { - type issuingCardShipping IssuingCardShipping - v := struct { - ETA int64 `json:"eta"` - *issuingCardShipping - }{ - issuingCardShipping: (*issuingCardShipping)(i), - } + var v issuingCard if err := json.Unmarshal(data, &v); err != nil { return err } - i.ETA = time.Unix(v.ETA, 0) + *i = IssuingCard(v) return nil } - -// MarshalJSON handles serialization of an IssuingCardShipping. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCardShipping) MarshalJSON() ([]byte, error) { - type issuingCardShipping IssuingCardShipping - v := struct { - ETA int64 `json:"eta"` - issuingCardShipping - }{ - issuingCardShipping: (issuingCardShipping)(i), - ETA: i.ETA.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingCard. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCard) MarshalJSON() ([]byte, error) { - type issuingCard IssuingCard - v := struct { - Created int64 `json:"created"` - issuingCard - }{ - issuingCard: (issuingCard)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_cardholder.go b/issuing_cardholder.go index 75c196d3fd..f1eb5ad674 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. // @@ -107,7 +104,7 @@ type IssuingCardholderCompanyParams struct { // Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program. type IssuingCardholderIndividualCardIssuingUserTermsAcceptanceParams struct { // The Unix timestamp marking when the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users. IP *string `form:"ip"` // The user agent of the browser from which the cardholder accepted the Authorized User Terms. @@ -242,7 +239,7 @@ type IssuingCardholderCompany struct { // Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program. type IssuingCardholderIndividualCardIssuingUserTermsAcceptance struct { // The Unix timestamp marking when the cardholder accepted the Authorized User Terms. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the cardholder accepted the Authorized User Terms. IP string `json:"ip"` // The user agent of the browser from which the cardholder accepted the Authorized User Terms. @@ -334,7 +331,7 @@ type IssuingCardholder struct { // Additional information about a `company` cardholder. Company *IssuingCardholderCompany `json:"company"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The cardholder's email address. Email string `json:"email"` // Unique identifier for the object. @@ -380,70 +377,11 @@ func (i *IssuingCardholder) UnmarshalJSON(data []byte) error { } type issuingCardholder IssuingCardholder - v := struct { - Created int64 `json:"created"` - *issuingCardholder - }{ - issuingCardholder: (*issuingCardholder)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingCardholderIndividualCardIssuingUserTermsAcceptance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingCardholderIndividualCardIssuingUserTermsAcceptance) UnmarshalJSON(data []byte) error { - type issuingCardholderIndividualCardIssuingUserTermsAcceptance IssuingCardholderIndividualCardIssuingUserTermsAcceptance - v := struct { - Date int64 `json:"date"` - *issuingCardholderIndividualCardIssuingUserTermsAcceptance - }{ - issuingCardholderIndividualCardIssuingUserTermsAcceptance: (*issuingCardholderIndividualCardIssuingUserTermsAcceptance)(i), - } + var v issuingCardholder if err := json.Unmarshal(data, &v); err != nil { return err } - i.Date = time.Unix(v.Date, 0) + *i = IssuingCardholder(v) return nil } - -// MarshalJSON handles serialization of an IssuingCardholderIndividualCardIssuingUserTermsAcceptance. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCardholderIndividualCardIssuingUserTermsAcceptance) MarshalJSON() ([]byte, error) { - type issuingCardholderIndividualCardIssuingUserTermsAcceptance IssuingCardholderIndividualCardIssuingUserTermsAcceptance - v := struct { - Date int64 `json:"date"` - issuingCardholderIndividualCardIssuingUserTermsAcceptance - }{ - issuingCardholderIndividualCardIssuingUserTermsAcceptance: (issuingCardholderIndividualCardIssuingUserTermsAcceptance)(i), - Date: i.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingCardholder. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCardholder) MarshalJSON() ([]byte, error) { - type issuingCardholder IssuingCardholder - v := struct { - Created int64 `json:"created"` - issuingCardholder - }{ - issuingCardholder: (issuingCardholder)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_creditunderwritingrecord.go b/issuing_creditunderwritingrecord.go index 6f3382e7cb..171cc94058 100644 --- a/issuing_creditunderwritingrecord.go +++ b/issuing_creditunderwritingrecord.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The channel through which the applicant has submitted their application. type IssuingCreditUnderwritingRecordApplicationApplicationMethod string @@ -325,7 +320,7 @@ type IssuingCreditUnderwritingRecordCorrectApplicationParams struct { // Scope of demand made by the applicant. Purpose *string `form:"purpose"` // Date when the applicant submitted their application. - SubmittedAt *time.Time `form:"submitted_at"` + SubmittedAt *int64 `form:"submitted_at"` } // Information about the company or person applying or holding the account. @@ -402,7 +397,7 @@ type IssuingCreditUnderwritingRecordCorrectParams struct { // Information about the company or person applying or holding the account. CreditUser *IssuingCreditUnderwritingRecordCorrectCreditUserParams `form:"credit_user"` // Date when a decision was made. - DecidedAt *time.Time `form:"decided_at"` + DecidedAt *int64 `form:"decided_at"` // Details about the decision. Decision *IssuingCreditUnderwritingRecordCorrectDecisionParams `form:"decision"` // Specifies which fields in the response should be expanded. @@ -467,7 +462,7 @@ type IssuingCreditUnderwritingRecordReportDecisionUnderwritingExceptionParams st type IssuingCreditUnderwritingRecordReportDecisionParams struct { Params `form:"*"` // Date when a decision was made. - DecidedAt *time.Time `form:"decided_at"` + DecidedAt *int64 `form:"decided_at"` // Details about the decision. Decision *IssuingCreditUnderwritingRecordReportDecisionDecisionParams `form:"decision"` // Specifies which fields in the response should be expanded. @@ -501,7 +496,7 @@ type IssuingCreditUnderwritingRecordCreateFromApplicationApplicationParams struc // Scope of demand made by the applicant. Purpose *string `form:"purpose"` // Date when the applicant submitted their application. - SubmittedAt *time.Time `form:"submitted_at"` + SubmittedAt *int64 `form:"submitted_at"` } // Information about the company or person applying or holding the account. @@ -601,7 +596,7 @@ type IssuingCreditUnderwritingRecordCreateFromProactiveReviewParams struct { // Information about the company or person applying or holding the account. CreditUser *IssuingCreditUnderwritingRecordCreateFromProactiveReviewCreditUserParams `form:"credit_user"` // Date when a decision was made. - DecidedAt *time.Time `form:"decided_at"` + DecidedAt *int64 `form:"decided_at"` // Details about the decision. Decision *IssuingCreditUnderwritingRecordCreateFromProactiveReviewDecisionParams `form:"decision"` // Specifies which fields in the response should be expanded. @@ -635,7 +630,7 @@ type IssuingCreditUnderwritingRecordApplication struct { // Scope of demand made by the applicant. Purpose IssuingCreditUnderwritingRecordApplicationPurpose `json:"purpose"` // Date when the applicant submitted their application. - SubmittedAt time.Time `json:"submitted_at"` + SubmittedAt int64 `json:"submitted_at"` } type IssuingCreditUnderwritingRecordCreditUser struct { // Email of the applicant or accountholder. @@ -710,16 +705,16 @@ type IssuingCreditUnderwritingRecord struct { // For decisions triggered by an application, details about the submission. Application *IssuingCreditUnderwritingRecordApplication `json:"application"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The event that triggered the underwriting. CreatedFrom IssuingCreditUnderwritingRecordCreatedFrom `json:"created_from"` CreditUser *IssuingCreditUnderwritingRecordCreditUser `json:"credit_user"` // Date when a decision was made. - DecidedAt time.Time `json:"decided_at"` + DecidedAt int64 `json:"decided_at"` // Details about the decision. Decision *IssuingCreditUnderwritingRecordDecision `json:"decision"` // For underwriting initiated by an application, a decision must be taken 30 days after the submission. - DecisionDeadline time.Time `json:"decision_deadline"` + DecisionDeadline int64 `json:"decision_deadline"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -740,83 +735,3 @@ type IssuingCreditUnderwritingRecordList struct { ListMeta Data []*IssuingCreditUnderwritingRecord `json:"data"` } - -// UnmarshalJSON handles deserialization of an IssuingCreditUnderwritingRecordApplication. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingCreditUnderwritingRecordApplication) UnmarshalJSON(data []byte) error { - type issuingCreditUnderwritingRecordApplication IssuingCreditUnderwritingRecordApplication - v := struct { - SubmittedAt int64 `json:"submitted_at"` - *issuingCreditUnderwritingRecordApplication - }{ - issuingCreditUnderwritingRecordApplication: (*issuingCreditUnderwritingRecordApplication)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.SubmittedAt = time.Unix(v.SubmittedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingCreditUnderwritingRecord. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingCreditUnderwritingRecord) UnmarshalJSON(data []byte) error { - type issuingCreditUnderwritingRecord IssuingCreditUnderwritingRecord - v := struct { - Created int64 `json:"created"` - DecidedAt int64 `json:"decided_at"` - DecisionDeadline int64 `json:"decision_deadline"` - *issuingCreditUnderwritingRecord - }{ - issuingCreditUnderwritingRecord: (*issuingCreditUnderwritingRecord)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - i.DecidedAt = time.Unix(v.DecidedAt, 0) - i.DecisionDeadline = time.Unix(v.DecisionDeadline, 0) - return nil -} - -// MarshalJSON handles serialization of an IssuingCreditUnderwritingRecordApplication. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCreditUnderwritingRecordApplication) MarshalJSON() ([]byte, error) { - type issuingCreditUnderwritingRecordApplication IssuingCreditUnderwritingRecordApplication - v := struct { - SubmittedAt int64 `json:"submitted_at"` - issuingCreditUnderwritingRecordApplication - }{ - issuingCreditUnderwritingRecordApplication: (issuingCreditUnderwritingRecordApplication)(i), - SubmittedAt: i.SubmittedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingCreditUnderwritingRecord. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingCreditUnderwritingRecord) MarshalJSON() ([]byte, error) { - type issuingCreditUnderwritingRecord IssuingCreditUnderwritingRecord - v := struct { - Created int64 `json:"created"` - DecidedAt int64 `json:"decided_at"` - DecisionDeadline int64 `json:"decision_deadline"` - issuingCreditUnderwritingRecord - }{ - issuingCreditUnderwritingRecord: (issuingCreditUnderwritingRecord)(i), - Created: i.Created.Unix(), - DecidedAt: i.DecidedAt.Unix(), - DecisionDeadline: i.DecisionDeadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_dispute.go b/issuing_dispute.go index 5c184a77e3..08eebc5be4 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Whether the product was a merchandise or service. type IssuingDisputeEvidenceCanceledProductType string @@ -135,13 +132,13 @@ type IssuingDisputeEvidenceCanceledParams struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *string `form:"additional_documentation"` // Date when order was canceled. - CanceledAt *time.Time `form:"canceled_at"` + CanceledAt *int64 `form:"canceled_at"` // Whether the cardholder was provided with a cancellation policy. CancellationPolicyProvided *bool `form:"cancellation_policy_provided"` // Reason for canceling the order. CancellationReason *string `form:"cancellation_reason"` // Date when the cardholder expected to receive the product. - ExpectedAt *time.Time `form:"expected_at"` + ExpectedAt *int64 `form:"expected_at"` // Explanation of why the cardholder is disputing this transaction. Explanation *string `form:"explanation"` // Description of the merchandise or service that was purchased. @@ -149,7 +146,7 @@ type IssuingDisputeEvidenceCanceledParams struct { // Whether the product was a merchandise or service. ProductType *string `form:"product_type"` // Date when the product was returned or attempted to be returned. - ReturnedAt *time.Time `form:"returned_at"` + ReturnedAt *int64 `form:"returned_at"` // Result of cardholder's attempt to return the product. ReturnStatus *string `form:"return_status"` } @@ -185,11 +182,11 @@ type IssuingDisputeEvidenceMerchandiseNotAsDescribedParams struct { // Explanation of why the cardholder is disputing this transaction. Explanation *string `form:"explanation"` // Date when the product was received. - ReceivedAt *time.Time `form:"received_at"` + ReceivedAt *int64 `form:"received_at"` // Description of the cardholder's attempt to return the product. ReturnDescription *string `form:"return_description"` // Date when the product was returned or attempted to be returned. - ReturnedAt *time.Time `form:"returned_at"` + ReturnedAt *int64 `form:"returned_at"` // Result of cardholder's attempt to return the product. ReturnStatus *string `form:"return_status"` } @@ -207,7 +204,7 @@ type IssuingDisputeEvidenceNotReceivedParams struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *string `form:"additional_documentation"` // Date when the cardholder expected to receive the product. - ExpectedAt *time.Time `form:"expected_at"` + ExpectedAt *int64 `form:"expected_at"` // Explanation of why the cardholder is disputing this transaction. Explanation *string `form:"explanation"` // Description of the merchandise or service that was purchased. @@ -233,13 +230,13 @@ type IssuingDisputeEvidenceServiceNotAsDescribedParams struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *string `form:"additional_documentation"` // Date when order was canceled. - CanceledAt *time.Time `form:"canceled_at"` + CanceledAt *int64 `form:"canceled_at"` // Reason for canceling the order. CancellationReason *string `form:"cancellation_reason"` // Explanation of why the cardholder is disputing this transaction. Explanation *string `form:"explanation"` // Date when the product was received. - ReceivedAt *time.Time `form:"received_at"` + ReceivedAt *int64 `form:"received_at"` } // Evidence provided for the dispute. @@ -328,13 +325,13 @@ type IssuingDisputeEvidenceCanceled struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *File `json:"additional_documentation"` // Date when order was canceled. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Whether the cardholder was provided with a cancellation policy. CancellationPolicyProvided bool `json:"cancellation_policy_provided"` // Reason for canceling the order. CancellationReason string `json:"cancellation_reason"` // Date when the cardholder expected to receive the product. - ExpectedAt time.Time `json:"expected_at"` + ExpectedAt int64 `json:"expected_at"` // Explanation of why the cardholder is disputing this transaction. Explanation string `json:"explanation"` // Description of the merchandise or service that was purchased. @@ -342,7 +339,7 @@ type IssuingDisputeEvidenceCanceled struct { // Whether the product was a merchandise or service. ProductType IssuingDisputeEvidenceCanceledProductType `json:"product_type"` // Date when the product was returned or attempted to be returned. - ReturnedAt time.Time `json:"returned_at"` + ReturnedAt int64 `json:"returned_at"` // Result of cardholder's attempt to return the product. ReturnStatus IssuingDisputeEvidenceCanceledReturnStatus `json:"return_status"` } @@ -372,11 +369,11 @@ type IssuingDisputeEvidenceMerchandiseNotAsDescribed struct { // Explanation of why the cardholder is disputing this transaction. Explanation string `json:"explanation"` // Date when the product was received. - ReceivedAt time.Time `json:"received_at"` + ReceivedAt int64 `json:"received_at"` // Description of the cardholder's attempt to return the product. ReturnDescription string `json:"return_description"` // Date when the product was returned or attempted to be returned. - ReturnedAt time.Time `json:"returned_at"` + ReturnedAt int64 `json:"returned_at"` // Result of cardholder's attempt to return the product. ReturnStatus IssuingDisputeEvidenceMerchandiseNotAsDescribedReturnStatus `json:"return_status"` } @@ -390,7 +387,7 @@ type IssuingDisputeEvidenceNotReceived struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *File `json:"additional_documentation"` // Date when the cardholder expected to receive the product. - ExpectedAt time.Time `json:"expected_at"` + ExpectedAt int64 `json:"expected_at"` // Explanation of why the cardholder is disputing this transaction. Explanation string `json:"explanation"` // Description of the merchandise or service that was purchased. @@ -412,13 +409,13 @@ type IssuingDisputeEvidenceServiceNotAsDescribed struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *File `json:"additional_documentation"` // Date when order was canceled. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Reason for canceling the order. CancellationReason string `json:"cancellation_reason"` // Explanation of why the cardholder is disputing this transaction. Explanation string `json:"explanation"` // Date when the product was received. - ReceivedAt time.Time `json:"received_at"` + ReceivedAt int64 `json:"received_at"` } type IssuingDisputeEvidence struct { Canceled *IssuingDisputeEvidenceCanceled `json:"canceled"` @@ -451,7 +448,7 @@ type IssuingDispute struct { // List of balance transactions associated with the dispute. BalanceTransactions []*BalanceTransaction `json:"balance_transactions"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The currency the `transaction` was made in. Currency Currency `json:"currency"` Evidence *IssuingDisputeEvidence `json:"evidence"` @@ -490,194 +487,11 @@ func (i *IssuingDispute) UnmarshalJSON(data []byte) error { } type issuingDispute IssuingDispute - v := struct { - Created int64 `json:"created"` - *issuingDispute - }{ - issuingDispute: (*issuingDispute)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingDisputeEvidenceCanceled. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingDisputeEvidenceCanceled) UnmarshalJSON(data []byte) error { - type issuingDisputeEvidenceCanceled IssuingDisputeEvidenceCanceled - v := struct { - CanceledAt int64 `json:"canceled_at"` - ExpectedAt int64 `json:"expected_at"` - ReturnedAt int64 `json:"returned_at"` - *issuingDisputeEvidenceCanceled - }{ - issuingDisputeEvidenceCanceled: (*issuingDisputeEvidenceCanceled)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.CanceledAt = time.Unix(v.CanceledAt, 0) - i.ExpectedAt = time.Unix(v.ExpectedAt, 0) - i.ReturnedAt = time.Unix(v.ReturnedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingDisputeEvidenceMerchandiseNotAsDescribed. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingDisputeEvidenceMerchandiseNotAsDescribed) UnmarshalJSON(data []byte) error { - type issuingDisputeEvidenceMerchandiseNotAsDescribed IssuingDisputeEvidenceMerchandiseNotAsDescribed - v := struct { - ReceivedAt int64 `json:"received_at"` - ReturnedAt int64 `json:"returned_at"` - *issuingDisputeEvidenceMerchandiseNotAsDescribed - }{ - issuingDisputeEvidenceMerchandiseNotAsDescribed: (*issuingDisputeEvidenceMerchandiseNotAsDescribed)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.ReceivedAt = time.Unix(v.ReceivedAt, 0) - i.ReturnedAt = time.Unix(v.ReturnedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingDisputeEvidenceNotReceived. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingDisputeEvidenceNotReceived) UnmarshalJSON(data []byte) error { - type issuingDisputeEvidenceNotReceived IssuingDisputeEvidenceNotReceived - v := struct { - ExpectedAt int64 `json:"expected_at"` - *issuingDisputeEvidenceNotReceived - }{ - issuingDisputeEvidenceNotReceived: (*issuingDisputeEvidenceNotReceived)(i), - } + var v issuingDispute if err := json.Unmarshal(data, &v); err != nil { return err } - i.ExpectedAt = time.Unix(v.ExpectedAt, 0) + *i = IssuingDispute(v) return nil } - -// UnmarshalJSON handles deserialization of an IssuingDisputeEvidenceServiceNotAsDescribed. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingDisputeEvidenceServiceNotAsDescribed) UnmarshalJSON(data []byte) error { - type issuingDisputeEvidenceServiceNotAsDescribed IssuingDisputeEvidenceServiceNotAsDescribed - v := struct { - CanceledAt int64 `json:"canceled_at"` - ReceivedAt int64 `json:"received_at"` - *issuingDisputeEvidenceServiceNotAsDescribed - }{ - issuingDisputeEvidenceServiceNotAsDescribed: (*issuingDisputeEvidenceServiceNotAsDescribed)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.CanceledAt = time.Unix(v.CanceledAt, 0) - i.ReceivedAt = time.Unix(v.ReceivedAt, 0) - return nil -} - -// MarshalJSON handles serialization of an IssuingDisputeEvidenceCanceled. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDisputeEvidenceCanceled) MarshalJSON() ([]byte, error) { - type issuingDisputeEvidenceCanceled IssuingDisputeEvidenceCanceled - v := struct { - CanceledAt int64 `json:"canceled_at"` - ExpectedAt int64 `json:"expected_at"` - ReturnedAt int64 `json:"returned_at"` - issuingDisputeEvidenceCanceled - }{ - issuingDisputeEvidenceCanceled: (issuingDisputeEvidenceCanceled)(i), - CanceledAt: i.CanceledAt.Unix(), - ExpectedAt: i.ExpectedAt.Unix(), - ReturnedAt: i.ReturnedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingDisputeEvidenceMerchandiseNotAsDescribed. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDisputeEvidenceMerchandiseNotAsDescribed) MarshalJSON() ([]byte, error) { - type issuingDisputeEvidenceMerchandiseNotAsDescribed IssuingDisputeEvidenceMerchandiseNotAsDescribed - v := struct { - ReceivedAt int64 `json:"received_at"` - ReturnedAt int64 `json:"returned_at"` - issuingDisputeEvidenceMerchandiseNotAsDescribed - }{ - issuingDisputeEvidenceMerchandiseNotAsDescribed: (issuingDisputeEvidenceMerchandiseNotAsDescribed)(i), - ReceivedAt: i.ReceivedAt.Unix(), - ReturnedAt: i.ReturnedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingDisputeEvidenceNotReceived. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDisputeEvidenceNotReceived) MarshalJSON() ([]byte, error) { - type issuingDisputeEvidenceNotReceived IssuingDisputeEvidenceNotReceived - v := struct { - ExpectedAt int64 `json:"expected_at"` - issuingDisputeEvidenceNotReceived - }{ - issuingDisputeEvidenceNotReceived: (issuingDisputeEvidenceNotReceived)(i), - ExpectedAt: i.ExpectedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingDisputeEvidenceServiceNotAsDescribed. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDisputeEvidenceServiceNotAsDescribed) MarshalJSON() ([]byte, error) { - type issuingDisputeEvidenceServiceNotAsDescribed IssuingDisputeEvidenceServiceNotAsDescribed - v := struct { - CanceledAt int64 `json:"canceled_at"` - ReceivedAt int64 `json:"received_at"` - issuingDisputeEvidenceServiceNotAsDescribed - }{ - issuingDisputeEvidenceServiceNotAsDescribed: (issuingDisputeEvidenceServiceNotAsDescribed)(i), - CanceledAt: i.CanceledAt.Unix(), - ReceivedAt: i.ReceivedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingDispute. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDispute) MarshalJSON() ([]byte, error) { - type issuingDispute IssuingDispute - v := struct { - Created int64 `json:"created"` - issuingDispute - }{ - issuingDispute: (issuingDispute)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_disputesettlementdetail.go b/issuing_disputesettlementdetail.go index 3c97f9ad2d..d5992004cd 100644 --- a/issuing_disputesettlementdetail.go +++ b/issuing_disputesettlementdetail.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of event corresponding to this dispute settlement detail, representing the stage in the dispute network lifecycle. type IssuingDisputeSettlementDetailEventType string @@ -66,7 +61,7 @@ type IssuingDisputeSettlementDetail struct { // The card used to make the original transaction. Card string `json:"card"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The currency the original transaction was made in. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The ID of the linked dispute. @@ -91,39 +86,3 @@ type IssuingDisputeSettlementDetailList struct { ListMeta Data []*IssuingDisputeSettlementDetail `json:"data"` } - -// UnmarshalJSON handles deserialization of an IssuingDisputeSettlementDetail. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingDisputeSettlementDetail) UnmarshalJSON(data []byte) error { - type issuingDisputeSettlementDetail IssuingDisputeSettlementDetail - v := struct { - Created int64 `json:"created"` - *issuingDisputeSettlementDetail - }{ - issuingDisputeSettlementDetail: (*issuingDisputeSettlementDetail)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an IssuingDisputeSettlementDetail. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingDisputeSettlementDetail) MarshalJSON() ([]byte, error) { - type issuingDisputeSettlementDetail IssuingDisputeSettlementDetail - v := struct { - Created int64 `json:"created"` - issuingDisputeSettlementDetail - }{ - issuingDisputeSettlementDetail: (issuingDisputeSettlementDetail)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_fraudliabilitydebit.go b/issuing_fraudliabilitydebit.go index bd7eee967b..cae6f4ac53 100644 --- a/issuing_fraudliabilitydebit.go +++ b/issuing_fraudliabilitydebit.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Returns a list of Issuing FraudLiabilityDebit objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. type IssuingFraudLiabilityDebitListParams struct { ListParams `form:"*"` @@ -47,7 +42,7 @@ type IssuingFraudLiabilityDebit struct { // ID of the [balance transaction](https://stripe.com/docs/api/balance_transactions) associated with this debit. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The currency of the debit. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The ID of the linked dispute. @@ -66,39 +61,3 @@ type IssuingFraudLiabilityDebitList struct { ListMeta Data []*IssuingFraudLiabilityDebit `json:"data"` } - -// UnmarshalJSON handles deserialization of an IssuingFraudLiabilityDebit. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingFraudLiabilityDebit) UnmarshalJSON(data []byte) error { - type issuingFraudLiabilityDebit IssuingFraudLiabilityDebit - v := struct { - Created int64 `json:"created"` - *issuingFraudLiabilityDebit - }{ - issuingFraudLiabilityDebit: (*issuingFraudLiabilityDebit)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an IssuingFraudLiabilityDebit. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingFraudLiabilityDebit) MarshalJSON() ([]byte, error) { - type issuingFraudLiabilityDebit IssuingFraudLiabilityDebit - v := struct { - Created int64 `json:"created"` - issuingFraudLiabilityDebit - }{ - issuingFraudLiabilityDebit: (issuingFraudLiabilityDebit)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_personalizationdesign.go b/issuing_personalizationdesign.go index 1d66e23399..b8f2d1b2c1 100644 --- a/issuing_personalizationdesign.go +++ b/issuing_personalizationdesign.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The reason(s) the card logo was rejected. type IssuingPersonalizationDesignRejectionReasonsCardLogo string @@ -164,7 +161,7 @@ type IssuingPersonalizationDesign struct { // Hash containing carrier text, for use with physical bundles that support carrier text. CarrierText *IssuingPersonalizationDesignCarrierText `json:"carrier_text"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -202,34 +199,11 @@ func (i *IssuingPersonalizationDesign) UnmarshalJSON(data []byte) error { } type issuingPersonalizationDesign IssuingPersonalizationDesign - v := struct { - Created int64 `json:"created"` - *issuingPersonalizationDesign - }{ - issuingPersonalizationDesign: (*issuingPersonalizationDesign)(i), - } + var v issuingPersonalizationDesign if err := json.Unmarshal(data, &v); err != nil { return err } - i.Created = time.Unix(v.Created, 0) + *i = IssuingPersonalizationDesign(v) return nil } - -// MarshalJSON handles serialization of an IssuingPersonalizationDesign. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingPersonalizationDesign) MarshalJSON() ([]byte, error) { - type issuingPersonalizationDesign IssuingPersonalizationDesign - v := struct { - Created int64 `json:"created"` - issuingPersonalizationDesign - }{ - issuingPersonalizationDesign: (issuingPersonalizationDesign)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_settlement.go b/issuing_settlement.go index fb4790d2b0..389c1c41d6 100644 --- a/issuing_settlement.go +++ b/issuing_settlement.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The card network for this settlement report. One of ["visa", "maestro"] type IssuingSettlementNetwork string @@ -34,9 +31,9 @@ type IssuingSettlement struct { // The Bank Identification Number reflecting this settlement record. Bin string `json:"bin"` // The date that the transactions are cleared and posted to user's accounts. - ClearingDate time.Time `json:"clearing_date"` + ClearingDate int64 `json:"clearing_date"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Unique identifier for the object. @@ -77,38 +74,11 @@ func (i *IssuingSettlement) UnmarshalJSON(data []byte) error { } type issuingSettlement IssuingSettlement - v := struct { - ClearingDate int64 `json:"clearing_date"` - Created int64 `json:"created"` - *issuingSettlement - }{ - issuingSettlement: (*issuingSettlement)(i), - } + var v issuingSettlement if err := json.Unmarshal(data, &v); err != nil { return err } - i.ClearingDate = time.Unix(v.ClearingDate, 0) - i.Created = time.Unix(v.Created, 0) + *i = IssuingSettlement(v) return nil } - -// MarshalJSON handles serialization of an IssuingSettlement. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingSettlement) MarshalJSON() ([]byte, error) { - type issuingSettlement IssuingSettlement - v := struct { - ClearingDate int64 `json:"clearing_date"` - Created int64 `json:"created"` - issuingSettlement - }{ - issuingSettlement: (issuingSettlement)(i), - ClearingDate: i.ClearingDate.Unix(), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_token.go b/issuing_token.go index f3c5979098..5a47bb1b45 100644 --- a/issuing_token.go +++ b/issuing_token.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The token service provider / card network associated with the token. type IssuingTokenNetwork string @@ -226,7 +223,7 @@ type IssuingToken struct { // Card associated with this token. Card *IssuingCard `json:"card"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The hashed ID derived from the device ID from the card network associated with the token. DeviceFingerprint string `json:"device_fingerprint"` // Unique identifier for the object. @@ -239,7 +236,7 @@ type IssuingToken struct { Network IssuingTokenNetwork `json:"network"` NetworkData *IssuingTokenNetworkData `json:"network_data"` // Time at which the token was last updated by the card network. Measured in seconds since the Unix epoch. - NetworkUpdatedAt time.Time `json:"network_updated_at"` + NetworkUpdatedAt int64 `json:"network_updated_at"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The usage state of the token. @@ -265,38 +262,11 @@ func (i *IssuingToken) UnmarshalJSON(data []byte) error { } type issuingToken IssuingToken - v := struct { - Created int64 `json:"created"` - NetworkUpdatedAt int64 `json:"network_updated_at"` - *issuingToken - }{ - issuingToken: (*issuingToken)(i), - } + var v issuingToken if err := json.Unmarshal(data, &v); err != nil { return err } - i.Created = time.Unix(v.Created, 0) - i.NetworkUpdatedAt = time.Unix(v.NetworkUpdatedAt, 0) + *i = IssuingToken(v) return nil } - -// MarshalJSON handles serialization of an IssuingToken. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingToken) MarshalJSON() ([]byte, error) { - type issuingToken IssuingToken - v := struct { - Created int64 `json:"created"` - NetworkUpdatedAt int64 `json:"network_updated_at"` - issuingToken - }{ - issuingToken: (issuingToken)(i), - Created: i.Created.Unix(), - NetworkUpdatedAt: i.NetworkUpdatedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/issuing_transaction.go b/issuing_transaction.go index c1973f5e7c..e1dcdb3590 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The type of fuel that was purchased. One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`. type IssuingTransactionPurchaseDetailsFuelType string @@ -197,7 +194,7 @@ type IssuingTransactionPurchaseDetailsFlightSegment struct { // Information about the flight that was purchased with this transaction. type IssuingTransactionPurchaseDetailsFlight struct { // The time that the flight departed. - DepartureAt time.Time `json:"departure_at"` + DepartureAt int64 `json:"departure_at"` // The name of the passenger. PassengerName string `json:"passenger_name"` // Whether the ticket is refundable. @@ -225,7 +222,7 @@ type IssuingTransactionPurchaseDetailsFuel struct { // Information about lodging that was purchased with this transaction. type IssuingTransactionPurchaseDetailsLodging struct { // The time of checking into the lodging. - CheckInAt time.Time `json:"check_in_at"` + CheckInAt int64 `json:"check_in_at"` // The number of nights stayed at the lodging. Nights int64 `json:"nights"` } @@ -286,7 +283,7 @@ type IssuingTransaction struct { // The cardholder to whom this transaction belongs. Cardholder *IssuingCardholder `json:"cardholder"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // If you've disputed the transaction, the ID of the dispute. @@ -336,106 +333,11 @@ func (i *IssuingTransaction) UnmarshalJSON(data []byte) error { } type issuingTransaction IssuingTransaction - v := struct { - Created int64 `json:"created"` - *issuingTransaction - }{ - issuingTransaction: (*issuingTransaction)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of an IssuingTransactionPurchaseDetailsFlight. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingTransactionPurchaseDetailsFlight) UnmarshalJSON(data []byte) error { - type issuingTransactionPurchaseDetailsFlight IssuingTransactionPurchaseDetailsFlight - v := struct { - DepartureAt int64 `json:"departure_at"` - *issuingTransactionPurchaseDetailsFlight - }{ - issuingTransactionPurchaseDetailsFlight: (*issuingTransactionPurchaseDetailsFlight)(i), - } + var v issuingTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - i.DepartureAt = time.Unix(v.DepartureAt, 0) + *i = IssuingTransaction(v) return nil } - -// UnmarshalJSON handles deserialization of an IssuingTransactionPurchaseDetailsLodging. -// This custom unmarshaling is needed to handle the time fields correctly. -func (i *IssuingTransactionPurchaseDetailsLodging) UnmarshalJSON(data []byte) error { - type issuingTransactionPurchaseDetailsLodging IssuingTransactionPurchaseDetailsLodging - v := struct { - CheckInAt int64 `json:"check_in_at"` - *issuingTransactionPurchaseDetailsLodging - }{ - issuingTransactionPurchaseDetailsLodging: (*issuingTransactionPurchaseDetailsLodging)(i), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - i.CheckInAt = time.Unix(v.CheckInAt, 0) - return nil -} - -// MarshalJSON handles serialization of an IssuingTransactionPurchaseDetailsFlight. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingTransactionPurchaseDetailsFlight) MarshalJSON() ([]byte, error) { - type issuingTransactionPurchaseDetailsFlight IssuingTransactionPurchaseDetailsFlight - v := struct { - DepartureAt int64 `json:"departure_at"` - issuingTransactionPurchaseDetailsFlight - }{ - issuingTransactionPurchaseDetailsFlight: (issuingTransactionPurchaseDetailsFlight)(i), - DepartureAt: i.DepartureAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingTransactionPurchaseDetailsLodging. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingTransactionPurchaseDetailsLodging) MarshalJSON() ([]byte, error) { - type issuingTransactionPurchaseDetailsLodging IssuingTransactionPurchaseDetailsLodging - v := struct { - CheckInAt int64 `json:"check_in_at"` - issuingTransactionPurchaseDetailsLodging - }{ - issuingTransactionPurchaseDetailsLodging: (issuingTransactionPurchaseDetailsLodging)(i), - CheckInAt: i.CheckInAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of an IssuingTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (i IssuingTransaction) MarshalJSON() ([]byte, error) { - type issuingTransaction IssuingTransaction - v := struct { - Created int64 `json:"created"` - issuingTransaction - }{ - issuingTransaction: (issuingTransaction)(i), - Created: i.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/loginlink.go b/loginlink.go index 529ec7120e..16acb4a2d9 100644 --- a/loginlink.go +++ b/loginlink.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Creates a login link for a connected account to access the Express Dashboard. // // You can only create login links for accounts that use the [Express Dashboard](https://stripe.com/connect/express-dashboard) and are connected to your platform. @@ -30,45 +25,9 @@ func (p *LoginLinkParams) AddExpand(f string) { type LoginLink struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The URL for the login link. URL string `json:"url"` } - -// UnmarshalJSON handles deserialization of a LoginLink. -// This custom unmarshaling is needed to handle the time fields correctly. -func (l *LoginLink) UnmarshalJSON(data []byte) error { - type loginLink LoginLink - v := struct { - Created int64 `json:"created"` - *loginLink - }{ - loginLink: (*loginLink)(l), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - l.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a LoginLink. -// This custom marshaling is needed to handle the time fields correctly. -func (l LoginLink) MarshalJSON() ([]byte, error) { - type loginLink LoginLink - v := struct { - Created int64 `json:"created"` - loginLink - }{ - loginLink: (loginLink)(l), - Created: l.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/mandate.go b/mandate.go index 2c413afc17..1f7701458f 100644 --- a/mandate.go +++ b/mandate.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The mandate includes the type of customer acceptance information, such as: `online` or `offline`. type MandateCustomerAcceptanceType string @@ -176,7 +173,7 @@ type MandateCustomerAcceptanceOnline struct { } type MandateCustomerAcceptance struct { // The time that the customer accepts the mandate. - AcceptedAt time.Time `json:"accepted_at"` + AcceptedAt int64 `json:"accepted_at"` Offline *MandateCustomerAcceptanceOffline `json:"offline"` Online *MandateCustomerAcceptanceOnline `json:"online"` // The mandate includes the type of customer acceptance information, such as: `online` or `offline`. @@ -317,39 +314,3 @@ func (m *Mandate) UnmarshalJSON(data []byte) error { *m = Mandate(v) return nil } - -// UnmarshalJSON handles deserialization of a MandateCustomerAcceptance. -// This custom unmarshaling is needed to handle the time fields correctly. -func (m *MandateCustomerAcceptance) UnmarshalJSON(data []byte) error { - type mandateCustomerAcceptance MandateCustomerAcceptance - v := struct { - AcceptedAt int64 `json:"accepted_at"` - *mandateCustomerAcceptance - }{ - mandateCustomerAcceptance: (*mandateCustomerAcceptance)(m), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - m.AcceptedAt = time.Unix(v.AcceptedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a MandateCustomerAcceptance. -// This custom marshaling is needed to handle the time fields correctly. -func (m MandateCustomerAcceptance) MarshalJSON() ([]byte, error) { - type mandateCustomerAcceptance MandateCustomerAcceptance - v := struct { - AcceptedAt int64 `json:"accepted_at"` - mandateCustomerAcceptance - }{ - mandateCustomerAcceptance: (mandateCustomerAcceptance)(m), - AcceptedAt: m.AcceptedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/margin.go b/margin.go index e3c43e2dff..6cb0f25a4d 100644 --- a/margin.go +++ b/margin.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Retrieve a list of your margins. type MarginListParams struct { @@ -61,7 +58,7 @@ type Margin struct { // Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults to `true`. Active bool `json:"active"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -75,7 +72,7 @@ type Margin struct { // Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied. PercentOff float64 `json:"percent_off"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` } // MarginList is a list of Margins as retrieved from a list endpoint. @@ -95,38 +92,11 @@ func (m *Margin) UnmarshalJSON(data []byte) error { } type margin Margin - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - *margin - }{ - margin: (*margin)(m), - } + var v margin if err := json.Unmarshal(data, &v); err != nil { return err } - m.Created = time.Unix(v.Created, 0) - m.Updated = time.Unix(v.Updated, 0) + *m = Margin(v) return nil } - -// MarshalJSON handles serialization of a Margin. -// This custom marshaling is needed to handle the time fields correctly. -func (m Margin) MarshalJSON() ([]byte, error) { - type margin Margin - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - margin - }{ - margin: (margin)(m), - Created: m.Created.Unix(), - Updated: m.Updated.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/order.go b/order.go index d14c0bc1a8..44ae40f717 100644 --- a/order.go +++ b/order.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The status of the most recent automated tax calculation for this Order. type OrderAutomaticTaxStatus string @@ -1870,7 +1865,7 @@ type Order struct { // Refer to our docs for [creating and processing an order](https://stripe.com/docs/orders-beta/create-and-process) to learn about how client_secret should be handled. ClientSecret string `json:"client_secret"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The credits applied to the Order. At most 10 credits can be applied to an Order. Credits []*OrderCredit `json:"credits"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). @@ -1910,39 +1905,3 @@ type OrderList struct { ListMeta Data []*Order `json:"data"` } - -// UnmarshalJSON handles deserialization of an Order. -// This custom unmarshaling is needed to handle the time fields correctly. -func (o *Order) UnmarshalJSON(data []byte) error { - type order Order - v := struct { - Created int64 `json:"created"` - *order - }{ - order: (*order)(o), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - o.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of an Order. -// This custom marshaling is needed to handle the time fields correctly. -func (o Order) MarshalJSON() ([]byte, error) { - type order Order - v := struct { - Created int64 `json:"created"` - order - }{ - order: (order)(o), - Created: o.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/paymentattemptrecord.go b/paymentattemptrecord.go index 0622e5429d..9feb9ff20d 100644 --- a/paymentattemptrecord.go +++ b/paymentattemptrecord.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Indicates whether the customer was present in your checkout flow during this payment. type PaymentAttemptRecordCustomerPresence string @@ -155,7 +150,7 @@ type PaymentAttemptRecord struct { // A representation of an amount of money, consisting of an amount and a currency. AmountRequested *PaymentAttemptRecordAmountRequested `json:"amount_requested"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Customer information for this payment. CustomerDetails *PaymentAttemptRecordCustomerDetails `json:"customer_details"` // Indicates whether the customer was present in your checkout flow during this payment. @@ -186,39 +181,3 @@ type PaymentAttemptRecordList struct { ListMeta Data []*PaymentAttemptRecord `json:"data"` } - -// UnmarshalJSON handles deserialization of a PaymentAttemptRecord. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentAttemptRecord) UnmarshalJSON(data []byte) error { - type paymentAttemptRecord PaymentAttemptRecord - v := struct { - Created int64 `json:"created"` - *paymentAttemptRecord - }{ - paymentAttemptRecord: (*paymentAttemptRecord)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a PaymentAttemptRecord. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentAttemptRecord) MarshalJSON() ([]byte, error) { - type paymentAttemptRecord PaymentAttemptRecord - v := struct { - Created int64 `json:"created"` - paymentAttemptRecord - }{ - paymentAttemptRecord: (paymentAttemptRecord)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/paymentintent.go b/paymentintent.go index 7284cc2f16..aafa5466c1 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Controls whether this PaymentIntent will accept redirect-based payment methods. // @@ -1404,7 +1401,7 @@ type PaymentIntentMandateDataCustomerAcceptanceOnlineParams struct { // This hash contains details about the customer acceptance of the Mandate. type PaymentIntentMandateDataCustomerAcceptanceParams struct { // The time at which the customer accepted the Mandate. - AcceptedAt *time.Time `form:"accepted_at"` + AcceptedAt *int64 `form:"accepted_at"` // If this is a Mandate accepted offline, this hash contains details about the offline acceptance. Offline *PaymentIntentMandateDataCustomerAcceptanceOfflineParams `form:"offline"` // If this is a Mandate accepted online, this hash contains details about the online acceptance. @@ -1478,7 +1475,7 @@ type PaymentIntentPaymentDetailsCarRentalParams struct { // Car pick-up address. PickupAddress *AddressParams `form:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt *time.Time `form:"pickup_at"` + PickupAt *int64 `form:"pickup_at"` // Rental rate. RateAmount *int64 `form:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -1488,7 +1485,7 @@ type PaymentIntentPaymentDetailsCarRentalParams struct { // Car return address. ReturnAddress *AddressParams `form:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt *time.Time `form:"return_at"` + ReturnAt *int64 `form:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt *bool `form:"tax_exempt"` } @@ -1530,13 +1527,13 @@ type PaymentIntentPaymentDetailsEventDetailsParams struct { // Delivery details for this purchase. Delivery *PaymentIntentPaymentDetailsEventDetailsDeliveryParams `form:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre *string `form:"genre"` // The name of the event. Name *string `form:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Affiliate details for this purchase. @@ -1576,11 +1573,11 @@ type PaymentIntentPaymentDetailsFlightSegmentParams struct { // The International Air Transport Association (IATA) airport code for the arrival airport. ArrivalAirport *string `form:"arrival_airport"` // The arrival time for the flight segment. Measured in seconds since the Unix epoch. - ArrivesAt *time.Time `form:"arrives_at"` + ArrivesAt *int64 `form:"arrives_at"` // The International Air Transport Association (IATA) carrier code of the carrier operating the flight segment. Carrier *string `form:"carrier"` // The departure time for the flight segment. Measured in seconds since the Unix epoch. - DepartsAt *time.Time `form:"departs_at"` + DepartsAt *int64 `form:"departs_at"` // The International Air Transport Association (IATA) airport code for the departure airport. DepartureAirport *string `form:"departure_airport"` // The flight number associated with the segment @@ -1652,9 +1649,9 @@ type PaymentIntentPaymentDetailsLodgingParams struct { // The lodging category Category *string `form:"category"` // Loding check-in time. Measured in seconds since the Unix epoch. - CheckinAt *time.Time `form:"checkin_at"` + CheckinAt *int64 `form:"checkin_at"` // Lodging check-out time. Measured in seconds since the Unix epoch. - CheckoutAt *time.Time `form:"checkout_at"` + CheckoutAt *int64 `form:"checkout_at"` // The customer service phone number of the lodging company. CustomerServicePhoneNumber *string `form:"customer_service_phone_number"` // The daily lodging room rate. @@ -1708,11 +1705,11 @@ type PaymentIntentPaymentDetailsSubscriptionParams struct { // Subscription billing details for this purchase. BillingInterval *PaymentIntentPaymentDetailsSubscriptionBillingIntervalParams `form:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription Name *string `form:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Provides industry-specific information about the charge. @@ -2111,7 +2108,7 @@ type PaymentIntentPaymentMethodOptionsCardMandateOptionsParams struct { // A description of the mandate or subscription that is meant to be displayed to the customer. Description *string `form:"description"` // End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. - EndDate *time.Time `form:"end_date"` + EndDate *int64 `form:"end_date"` // Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. Interval *string `form:"interval"` // The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. @@ -2119,7 +2116,7 @@ type PaymentIntentPaymentMethodOptionsCardMandateOptionsParams struct { // Unique identifier for the mandate or subscription. Reference *string `form:"reference"` // Start date of the mandate or subscription. Start date should not be lesser than yesterday. - StartDate *time.Time `form:"start_date"` + StartDate *int64 `form:"start_date"` // Specifies the type of mandates supported. Possible values are `india`. SupportedTypes []*string `form:"supported_types"` } @@ -2391,7 +2388,7 @@ type PaymentIntentPaymentMethodOptionsIDBankTransferParams struct { // The UNIX timestamp until which the virtual bank account is valid. Permitted range is from 5 minutes from now until 31 days from now. If unset, it defaults to 3 days from now. ExpiresAfter *int64 `form:"expires_after"` // The UNIX timestamp until which the virtual bank account is valid. Permitted range is from now until 30 days from now. If unset, it defaults to 1 days from now. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. @@ -2468,7 +2465,7 @@ type PaymentIntentPaymentMethodOptionsKonbiniParams struct { // The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire. For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST. Defaults to 3 days. ExpiresAfterDays *int64 `form:"expires_after_days"` // The timestamp at which the Konbini payment instructions will expire. Only one of `expires_after_days` or `expires_at` may be set. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // A product descriptor of up to 22 characters, which will appear to customers at the convenience store. ProductDescription *string `form:"product_description"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -2734,7 +2731,7 @@ type PaymentIntentPaymentMethodOptionsPixParams struct { // The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds. ExpiresAfterSeconds *int64 `form:"expires_after_seconds"` // The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future). Defaults to 1 day in the future. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. @@ -3371,7 +3368,7 @@ type PaymentIntentCapturePaymentDetailsCarRentalParams struct { // Car pick-up address. PickupAddress *AddressParams `form:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt *time.Time `form:"pickup_at"` + PickupAt *int64 `form:"pickup_at"` // Rental rate. RateAmount *int64 `form:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -3381,7 +3378,7 @@ type PaymentIntentCapturePaymentDetailsCarRentalParams struct { // Car return address. ReturnAddress *AddressParams `form:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt *time.Time `form:"return_at"` + ReturnAt *int64 `form:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt *bool `form:"tax_exempt"` } @@ -3423,13 +3420,13 @@ type PaymentIntentCapturePaymentDetailsEventDetailsParams struct { // Delivery details for this purchase. Delivery *PaymentIntentCapturePaymentDetailsEventDetailsDeliveryParams `form:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre *string `form:"genre"` // The name of the event. Name *string `form:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Affiliate details for this purchase. @@ -3469,11 +3466,11 @@ type PaymentIntentCapturePaymentDetailsFlightSegmentParams struct { // The International Air Transport Association (IATA) airport code for the arrival airport. ArrivalAirport *string `form:"arrival_airport"` // The arrival time for the flight segment. Measured in seconds since the Unix epoch. - ArrivesAt *time.Time `form:"arrives_at"` + ArrivesAt *int64 `form:"arrives_at"` // The International Air Transport Association (IATA) carrier code of the carrier operating the flight segment. Carrier *string `form:"carrier"` // The departure time for the flight segment. Measured in seconds since the Unix epoch. - DepartsAt *time.Time `form:"departs_at"` + DepartsAt *int64 `form:"departs_at"` // The International Air Transport Association (IATA) airport code for the departure airport. DepartureAirport *string `form:"departure_airport"` // The flight number associated with the segment @@ -3545,9 +3542,9 @@ type PaymentIntentCapturePaymentDetailsLodgingParams struct { // The lodging category Category *string `form:"category"` // Loding check-in time. Measured in seconds since the Unix epoch. - CheckinAt *time.Time `form:"checkin_at"` + CheckinAt *int64 `form:"checkin_at"` // Lodging check-out time. Measured in seconds since the Unix epoch. - CheckoutAt *time.Time `form:"checkout_at"` + CheckoutAt *int64 `form:"checkout_at"` // The customer service phone number of the lodging company. CustomerServicePhoneNumber *string `form:"customer_service_phone_number"` // The daily lodging room rate. @@ -3601,11 +3598,11 @@ type PaymentIntentCapturePaymentDetailsSubscriptionParams struct { // Subscription billing details for this purchase. BillingInterval *PaymentIntentCapturePaymentDetailsSubscriptionBillingIntervalParams `form:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription Name *string `form:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Provides industry-specific information about the charge. @@ -3745,7 +3742,7 @@ type PaymentIntentConfirmPaymentDetailsCarRentalParams struct { // Car pick-up address. PickupAddress *AddressParams `form:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt *time.Time `form:"pickup_at"` + PickupAt *int64 `form:"pickup_at"` // Rental rate. RateAmount *int64 `form:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -3755,7 +3752,7 @@ type PaymentIntentConfirmPaymentDetailsCarRentalParams struct { // Car return address. ReturnAddress *AddressParams `form:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt *time.Time `form:"return_at"` + ReturnAt *int64 `form:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt *bool `form:"tax_exempt"` } @@ -3797,13 +3794,13 @@ type PaymentIntentConfirmPaymentDetailsEventDetailsParams struct { // Delivery details for this purchase. Delivery *PaymentIntentConfirmPaymentDetailsEventDetailsDeliveryParams `form:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre *string `form:"genre"` // The name of the event. Name *string `form:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Affiliate details for this purchase. @@ -3843,11 +3840,11 @@ type PaymentIntentConfirmPaymentDetailsFlightSegmentParams struct { // The International Air Transport Association (IATA) airport code for the arrival airport. ArrivalAirport *string `form:"arrival_airport"` // The arrival time for the flight segment. Measured in seconds since the Unix epoch. - ArrivesAt *time.Time `form:"arrives_at"` + ArrivesAt *int64 `form:"arrives_at"` // The International Air Transport Association (IATA) carrier code of the carrier operating the flight segment. Carrier *string `form:"carrier"` // The departure time for the flight segment. Measured in seconds since the Unix epoch. - DepartsAt *time.Time `form:"departs_at"` + DepartsAt *int64 `form:"departs_at"` // The International Air Transport Association (IATA) airport code for the departure airport. DepartureAirport *string `form:"departure_airport"` // The flight number associated with the segment @@ -3919,9 +3916,9 @@ type PaymentIntentConfirmPaymentDetailsLodgingParams struct { // The lodging category Category *string `form:"category"` // Loding check-in time. Measured in seconds since the Unix epoch. - CheckinAt *time.Time `form:"checkin_at"` + CheckinAt *int64 `form:"checkin_at"` // Lodging check-out time. Measured in seconds since the Unix epoch. - CheckoutAt *time.Time `form:"checkout_at"` + CheckoutAt *int64 `form:"checkout_at"` // The customer service phone number of the lodging company. CustomerServicePhoneNumber *string `form:"customer_service_phone_number"` // The daily lodging room rate. @@ -3975,11 +3972,11 @@ type PaymentIntentConfirmPaymentDetailsSubscriptionParams struct { // Subscription billing details for this purchase. BillingInterval *PaymentIntentConfirmPaymentDetailsSubscriptionBillingIntervalParams `form:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt *time.Time `form:"ends_at"` + EndsAt *int64 `form:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription Name *string `form:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt *time.Time `form:"starts_at"` + StartsAt *int64 `form:"starts_at"` } // Provides industry-specific information about the charge. @@ -4338,7 +4335,7 @@ type PaymentIntentNextActionAlipayHandleRedirect struct { } type PaymentIntentNextActionBoletoDisplayDetails struct { // The timestamp after which the boleto expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The URL to the hosted boleto voucher page, which allows customers to view the boleto voucher. HostedVoucherURL string `json:"hosted_voucher_url"` // The boleto number. @@ -4348,13 +4345,13 @@ type PaymentIntentNextActionBoletoDisplayDetails struct { } type PaymentIntentNextActionCardAwaitNotification struct { // The time that payment will be attempted. If customer approval is required, they need to provide approval before this time. - ChargeAttemptAt time.Time `json:"charge_attempt_at"` + ChargeAttemptAt int64 `json:"charge_attempt_at"` // For payments greater than INR 15000, the customer must provide explicit approval of the payment with their bank. For payments of lower amount, no customer action is required. CustomerApprovalRequired bool `json:"customer_approval_required"` } type PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode struct { // The date (unix timestamp) when the QR code expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The image_url_png string used to render QR code ImageURLPNG string `json:"image_url_png"` // The image_url_svg string used to render QR code @@ -4537,7 +4534,7 @@ type PaymentIntentNextActionKonbiniDisplayDetailsStores struct { } type PaymentIntentNextActionKonbiniDisplayDetails struct { // The timestamp at which the pending Konbini payment expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The URL for the Konbini payment instructions page, which allows customers to view and print a Konbini voucher. HostedVoucherURL string `json:"hosted_voucher_url"` Stores *PaymentIntentNextActionKonbiniDisplayDetailsStores `json:"stores"` @@ -4546,7 +4543,7 @@ type PaymentIntentNextActionMultibancoDisplayDetails struct { // Entity number associated with this Multibanco payment. Entity string `json:"entity"` // The timestamp at which the Multibanco voucher expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The URL for the hosted Multibanco voucher page, which allows customers to view a Multibanco voucher. HostedVoucherURL string `json:"hosted_voucher_url"` // Reference number associated with this Multibanco payment. @@ -4554,7 +4551,7 @@ type PaymentIntentNextActionMultibancoDisplayDetails struct { } type PaymentIntentNextActionOXXODisplayDetails struct { // The timestamp after which the OXXO voucher expires. - ExpiresAfter time.Time `json:"expires_after"` + ExpiresAfter int64 `json:"expires_after"` // The URL for the hosted OXXO voucher page, which allows customers to view and print an OXXO voucher. HostedVoucherURL string `json:"hosted_voucher_url"` // OXXO reference number. @@ -4574,7 +4571,7 @@ type PaymentIntentNextActionPixDisplayQRCode struct { // The raw data string used to generate QR code, it should be used together with QR code library. Data string `json:"data"` // The date (unix timestamp) when the PIX expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The URL to the hosted pix instructions page, which allows customers to view the pix QR code. HostedInstructionsURL string `json:"hosted_instructions_url"` // The image_url_png string used to render png QR code @@ -4618,7 +4615,7 @@ type PaymentIntentNextActionSwishHandleRedirectOrDisplayQRCode struct { type PaymentIntentNextActionUseStripeSDK struct{} type PaymentIntentNextActionVerifyWithMicrodeposits struct { // The timestamp when the microdeposits are expected to land. - ArrivalDate time.Time `json:"arrival_date"` + ArrivalDate int64 `json:"arrival_date"` // The URL for the hosted verification page, which allows customers to verify their bank account. HostedVerificationURL string `json:"hosted_verification_url"` // The type of the microdeposit sent to the customer. Used to distinguish between different verification methods. @@ -4729,7 +4726,7 @@ type PaymentIntentPaymentDetailsCarRental struct { NoShow bool `json:"no_show"` PickupAddress *Address `json:"pickup_address"` // Car pick-up time. Measured in seconds since the Unix epoch. - PickupAt time.Time `json:"pickup_at"` + PickupAt int64 `json:"pickup_at"` // Rental rate. RateAmount int64 `json:"rate_amount"` // The frequency at which the rate amount is applied. One of `day`, `week` or `month` @@ -4738,7 +4735,7 @@ type PaymentIntentPaymentDetailsCarRental struct { RenterName string `json:"renter_name"` ReturnAddress *Address `json:"return_address"` // Car return time. Measured in seconds since the Unix epoch. - ReturnAt time.Time `json:"return_at"` + ReturnAt int64 `json:"return_at"` // Indicates whether the goods or services are tax-exempt or tax is not collected. TaxExempt bool `json:"tax_exempt"` } @@ -4768,13 +4765,13 @@ type PaymentIntentPaymentDetailsEventDetails struct { Company string `json:"company"` Delivery *PaymentIntentPaymentDetailsEventDetailsDelivery `json:"delivery"` // Event end time. Measured in seconds since the Unix epoch. - EndsAt time.Time `json:"ends_at"` + EndsAt int64 `json:"ends_at"` // Type of the event entertainment (concert, sports event etc) Genre string `json:"genre"` // The name of the event. Name string `json:"name"` // Event start time. Measured in seconds since the Unix epoch. - StartsAt time.Time `json:"starts_at"` + StartsAt int64 `json:"starts_at"` } type PaymentIntentPaymentDetailsSubscriptionAffiliate struct { // The name of the affiliate that originated the purchase. @@ -4792,11 +4789,11 @@ type PaymentIntentPaymentDetailsSubscription struct { AutoRenewal bool `json:"auto_renewal"` BillingInterval *PaymentIntentPaymentDetailsSubscriptionBillingInterval `json:"billing_interval"` // Subscription end time. Measured in seconds since the Unix epoch. - EndsAt time.Time `json:"ends_at"` + EndsAt int64 `json:"ends_at"` // Name of the product on subscription. e.g. Apple Music Subscription. Name string `json:"name"` // Subscription start time. Measured in seconds since the Unix epoch. - StartsAt time.Time `json:"starts_at"` + StartsAt int64 `json:"starts_at"` } type PaymentIntentPaymentDetails struct { CarRental *PaymentIntentPaymentDetailsCarRental `json:"car_rental"` @@ -4981,7 +4978,7 @@ type PaymentIntentPaymentMethodOptionsCardMandateOptions struct { // A description of the mandate or subscription that is meant to be displayed to the customer. Description string `json:"description"` // End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. Interval PaymentIntentPaymentMethodOptionsCardMandateOptionsInterval `json:"interval"` // The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. @@ -4989,7 +4986,7 @@ type PaymentIntentPaymentMethodOptionsCardMandateOptions struct { // Unique identifier for the mandate or subscription. Reference string `json:"reference"` // Start date of the mandate or subscription. Start date should not be lesser than yesterday. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` // Specifies the type of mandates supported. Possible values are `india`. SupportedTypes []PaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedType `json:"supported_types"` } @@ -5142,7 +5139,7 @@ type PaymentIntentPaymentMethodOptionsIDBankTransfer struct { // The UNIX timestamp until which the virtual bank account is valid. Permitted range is from now till 2678400 seconds (31 days) from now. ExpiresAfter int64 `json:"expires_after"` // The UNIX timestamp until which the virtual bank account is valid. Permitted range is from now until 30 days from now. If unset, it defaults to 1 days from now. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. @@ -5195,7 +5192,7 @@ type PaymentIntentPaymentMethodOptionsKonbini struct { // The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire. For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST. ExpiresAfterDays int64 `json:"expires_after_days"` // The timestamp at which the Konbini payment instructions will expire. Only one of `expires_after_days` or `expires_at` may be set. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // A product descriptor of up to 22 characters, which will appear to customers at the convenience store. ProductDescription string `json:"product_description"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -5383,7 +5380,7 @@ type PaymentIntentPaymentMethodOptionsPix struct { // The number of seconds (between 10 and 1209600) after which Pix payment will expire. ExpiresAfterSeconds int64 `json:"expires_after_seconds"` // The timestamp at which the Pix expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. @@ -5614,7 +5611,7 @@ type PaymentIntentProcessingCardCustomerNotification struct { // Whether customer approval has been requested for this payment. For payments greater than INR 15000 or mandate amount, the customer must provide explicit approval of the payment with their bank. ApprovalRequested bool `json:"approval_requested"` // If customer approval is required, they need to provide approval before this time. - CompletesAt time.Time `json:"completes_at"` + CompletesAt int64 `json:"completes_at"` } type PaymentIntentProcessingCard struct { CustomerNotification *PaymentIntentProcessingCardCustomerNotification `json:"customer_notification"` @@ -5665,7 +5662,7 @@ type PaymentIntent struct { // Settings to configure compatible payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods) AutomaticPaymentMethods *PaymentIntentAutomaticPaymentMethods `json:"automatic_payment_methods"` // Populated when `status` is `canceled`, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Reason for cancellation of this PaymentIntent, either user-provided (`duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`) or generated by Stripe internally (`failed_invoice`, `void_invoice`, or `automatic`). CancellationReason PaymentIntentCancellationReason `json:"cancellation_reason"` // Controls when the funds will be captured from the customer's account. @@ -5679,7 +5676,7 @@ type PaymentIntent struct { // Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment. ConfirmationMethod PaymentIntentConfirmationMethod `json:"confirmation_method"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // ID of the Customer this PaymentIntent belongs to, if one exists. @@ -5775,630 +5772,11 @@ func (p *PaymentIntent) UnmarshalJSON(data []byte) error { } type paymentIntent PaymentIntent - v := struct { - CanceledAt int64 `json:"canceled_at"` - Created int64 `json:"created"` - *paymentIntent - }{ - paymentIntent: (*paymentIntent)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.CanceledAt = time.Unix(v.CanceledAt, 0) - p.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionBoletoDisplayDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionBoletoDisplayDetails) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionBoletoDisplayDetails PaymentIntentNextActionBoletoDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentNextActionBoletoDisplayDetails - }{ - paymentIntentNextActionBoletoDisplayDetails: (*paymentIntentNextActionBoletoDisplayDetails)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionCardAwaitNotification. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionCardAwaitNotification) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionCardAwaitNotification PaymentIntentNextActionCardAwaitNotification - v := struct { - ChargeAttemptAt int64 `json:"charge_attempt_at"` - *paymentIntentNextActionCardAwaitNotification - }{ - paymentIntentNextActionCardAwaitNotification: (*paymentIntentNextActionCardAwaitNotification)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ChargeAttemptAt = time.Unix(v.ChargeAttemptAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - }{ - paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode: (*paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionKonbiniDisplayDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionKonbiniDisplayDetails) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionKonbiniDisplayDetails PaymentIntentNextActionKonbiniDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentNextActionKonbiniDisplayDetails - }{ - paymentIntentNextActionKonbiniDisplayDetails: (*paymentIntentNextActionKonbiniDisplayDetails)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionMultibancoDisplayDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionMultibancoDisplayDetails) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionMultibancoDisplayDetails PaymentIntentNextActionMultibancoDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentNextActionMultibancoDisplayDetails - }{ - paymentIntentNextActionMultibancoDisplayDetails: (*paymentIntentNextActionMultibancoDisplayDetails)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionOXXODisplayDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionOXXODisplayDetails) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionOXXODisplayDetails PaymentIntentNextActionOXXODisplayDetails - v := struct { - ExpiresAfter int64 `json:"expires_after"` - *paymentIntentNextActionOXXODisplayDetails - }{ - paymentIntentNextActionOXXODisplayDetails: (*paymentIntentNextActionOXXODisplayDetails)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAfter = time.Unix(v.ExpiresAfter, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionPixDisplayQRCode. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionPixDisplayQRCode) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionPixDisplayQRCode PaymentIntentNextActionPixDisplayQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentNextActionPixDisplayQRCode - }{ - paymentIntentNextActionPixDisplayQRCode: (*paymentIntentNextActionPixDisplayQRCode)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentNextActionVerifyWithMicrodeposits. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentNextActionVerifyWithMicrodeposits) UnmarshalJSON(data []byte) error { - type paymentIntentNextActionVerifyWithMicrodeposits PaymentIntentNextActionVerifyWithMicrodeposits - v := struct { - ArrivalDate int64 `json:"arrival_date"` - *paymentIntentNextActionVerifyWithMicrodeposits - }{ - paymentIntentNextActionVerifyWithMicrodeposits: (*paymentIntentNextActionVerifyWithMicrodeposits)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ArrivalDate = time.Unix(v.ArrivalDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentDetailsCarRental. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentDetailsCarRental) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentDetailsCarRental PaymentIntentPaymentDetailsCarRental - v := struct { - PickupAt int64 `json:"pickup_at"` - ReturnAt int64 `json:"return_at"` - *paymentIntentPaymentDetailsCarRental - }{ - paymentIntentPaymentDetailsCarRental: (*paymentIntentPaymentDetailsCarRental)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.PickupAt = time.Unix(v.PickupAt, 0) - p.ReturnAt = time.Unix(v.ReturnAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentDetailsEventDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentDetailsEventDetails) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentDetailsEventDetails PaymentIntentPaymentDetailsEventDetails - v := struct { - EndsAt int64 `json:"ends_at"` - StartsAt int64 `json:"starts_at"` - *paymentIntentPaymentDetailsEventDetails - }{ - paymentIntentPaymentDetailsEventDetails: (*paymentIntentPaymentDetailsEventDetails)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.EndsAt = time.Unix(v.EndsAt, 0) - p.StartsAt = time.Unix(v.StartsAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentDetailsSubscription. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentDetailsSubscription) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentDetailsSubscription PaymentIntentPaymentDetailsSubscription - v := struct { - EndsAt int64 `json:"ends_at"` - StartsAt int64 `json:"starts_at"` - *paymentIntentPaymentDetailsSubscription - }{ - paymentIntentPaymentDetailsSubscription: (*paymentIntentPaymentDetailsSubscription)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.EndsAt = time.Unix(v.EndsAt, 0) - p.StartsAt = time.Unix(v.StartsAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentMethodOptionsCardMandateOptions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentMethodOptionsCardMandateOptions) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentMethodOptionsCardMandateOptions PaymentIntentPaymentMethodOptionsCardMandateOptions - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - *paymentIntentPaymentMethodOptionsCardMandateOptions - }{ - paymentIntentPaymentMethodOptionsCardMandateOptions: (*paymentIntentPaymentMethodOptionsCardMandateOptions)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.EndDate = time.Unix(v.EndDate, 0) - p.StartDate = time.Unix(v.StartDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentMethodOptionsIDBankTransfer. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentMethodOptionsIDBankTransfer) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentMethodOptionsIDBankTransfer PaymentIntentPaymentMethodOptionsIDBankTransfer - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentPaymentMethodOptionsIDBankTransfer - }{ - paymentIntentPaymentMethodOptionsIDBankTransfer: (*paymentIntentPaymentMethodOptionsIDBankTransfer)(p), - } + var v paymentIntent if err := json.Unmarshal(data, &v); err != nil { return err } - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) + *p = PaymentIntent(v) return nil } - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentMethodOptionsKonbini. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentMethodOptionsKonbini) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentMethodOptionsKonbini PaymentIntentPaymentMethodOptionsKonbini - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentPaymentMethodOptionsKonbini - }{ - paymentIntentPaymentMethodOptionsKonbini: (*paymentIntentPaymentMethodOptionsKonbini)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentPaymentMethodOptionsPix. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentPaymentMethodOptionsPix) UnmarshalJSON(data []byte) error { - type paymentIntentPaymentMethodOptionsPix PaymentIntentPaymentMethodOptionsPix - v := struct { - ExpiresAt int64 `json:"expires_at"` - *paymentIntentPaymentMethodOptionsPix - }{ - paymentIntentPaymentMethodOptionsPix: (*paymentIntentPaymentMethodOptionsPix)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentIntentProcessingCardCustomerNotification. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentIntentProcessingCardCustomerNotification) UnmarshalJSON(data []byte) error { - type paymentIntentProcessingCardCustomerNotification PaymentIntentProcessingCardCustomerNotification - v := struct { - CompletesAt int64 `json:"completes_at"` - *paymentIntentProcessingCardCustomerNotification - }{ - paymentIntentProcessingCardCustomerNotification: (*paymentIntentProcessingCardCustomerNotification)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.CompletesAt = time.Unix(v.CompletesAt, 0) - return nil -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionBoletoDisplayDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionBoletoDisplayDetails) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionBoletoDisplayDetails PaymentIntentNextActionBoletoDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentNextActionBoletoDisplayDetails - }{ - paymentIntentNextActionBoletoDisplayDetails: (paymentIntentNextActionBoletoDisplayDetails)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionCardAwaitNotification. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionCardAwaitNotification) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionCardAwaitNotification PaymentIntentNextActionCardAwaitNotification - v := struct { - ChargeAttemptAt int64 `json:"charge_attempt_at"` - paymentIntentNextActionCardAwaitNotification - }{ - paymentIntentNextActionCardAwaitNotification: (paymentIntentNextActionCardAwaitNotification)(p), - ChargeAttemptAt: p.ChargeAttemptAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode PaymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - }{ - paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode: (paymentIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionKonbiniDisplayDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionKonbiniDisplayDetails) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionKonbiniDisplayDetails PaymentIntentNextActionKonbiniDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentNextActionKonbiniDisplayDetails - }{ - paymentIntentNextActionKonbiniDisplayDetails: (paymentIntentNextActionKonbiniDisplayDetails)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionMultibancoDisplayDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionMultibancoDisplayDetails) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionMultibancoDisplayDetails PaymentIntentNextActionMultibancoDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentNextActionMultibancoDisplayDetails - }{ - paymentIntentNextActionMultibancoDisplayDetails: (paymentIntentNextActionMultibancoDisplayDetails)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionOXXODisplayDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionOXXODisplayDetails) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionOXXODisplayDetails PaymentIntentNextActionOXXODisplayDetails - v := struct { - ExpiresAfter int64 `json:"expires_after"` - paymentIntentNextActionOXXODisplayDetails - }{ - paymentIntentNextActionOXXODisplayDetails: (paymentIntentNextActionOXXODisplayDetails)(p), - ExpiresAfter: p.ExpiresAfter.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionPixDisplayQRCode. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionPixDisplayQRCode) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionPixDisplayQRCode PaymentIntentNextActionPixDisplayQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentNextActionPixDisplayQRCode - }{ - paymentIntentNextActionPixDisplayQRCode: (paymentIntentNextActionPixDisplayQRCode)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentNextActionVerifyWithMicrodeposits. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentNextActionVerifyWithMicrodeposits) MarshalJSON() ([]byte, error) { - type paymentIntentNextActionVerifyWithMicrodeposits PaymentIntentNextActionVerifyWithMicrodeposits - v := struct { - ArrivalDate int64 `json:"arrival_date"` - paymentIntentNextActionVerifyWithMicrodeposits - }{ - paymentIntentNextActionVerifyWithMicrodeposits: (paymentIntentNextActionVerifyWithMicrodeposits)(p), - ArrivalDate: p.ArrivalDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentDetailsCarRental. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentDetailsCarRental) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentDetailsCarRental PaymentIntentPaymentDetailsCarRental - v := struct { - PickupAt int64 `json:"pickup_at"` - ReturnAt int64 `json:"return_at"` - paymentIntentPaymentDetailsCarRental - }{ - paymentIntentPaymentDetailsCarRental: (paymentIntentPaymentDetailsCarRental)(p), - PickupAt: p.PickupAt.Unix(), - ReturnAt: p.ReturnAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentDetailsEventDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentDetailsEventDetails) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentDetailsEventDetails PaymentIntentPaymentDetailsEventDetails - v := struct { - EndsAt int64 `json:"ends_at"` - StartsAt int64 `json:"starts_at"` - paymentIntentPaymentDetailsEventDetails - }{ - paymentIntentPaymentDetailsEventDetails: (paymentIntentPaymentDetailsEventDetails)(p), - EndsAt: p.EndsAt.Unix(), - StartsAt: p.StartsAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentDetailsSubscription. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentDetailsSubscription) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentDetailsSubscription PaymentIntentPaymentDetailsSubscription - v := struct { - EndsAt int64 `json:"ends_at"` - StartsAt int64 `json:"starts_at"` - paymentIntentPaymentDetailsSubscription - }{ - paymentIntentPaymentDetailsSubscription: (paymentIntentPaymentDetailsSubscription)(p), - EndsAt: p.EndsAt.Unix(), - StartsAt: p.StartsAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentMethodOptionsCardMandateOptions. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentMethodOptionsCardMandateOptions) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentMethodOptionsCardMandateOptions PaymentIntentPaymentMethodOptionsCardMandateOptions - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - paymentIntentPaymentMethodOptionsCardMandateOptions - }{ - paymentIntentPaymentMethodOptionsCardMandateOptions: (paymentIntentPaymentMethodOptionsCardMandateOptions)(p), - EndDate: p.EndDate.Unix(), - StartDate: p.StartDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentMethodOptionsIDBankTransfer. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentMethodOptionsIDBankTransfer) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentMethodOptionsIDBankTransfer PaymentIntentPaymentMethodOptionsIDBankTransfer - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentPaymentMethodOptionsIDBankTransfer - }{ - paymentIntentPaymentMethodOptionsIDBankTransfer: (paymentIntentPaymentMethodOptionsIDBankTransfer)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentMethodOptionsKonbini. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentMethodOptionsKonbini) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentMethodOptionsKonbini PaymentIntentPaymentMethodOptionsKonbini - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentPaymentMethodOptionsKonbini - }{ - paymentIntentPaymentMethodOptionsKonbini: (paymentIntentPaymentMethodOptionsKonbini)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentPaymentMethodOptionsPix. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentPaymentMethodOptionsPix) MarshalJSON() ([]byte, error) { - type paymentIntentPaymentMethodOptionsPix PaymentIntentPaymentMethodOptionsPix - v := struct { - ExpiresAt int64 `json:"expires_at"` - paymentIntentPaymentMethodOptionsPix - }{ - paymentIntentPaymentMethodOptionsPix: (paymentIntentPaymentMethodOptionsPix)(p), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntentProcessingCardCustomerNotification. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntentProcessingCardCustomerNotification) MarshalJSON() ([]byte, error) { - type paymentIntentProcessingCardCustomerNotification PaymentIntentProcessingCardCustomerNotification - v := struct { - CompletesAt int64 `json:"completes_at"` - paymentIntentProcessingCardCustomerNotification - }{ - paymentIntentProcessingCardCustomerNotification: (paymentIntentProcessingCardCustomerNotification)(p), - CompletesAt: p.CompletesAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentIntent. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentIntent) MarshalJSON() ([]byte, error) { - type paymentIntent PaymentIntent - v := struct { - CanceledAt int64 `json:"canceled_at"` - Created int64 `json:"created"` - paymentIntent - }{ - paymentIntent: (paymentIntent)(p), - CanceledAt: p.CanceledAt.Unix(), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/paymentmethod.go b/paymentmethod.go index 8fb844d310..631c12284b 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. type PaymentMethodAllowRedisplay string @@ -930,7 +927,7 @@ type PaymentMethodCardChecks struct { // Details about payments collected offline. type PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOfflineType `json:"type"` } @@ -968,7 +965,7 @@ type PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent struct { // The [product code](https://stripe.com/docs/card-product-codes) that identifies the specific program or product associated with a card. BrandProduct string `json:"brand_product"` // When using manual capture, a future timestamp after which the charge will be automatically refunded if uncaptured. - CaptureBefore time.Time `json:"capture_before"` + CaptureBefore int64 `json:"capture_before"` // The cardholder name as read from the card, in [ISO 7813](https://en.wikipedia.org/wiki/ISO/IEC_7813) format. May include alphanumeric characters, special characters and first/last name separator (`/`). In some cases, the cardholder name may not be available depending on how the issuer has configured the card. Cardholder name is typically not available on swipe or contactless payments, such as those made with Apple Pay and Google Pay. CardholderName string `json:"cardholder_name"` // Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. @@ -1136,7 +1133,7 @@ type PaymentMethodCardPresentNetworks struct { // Details about payment methods collected offline. type PaymentMethodCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type PaymentMethodCardPresentOfflineType `json:"type"` } @@ -1439,7 +1436,7 @@ type PaymentMethod struct { CardPresent *PaymentMethodCardPresent `json:"card_present"` CashApp *PaymentMethodCashApp `json:"cashapp"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. Customer *Customer `json:"customer"` CustomerBalance *PaymentMethodCustomerBalance `json:"customer_balance"` @@ -1512,142 +1509,11 @@ func (p *PaymentMethod) UnmarshalJSON(data []byte) error { } type paymentMethod PaymentMethod - v := struct { - Created int64 `json:"created"` - *paymentMethod - }{ - paymentMethod: (*paymentMethod)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline) UnmarshalJSON(data []byte) error { - type paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline - }{ - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline: (*paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline)(p), - } + var v paymentMethod if err := json.Unmarshal(data, &v); err != nil { return err } - p.StoredAt = time.Unix(v.StoredAt, 0) + *p = PaymentMethod(v) return nil } - -// UnmarshalJSON handles deserialization of a PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent) UnmarshalJSON(data []byte) error { - type paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - *paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent - }{ - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent: (*paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.CaptureBefore = time.Unix(v.CaptureBefore, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PaymentMethodCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentMethodCardPresentOffline) UnmarshalJSON(data []byte) error { - type paymentMethodCardPresentOffline PaymentMethodCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *paymentMethodCardPresentOffline - }{ - paymentMethodCardPresentOffline: (*paymentMethodCardPresentOffline)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.StoredAt = time.Unix(v.StoredAt, 0) - return nil -} - -// MarshalJSON handles serialization of a PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline) MarshalJSON() ([]byte, error) { - type paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline - }{ - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline: (paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresentOffline)(p), - StoredAt: p.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent) MarshalJSON() ([]byte, error) { - type paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent - v := struct { - CaptureBefore int64 `json:"capture_before"` - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent - }{ - paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent: (paymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent)(p), - CaptureBefore: p.CaptureBefore.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentMethodCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentMethodCardPresentOffline) MarshalJSON() ([]byte, error) { - type paymentMethodCardPresentOffline PaymentMethodCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - paymentMethodCardPresentOffline - }{ - paymentMethodCardPresentOffline: (paymentMethodCardPresentOffline)(p), - StoredAt: p.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a PaymentMethod. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentMethod) MarshalJSON() ([]byte, error) { - type paymentMethod PaymentMethod - v := struct { - Created int64 `json:"created"` - paymentMethod - }{ - paymentMethod: (paymentMethod)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/paymentmethoddomain.go b/paymentmethoddomain.go index 0ea6a4e690..03ad7e5b47 100644 --- a/paymentmethoddomain.go +++ b/paymentmethoddomain.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The status of the payment method on the domain. type PaymentMethodDomainAmazonPayStatus string @@ -186,7 +181,7 @@ type PaymentMethodDomain struct { // Indicates the status of a specific payment method on a payment method domain. ApplePay *PaymentMethodDomainApplePay `json:"apple_pay"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The domain name that this payment method domain object represents. DomainName string `json:"domain_name"` // Whether this payment method domain is enabled. If the domain is not enabled, payment methods that require a payment method domain will not appear in Elements. @@ -211,39 +206,3 @@ type PaymentMethodDomainList struct { ListMeta Data []*PaymentMethodDomain `json:"data"` } - -// UnmarshalJSON handles deserialization of a PaymentMethodDomain. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PaymentMethodDomain) UnmarshalJSON(data []byte) error { - type paymentMethodDomain PaymentMethodDomain - v := struct { - Created int64 `json:"created"` - *paymentMethodDomain - }{ - paymentMethodDomain: (*paymentMethodDomain)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a PaymentMethodDomain. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentMethodDomain) MarshalJSON() ([]byte, error) { - type paymentMethodDomain PaymentMethodDomain - v := struct { - Created int64 `json:"created"` - paymentMethodDomain - }{ - paymentMethodDomain: (paymentMethodDomain)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/paymentrecord.go b/paymentrecord.go index 78c6acd3d1..5c4d2c1e2a 100644 --- a/paymentrecord.go +++ b/paymentrecord.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Indicates whether the customer was present in your checkout flow during this payment. type PaymentRecordCustomerPresence string @@ -46,7 +43,7 @@ type PaymentRecordReportPaymentAttemptFailedParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // When the reported payment failed. Measured in seconds since the Unix epoch. - FailedAt *time.Time `form:"failed_at"` + FailedAt *int64 `form:"failed_at"` Metadata map[string]string `form:"metadata"` } @@ -70,7 +67,7 @@ type PaymentRecordReportPaymentAttemptGuaranteedParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // When the reported payment was guaranteed. Measured in seconds since the Unix epoch. - GuaranteedAt *time.Time `form:"guaranteed_at"` + GuaranteedAt *int64 `form:"guaranteed_at"` Metadata map[string]string `form:"metadata"` } @@ -144,7 +141,7 @@ type PaymentRecordReportPaymentAttemptParams struct { // Information about the payment attempt guarantee. Guaranteed *PaymentRecordReportPaymentAttemptGuaranteedParams `form:"guaranteed"` // When the reported payment was initiated. Measured in seconds since the Unix epoch. - InitiatedAt *time.Time `form:"initiated_at"` + InitiatedAt *int64 `form:"initiated_at"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` // The outcome of the reported payment. @@ -175,7 +172,7 @@ func (p *PaymentRecordReportPaymentAttemptParams) AddMetadata(key string, value type PaymentRecordReportPaymentAttemptCanceledParams struct { Params `form:"*"` // When the reported payment was canceled. Measured in seconds since the Unix epoch. - CanceledAt *time.Time `form:"canceled_at"` + CanceledAt *int64 `form:"canceled_at"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` Metadata map[string]string `form:"metadata"` @@ -218,13 +215,13 @@ type PaymentRecordReportPaymentCustomerDetailsParams struct { // Information about the payment attempt failure. type PaymentRecordReportPaymentFailedParams struct { // When the reported payment failed. Measured in seconds since the Unix epoch. - FailedAt *time.Time `form:"failed_at"` + FailedAt *int64 `form:"failed_at"` } // Information about the payment attempt guarantee. type PaymentRecordReportPaymentGuaranteedParams struct { // When the reported payment was guaranteed. Measured in seconds since the Unix epoch. - GuaranteedAt *time.Time `form:"guaranteed_at"` + GuaranteedAt *int64 `form:"guaranteed_at"` } // The billing details associated with the method of payment. @@ -290,7 +287,7 @@ type PaymentRecordReportPaymentParams struct { // Information about the payment attempt guarantee. Guaranteed *PaymentRecordReportPaymentGuaranteedParams `form:"guaranteed"` // When the reported payment was initiated. Measured in seconds since the Unix epoch. - InitiatedAt *time.Time `form:"initiated_at"` + InitiatedAt *int64 `form:"initiated_at"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` // The outcome of the reported payment. @@ -418,7 +415,7 @@ type PaymentRecord struct { // A representation of an amount of money, consisting of an amount and a currency. AmountRequested *PaymentRecordAmountRequested `json:"amount_requested"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Customer information for this payment. CustomerDetails *PaymentRecordCustomerDetails `json:"customer_details"` // Indicates whether the customer was present in your checkout flow during this payment. @@ -453,34 +450,11 @@ func (p *PaymentRecord) UnmarshalJSON(data []byte) error { } type paymentRecord PaymentRecord - v := struct { - Created int64 `json:"created"` - *paymentRecord - }{ - paymentRecord: (*paymentRecord)(p), - } + var v paymentRecord if err := json.Unmarshal(data, &v); err != nil { return err } - p.Created = time.Unix(v.Created, 0) + *p = PaymentRecord(v) return nil } - -// MarshalJSON handles serialization of a PaymentRecord. -// This custom marshaling is needed to handle the time fields correctly. -func (p PaymentRecord) MarshalJSON() ([]byte, error) { - type paymentRecord PaymentRecord - v := struct { - Created int64 `json:"created"` - paymentRecord - }{ - paymentRecord: (paymentRecord)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/payout.go b/payout.go index e8a099939e..c7a63bcd55 100644 --- a/payout.go +++ b/payout.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" type PayoutDestinationType string @@ -206,13 +203,13 @@ type Payout struct { // The amount of the application fee (if any) requested for the payout. [See the Connect documentation](https://stripe.com/docs/connect/instant-payouts#monetization-and-fees) for details. ApplicationFeeAmount int64 `json:"application_fee_amount"` // Date that you can expect the payout to arrive in the bank. This factors in delays to account for weekends or bank holidays. - ArrivalDate time.Time `json:"arrival_date"` + ArrivalDate int64 `json:"arrival_date"` // Returns `true` if the payout is created by an [automated payout schedule](https://stripe.com/docs/payouts#payout-schedule) and `false` if it's [requested manually](https://stripe.com/docs/payouts#manual-payouts). Automatic bool `json:"automatic"` // ID of the balance transaction that describes the impact of this payout on your account balance. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -277,19 +274,12 @@ func (p *Payout) UnmarshalJSON(data []byte) error { } type payout Payout - v := struct { - ArrivalDate int64 `json:"arrival_date"` - Created int64 `json:"created"` - *payout - }{ - payout: (*payout)(p), - } + var v payout if err := json.Unmarshal(data, &v); err != nil { return err } - p.ArrivalDate = time.Unix(v.ArrivalDate, 0) - p.Created = time.Unix(v.Created, 0) + *p = Payout(v) return nil } @@ -319,23 +309,3 @@ func (p *PayoutDestination) UnmarshalJSON(data []byte) error { } return err } - -// MarshalJSON handles serialization of a Payout. -// This custom marshaling is needed to handle the time fields correctly. -func (p Payout) MarshalJSON() ([]byte, error) { - type payout Payout - v := struct { - ArrivalDate int64 `json:"arrival_date"` - Created int64 `json:"created"` - payout - }{ - payout: (payout)(p), - ArrivalDate: p.ArrivalDate.Unix(), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/person.go b/person.go index cfca49d863..0bde2384a4 100644 --- a/person.go +++ b/person.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. type PersonPoliticalExposure string @@ -152,7 +147,7 @@ func (p *PersonParams) AddMetadata(key string, value string) { // Details on the legal guardian's acceptance of the main Stripe service agreement. type PersonAdditionalTOSAcceptancesAccountParams struct { // The Unix timestamp marking when the account representative accepted the service agreement. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the account representative accepted the service agreement. IP *string `form:"ip"` // The user agent of the browser from which the account representative accepted the service agreement. @@ -309,7 +304,7 @@ func (p *PersonListParams) AddExpand(f string) { // Details on the legal guardian's acceptance of the main Stripe service agreement. type PersonAdditionalTOSAcceptancesAccount struct { // The Unix timestamp marking when the legal guardian accepted the service agreement. - Date time.Time `json:"date"` + Date int64 `json:"date"` // The IP address from which the legal guardian accepted the service agreement. IP string `json:"ip"` // The user agent of the browser from which the legal guardian accepted the service agreement. @@ -479,7 +474,7 @@ type Person struct { // The Kanji variation of the person's address (Japan only). AddressKanji *PersonAddressKanji `json:"address_kanji"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` Deleted bool `json:"deleted"` DOB *PersonDOB `json:"dob"` // The person's email address. @@ -535,75 +530,3 @@ type PersonList struct { ListMeta Data []*Person `json:"data"` } - -// UnmarshalJSON handles deserialization of a PersonAdditionalTOSAcceptancesAccount. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PersonAdditionalTOSAcceptancesAccount) UnmarshalJSON(data []byte) error { - type personAdditionalTOSAcceptancesAccount PersonAdditionalTOSAcceptancesAccount - v := struct { - Date int64 `json:"date"` - *personAdditionalTOSAcceptancesAccount - }{ - personAdditionalTOSAcceptancesAccount: (*personAdditionalTOSAcceptancesAccount)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Date = time.Unix(v.Date, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a Person. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *Person) UnmarshalJSON(data []byte) error { - type person Person - v := struct { - Created int64 `json:"created"` - *person - }{ - person: (*person)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a PersonAdditionalTOSAcceptancesAccount. -// This custom marshaling is needed to handle the time fields correctly. -func (p PersonAdditionalTOSAcceptancesAccount) MarshalJSON() ([]byte, error) { - type personAdditionalTOSAcceptancesAccount PersonAdditionalTOSAcceptancesAccount - v := struct { - Date int64 `json:"date"` - personAdditionalTOSAcceptancesAccount - }{ - personAdditionalTOSAcceptancesAccount: (personAdditionalTOSAcceptancesAccount)(p), - Date: p.Date.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Person. -// This custom marshaling is needed to handle the time fields correctly. -func (p Person) MarshalJSON() ([]byte, error) { - type person Person - v := struct { - Created int64 `json:"created"` - person - }{ - person: (person)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/plan.go b/plan.go index 57e4e18f0a..fbf57dae40 100644 --- a/plan.go +++ b/plan.go @@ -10,7 +10,6 @@ import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" "strconv" - "time" ) // Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`. @@ -256,7 +255,7 @@ type Plan struct { // Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. BillingScheme PlanBillingScheme `json:"billing_scheme"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` Deleted bool `json:"deleted"` @@ -307,34 +306,11 @@ func (p *Plan) UnmarshalJSON(data []byte) error { } type plan Plan - v := struct { - Created int64 `json:"created"` - *plan - }{ - plan: (*plan)(p), - } + var v plan if err := json.Unmarshal(data, &v); err != nil { return err } - p.Created = time.Unix(v.Created, 0) + *p = Plan(v) return nil } - -// MarshalJSON handles serialization of a Plan. -// This custom marshaling is needed to handle the time fields correctly. -func (p Plan) MarshalJSON() ([]byte, error) { - type plan Plan - v := struct { - Created int64 `json:"created"` - plan - }{ - plan: (plan)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/price.go b/price.go index 7130215267..2066709803 100644 --- a/price.go +++ b/price.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. @@ -344,7 +343,7 @@ type PriceMigrateToParams struct { // The behavior controlling the point in the subscription lifecycle after which to migrate the price. Currently must be `at_cycle_end`. Behavior *string `form:"behavior"` // The time after which subscriptions should start using the new price. - EffectiveAfter *time.Time `form:"effective_after"` + EffectiveAfter *int64 `form:"effective_after"` // The ID of the price object. Price *string `form:"price"` } @@ -419,7 +418,7 @@ type PriceMigrateTo struct { // The behavior controlling at what point in the subscription lifecycle to migrate the price Behavior PriceMigrateToBehavior `json:"behavior"` // The unix timestamp after at which subscriptions will start to migrate to the new price. - EffectiveAfter time.Time `json:"effective_after"` + EffectiveAfter int64 `json:"effective_after"` // The id of the price being migrated to Price string `json:"price"` } @@ -475,7 +474,7 @@ type Price struct { // Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. BillingScheme PriceBillingScheme `json:"billing_scheme"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). @@ -541,70 +540,11 @@ func (p *Price) UnmarshalJSON(data []byte) error { } type price Price - v := struct { - Created int64 `json:"created"` - *price - }{ - price: (*price)(p), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - p.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a PriceMigrateTo. -// This custom unmarshaling is needed to handle the time fields correctly. -func (p *PriceMigrateTo) UnmarshalJSON(data []byte) error { - type priceMigrateTo PriceMigrateTo - v := struct { - EffectiveAfter int64 `json:"effective_after"` - *priceMigrateTo - }{ - priceMigrateTo: (*priceMigrateTo)(p), - } + var v price if err := json.Unmarshal(data, &v); err != nil { return err } - p.EffectiveAfter = time.Unix(v.EffectiveAfter, 0) + *p = Price(v) return nil } - -// MarshalJSON handles serialization of a PriceMigrateTo. -// This custom marshaling is needed to handle the time fields correctly. -func (p PriceMigrateTo) MarshalJSON() ([]byte, error) { - type priceMigrateTo PriceMigrateTo - v := struct { - EffectiveAfter int64 `json:"effective_after"` - priceMigrateTo - }{ - priceMigrateTo: (priceMigrateTo)(p), - EffectiveAfter: p.EffectiveAfter.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Price. -// This custom marshaling is needed to handle the time fields correctly. -func (p Price) MarshalJSON() ([]byte, error) { - type price Price - v := struct { - Created int64 `json:"created"` - price - }{ - price: (price)(p), - Created: p.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/product.go b/product.go index ba23372d99..4bf3bc8f13 100644 --- a/product.go +++ b/product.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // The specific type of gift_card provisioning, only `fixed_amount` currently supported. @@ -308,7 +307,7 @@ type Product struct { // Whether the product is currently available for purchase. Active bool `json:"active"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The ID of the [Price](https://stripe.com/docs/api/prices) object that is the default price for this product. DefaultPrice *Price `json:"default_price"` Deleted bool `json:"deleted"` @@ -343,7 +342,7 @@ type Product struct { // A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. UnitLabel string `json:"unit_label"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` // A URL of a publicly-accessible webpage for this product. URL string `json:"url"` } @@ -372,38 +371,11 @@ func (p *Product) UnmarshalJSON(data []byte) error { } type product Product - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - *product - }{ - product: (*product)(p), - } + var v product if err := json.Unmarshal(data, &v); err != nil { return err } - p.Created = time.Unix(v.Created, 0) - p.Updated = time.Unix(v.Updated, 0) + *p = Product(v) return nil } - -// MarshalJSON handles serialization of a Product. -// This custom marshaling is needed to handle the time fields correctly. -func (p Product) MarshalJSON() ([]byte, error) { - type product Product - v := struct { - Created int64 `json:"created"` - Updated int64 `json:"updated"` - product - }{ - product: (product)(p), - Created: p.Created.Unix(), - Updated: p.Updated.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/promotioncode.go b/promotioncode.go index e28610b471..ad37d381e7 100644 --- a/promotioncode.go +++ b/promotioncode.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Returns a list of your promotion codes. type PromotionCodeListParams struct { @@ -69,7 +66,7 @@ type PromotionCodeParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The timestamp at which this promotion code will expire. If the coupon has specified a `redeems_by`, then this value cannot be after the coupon's `redeems_by`. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `max_redemptions`, then this value cannot be greater than the coupon's `max_redemptions`. MaxRedemptions *int64 `form:"max_redemptions"` // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. @@ -121,11 +118,11 @@ type PromotionCode struct { // [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents). Coupon *Coupon `json:"coupon"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The customer that this promotion code can be used by. Customer *Customer `json:"customer"` // Date at which the promotion code can no longer be redeemed. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -158,38 +155,11 @@ func (p *PromotionCode) UnmarshalJSON(data []byte) error { } type promotionCode PromotionCode - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *promotionCode - }{ - promotionCode: (*promotionCode)(p), - } + var v promotionCode if err := json.Unmarshal(data, &v); err != nil { return err } - p.Created = time.Unix(v.Created, 0) - p.ExpiresAt = time.Unix(v.ExpiresAt, 0) + *p = PromotionCode(v) return nil } - -// MarshalJSON handles serialization of a PromotionCode. -// This custom marshaling is needed to handle the time fields correctly. -func (p PromotionCode) MarshalJSON() ([]byte, error) { - type promotionCode PromotionCode - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - promotionCode - }{ - promotionCode: (promotionCode)(p), - Created: p.Created.Unix(), - ExpiresAt: p.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/quote.go b/quote.go index db853bbcf2..2896e7a4cc 100644 --- a/quote.go +++ b/quote.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // Type of the account referenced. @@ -389,7 +388,7 @@ type QuoteDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *QuoteDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -443,7 +442,7 @@ type QuoteLineItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *QuoteLineItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -533,7 +532,7 @@ type QuoteLineActionAddItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *QuoteLineActionAddItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -622,7 +621,7 @@ type QuoteLineActionSetItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *QuoteLineActionSetItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -737,7 +736,7 @@ type QuoteLineEndsAtParams struct { // Time span for the quote line starting from the `starts_at` date. Duration *QuoteLineEndsAtDurationParams `form:"duration"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select a way to pass in `ends_at`. Type *string `form:"type"` } @@ -777,7 +776,7 @@ type QuoteLineStartsAtParams struct { // The timestamp the given line ends at. LineEndsAt *QuoteLineStartsAtLineEndsAtParams `form:"line_ends_at"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select a way to pass in `starts_at`. Type *string `form:"type"` } @@ -833,7 +832,7 @@ type QuoteSubscriptionDataBillOnAcceptanceBillFromParams struct { // Details of a Quote line to start the bill period from. LineStartsAt *QuoteSubscriptionDataBillOnAcceptanceBillFromLineStartsAtParams `form:"line_starts_at"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of method to specify the `bill_from` time. Type *string `form:"type"` } @@ -861,7 +860,7 @@ type QuoteSubscriptionDataBillOnAcceptanceBillUntilParams struct { // Details of a Quote line item from which to bill until. LineEndsAt *QuoteSubscriptionDataBillOnAcceptanceBillUntilLineEndsAtParams `form:"line_ends_at"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of method to specify the `bill_until` time. Type *string `form:"type"` } @@ -891,8 +890,8 @@ type QuoteSubscriptionDataParams struct { // The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. Description *string `form:"description"` // When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted. - EffectiveDate *time.Time `form:"effective_date"` - EffectiveDateCurrentPeriodEnd *bool `form:"-"` // See custom AppendTo + EffectiveDate *int64 `form:"effective_date"` + EffectiveDateCurrentPeriodEnd *bool `form:"-"` // See custom AppendTo // Behavior of the subscription schedule and underlying subscription when it ends. EndBehavior *string `form:"end_behavior"` // The id of a subscription that the quote will update. By default, the quote will contain the state of the subscription (such as line items, collection method and billing thresholds) unless overridden. @@ -952,7 +951,7 @@ type QuoteSubscriptionDataOverrideBillOnAcceptanceBillFromParams struct { // Details of a Quote line to start the bill period from. LineStartsAt *QuoteSubscriptionDataOverrideBillOnAcceptanceBillFromLineStartsAtParams `form:"line_starts_at"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of method to specify the `bill_from` time. Type *string `form:"type"` } @@ -980,7 +979,7 @@ type QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilParams struct { // Details of a Quote line item from which to bill until. LineEndsAt *QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilLineEndsAtParams `form:"line_ends_at"` // A precise Unix timestamp. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of method to specify the `bill_until` time. Type *string `form:"type"` } @@ -1051,7 +1050,7 @@ type QuoteParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. If no value is passed, the default expiration date configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` // A footer that will be displayed on the quote PDF. If no value is passed, the default footer configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. Footer *string `form:"footer"` // Clone an existing quote. The new quote will be created in `status=draft`. When using this parameter, you cannot specify any other parameters except for `expires_at`. @@ -1161,7 +1160,7 @@ type QuoteFinalizeQuoteParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. - ExpiresAt *time.Time `form:"expires_at"` + ExpiresAt *int64 `form:"expires_at"` } // AddExpand appends a new field to expand. @@ -1374,7 +1373,7 @@ type QuoteComputed struct { // The definitive totals and line items the customer will be charged on a recurring basis. Takes into account the line items with recurring prices and discounts with `duration=forever` coupons only. Defaults to `null` if no inputted line items with recurring prices. Recurring *QuoteComputedRecurring `json:"recurring"` // The time at which the quote's estimated schedules and upcoming invoices were generated. - UpdatedAt time.Time `json:"updated_at"` + UpdatedAt int64 `json:"updated_at"` Upfront *QuoteComputedUpfront `json:"upfront"` } @@ -1400,13 +1399,13 @@ type QuoteStatusDetailsCanceled struct { // The reason this quote was marked as canceled. Reason QuoteStatusDetailsCanceledReason `json:"reason"` // Time at which the quote was marked as canceled. Measured in seconds since the Unix epoch. - TransitionedAt time.Time `json:"transitioned_at"` + TransitionedAt int64 `json:"transitioned_at"` } // The IDs of the lines that are invalid if the stale reason type is `lines_invalid`. type QuoteStatusDetailsStaleLastReasonLinesInvalid struct { // The timestamp at which the lines were marked as invalid. - InvalidAt time.Time `json:"invalid_at"` + InvalidAt int64 `json:"invalid_at"` // The list of lines that became invalid at the given timestamp. Lines []string `json:"lines"` } @@ -1442,13 +1441,13 @@ type QuoteStatusDetailsStaleLastReason struct { } type QuoteStatusDetailsStale struct { // Time at which the quote expires. Measured in seconds since the Unix epoch. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The most recent reason this quote was marked as stale. LastReason *QuoteStatusDetailsStaleLastReason `json:"last_reason"` // Time at which the stale reason was updated. Measured in seconds since the Unix epoch. - LastUpdatedAt time.Time `json:"last_updated_at"` + LastUpdatedAt int64 `json:"last_updated_at"` // Time at which the quote was marked as stale. Measured in seconds since the Unix epoch. - TransitionedAt time.Time `json:"transitioned_at"` + TransitionedAt int64 `json:"transitioned_at"` } // Details on when and why a quote has been marked as stale or canceled. @@ -1458,11 +1457,11 @@ type QuoteStatusDetails struct { } type QuoteStatusTransitions struct { // The time that the quote was accepted. Measured in seconds since Unix epoch. - AcceptedAt time.Time `json:"accepted_at"` + AcceptedAt int64 `json:"accepted_at"` // The time that the quote was canceled. Measured in seconds since Unix epoch. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // The time that the quote was finalized. Measured in seconds since Unix epoch. - FinalizedAt time.Time `json:"finalized_at"` + FinalizedAt int64 `json:"finalized_at"` } // The timestamp the given line starts at. @@ -1474,11 +1473,11 @@ type QuoteSubscriptionDataBillOnAcceptanceBillFromLineStartsAt struct { // The start of the period to bill from when the Quote is accepted. type QuoteSubscriptionDataBillOnAcceptanceBillFrom struct { // The materialized time. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // The timestamp the given line starts at. LineStartsAt *QuoteSubscriptionDataBillOnAcceptanceBillFromLineStartsAt `json:"line_starts_at"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The type of method to specify the `bill_from` time. Type QuoteSubscriptionDataBillOnAcceptanceBillFromType `json:"type"` } @@ -1500,13 +1499,13 @@ type QuoteSubscriptionDataBillOnAcceptanceBillUntilLineEndsAt struct { // The end of the period to bill until when the Quote is accepted. type QuoteSubscriptionDataBillOnAcceptanceBillUntil struct { // The materialized time. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // Time span for the quote line starting from the `starts_at` date. Duration *QuoteSubscriptionDataBillOnAcceptanceBillUntilDuration `json:"duration"` // The timestamp the given line ends at. LineEndsAt *QuoteSubscriptionDataBillOnAcceptanceBillUntilLineEndsAt `json:"line_ends_at"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The type of method to specify the `bill_until` time. Type QuoteSubscriptionDataBillOnAcceptanceBillUntilType `json:"type"` } @@ -1533,7 +1532,7 @@ type QuoteSubscriptionData struct { // The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. Description string `json:"description"` // When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. This date is ignored if it is in the past when the quote is accepted. Measured in seconds since the Unix epoch. - EffectiveDate time.Time `json:"effective_date"` + EffectiveDate int64 `json:"effective_date"` // Behavior of the subscription schedule and underlying subscription when it ends. EndBehavior QuoteSubscriptionDataEndBehavior `json:"end_behavior"` // The id of the subscription that will be updated when the quote is accepted. @@ -1565,11 +1564,11 @@ type QuoteSubscriptionDataOverrideBillOnAcceptanceBillFromLineStartsAt struct { // The start of the period to bill from when the Quote is accepted. type QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom struct { // The materialized time. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // The timestamp the given line starts at. LineStartsAt *QuoteSubscriptionDataOverrideBillOnAcceptanceBillFromLineStartsAt `json:"line_starts_at"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The type of method to specify the `bill_from` time. Type QuoteSubscriptionDataOverrideBillOnAcceptanceBillFromType `json:"type"` } @@ -1591,13 +1590,13 @@ type QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilLineEndsAt struct { // The end of the period to bill until when the Quote is accepted. type QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil struct { // The materialized time. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // Time span for the quote line starting from the `starts_at` date. Duration *QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilDuration `json:"duration"` // The timestamp the given line ends at. LineEndsAt *QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilLineEndsAt `json:"line_ends_at"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The type of method to specify the `bill_until` time. Type QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntilType `json:"type"` } @@ -1713,7 +1712,7 @@ type Quote struct { CollectionMethod QuoteCollectionMethod `json:"collection_method"` Computed *QuoteComputed `json:"computed"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed. @@ -1725,7 +1724,7 @@ type Quote struct { // The discounts applied to this quote. Discounts []*Discount `json:"discounts"` // The date on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // A footer that will be displayed on the quote PDF. Footer string `json:"footer"` // Details of the quote that was cloned. See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details. @@ -1789,430 +1788,11 @@ func (q *Quote) UnmarshalJSON(data []byte) error { } type quote Quote - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *quote - }{ - quote: (*quote)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Created = time.Unix(v.Created, 0) - q.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteComputed. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteComputed) UnmarshalJSON(data []byte) error { - type quoteComputed QuoteComputed - v := struct { - UpdatedAt int64 `json:"updated_at"` - *quoteComputed - }{ - quoteComputed: (*quoteComputed)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.UpdatedAt = time.Unix(v.UpdatedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteStatusDetailsCanceled. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteStatusDetailsCanceled) UnmarshalJSON(data []byte) error { - type quoteStatusDetailsCanceled QuoteStatusDetailsCanceled - v := struct { - TransitionedAt int64 `json:"transitioned_at"` - *quoteStatusDetailsCanceled - }{ - quoteStatusDetailsCanceled: (*quoteStatusDetailsCanceled)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.TransitionedAt = time.Unix(v.TransitionedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteStatusDetailsStaleLastReasonLinesInvalid. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteStatusDetailsStaleLastReasonLinesInvalid) UnmarshalJSON(data []byte) error { - type quoteStatusDetailsStaleLastReasonLinesInvalid QuoteStatusDetailsStaleLastReasonLinesInvalid - v := struct { - InvalidAt int64 `json:"invalid_at"` - *quoteStatusDetailsStaleLastReasonLinesInvalid - }{ - quoteStatusDetailsStaleLastReasonLinesInvalid: (*quoteStatusDetailsStaleLastReasonLinesInvalid)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.InvalidAt = time.Unix(v.InvalidAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteStatusDetailsStale. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteStatusDetailsStale) UnmarshalJSON(data []byte) error { - type quoteStatusDetailsStale QuoteStatusDetailsStale - v := struct { - ExpiresAt int64 `json:"expires_at"` - LastUpdatedAt int64 `json:"last_updated_at"` - TransitionedAt int64 `json:"transitioned_at"` - *quoteStatusDetailsStale - }{ - quoteStatusDetailsStale: (*quoteStatusDetailsStale)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.ExpiresAt = time.Unix(v.ExpiresAt, 0) - q.LastUpdatedAt = time.Unix(v.LastUpdatedAt, 0) - q.TransitionedAt = time.Unix(v.TransitionedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteStatusTransitions) UnmarshalJSON(data []byte) error { - type quoteStatusTransitions QuoteStatusTransitions - v := struct { - AcceptedAt int64 `json:"accepted_at"` - CanceledAt int64 `json:"canceled_at"` - FinalizedAt int64 `json:"finalized_at"` - *quoteStatusTransitions - }{ - quoteStatusTransitions: (*quoteStatusTransitions)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.AcceptedAt = time.Unix(v.AcceptedAt, 0) - q.CanceledAt = time.Unix(v.CanceledAt, 0) - q.FinalizedAt = time.Unix(v.FinalizedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteSubscriptionDataBillOnAcceptanceBillFrom. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteSubscriptionDataBillOnAcceptanceBillFrom) UnmarshalJSON(data []byte) error { - type quoteSubscriptionDataBillOnAcceptanceBillFrom QuoteSubscriptionDataBillOnAcceptanceBillFrom - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteSubscriptionDataBillOnAcceptanceBillFrom - }{ - quoteSubscriptionDataBillOnAcceptanceBillFrom: (*quoteSubscriptionDataBillOnAcceptanceBillFrom)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteSubscriptionDataBillOnAcceptanceBillUntil. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteSubscriptionDataBillOnAcceptanceBillUntil) UnmarshalJSON(data []byte) error { - type quoteSubscriptionDataBillOnAcceptanceBillUntil QuoteSubscriptionDataBillOnAcceptanceBillUntil - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteSubscriptionDataBillOnAcceptanceBillUntil - }{ - quoteSubscriptionDataBillOnAcceptanceBillUntil: (*quoteSubscriptionDataBillOnAcceptanceBillUntil)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteSubscriptionData. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteSubscriptionData) UnmarshalJSON(data []byte) error { - type quoteSubscriptionData QuoteSubscriptionData - v := struct { - EffectiveDate int64 `json:"effective_date"` - *quoteSubscriptionData - }{ - quoteSubscriptionData: (*quoteSubscriptionData)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.EffectiveDate = time.Unix(v.EffectiveDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom) UnmarshalJSON(data []byte) error { - type quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom - }{ - quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom: (*quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil) UnmarshalJSON(data []byte) error { - type quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil - }{ - quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil: (*quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil)(q), - } + var v quote if err := json.Unmarshal(data, &v); err != nil { return err } - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) + *q = Quote(v) return nil } - -// MarshalJSON handles serialization of a QuoteComputed. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteComputed) MarshalJSON() ([]byte, error) { - type quoteComputed QuoteComputed - v := struct { - UpdatedAt int64 `json:"updated_at"` - quoteComputed - }{ - quoteComputed: (quoteComputed)(q), - UpdatedAt: q.UpdatedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteStatusDetailsCanceled. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteStatusDetailsCanceled) MarshalJSON() ([]byte, error) { - type quoteStatusDetailsCanceled QuoteStatusDetailsCanceled - v := struct { - TransitionedAt int64 `json:"transitioned_at"` - quoteStatusDetailsCanceled - }{ - quoteStatusDetailsCanceled: (quoteStatusDetailsCanceled)(q), - TransitionedAt: q.TransitionedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteStatusDetailsStaleLastReasonLinesInvalid. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteStatusDetailsStaleLastReasonLinesInvalid) MarshalJSON() ([]byte, error) { - type quoteStatusDetailsStaleLastReasonLinesInvalid QuoteStatusDetailsStaleLastReasonLinesInvalid - v := struct { - InvalidAt int64 `json:"invalid_at"` - quoteStatusDetailsStaleLastReasonLinesInvalid - }{ - quoteStatusDetailsStaleLastReasonLinesInvalid: (quoteStatusDetailsStaleLastReasonLinesInvalid)(q), - InvalidAt: q.InvalidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteStatusDetailsStale. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteStatusDetailsStale) MarshalJSON() ([]byte, error) { - type quoteStatusDetailsStale QuoteStatusDetailsStale - v := struct { - ExpiresAt int64 `json:"expires_at"` - LastUpdatedAt int64 `json:"last_updated_at"` - TransitionedAt int64 `json:"transitioned_at"` - quoteStatusDetailsStale - }{ - quoteStatusDetailsStale: (quoteStatusDetailsStale)(q), - ExpiresAt: q.ExpiresAt.Unix(), - LastUpdatedAt: q.LastUpdatedAt.Unix(), - TransitionedAt: q.TransitionedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteStatusTransitions) MarshalJSON() ([]byte, error) { - type quoteStatusTransitions QuoteStatusTransitions - v := struct { - AcceptedAt int64 `json:"accepted_at"` - CanceledAt int64 `json:"canceled_at"` - FinalizedAt int64 `json:"finalized_at"` - quoteStatusTransitions - }{ - quoteStatusTransitions: (quoteStatusTransitions)(q), - AcceptedAt: q.AcceptedAt.Unix(), - CanceledAt: q.CanceledAt.Unix(), - FinalizedAt: q.FinalizedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteSubscriptionDataBillOnAcceptanceBillFrom. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteSubscriptionDataBillOnAcceptanceBillFrom) MarshalJSON() ([]byte, error) { - type quoteSubscriptionDataBillOnAcceptanceBillFrom QuoteSubscriptionDataBillOnAcceptanceBillFrom - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteSubscriptionDataBillOnAcceptanceBillFrom - }{ - quoteSubscriptionDataBillOnAcceptanceBillFrom: (quoteSubscriptionDataBillOnAcceptanceBillFrom)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteSubscriptionDataBillOnAcceptanceBillUntil. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteSubscriptionDataBillOnAcceptanceBillUntil) MarshalJSON() ([]byte, error) { - type quoteSubscriptionDataBillOnAcceptanceBillUntil QuoteSubscriptionDataBillOnAcceptanceBillUntil - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteSubscriptionDataBillOnAcceptanceBillUntil - }{ - quoteSubscriptionDataBillOnAcceptanceBillUntil: (quoteSubscriptionDataBillOnAcceptanceBillUntil)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteSubscriptionData. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteSubscriptionData) MarshalJSON() ([]byte, error) { - type quoteSubscriptionData QuoteSubscriptionData - v := struct { - EffectiveDate int64 `json:"effective_date"` - quoteSubscriptionData - }{ - quoteSubscriptionData: (quoteSubscriptionData)(q), - EffectiveDate: q.EffectiveDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom) MarshalJSON() ([]byte, error) { - type quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom QuoteSubscriptionDataOverrideBillOnAcceptanceBillFrom - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom - }{ - quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom: (quoteSubscriptionDataOverrideBillOnAcceptanceBillFrom)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil) MarshalJSON() ([]byte, error) { - type quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil QuoteSubscriptionDataOverrideBillOnAcceptanceBillUntil - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil - }{ - quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil: (quoteSubscriptionDataOverrideBillOnAcceptanceBillUntil)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Quote. -// This custom marshaling is needed to handle the time fields correctly. -func (q Quote) MarshalJSON() ([]byte, error) { - type quote Quote - v := struct { - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - quote - }{ - quote: (quote)(q), - Created: q.Created.Unix(), - ExpiresAt: q.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/quoteline.go b/quoteline.go index 9c2b7057fc..6acb4482b0 100644 --- a/quoteline.go +++ b/quoteline.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The discount end type. type QuoteLineActionAddDiscountDiscountEndType string @@ -222,7 +217,7 @@ type QuoteLineActionAddDiscount struct { // Details to determine how long the discount should be applied for. type QuoteLineActionAddItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuoteLineActionAddItemDiscountDiscountEndType `json:"type"` } @@ -266,7 +261,7 @@ type QuoteLineActionAddItem struct { // Details to determine how long the discount should be applied for. type QuoteLineActionRemoveDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuoteLineActionRemoveDiscountDiscountEndType `json:"type"` } @@ -292,7 +287,7 @@ type QuoteLineActionRemoveItem struct { // Details to determine how long the discount should be applied for. type QuoteLineActionSetDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuoteLineActionSetDiscountDiscountEndType `json:"type"` } @@ -312,7 +307,7 @@ type QuoteLineActionSetDiscount struct { // Details to determine how long the discount should be applied for. type QuoteLineActionSetItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuoteLineActionSetItemDiscountDiscountEndType `json:"type"` } @@ -414,13 +409,13 @@ type QuoteLineEndsAtDuration struct { // Details to identify the end of the time range modified by the proposed change. If not supplied, the quote line is considered a point-in-time operation that only affects the exact timestamp at `starts_at`, and a restricted set of attributes is supported on the quote line. type QuoteLineEndsAt struct { // The timestamp value that will be used to determine when to make changes to the subscription schedule, as computed from the `ends_at` field. For example, if `ends_at[type]=upcoming_invoice`, the upcoming invoice date will be computed at the time the `ends_at` field was specified and saved. This field will not be recomputed upon future requests to update or finalize the quote unless `ends_at` is respecified. This field is guaranteed to be populated after quote acceptance. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // Use the `end` time of a given discount. DiscountEnd *QuoteLineEndsAtDiscountEnd `json:"discount_end"` // Time span for the quote line starting from the `starts_at` date. Duration *QuoteLineEndsAtDuration `json:"duration"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // Select a way to pass in `ends_at`. Type QuoteLineEndsAtType `json:"type"` } @@ -454,13 +449,13 @@ type QuoteLineStartsAtLineEndsAt struct { // Details to identify the earliest timestamp where the proposed change should take effect. type QuoteLineStartsAt struct { // The timestamp value that will be used to determine when to make changes to the subscription schedule, as computed from the `starts_at` field. For example, if `starts_at[type]=upcoming_invoice`, the upcoming invoice date will be computed at the time the `starts_at` field was specified and saved. This field will not be recomputed upon future requests to update or finalize the quote unless `starts_at` is respecified. This field is guaranteed to be populated after quote acceptance. - Computed time.Time `json:"computed"` + Computed int64 `json:"computed"` // Use the `end` time of a given discount. DiscountEnd *QuoteLineStartsAtDiscountEnd `json:"discount_end"` // The timestamp the given line ends at. LineEndsAt *QuoteLineStartsAtLineEndsAt `json:"line_ends_at"` // A precise Unix timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // Select a way to pass in `starts_at`. Type QuoteLineStartsAtType `json:"type"` } @@ -511,227 +506,3 @@ type QuoteLineList struct { ListMeta Data []*QuoteLine `json:"data"` } - -// UnmarshalJSON handles deserialization of a QuoteLineActionAddItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineActionAddItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quoteLineActionAddItemDiscountDiscountEnd QuoteLineActionAddItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quoteLineActionAddItemDiscountDiscountEnd - }{ - quoteLineActionAddItemDiscountDiscountEnd: (*quoteLineActionAddItemDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteLineActionRemoveDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineActionRemoveDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quoteLineActionRemoveDiscountDiscountEnd QuoteLineActionRemoveDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quoteLineActionRemoveDiscountDiscountEnd - }{ - quoteLineActionRemoveDiscountDiscountEnd: (*quoteLineActionRemoveDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteLineActionSetDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineActionSetDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quoteLineActionSetDiscountDiscountEnd QuoteLineActionSetDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quoteLineActionSetDiscountDiscountEnd - }{ - quoteLineActionSetDiscountDiscountEnd: (*quoteLineActionSetDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteLineActionSetItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineActionSetItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quoteLineActionSetItemDiscountDiscountEnd QuoteLineActionSetItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quoteLineActionSetItemDiscountDiscountEnd - }{ - quoteLineActionSetItemDiscountDiscountEnd: (*quoteLineActionSetItemDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteLineEndsAt. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineEndsAt) UnmarshalJSON(data []byte) error { - type quoteLineEndsAt QuoteLineEndsAt - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteLineEndsAt - }{ - quoteLineEndsAt: (*quoteLineEndsAt)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuoteLineStartsAt. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuoteLineStartsAt) UnmarshalJSON(data []byte) error { - type quoteLineStartsAt QuoteLineStartsAt - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - *quoteLineStartsAt - }{ - quoteLineStartsAt: (*quoteLineStartsAt)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Computed = time.Unix(v.Computed, 0) - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// MarshalJSON handles serialization of a QuoteLineActionAddItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineActionAddItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quoteLineActionAddItemDiscountDiscountEnd QuoteLineActionAddItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quoteLineActionAddItemDiscountDiscountEnd - }{ - quoteLineActionAddItemDiscountDiscountEnd: (quoteLineActionAddItemDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteLineActionRemoveDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineActionRemoveDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quoteLineActionRemoveDiscountDiscountEnd QuoteLineActionRemoveDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quoteLineActionRemoveDiscountDiscountEnd - }{ - quoteLineActionRemoveDiscountDiscountEnd: (quoteLineActionRemoveDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteLineActionSetDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineActionSetDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quoteLineActionSetDiscountDiscountEnd QuoteLineActionSetDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quoteLineActionSetDiscountDiscountEnd - }{ - quoteLineActionSetDiscountDiscountEnd: (quoteLineActionSetDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteLineActionSetItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineActionSetItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quoteLineActionSetItemDiscountDiscountEnd QuoteLineActionSetItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quoteLineActionSetItemDiscountDiscountEnd - }{ - quoteLineActionSetItemDiscountDiscountEnd: (quoteLineActionSetItemDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteLineEndsAt. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineEndsAt) MarshalJSON() ([]byte, error) { - type quoteLineEndsAt QuoteLineEndsAt - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteLineEndsAt - }{ - quoteLineEndsAt: (quoteLineEndsAt)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuoteLineStartsAt. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuoteLineStartsAt) MarshalJSON() ([]byte, error) { - type quoteLineStartsAt QuoteLineStartsAt - v := struct { - Computed int64 `json:"computed"` - Timestamp int64 `json:"timestamp"` - quoteLineStartsAt - }{ - quoteLineStartsAt: (quoteLineStartsAt)(q), - Computed: q.Computed.Unix(), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/quotepreviewinvoice.go b/quotepreviewinvoice.go index 9c5b860f80..ec2e14b5f7 100644 --- a/quotepreviewinvoice.go +++ b/quotepreviewinvoice.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The status of the payment, one of `open`, `paid`, or `past_due` type QuotePreviewInvoiceAmountsDueStatus string @@ -476,9 +471,9 @@ type QuotePreviewInvoiceAmountsDue struct { // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` // Date on which a payment plan's payment is due. - DueDate time.Time `json:"due_date"` + DueDate int64 `json:"due_date"` // Timestamp when the payment was paid. - PaidAt time.Time `json:"paid_at"` + PaidAt int64 `json:"paid_at"` // The status of the payment, one of `open`, `paid`, or `past_due` Status QuotePreviewInvoiceAmountsDueStatus `json:"status"` } @@ -687,13 +682,13 @@ type QuotePreviewInvoiceShippingCost struct { } type QuotePreviewInvoiceStatusTransitions struct { // The time that the invoice draft was finalized. - FinalizedAt time.Time `json:"finalized_at"` + FinalizedAt int64 `json:"finalized_at"` // The time that the invoice was marked uncollectible. - MarkedUncollectibleAt time.Time `json:"marked_uncollectible_at"` + MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` // The time that the invoice was paid. - PaidAt time.Time `json:"paid_at"` + PaidAt int64 `json:"paid_at"` // The time that the invoice was voided. - VoidedAt time.Time `json:"voided_at"` + VoidedAt int64 `json:"voided_at"` } // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment). @@ -701,7 +696,7 @@ type QuotePreviewInvoiceSubscriptionDetailsPauseCollection struct { // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`. Behavior QuotePreviewInvoiceSubscriptionDetailsPauseCollectionBehavior `json:"behavior"` // The time after which the subscription will resume collecting payments. - ResumesAt time.Time `json:"resumes_at"` + ResumesAt int64 `json:"resumes_at"` } // Details about the subscription that created this invoice. @@ -840,7 +835,7 @@ type QuotePreviewInvoice struct { // Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users. Attempted bool `json:"attempted"` // The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. - AutomaticallyFinalizesAt time.Time `json:"automatically_finalizes_at"` + AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` AutomaticTax *QuotePreviewInvoiceAutomaticTax `json:"automatic_tax"` // Indicates the reason why the invoice was created. // @@ -855,7 +850,7 @@ type QuotePreviewInvoice struct { // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. CollectionMethod QuotePreviewInvoiceCollectionMethod `json:"collection_method"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated. @@ -889,9 +884,9 @@ type QuotePreviewInvoice struct { // The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount. Discounts []*Discount `json:"discounts"` // The date on which payment for this invoice is due. This value will be `null` for invoices where `collection_method=charge_automatically`. - DueDate time.Time `json:"due_date"` + DueDate int64 `json:"due_date"` // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. EndingBalance int64 `json:"ending_balance"` // Footer displayed on the invoice. @@ -912,7 +907,7 @@ type QuotePreviewInvoice struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` // The time at which payment will next be attempted. This value will be `null` for invoices where `collection_method=send_invoice`. - NextPaymentAttempt time.Time `json:"next_payment_attempt"` + NextPaymentAttempt int64 `json:"next_payment_attempt"` // A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. Number string `json:"number"` // String representing the object's type. Objects of the same type share the same value. @@ -929,9 +924,9 @@ type QuotePreviewInvoice struct { Payments *InvoicePaymentList `json:"payments"` PaymentSettings *QuotePreviewInvoicePaymentSettings `json:"payment_settings"` // End of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // Start of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // Total amount of all post-payment credit notes issued for this invoice. PostPaymentCreditNotesAmount int64 `json:"post_payment_credit_notes_amount"` // Total amount of all pre-payment credit notes issued for this invoice. @@ -957,7 +952,7 @@ type QuotePreviewInvoice struct { // Details about the subscription that created this invoice. SubscriptionDetails *QuotePreviewInvoiceSubscriptionDetails `json:"subscription_details"` // Only set for upcoming invoices that preview prorations. The time used to calculate prorations. - SubscriptionProrationDate time.Time `json:"subscription_proration_date"` + SubscriptionProrationDate int64 `json:"subscription_proration_date"` // Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated Subtotal int64 `json:"subtotal"` // The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated @@ -982,7 +977,7 @@ type QuotePreviewInvoice struct { // The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. TransferData *QuotePreviewInvoiceTransferData `json:"transfer_data"` // Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have [been exhausted](https://stripe.com/docs/billing/webhooks#understand). This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. - WebhooksDeliveredAt time.Time `json:"webhooks_delivered_at"` + WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` } // QuotePreviewInvoiceList is a list of QuotePreviewInvoices as retrieved from a list endpoint. @@ -991,195 +986,3 @@ type QuotePreviewInvoiceList struct { ListMeta Data []*QuotePreviewInvoice `json:"data"` } - -// UnmarshalJSON handles deserialization of a QuotePreviewInvoiceAmountsDue. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewInvoiceAmountsDue) UnmarshalJSON(data []byte) error { - type quotePreviewInvoiceAmountsDue QuotePreviewInvoiceAmountsDue - v := struct { - DueDate int64 `json:"due_date"` - PaidAt int64 `json:"paid_at"` - *quotePreviewInvoiceAmountsDue - }{ - quotePreviewInvoiceAmountsDue: (*quotePreviewInvoiceAmountsDue)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.DueDate = time.Unix(v.DueDate, 0) - q.PaidAt = time.Unix(v.PaidAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewInvoiceStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewInvoiceStatusTransitions) UnmarshalJSON(data []byte) error { - type quotePreviewInvoiceStatusTransitions QuotePreviewInvoiceStatusTransitions - v := struct { - FinalizedAt int64 `json:"finalized_at"` - MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` - PaidAt int64 `json:"paid_at"` - VoidedAt int64 `json:"voided_at"` - *quotePreviewInvoiceStatusTransitions - }{ - quotePreviewInvoiceStatusTransitions: (*quotePreviewInvoiceStatusTransitions)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.FinalizedAt = time.Unix(v.FinalizedAt, 0) - q.MarkedUncollectibleAt = time.Unix(v.MarkedUncollectibleAt, 0) - q.PaidAt = time.Unix(v.PaidAt, 0) - q.VoidedAt = time.Unix(v.VoidedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewInvoiceSubscriptionDetailsPauseCollection. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewInvoiceSubscriptionDetailsPauseCollection) UnmarshalJSON(data []byte) error { - type quotePreviewInvoiceSubscriptionDetailsPauseCollection QuotePreviewInvoiceSubscriptionDetailsPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - *quotePreviewInvoiceSubscriptionDetailsPauseCollection - }{ - quotePreviewInvoiceSubscriptionDetailsPauseCollection: (*quotePreviewInvoiceSubscriptionDetailsPauseCollection)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.ResumesAt = time.Unix(v.ResumesAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewInvoice. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewInvoice) UnmarshalJSON(data []byte) error { - type quotePreviewInvoice QuotePreviewInvoice - v := struct { - AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` - Created int64 `json:"created"` - DueDate int64 `json:"due_date"` - EffectiveAt int64 `json:"effective_at"` - NextPaymentAttempt int64 `json:"next_payment_attempt"` - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - SubscriptionProrationDate int64 `json:"subscription_proration_date"` - WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` - *quotePreviewInvoice - }{ - quotePreviewInvoice: (*quotePreviewInvoice)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.AutomaticallyFinalizesAt = time.Unix(v.AutomaticallyFinalizesAt, 0) - q.Created = time.Unix(v.Created, 0) - q.DueDate = time.Unix(v.DueDate, 0) - q.EffectiveAt = time.Unix(v.EffectiveAt, 0) - q.NextPaymentAttempt = time.Unix(v.NextPaymentAttempt, 0) - q.PeriodEnd = time.Unix(v.PeriodEnd, 0) - q.PeriodStart = time.Unix(v.PeriodStart, 0) - q.SubscriptionProrationDate = time.Unix(v.SubscriptionProrationDate, 0) - q.WebhooksDeliveredAt = time.Unix(v.WebhooksDeliveredAt, 0) - return nil -} - -// MarshalJSON handles serialization of a QuotePreviewInvoiceAmountsDue. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewInvoiceAmountsDue) MarshalJSON() ([]byte, error) { - type quotePreviewInvoiceAmountsDue QuotePreviewInvoiceAmountsDue - v := struct { - DueDate int64 `json:"due_date"` - PaidAt int64 `json:"paid_at"` - quotePreviewInvoiceAmountsDue - }{ - quotePreviewInvoiceAmountsDue: (quotePreviewInvoiceAmountsDue)(q), - DueDate: q.DueDate.Unix(), - PaidAt: q.PaidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewInvoiceStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewInvoiceStatusTransitions) MarshalJSON() ([]byte, error) { - type quotePreviewInvoiceStatusTransitions QuotePreviewInvoiceStatusTransitions - v := struct { - FinalizedAt int64 `json:"finalized_at"` - MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"` - PaidAt int64 `json:"paid_at"` - VoidedAt int64 `json:"voided_at"` - quotePreviewInvoiceStatusTransitions - }{ - quotePreviewInvoiceStatusTransitions: (quotePreviewInvoiceStatusTransitions)(q), - FinalizedAt: q.FinalizedAt.Unix(), - MarkedUncollectibleAt: q.MarkedUncollectibleAt.Unix(), - PaidAt: q.PaidAt.Unix(), - VoidedAt: q.VoidedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewInvoiceSubscriptionDetailsPauseCollection. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewInvoiceSubscriptionDetailsPauseCollection) MarshalJSON() ([]byte, error) { - type quotePreviewInvoiceSubscriptionDetailsPauseCollection QuotePreviewInvoiceSubscriptionDetailsPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - quotePreviewInvoiceSubscriptionDetailsPauseCollection - }{ - quotePreviewInvoiceSubscriptionDetailsPauseCollection: (quotePreviewInvoiceSubscriptionDetailsPauseCollection)(q), - ResumesAt: q.ResumesAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewInvoice. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewInvoice) MarshalJSON() ([]byte, error) { - type quotePreviewInvoice QuotePreviewInvoice - v := struct { - AutomaticallyFinalizesAt int64 `json:"automatically_finalizes_at"` - Created int64 `json:"created"` - DueDate int64 `json:"due_date"` - EffectiveAt int64 `json:"effective_at"` - NextPaymentAttempt int64 `json:"next_payment_attempt"` - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - SubscriptionProrationDate int64 `json:"subscription_proration_date"` - WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"` - quotePreviewInvoice - }{ - quotePreviewInvoice: (quotePreviewInvoice)(q), - AutomaticallyFinalizesAt: q.AutomaticallyFinalizesAt.Unix(), - Created: q.Created.Unix(), - DueDate: q.DueDate.Unix(), - EffectiveAt: q.EffectiveAt.Unix(), - NextPaymentAttempt: q.NextPaymentAttempt.Unix(), - PeriodEnd: q.PeriodEnd.Unix(), - PeriodStart: q.PeriodStart.Unix(), - SubscriptionProrationDate: q.SubscriptionProrationDate.Unix(), - WebhooksDeliveredAt: q.WebhooksDeliveredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/quotepreviewsubscriptionschedule.go b/quotepreviewsubscriptionschedule.go index 8966a5c6a0..2101205cf4 100644 --- a/quotepreviewsubscriptionschedule.go +++ b/quotepreviewsubscriptionschedule.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Describes whether the quote line is affecting a new schedule or an existing schedule. type QuotePreviewSubscriptionScheduleAppliesToType string @@ -253,9 +248,9 @@ type QuotePreviewSubscriptionScheduleAppliesTo struct { // Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. type QuotePreviewSubscriptionScheduleCurrentPhase struct { // The end of this phase of the subscription schedule. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // The start of this phase of the subscription schedule. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` } // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account. @@ -334,7 +329,7 @@ type QuotePreviewSubscriptionScheduleLastPriceMigrationErrorFailedTransition str // Details of the most recent price migration that failed for the subscription schedule. type QuotePreviewSubscriptionScheduleLastPriceMigrationError struct { // The time at which the price migration encountered an error. - ErroredAt time.Time `json:"errored_at"` + ErroredAt int64 `json:"errored_at"` // The involved price pairs in each failed transition. FailedTransitions []*QuotePreviewSubscriptionScheduleLastPriceMigrationErrorFailedTransition `json:"failed_transitions"` // The type of error encountered by the price migration. @@ -344,7 +339,7 @@ type QuotePreviewSubscriptionScheduleLastPriceMigrationError struct { // Details to determine how long the discount should be applied for. type QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEndType `json:"type"` } @@ -400,7 +395,7 @@ type QuotePreviewSubscriptionSchedulePhaseBillingThresholds struct { // Details to determine how long the discount should be applied for. type QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEndType `json:"type"` } @@ -444,7 +439,7 @@ type QuotePreviewSubscriptionSchedulePhaseItemBillingThresholds struct { // Details to determine how long the discount should be applied for. type QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEndType `json:"type"` } @@ -541,7 +536,7 @@ type QuotePreviewSubscriptionSchedulePhase struct { // The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts. Discounts []*QuotePreviewSubscriptionSchedulePhaseDiscount `json:"discounts"` // The end of this phase of the subscription schedule. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // The invoice settings applicable during this phase. InvoiceSettings *QuotePreviewSubscriptionSchedulePhaseInvoiceSettings `json:"invoice_settings"` // Subscription items to configure the subscription to during this phase of the subscription schedule. @@ -555,13 +550,13 @@ type QuotePreviewSubscriptionSchedulePhase struct { // If the subscription schedule will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. ProrationBehavior QuotePreviewSubscriptionSchedulePhaseProrationBehavior `json:"proration_behavior"` // The start of this phase of the subscription schedule. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` // The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. TransferData *QuotePreviewSubscriptionSchedulePhaseTransferData `json:"transfer_data"` // Specify behavior of the trial when crossing schedule phase boundaries TrialContinuation QuotePreviewSubscriptionSchedulePhaseTrialContinuation `json:"trial_continuation"` // When the trial ends within the phase. - TrialEnd time.Time `json:"trial_end"` + TrialEnd int64 `json:"trial_end"` // Settings related to any trials on the subscription during this phase. TrialSettings *QuotePreviewSubscriptionSchedulePhaseTrialSettings `json:"trial_settings"` } @@ -571,9 +566,9 @@ type QuotePreviewSubscriptionSchedulePrebilling struct { // ID of the prebilling invoice. Invoice *Invoice `json:"invoice"` // The end of the last period for which the invoice pre-bills. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // The start of the first period for which the invoice pre-bills. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. UpdateBehavior QuotePreviewSubscriptionSchedulePrebillingUpdateBehavior `json:"update_behavior"` } @@ -584,11 +579,11 @@ type QuotePreviewSubscriptionSchedule struct { // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front. BillingBehavior QuotePreviewSubscriptionScheduleBillingBehavior `json:"billing_behavior"` // Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. - CompletedAt time.Time `json:"completed_at"` + CompletedAt int64 `json:"completed_at"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. CurrentPhase *QuotePreviewSubscriptionScheduleCurrentPhase `json:"current_phase"` // ID of the customer who owns the subscription schedule. @@ -611,7 +606,7 @@ type QuotePreviewSubscriptionSchedule struct { // Time period and invoice for a Subscription billed in advance. Prebilling *QuotePreviewSubscriptionSchedulePrebilling `json:"prebilling"` // Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. - ReleasedAt time.Time `json:"released_at"` + ReleasedAt int64 `json:"released_at"` // ID of the subscription once managed by the subscription schedule (if it is released). ReleasedSubscription string `json:"released_subscription"` // The present status of the subscription schedule. Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules). @@ -628,319 +623,3 @@ type QuotePreviewSubscriptionScheduleList struct { ListMeta Data []*QuotePreviewSubscriptionSchedule `json:"data"` } - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionScheduleCurrentPhase. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionScheduleCurrentPhase) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionScheduleCurrentPhase QuotePreviewSubscriptionScheduleCurrentPhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - *quotePreviewSubscriptionScheduleCurrentPhase - }{ - quotePreviewSubscriptionScheduleCurrentPhase: (*quotePreviewSubscriptionScheduleCurrentPhase)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.EndDate = time.Unix(v.EndDate, 0) - q.StartDate = time.Unix(v.StartDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionScheduleLastPriceMigrationError. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionScheduleLastPriceMigrationError) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionScheduleLastPriceMigrationError QuotePreviewSubscriptionScheduleLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - *quotePreviewSubscriptionScheduleLastPriceMigrationError - }{ - quotePreviewSubscriptionScheduleLastPriceMigrationError: (*quotePreviewSubscriptionScheduleLastPriceMigrationError)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.ErroredAt = time.Unix(v.ErroredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd: (*quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd: (*quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd: (*quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedulePhase. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedulePhase) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedulePhase QuotePreviewSubscriptionSchedulePhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - *quotePreviewSubscriptionSchedulePhase - }{ - quotePreviewSubscriptionSchedulePhase: (*quotePreviewSubscriptionSchedulePhase)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.EndDate = time.Unix(v.EndDate, 0) - q.StartDate = time.Unix(v.StartDate, 0) - q.TrialEnd = time.Unix(v.TrialEnd, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedulePrebilling. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedulePrebilling) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedulePrebilling QuotePreviewSubscriptionSchedulePrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - *quotePreviewSubscriptionSchedulePrebilling - }{ - quotePreviewSubscriptionSchedulePrebilling: (*quotePreviewSubscriptionSchedulePrebilling)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.PeriodEnd = time.Unix(v.PeriodEnd, 0) - q.PeriodStart = time.Unix(v.PeriodStart, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a QuotePreviewSubscriptionSchedule. -// This custom unmarshaling is needed to handle the time fields correctly. -func (q *QuotePreviewSubscriptionSchedule) UnmarshalJSON(data []byte) error { - type quotePreviewSubscriptionSchedule QuotePreviewSubscriptionSchedule - v := struct { - CanceledAt int64 `json:"canceled_at"` - CompletedAt int64 `json:"completed_at"` - Created int64 `json:"created"` - ReleasedAt int64 `json:"released_at"` - *quotePreviewSubscriptionSchedule - }{ - quotePreviewSubscriptionSchedule: (*quotePreviewSubscriptionSchedule)(q), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - q.CanceledAt = time.Unix(v.CanceledAt, 0) - q.CompletedAt = time.Unix(v.CompletedAt, 0) - q.Created = time.Unix(v.Created, 0) - q.ReleasedAt = time.Unix(v.ReleasedAt, 0) - return nil -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionScheduleCurrentPhase. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionScheduleCurrentPhase) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionScheduleCurrentPhase QuotePreviewSubscriptionScheduleCurrentPhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - quotePreviewSubscriptionScheduleCurrentPhase - }{ - quotePreviewSubscriptionScheduleCurrentPhase: (quotePreviewSubscriptionScheduleCurrentPhase)(q), - EndDate: q.EndDate.Unix(), - StartDate: q.StartDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionScheduleLastPriceMigrationError. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionScheduleLastPriceMigrationError) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionScheduleLastPriceMigrationError QuotePreviewSubscriptionScheduleLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - quotePreviewSubscriptionScheduleLastPriceMigrationError - }{ - quotePreviewSubscriptionScheduleLastPriceMigrationError: (quotePreviewSubscriptionScheduleLastPriceMigrationError)(q), - ErroredAt: q.ErroredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd: (quotePreviewSubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd: (quotePreviewSubscriptionSchedulePhaseDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd QuotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd - }{ - quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd: (quotePreviewSubscriptionSchedulePhaseItemDiscountDiscountEnd)(q), - Timestamp: q.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedulePhase. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedulePhase) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedulePhase QuotePreviewSubscriptionSchedulePhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - quotePreviewSubscriptionSchedulePhase - }{ - quotePreviewSubscriptionSchedulePhase: (quotePreviewSubscriptionSchedulePhase)(q), - EndDate: q.EndDate.Unix(), - StartDate: q.StartDate.Unix(), - TrialEnd: q.TrialEnd.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedulePrebilling. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedulePrebilling) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedulePrebilling QuotePreviewSubscriptionSchedulePrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - quotePreviewSubscriptionSchedulePrebilling - }{ - quotePreviewSubscriptionSchedulePrebilling: (quotePreviewSubscriptionSchedulePrebilling)(q), - PeriodEnd: q.PeriodEnd.Unix(), - PeriodStart: q.PeriodStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a QuotePreviewSubscriptionSchedule. -// This custom marshaling is needed to handle the time fields correctly. -func (q QuotePreviewSubscriptionSchedule) MarshalJSON() ([]byte, error) { - type quotePreviewSubscriptionSchedule QuotePreviewSubscriptionSchedule - v := struct { - CanceledAt int64 `json:"canceled_at"` - CompletedAt int64 `json:"completed_at"` - Created int64 `json:"created"` - ReleasedAt int64 `json:"released_at"` - quotePreviewSubscriptionSchedule - }{ - quotePreviewSubscriptionSchedule: (quotePreviewSubscriptionSchedule)(q), - CanceledAt: q.CanceledAt.Unix(), - CompletedAt: q.CompletedAt.Unix(), - Created: q.Created.Unix(), - ReleasedAt: q.ReleasedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/radar_earlyfraudwarning.go b/radar_earlyfraudwarning.go index ff8b227723..dffebc1c11 100644 --- a/radar_earlyfraudwarning.go +++ b/radar_earlyfraudwarning.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of fraud labelled by the issuer. One of `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`. type RadarEarlyFraudWarningFraudType string @@ -70,7 +65,7 @@ type RadarEarlyFraudWarning struct { // ID of the charge this early fraud warning is for, optionally expanded. Charge *Charge `json:"charge"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The type of fraud labelled by the issuer. One of `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`. FraudType RadarEarlyFraudWarningFraudType `json:"fraud_type"` // Unique identifier for the object. @@ -89,39 +84,3 @@ type RadarEarlyFraudWarningList struct { ListMeta Data []*RadarEarlyFraudWarning `json:"data"` } - -// UnmarshalJSON handles deserialization of a RadarEarlyFraudWarning. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *RadarEarlyFraudWarning) UnmarshalJSON(data []byte) error { - type radarEarlyFraudWarning RadarEarlyFraudWarning - v := struct { - Created int64 `json:"created"` - *radarEarlyFraudWarning - }{ - radarEarlyFraudWarning: (*radarEarlyFraudWarning)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a RadarEarlyFraudWarning. -// This custom marshaling is needed to handle the time fields correctly. -func (r RadarEarlyFraudWarning) MarshalJSON() ([]byte, error) { - type radarEarlyFraudWarning RadarEarlyFraudWarning - v := struct { - Created int64 `json:"created"` - radarEarlyFraudWarning - }{ - radarEarlyFraudWarning: (radarEarlyFraudWarning)(r), - Created: r.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/radar_valuelist.go b/radar_valuelist.go index a4bf03c249..e3f232237d 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of items in the value list. One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. type RadarValueListItemType string @@ -85,7 +80,7 @@ type RadarValueList struct { // The name of the value list for use in rules. Alias string `json:"alias"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The name or email address of the user who created this value list. CreatedBy string `json:"created_by"` Deleted bool `json:"deleted"` @@ -111,39 +106,3 @@ type RadarValueListList struct { ListMeta Data []*RadarValueList `json:"data"` } - -// UnmarshalJSON handles deserialization of a RadarValueList. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *RadarValueList) UnmarshalJSON(data []byte) error { - type radarValueList RadarValueList - v := struct { - Created int64 `json:"created"` - *radarValueList - }{ - radarValueList: (*radarValueList)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a RadarValueList. -// This custom marshaling is needed to handle the time fields correctly. -func (r RadarValueList) MarshalJSON() ([]byte, error) { - type radarValueList RadarValueList - v := struct { - Created int64 `json:"created"` - radarValueList - }{ - radarValueList: (radarValueList)(r), - Created: r.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index b57de2dde4..9a4a09d1c4 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Deletes a ValueListItem object, removing it from its parent value list. type RadarValueListItemParams struct { Params `form:"*"` @@ -53,7 +48,7 @@ func (p *RadarValueListItemListParams) AddExpand(f string) { type RadarValueListItem struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The name or email address of the user who added this item to the value list. CreatedBy string `json:"created_by"` Deleted bool `json:"deleted"` @@ -75,39 +70,3 @@ type RadarValueListItemList struct { ListMeta Data []*RadarValueListItem `json:"data"` } - -// UnmarshalJSON handles deserialization of a RadarValueListItem. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *RadarValueListItem) UnmarshalJSON(data []byte) error { - type radarValueListItem RadarValueListItem - v := struct { - Created int64 `json:"created"` - *radarValueListItem - }{ - radarValueListItem: (*radarValueListItem)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a RadarValueListItem. -// This custom marshaling is needed to handle the time fields correctly. -func (r RadarValueListItem) MarshalJSON() ([]byte, error) { - type radarValueListItem RadarValueListItem - v := struct { - Created int64 `json:"created"` - radarValueListItem - }{ - radarValueListItem: (radarValueListItem)(r), - Created: r.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/refund.go b/refund.go index ef309ca58a..d00346ad1a 100644 --- a/refund.go +++ b/refund.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The type of refund. This can be `refund`, `reversal`, or `pending`. type RefundDestinationDetailsCardType string @@ -285,14 +282,14 @@ type RefundDestinationDetails struct { } type RefundNextActionDisplayDetailsEmailSent struct { // The timestamp when the email was sent. - EmailSentAt time.Time `json:"email_sent_at"` + EmailSentAt int64 `json:"email_sent_at"` // The recipient's email address. EmailSentTo string `json:"email_sent_to"` } type RefundNextActionDisplayDetails struct { EmailSent *RefundNextActionDisplayDetailsEmailSent `json:"email_sent"` // The expiry timestamp. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` } type RefundNextAction struct { DisplayDetails *RefundNextActionDisplayDetails `json:"display_details"` @@ -314,7 +311,7 @@ type Refund struct { // ID of the charge that's refunded. Charge *Charge `json:"charge"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. You can use this for displaying to users (available on non-card refunds only). @@ -364,106 +361,11 @@ func (r *Refund) UnmarshalJSON(data []byte) error { } type refund Refund - v := struct { - Created int64 `json:"created"` - *refund - }{ - refund: (*refund)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a RefundNextActionDisplayDetailsEmailSent. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *RefundNextActionDisplayDetailsEmailSent) UnmarshalJSON(data []byte) error { - type refundNextActionDisplayDetailsEmailSent RefundNextActionDisplayDetailsEmailSent - v := struct { - EmailSentAt int64 `json:"email_sent_at"` - *refundNextActionDisplayDetailsEmailSent - }{ - refundNextActionDisplayDetailsEmailSent: (*refundNextActionDisplayDetailsEmailSent)(r), - } + var v refund if err := json.Unmarshal(data, &v); err != nil { return err } - r.EmailSentAt = time.Unix(v.EmailSentAt, 0) + *r = Refund(v) return nil } - -// UnmarshalJSON handles deserialization of a RefundNextActionDisplayDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *RefundNextActionDisplayDetails) UnmarshalJSON(data []byte) error { - type refundNextActionDisplayDetails RefundNextActionDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - *refundNextActionDisplayDetails - }{ - refundNextActionDisplayDetails: (*refundNextActionDisplayDetails)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a RefundNextActionDisplayDetailsEmailSent. -// This custom marshaling is needed to handle the time fields correctly. -func (r RefundNextActionDisplayDetailsEmailSent) MarshalJSON() ([]byte, error) { - type refundNextActionDisplayDetailsEmailSent RefundNextActionDisplayDetailsEmailSent - v := struct { - EmailSentAt int64 `json:"email_sent_at"` - refundNextActionDisplayDetailsEmailSent - }{ - refundNextActionDisplayDetailsEmailSent: (refundNextActionDisplayDetailsEmailSent)(r), - EmailSentAt: r.EmailSentAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a RefundNextActionDisplayDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (r RefundNextActionDisplayDetails) MarshalJSON() ([]byte, error) { - type refundNextActionDisplayDetails RefundNextActionDisplayDetails - v := struct { - ExpiresAt int64 `json:"expires_at"` - refundNextActionDisplayDetails - }{ - refundNextActionDisplayDetails: (refundNextActionDisplayDetails)(r), - ExpiresAt: r.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Refund. -// This custom marshaling is needed to handle the time fields correctly. -func (r Refund) MarshalJSON() ([]byte, error) { - type refund Refund - v := struct { - Created int64 `json:"created"` - refund - }{ - refund: (refund)(r), - Created: r.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 60c64d0201..7df5ad998f 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Status of this report run. This will be `pending` when the run is initially created. // // When the run finishes, this will be set to `succeeded` and the `result` field will be populated. @@ -49,9 +44,9 @@ type ReportingReportRunParametersParams struct { // Currency of objects to be included in the report run. Currency *string `form:"currency"` // Ending timestamp of data to be included in the report run (exclusive). - IntervalEnd *time.Time `form:"interval_end"` + IntervalEnd *int64 `form:"interval_end"` // Starting timestamp of data to be included in the report run. - IntervalStart *time.Time `form:"interval_start"` + IntervalStart *int64 `form:"interval_start"` // Payout ID by which to filter the report run. Payout *string `form:"payout"` // Category of balance transactions to be included in the report run. @@ -84,9 +79,9 @@ type ReportingReportRunParameters struct { // Currency of objects to be included in the report run. Currency Currency `json:"currency"` // Ending timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after the user specified `interval_start` and 1 second before this report's last `data_available_end` value. - IntervalEnd time.Time `json:"interval_end"` + IntervalEnd int64 `json:"interval_end"` // Starting timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after this report's `data_available_start` and 1 second before the user specified `interval_end` value. - IntervalStart time.Time `json:"interval_start"` + IntervalStart int64 `json:"interval_start"` // Payout ID by which to filter the report run. Payout string `json:"payout"` // Category of balance transactions to be included in the report run. @@ -106,7 +101,7 @@ type ReportingReportRunParameters struct { type ReportingReportRun struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // If something should go wrong during the run, a message about the failure (populated when // `status=failed`). Error string `json:"error"` @@ -128,7 +123,7 @@ type ReportingReportRun struct { Status ReportingReportRunStatus `json:"status"` // Timestamp at which this run successfully finished (populated when // `status=succeeded`). Measured in seconds since the Unix epoch. - SucceededAt time.Time `json:"succeeded_at"` + SucceededAt int64 `json:"succeeded_at"` } // ReportingReportRunList is a list of ReportRuns as retrieved from a list endpoint. @@ -137,83 +132,3 @@ type ReportingReportRunList struct { ListMeta Data []*ReportingReportRun `json:"data"` } - -// UnmarshalJSON handles deserialization of a ReportingReportRunParameters. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *ReportingReportRunParameters) UnmarshalJSON(data []byte) error { - type reportingReportRunParameters ReportingReportRunParameters - v := struct { - IntervalEnd int64 `json:"interval_end"` - IntervalStart int64 `json:"interval_start"` - *reportingReportRunParameters - }{ - reportingReportRunParameters: (*reportingReportRunParameters)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.IntervalEnd = time.Unix(v.IntervalEnd, 0) - r.IntervalStart = time.Unix(v.IntervalStart, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a ReportingReportRun. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *ReportingReportRun) UnmarshalJSON(data []byte) error { - type reportingReportRun ReportingReportRun - v := struct { - Created int64 `json:"created"` - SucceededAt int64 `json:"succeeded_at"` - *reportingReportRun - }{ - reportingReportRun: (*reportingReportRun)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.Created = time.Unix(v.Created, 0) - r.SucceededAt = time.Unix(v.SucceededAt, 0) - return nil -} - -// MarshalJSON handles serialization of a ReportingReportRunParameters. -// This custom marshaling is needed to handle the time fields correctly. -func (r ReportingReportRunParameters) MarshalJSON() ([]byte, error) { - type reportingReportRunParameters ReportingReportRunParameters - v := struct { - IntervalEnd int64 `json:"interval_end"` - IntervalStart int64 `json:"interval_start"` - reportingReportRunParameters - }{ - reportingReportRunParameters: (reportingReportRunParameters)(r), - IntervalEnd: r.IntervalEnd.Unix(), - IntervalStart: r.IntervalStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a ReportingReportRun. -// This custom marshaling is needed to handle the time fields correctly. -func (r ReportingReportRun) MarshalJSON() ([]byte, error) { - type reportingReportRun ReportingReportRun - v := struct { - Created int64 `json:"created"` - SucceededAt int64 `json:"succeeded_at"` - reportingReportRun - }{ - reportingReportRun: (reportingReportRun)(r), - Created: r.Created.Unix(), - SucceededAt: r.SucceededAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/reporting_reporttype.go b/reporting_reporttype.go index 4de8dd963c..7073e50a70 100644 --- a/reporting_reporttype.go +++ b/reporting_reporttype.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Returns a full list of Report Types. type ReportingReportTypeListParams struct { ListParams `form:"*"` @@ -46,9 +41,9 @@ func (p *ReportingReportTypeParams) AddExpand(f string) { type ReportingReportType struct { APIResource // Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch. - DataAvailableEnd time.Time `json:"data_available_end"` + DataAvailableEnd int64 `json:"data_available_end"` // Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch. - DataAvailableStart time.Time `json:"data_available_start"` + DataAvailableStart int64 `json:"data_available_start"` // List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the `columns` parameter, this will be null.) DefaultColumns []string `json:"default_columns"` // The [ID of the Report Type](https://stripe.com/docs/reporting/statements/api#available-report-types), such as `balance.summary.1`. @@ -60,7 +55,7 @@ type ReportingReportType struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // When this Report Type was latest updated. Measured in seconds since the Unix epoch. - Updated time.Time `json:"updated"` + Updated int64 `json:"updated"` // Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas. Version int64 `json:"version"` } @@ -71,47 +66,3 @@ type ReportingReportTypeList struct { ListMeta Data []*ReportingReportType `json:"data"` } - -// UnmarshalJSON handles deserialization of a ReportingReportType. -// This custom unmarshaling is needed to handle the time fields correctly. -func (r *ReportingReportType) UnmarshalJSON(data []byte) error { - type reportingReportType ReportingReportType - v := struct { - DataAvailableEnd int64 `json:"data_available_end"` - DataAvailableStart int64 `json:"data_available_start"` - Updated int64 `json:"updated"` - *reportingReportType - }{ - reportingReportType: (*reportingReportType)(r), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - r.DataAvailableEnd = time.Unix(v.DataAvailableEnd, 0) - r.DataAvailableStart = time.Unix(v.DataAvailableStart, 0) - r.Updated = time.Unix(v.Updated, 0) - return nil -} - -// MarshalJSON handles serialization of a ReportingReportType. -// This custom marshaling is needed to handle the time fields correctly. -func (r ReportingReportType) MarshalJSON() ([]byte, error) { - type reportingReportType ReportingReportType - v := struct { - DataAvailableEnd int64 `json:"data_available_end"` - DataAvailableStart int64 `json:"data_available_start"` - Updated int64 `json:"updated"` - reportingReportType - }{ - reportingReportType: (reportingReportType)(r), - DataAvailableEnd: r.DataAvailableEnd.Unix(), - DataAvailableStart: r.DataAvailableStart.Unix(), - Updated: r.Updated.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/review.go b/review.go index 2d55511dce..0bfa222645 100644 --- a/review.go +++ b/review.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The reason the review was closed, or null if it has not yet been closed. One of `approved`, `refunded`, `refunded_as_fraud`, `disputed`, or `redacted`. type ReviewClosedReason string @@ -125,7 +122,7 @@ type Review struct { // The reason the review was closed, or null if it has not yet been closed. One of `approved`, `refunded`, `refunded_as_fraud`, `disputed`, or `redacted`. ClosedReason ReviewClosedReason `json:"closed_reason"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // The IP address where the payment originated. @@ -165,34 +162,11 @@ func (r *Review) UnmarshalJSON(data []byte) error { } type review Review - v := struct { - Created int64 `json:"created"` - *review - }{ - review: (*review)(r), - } + var v review if err := json.Unmarshal(data, &v); err != nil { return err } - r.Created = time.Unix(v.Created, 0) + *r = Review(v) return nil } - -// MarshalJSON handles serialization of a Review. -// This custom marshaling is needed to handle the time fields correctly. -func (r Review) MarshalJSON() ([]byte, error) { - type review Review - v := struct { - Created int64 `json:"created"` - review - }{ - review: (review)(r), - Created: r.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/setupattempt.go b/setupattempt.go index 7e83dfeecc..2e77bb42fd 100644 --- a/setupattempt.go +++ b/setupattempt.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Indicates the directions of money movement for which this payment method is intended to be used. // @@ -257,7 +254,7 @@ type SetupAttemptPaymentMethodDetailsCard struct { // Details about payments collected offline. type SetupAttemptPaymentMethodDetailsCardPresentOffline struct { // Time at which the payment was collected while offline - StoredAt time.Time `json:"stored_at"` + StoredAt int64 `json:"stored_at"` // The method used to process this payment method offline. Only deferred is allowed. Type SetupAttemptPaymentMethodDetailsCardPresentOfflineType `json:"type"` } @@ -361,7 +358,7 @@ type SetupAttempt struct { // It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer. AttachToSelf bool `json:"attach_to_self"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The value of [customer](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer) on the SetupIntent at the time of this confirmation. Customer *Customer `json:"customer"` // Indicates the directions of money movement for which this payment method is intended to be used. @@ -406,70 +403,11 @@ func (s *SetupAttempt) UnmarshalJSON(data []byte) error { } type setupAttempt SetupAttempt - v := struct { - Created int64 `json:"created"` - *setupAttempt - }{ - setupAttempt: (*setupAttempt)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SetupAttemptPaymentMethodDetailsCardPresentOffline. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SetupAttemptPaymentMethodDetailsCardPresentOffline) UnmarshalJSON(data []byte) error { - type setupAttemptPaymentMethodDetailsCardPresentOffline SetupAttemptPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - *setupAttemptPaymentMethodDetailsCardPresentOffline - }{ - setupAttemptPaymentMethodDetailsCardPresentOffline: (*setupAttemptPaymentMethodDetailsCardPresentOffline)(s), - } + var v setupAttempt if err := json.Unmarshal(data, &v); err != nil { return err } - s.StoredAt = time.Unix(v.StoredAt, 0) + *s = SetupAttempt(v) return nil } - -// MarshalJSON handles serialization of a SetupAttemptPaymentMethodDetailsCardPresentOffline. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupAttemptPaymentMethodDetailsCardPresentOffline) MarshalJSON() ([]byte, error) { - type setupAttemptPaymentMethodDetailsCardPresentOffline SetupAttemptPaymentMethodDetailsCardPresentOffline - v := struct { - StoredAt int64 `json:"stored_at"` - setupAttemptPaymentMethodDetailsCardPresentOffline - }{ - setupAttemptPaymentMethodDetailsCardPresentOffline: (setupAttemptPaymentMethodDetailsCardPresentOffline)(s), - StoredAt: s.StoredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SetupAttempt. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupAttempt) MarshalJSON() ([]byte, error) { - type setupAttempt SetupAttempt - v := struct { - Created int64 `json:"created"` - setupAttempt - }{ - setupAttempt: (setupAttempt)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/setupintent.go b/setupintent.go index 7fb63e3419..bcf53f8184 100644 --- a/setupintent.go +++ b/setupintent.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Controls whether this SetupIntent will accept redirect-based payment methods. // @@ -342,7 +339,7 @@ type SetupIntentMandateDataCustomerAcceptanceOnlineParams struct { // This hash contains details about the customer acceptance of the Mandate. type SetupIntentMandateDataCustomerAcceptanceParams struct { // The time at which the customer accepted the Mandate. - AcceptedAt *time.Time `form:"accepted_at"` + AcceptedAt *int64 `form:"accepted_at"` // If this is a Mandate accepted offline, this hash contains details about the offline acceptance. Offline *SetupIntentMandateDataCustomerAcceptanceOfflineParams `form:"offline"` // If this is a Mandate accepted online, this hash contains details about the online acceptance. @@ -796,7 +793,7 @@ type SetupIntentPaymentMethodOptionsCardMandateOptionsParams struct { // A description of the mandate or subscription that is meant to be displayed to the customer. Description *string `form:"description"` // End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. - EndDate *time.Time `form:"end_date"` + EndDate *int64 `form:"end_date"` // Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. Interval *string `form:"interval"` // The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. @@ -804,7 +801,7 @@ type SetupIntentPaymentMethodOptionsCardMandateOptionsParams struct { // Unique identifier for the mandate or subscription. Reference *string `form:"reference"` // Start date of the mandate or subscription. Start date should not be lesser than yesterday. - StartDate *time.Time `form:"start_date"` + StartDate *int64 `form:"start_date"` // Specifies the type of mandates supported. Possible values are `india`. SupportedTypes []*string `form:"supported_types"` } @@ -1562,7 +1559,7 @@ type SetupIntentAutomaticPaymentMethods struct { } type SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode struct { // The date (unix timestamp) when the QR code expires. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The image_url_png string used to render QR code ImageURLPNG string `json:"image_url_png"` // The image_url_svg string used to render QR code @@ -1586,7 +1583,7 @@ type SetupIntentNextActionRedirectToURL struct { type SetupIntentNextActionUseStripeSDK struct{} type SetupIntentNextActionVerifyWithMicrodeposits struct { // The timestamp when the microdeposits are expected to land. - ArrivalDate time.Time `json:"arrival_date"` + ArrivalDate int64 `json:"arrival_date"` // The URL for the hosted verification page, which allows customers to verify their bank account. HostedVerificationURL string `json:"hosted_verification_url"` // The type of the microdeposit sent to the customer. Used to distinguish between different verification methods. @@ -1650,7 +1647,7 @@ type SetupIntentPaymentMethodOptionsCardMandateOptions struct { // A description of the mandate or subscription that is meant to be displayed to the customer. Description string `json:"description"` // End date of the mandate or subscription. If not provided, the mandate will be active until canceled. If provided, end date should be after start date. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`. Interval SetupIntentPaymentMethodOptionsCardMandateOptionsInterval `json:"interval"` // The number of intervals between payments. For example, `interval=month` and `interval_count=3` indicates one payment every three months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). This parameter is optional when `interval=sporadic`. @@ -1658,7 +1655,7 @@ type SetupIntentPaymentMethodOptionsCardMandateOptions struct { // Unique identifier for the mandate or subscription. Reference string `json:"reference"` // Start date of the mandate or subscription. Start date should not be lesser than yesterday. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` // Specifies the type of mandates supported. Possible values are `india`. SupportedTypes []SetupIntentPaymentMethodOptionsCardMandateOptionsSupportedType `json:"supported_types"` } @@ -1793,7 +1790,7 @@ type SetupIntent struct { // The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret. ClientSecret string `json:"client_secret"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // ID of the Customer this SetupIntent belongs to, if one exists. // // If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent. @@ -1857,146 +1854,11 @@ func (s *SetupIntent) UnmarshalJSON(data []byte) error { } type setupIntent SetupIntent - v := struct { - Created int64 `json:"created"` - *setupIntent - }{ - setupIntent: (*setupIntent)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode) UnmarshalJSON(data []byte) error { - type setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - *setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - }{ - setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode: (*setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode)(s), - } + var v setupIntent if err := json.Unmarshal(data, &v); err != nil { return err } - s.ExpiresAt = time.Unix(v.ExpiresAt, 0) + *s = SetupIntent(v) return nil } - -// UnmarshalJSON handles deserialization of a SetupIntentNextActionVerifyWithMicrodeposits. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SetupIntentNextActionVerifyWithMicrodeposits) UnmarshalJSON(data []byte) error { - type setupIntentNextActionVerifyWithMicrodeposits SetupIntentNextActionVerifyWithMicrodeposits - v := struct { - ArrivalDate int64 `json:"arrival_date"` - *setupIntentNextActionVerifyWithMicrodeposits - }{ - setupIntentNextActionVerifyWithMicrodeposits: (*setupIntentNextActionVerifyWithMicrodeposits)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.ArrivalDate = time.Unix(v.ArrivalDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SetupIntentPaymentMethodOptionsCardMandateOptions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SetupIntentPaymentMethodOptionsCardMandateOptions) UnmarshalJSON(data []byte) error { - type setupIntentPaymentMethodOptionsCardMandateOptions SetupIntentPaymentMethodOptionsCardMandateOptions - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - *setupIntentPaymentMethodOptionsCardMandateOptions - }{ - setupIntentPaymentMethodOptionsCardMandateOptions: (*setupIntentPaymentMethodOptionsCardMandateOptions)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.EndDate = time.Unix(v.EndDate, 0) - s.StartDate = time.Unix(v.StartDate, 0) - return nil -} - -// MarshalJSON handles serialization of a SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode) MarshalJSON() ([]byte, error) { - type setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode SetupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - v := struct { - ExpiresAt int64 `json:"expires_at"` - setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode - }{ - setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode: (setupIntentNextActionCashAppHandleRedirectOrDisplayQRCodeQRCode)(s), - ExpiresAt: s.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SetupIntentNextActionVerifyWithMicrodeposits. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupIntentNextActionVerifyWithMicrodeposits) MarshalJSON() ([]byte, error) { - type setupIntentNextActionVerifyWithMicrodeposits SetupIntentNextActionVerifyWithMicrodeposits - v := struct { - ArrivalDate int64 `json:"arrival_date"` - setupIntentNextActionVerifyWithMicrodeposits - }{ - setupIntentNextActionVerifyWithMicrodeposits: (setupIntentNextActionVerifyWithMicrodeposits)(s), - ArrivalDate: s.ArrivalDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SetupIntentPaymentMethodOptionsCardMandateOptions. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupIntentPaymentMethodOptionsCardMandateOptions) MarshalJSON() ([]byte, error) { - type setupIntentPaymentMethodOptionsCardMandateOptions SetupIntentPaymentMethodOptionsCardMandateOptions - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - setupIntentPaymentMethodOptionsCardMandateOptions - }{ - setupIntentPaymentMethodOptionsCardMandateOptions: (setupIntentPaymentMethodOptionsCardMandateOptions)(s), - EndDate: s.EndDate.Unix(), - StartDate: s.StartDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SetupIntent. -// This custom marshaling is needed to handle the time fields correctly. -func (s SetupIntent) MarshalJSON() ([]byte, error) { - type setupIntent SetupIntent - v := struct { - Created int64 `json:"created"` - setupIntent - }{ - setupIntent: (setupIntent)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/shippingrate.go b/shippingrate.go index 49b642a4ad..0ae5ca22ed 100644 --- a/shippingrate.go +++ b/shippingrate.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // A unit of time. type ShippingRateDeliveryEstimateMaximumUnit string @@ -209,7 +206,7 @@ type ShippingRate struct { // Whether the shipping rate can be used for new purchases. Defaults to `true`. Active bool `json:"active"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. DeliveryEstimate *ShippingRateDeliveryEstimate `json:"delivery_estimate"` // The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. @@ -248,34 +245,11 @@ func (s *ShippingRate) UnmarshalJSON(data []byte) error { } type shippingRate ShippingRate - v := struct { - Created int64 `json:"created"` - *shippingRate - }{ - shippingRate: (*shippingRate)(s), - } + var v shippingRate if err := json.Unmarshal(data, &v); err != nil { return err } - s.Created = time.Unix(v.Created, 0) + *s = ShippingRate(v) return nil } - -// MarshalJSON handles serialization of a ShippingRate. -// This custom marshaling is needed to handle the time fields correctly. -func (s ShippingRate) MarshalJSON() ([]byte, error) { - type shippingRate ShippingRate - v := struct { - Created int64 `json:"created"` - shippingRate - }{ - shippingRate: (shippingRate)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/sigma_scheduledqueryrun.go b/sigma_scheduledqueryrun.go index f42bfc2c70..4fdd86d99b 100644 --- a/sigma_scheduledqueryrun.go +++ b/sigma_scheduledqueryrun.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The query's execution status, which will be `completed` for successful runs, and `canceled`, `failed`, or `timed_out` otherwise. type SigmaScheduledQueryRunStatus string @@ -58,9 +53,9 @@ type SigmaScheduledQueryRunError struct { type SigmaScheduledQueryRun struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // When the query was run, Sigma contained a snapshot of your Stripe data at this time. - DataLoadTime time.Time `json:"data_load_time"` + DataLoadTime int64 `json:"data_load_time"` Error *SigmaScheduledQueryRunError `json:"error"` // The file object representing the results of the query. File *File `json:"file"` @@ -71,7 +66,7 @@ type SigmaScheduledQueryRun struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Time at which the result expires and is no longer available for download. - ResultAvailableUntil time.Time `json:"result_available_until"` + ResultAvailableUntil int64 `json:"result_available_until"` // SQL for the query. SQL string `json:"sql"` // The query's execution status, which will be `completed` for successful runs, and `canceled`, `failed`, or `timed_out` otherwise. @@ -86,47 +81,3 @@ type SigmaScheduledQueryRunList struct { ListMeta Data []*SigmaScheduledQueryRun `json:"data"` } - -// UnmarshalJSON handles deserialization of a SigmaScheduledQueryRun. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SigmaScheduledQueryRun) UnmarshalJSON(data []byte) error { - type sigmaScheduledQueryRun SigmaScheduledQueryRun - v := struct { - Created int64 `json:"created"` - DataLoadTime int64 `json:"data_load_time"` - ResultAvailableUntil int64 `json:"result_available_until"` - *sigmaScheduledQueryRun - }{ - sigmaScheduledQueryRun: (*sigmaScheduledQueryRun)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Created = time.Unix(v.Created, 0) - s.DataLoadTime = time.Unix(v.DataLoadTime, 0) - s.ResultAvailableUntil = time.Unix(v.ResultAvailableUntil, 0) - return nil -} - -// MarshalJSON handles serialization of a SigmaScheduledQueryRun. -// This custom marshaling is needed to handle the time fields correctly. -func (s SigmaScheduledQueryRun) MarshalJSON() ([]byte, error) { - type sigmaScheduledQueryRun SigmaScheduledQueryRun - v := struct { - Created int64 `json:"created"` - DataLoadTime int64 `json:"data_load_time"` - ResultAvailableUntil int64 `json:"result_available_until"` - sigmaScheduledQueryRun - }{ - sigmaScheduledQueryRun: (sigmaScheduledQueryRun)(s), - Created: s.Created.Unix(), - DataLoadTime: s.DataLoadTime.Unix(), - ResultAvailableUntil: s.ResultAvailableUntil.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/source.go b/source.go index 49a8987890..787d5a42be 100644 --- a/source.go +++ b/source.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. type SourceAllowRedisplay string @@ -189,7 +184,7 @@ type SourceMandateAcceptanceOfflineParams struct { // The parameters required to store a mandate accepted online. Should only be set if `mandate[type]` is `online` type SourceMandateAcceptanceOnlineParams struct { // The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the mandate was accepted or refused by the customer. IP *string `form:"ip"` // The user agent of the browser from which the mandate was accepted or refused by the customer. @@ -199,7 +194,7 @@ type SourceMandateAcceptanceOnlineParams struct { // The parameters required to notify Stripe of a mandate acceptance or refusal by the customer. type SourceMandateAcceptanceParams struct { // The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. - Date *time.Time `form:"date"` + Date *int64 `form:"date"` // The IP address from which the mandate was accepted or refused by the customer. IP *string `form:"ip"` // The parameters required to store a mandate accepted offline. Should only be set if `mandate[type]` is `offline` @@ -603,7 +598,7 @@ type Source struct { ClientSecret string `json:"client_secret"` CodeVerification *SourceCodeVerification `json:"code_verification"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source. This is the currency for which the source will be chargeable once ready. Required for `single_use` sources. Currency Currency `json:"currency"` // The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. @@ -644,39 +639,3 @@ type Source struct { Usage SourceUsage `json:"usage"` WeChat *SourceWeChat `json:"wechat"` } - -// UnmarshalJSON handles deserialization of a Source. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *Source) UnmarshalJSON(data []byte) error { - type source Source - v := struct { - Created int64 `json:"created"` - *source - }{ - source: (*source)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a Source. -// This custom marshaling is needed to handle the time fields correctly. -func (s Source) MarshalJSON() ([]byte, error) { - type source Source - v := struct { - Created int64 `json:"created"` - source - }{ - source: (source)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/sourcetransaction.go b/sourcetransaction.go index 121d01218f..bf61461e7a 100644 --- a/sourcetransaction.go +++ b/sourcetransaction.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // List source transactions for a given source. type SourceTransactionListParams struct { ListParams `form:"*"` @@ -87,7 +82,7 @@ type SourceTransaction struct { Amount int64 `json:"amount"` CHFCreditTransfer *SourceTransactionCHFCreditTransfer `json:"chf_credit_transfer"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` GBPCreditTransfer *SourceTransactionGBPCreditTransfer `json:"gbp_credit_transfer"` @@ -113,39 +108,3 @@ type SourceTransactionList struct { ListMeta Data []*SourceTransaction `json:"data"` } - -// UnmarshalJSON handles deserialization of a SourceTransaction. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SourceTransaction) UnmarshalJSON(data []byte) error { - type sourceTransaction SourceTransaction - v := struct { - Created int64 `json:"created"` - *sourceTransaction - }{ - sourceTransaction: (*sourceTransaction)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a SourceTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (s SourceTransaction) MarshalJSON() ([]byte, error) { - type sourceTransaction SourceTransaction - v := struct { - Created int64 `json:"created"` - sourceTransaction - }{ - sourceTransaction: (sourceTransaction)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/subscription.go b/subscription.go index 8452d8d1f4..c8886eb5a0 100644 --- a/subscription.go +++ b/subscription.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // If Stripe disabled automatic tax, this enum describes why. @@ -345,7 +344,7 @@ type SubscriptionParams struct { // Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed. AutomaticTax *SubscriptionAutomaticTaxParams `form:"automatic_tax"` // For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor. - BackdateStartDate *time.Time `form:"backdate_start_date"` + BackdateStartDate *int64 `form:"backdate_start_date"` // A future timestamp in UTC format to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). The anchor is the reference point that aligns future billing cycle dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` // Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC. @@ -355,7 +354,7 @@ type SubscriptionParams struct { // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds. BillingThresholds *SubscriptionBillingThresholdsParams `form:"billing_thresholds"` // A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period. - CancelAt *time.Time `form:"cancel_at"` + CancelAt *int64 `form:"cancel_at"` // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. CancelAtPeriodEnd *bool `form:"cancel_at_period_end"` // Details about why this subscription was cancelled @@ -417,12 +416,12 @@ type SubscriptionParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` // If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value. TransferData *SubscriptionTransferDataParams `form:"transfer_data"` // Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. TrialFromPlan *bool `form:"trial_from_plan"` // Integer representing the number of trial period days before the customer is charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. @@ -471,7 +470,7 @@ type SubscriptionAddInvoiceItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -547,7 +546,7 @@ type SubscriptionDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -623,7 +622,7 @@ type SubscriptionPauseCollectionParams struct { // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`. Behavior *string `form:"behavior"` // The time after which the subscription will resume collecting payments. - ResumesAt *time.Time `form:"resumes_at"` + ResumesAt *int64 `form:"resumes_at"` } // Additional fields for Mandate creation @@ -879,7 +878,7 @@ type SubscriptionResumeParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` } // AddExpand appends a new field to expand. @@ -957,7 +956,7 @@ type SubscriptionLastPriceMigrationErrorFailedTransition struct { // Details of the most recent price migration that failed for the subscription. type SubscriptionLastPriceMigrationError struct { // The time at which the price migration encountered an error. - ErroredAt time.Time `json:"errored_at"` + ErroredAt int64 `json:"errored_at"` // The involved price pairs in each failed transition. FailedTransitions []*SubscriptionLastPriceMigrationErrorFailedTransition `json:"failed_transitions"` // The type of error encountered by the price migration. @@ -969,7 +968,7 @@ type SubscriptionPauseCollection struct { // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`. Behavior SubscriptionPauseCollectionBehavior `json:"behavior"` // The time after which the subscription will resume collecting payments. - ResumesAt time.Time `json:"resumes_at"` + ResumesAt int64 `json:"resumes_at"` } type SubscriptionPaymentSettingsPaymentMethodOptionsACSSDebitMandateOptions struct { // Transaction type of the mandate. @@ -1092,15 +1091,15 @@ type SubscriptionPendingInvoiceItemInterval struct { // If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid. type SubscriptionPendingUpdate struct { // If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format. - BillingCycleAnchor time.Time `json:"billing_cycle_anchor"` + BillingCycleAnchor int64 `json:"billing_cycle_anchor"` // The point after which the changes reflected by this update will be discarded and no longer applied. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // The number of iterations of prebilling to apply. PrebillingIterations int64 `json:"prebilling_iterations"` // List of subscription items, each with an attached plan, that will be set if the update is applied. SubscriptionItems []*SubscriptionItem `json:"subscription_items"` // Unix timestamp representing the end of the trial period the customer will get before being charged for the first time, if the update is applied. - TrialEnd time.Time `json:"trial_end"` + TrialEnd int64 `json:"trial_end"` // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. TrialFromPlan bool `json:"trial_from_plan"` } @@ -1110,9 +1109,9 @@ type SubscriptionPrebilling struct { // ID of the prebilling invoice. Invoice *Invoice `json:"invoice"` // The end of the last period for which the invoice pre-bills. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // The start of the first period for which the invoice pre-bills. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. UpdateBehavior SubscriptionPrebillingUpdateBehavior `json:"update_behavior"` } @@ -1148,29 +1147,29 @@ type Subscription struct { ApplicationFeePercent float64 `json:"application_fee_percent"` AutomaticTax *SubscriptionAutomaticTax `json:"automatic_tax"` // The reference point that aligns future [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle) dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals. The timestamp is in UTC format. - BillingCycleAnchor time.Time `json:"billing_cycle_anchor"` + BillingCycleAnchor int64 `json:"billing_cycle_anchor"` // The fixed values used to calculate the `billing_cycle_anchor`. BillingCycleAnchorConfig *SubscriptionBillingCycleAnchorConfig `json:"billing_cycle_anchor_config"` // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period BillingThresholds *SubscriptionBillingThresholds `json:"billing_thresholds"` // A date in the future at which the subscription will automatically get canceled - CancelAt time.Time `json:"cancel_at"` + CancelAt int64 `json:"cancel_at"` // Whether this subscription will (if `status=active`) or did (if `status=canceled`) cancel at the end of the current billing period. CancelAtPeriodEnd bool `json:"cancel_at_period_end"` // If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Details about why this subscription was cancelled CancellationDetails *SubscriptionCancellationDetails `json:"cancellation_details"` // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. CollectionMethod SubscriptionCollectionMethod `json:"collection_method"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. - CurrentPeriodEnd time.Time `json:"current_period_end"` + CurrentPeriodEnd int64 `json:"current_period_end"` // Start of the current period that the subscription has been invoiced for. - CurrentPeriodStart time.Time `json:"current_period_start"` + CurrentPeriodStart int64 `json:"current_period_start"` // ID of the customer who owns the subscription. Customer *Customer `json:"customer"` // Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`. @@ -1188,7 +1187,7 @@ type Subscription struct { // The discounts applied to the subscription. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount. Discounts []*Discount `json:"discounts"` // If the subscription has ended, the date the subscription ended. - EndedAt time.Time `json:"ended_at"` + EndedAt int64 `json:"ended_at"` // Unique identifier for the object. ID string `json:"id"` InvoiceSettings *SubscriptionInvoiceSettings `json:"invoice_settings"` @@ -1203,7 +1202,7 @@ type Subscription struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` // Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`. - NextPendingInvoiceItemInvoice time.Time `json:"next_pending_invoice_item_invoice"` + NextPendingInvoiceItemInvoice int64 `json:"next_pending_invoice_item_invoice"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The account (if any) the charge was made on behalf of for charges associated with this subscription. See the Connect documentation for details. @@ -1223,7 +1222,7 @@ type Subscription struct { // The schedule attached to the subscription Schedule *SubscriptionSchedule `json:"schedule"` // Date when the subscription was first created. The date might differ from the `created` date due to backdating. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` // Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, or `paused`. // // For `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` status. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal status, the open invoice will be voided and no further invoices will be generated. @@ -1241,11 +1240,11 @@ type Subscription struct { // The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. TransferData *SubscriptionTransferData `json:"transfer_data"` // If the subscription has a trial, the end of that trial. - TrialEnd time.Time `json:"trial_end"` + TrialEnd int64 `json:"trial_end"` // Settings related to subscription trials. TrialSettings *SubscriptionTrialSettings `json:"trial_settings"` // If the subscription has a trial, the beginning of that trial. - TrialStart time.Time `json:"trial_start"` + TrialStart int64 `json:"trial_start"` } // SubscriptionList is a list of Subscriptions as retrieved from a list endpoint. @@ -1272,230 +1271,11 @@ func (s *Subscription) UnmarshalJSON(data []byte) error { } type subscription Subscription - v := struct { - BillingCycleAnchor int64 `json:"billing_cycle_anchor"` - CancelAt int64 `json:"cancel_at"` - CanceledAt int64 `json:"canceled_at"` - Created int64 `json:"created"` - CurrentPeriodEnd int64 `json:"current_period_end"` - CurrentPeriodStart int64 `json:"current_period_start"` - EndedAt int64 `json:"ended_at"` - NextPendingInvoiceItemInvoice int64 `json:"next_pending_invoice_item_invoice"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - TrialStart int64 `json:"trial_start"` - *subscription - }{ - subscription: (*subscription)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.BillingCycleAnchor = time.Unix(v.BillingCycleAnchor, 0) - s.CancelAt = time.Unix(v.CancelAt, 0) - s.CanceledAt = time.Unix(v.CanceledAt, 0) - s.Created = time.Unix(v.Created, 0) - s.CurrentPeriodEnd = time.Unix(v.CurrentPeriodEnd, 0) - s.CurrentPeriodStart = time.Unix(v.CurrentPeriodStart, 0) - s.EndedAt = time.Unix(v.EndedAt, 0) - s.NextPendingInvoiceItemInvoice = time.Unix(v.NextPendingInvoiceItemInvoice, 0) - s.StartDate = time.Unix(v.StartDate, 0) - s.TrialEnd = time.Unix(v.TrialEnd, 0) - s.TrialStart = time.Unix(v.TrialStart, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionLastPriceMigrationError. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionLastPriceMigrationError) UnmarshalJSON(data []byte) error { - type subscriptionLastPriceMigrationError SubscriptionLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - *subscriptionLastPriceMigrationError - }{ - subscriptionLastPriceMigrationError: (*subscriptionLastPriceMigrationError)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.ErroredAt = time.Unix(v.ErroredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionPauseCollection. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionPauseCollection) UnmarshalJSON(data []byte) error { - type subscriptionPauseCollection SubscriptionPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - *subscriptionPauseCollection - }{ - subscriptionPauseCollection: (*subscriptionPauseCollection)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.ResumesAt = time.Unix(v.ResumesAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionPendingUpdate. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionPendingUpdate) UnmarshalJSON(data []byte) error { - type subscriptionPendingUpdate SubscriptionPendingUpdate - v := struct { - BillingCycleAnchor int64 `json:"billing_cycle_anchor"` - ExpiresAt int64 `json:"expires_at"` - TrialEnd int64 `json:"trial_end"` - *subscriptionPendingUpdate - }{ - subscriptionPendingUpdate: (*subscriptionPendingUpdate)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.BillingCycleAnchor = time.Unix(v.BillingCycleAnchor, 0) - s.ExpiresAt = time.Unix(v.ExpiresAt, 0) - s.TrialEnd = time.Unix(v.TrialEnd, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionPrebilling. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionPrebilling) UnmarshalJSON(data []byte) error { - type subscriptionPrebilling SubscriptionPrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - *subscriptionPrebilling - }{ - subscriptionPrebilling: (*subscriptionPrebilling)(s), - } + var v subscription if err := json.Unmarshal(data, &v); err != nil { return err } - s.PeriodEnd = time.Unix(v.PeriodEnd, 0) - s.PeriodStart = time.Unix(v.PeriodStart, 0) + *s = Subscription(v) return nil } - -// MarshalJSON handles serialization of a SubscriptionLastPriceMigrationError. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionLastPriceMigrationError) MarshalJSON() ([]byte, error) { - type subscriptionLastPriceMigrationError SubscriptionLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - subscriptionLastPriceMigrationError - }{ - subscriptionLastPriceMigrationError: (subscriptionLastPriceMigrationError)(s), - ErroredAt: s.ErroredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionPauseCollection. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionPauseCollection) MarshalJSON() ([]byte, error) { - type subscriptionPauseCollection SubscriptionPauseCollection - v := struct { - ResumesAt int64 `json:"resumes_at"` - subscriptionPauseCollection - }{ - subscriptionPauseCollection: (subscriptionPauseCollection)(s), - ResumesAt: s.ResumesAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionPendingUpdate. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionPendingUpdate) MarshalJSON() ([]byte, error) { - type subscriptionPendingUpdate SubscriptionPendingUpdate - v := struct { - BillingCycleAnchor int64 `json:"billing_cycle_anchor"` - ExpiresAt int64 `json:"expires_at"` - TrialEnd int64 `json:"trial_end"` - subscriptionPendingUpdate - }{ - subscriptionPendingUpdate: (subscriptionPendingUpdate)(s), - BillingCycleAnchor: s.BillingCycleAnchor.Unix(), - ExpiresAt: s.ExpiresAt.Unix(), - TrialEnd: s.TrialEnd.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionPrebilling. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionPrebilling) MarshalJSON() ([]byte, error) { - type subscriptionPrebilling SubscriptionPrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - subscriptionPrebilling - }{ - subscriptionPrebilling: (subscriptionPrebilling)(s), - PeriodEnd: s.PeriodEnd.Unix(), - PeriodStart: s.PeriodStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a Subscription. -// This custom marshaling is needed to handle the time fields correctly. -func (s Subscription) MarshalJSON() ([]byte, error) { - type subscription Subscription - v := struct { - BillingCycleAnchor int64 `json:"billing_cycle_anchor"` - CancelAt int64 `json:"cancel_at"` - CanceledAt int64 `json:"canceled_at"` - Created int64 `json:"created"` - CurrentPeriodEnd int64 `json:"current_period_end"` - CurrentPeriodStart int64 `json:"current_period_start"` - EndedAt int64 `json:"ended_at"` - NextPendingInvoiceItemInvoice int64 `json:"next_pending_invoice_item_invoice"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - TrialStart int64 `json:"trial_start"` - subscription - }{ - subscription: (subscription)(s), - BillingCycleAnchor: s.BillingCycleAnchor.Unix(), - CancelAt: s.CancelAt.Unix(), - CanceledAt: s.CanceledAt.Unix(), - Created: s.Created.Unix(), - CurrentPeriodEnd: s.CurrentPeriodEnd.Unix(), - CurrentPeriodStart: s.CurrentPeriodStart.Unix(), - EndedAt: s.EndedAt.Unix(), - NextPendingInvoiceItemInvoice: s.NextPendingInvoiceItemInvoice.Unix(), - StartDate: s.StartDate.Unix(), - TrialEnd: s.TrialEnd.Unix(), - TrialStart: s.TrialStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/subscriptionitem.go b/subscriptionitem.go index a40e8df6da..71b7f842fd 100644 --- a/subscriptionitem.go +++ b/subscriptionitem.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Determines the type of trial for this item. type SubscriptionItemTrialType string @@ -53,7 +50,7 @@ type SubscriptionItemParams struct { // Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. - ProrationDate *time.Time `form:"proration_date"` + ProrationDate *int64 `form:"proration_date"` // The quantity you'd like to apply to the subscription item you're creating. Quantity *int64 `form:"quantity"` // The identifier of the subscription to modify. @@ -97,7 +94,7 @@ type SubscriptionItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -196,8 +193,8 @@ type SubscriptionItem struct { // Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period BillingThresholds *SubscriptionItemBillingThresholds `json:"billing_thresholds"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` - Deleted bool `json:"deleted"` + Created int64 `json:"created"` + Deleted bool `json:"deleted"` // The discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount. Discounts []*Discount `json:"discounts"` // Unique identifier for the object. @@ -249,34 +246,11 @@ func (s *SubscriptionItem) UnmarshalJSON(data []byte) error { } type subscriptionItem SubscriptionItem - v := struct { - Created int64 `json:"created"` - *subscriptionItem - }{ - subscriptionItem: (*subscriptionItem)(s), - } + var v subscriptionItem if err := json.Unmarshal(data, &v); err != nil { return err } - s.Created = time.Unix(v.Created, 0) + *s = SubscriptionItem(v) return nil } - -// MarshalJSON handles serialization of a SubscriptionItem. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionItem) MarshalJSON() ([]byte, error) { - type subscriptionItem SubscriptionItem - v := struct { - Created int64 `json:"created"` - subscriptionItem - }{ - subscriptionItem: (subscriptionItem)(s), - Created: s.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/subscriptionschedule.go b/subscriptionschedule.go index e299d43244..91bc83db21 100644 --- a/subscriptionschedule.go +++ b/subscriptionschedule.go @@ -9,7 +9,6 @@ package stripe import ( "encoding/json" "github.com/stripe/stripe-go/v81/form" - "time" ) // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front. @@ -256,7 +255,7 @@ type SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -316,7 +315,7 @@ type SubscriptionSchedulePhaseDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionSchedulePhaseDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -364,7 +363,7 @@ type SubscriptionSchedulePhaseItemDiscountDiscountEndParams struct { // Time span for the redeemed discount. Duration *SubscriptionSchedulePhaseItemDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -465,8 +464,8 @@ type SubscriptionSchedulePhaseParams struct { // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*SubscriptionSchedulePhaseDiscountParams `form:"discounts"` // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set. - EndDate *time.Time `form:"end_date"` - EndDateNow *bool `form:"-"` // See custom AppendTo + EndDate *int64 `form:"end_date"` + EndDateNow *bool `form:"-"` // See custom AppendTo // All invoices will be billed using the specified settings. InvoiceSettings *SubscriptionSchedulePhaseInvoiceSettingsParams `form:"invoice_settings"` // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. @@ -482,8 +481,8 @@ type SubscriptionSchedulePhaseParams struct { // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase. ProrationBehavior *string `form:"proration_behavior"` // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase. - StartDate *time.Time `form:"start_date"` - StartDateNow *bool `form:"-"` // See custom AppendTo + StartDate *int64 `form:"start_date"` + StartDateNow *bool `form:"-"` // See custom AppendTo // The data with which to automatically create a Transfer for each of the associated subscription's invoices. TransferData *SubscriptionTransferDataParams `form:"transfer_data"` // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. @@ -491,8 +490,8 @@ type SubscriptionSchedulePhaseParams struct { // Specify trial behavior when crossing phase boundaries TrialContinuation *string `form:"trial_continuation"` // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial` - TrialEnd *time.Time `form:"trial_end"` - TrialEndNow *bool `form:"-"` // See custom AppendTo + TrialEnd *int64 `form:"trial_end"` + TrialEndNow *bool `form:"-"` // See custom AppendTo // Settings related to subscription trials. TrialSettings *SubscriptionSchedulePhaseTrialSettingsParams `form:"trial_settings"` } @@ -551,8 +550,8 @@ type SubscriptionScheduleParams struct { // If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`. ProrationBehavior *string `form:"proration_behavior"` // When the subscription schedule starts. We recommend using `now` so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. - StartDate *time.Time `form:"start_date"` - StartDateNow *bool `form:"-"` // See custom AppendTo + StartDate *int64 `form:"start_date"` + StartDateNow *bool `form:"-"` // See custom AppendTo } // AddExpand appends a new field to expand. @@ -597,7 +596,7 @@ type SubscriptionScheduleAmendAmendmentAmendmentEndParams struct { // Time span for the amendment starting from the `amendment_start`. Duration *SubscriptionScheduleAmendAmendmentAmendmentEndDurationParams `form:"duration"` // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_end`. Type *string `form:"type"` } @@ -621,7 +620,7 @@ type SubscriptionScheduleAmendAmendmentAmendmentStartParams struct { // Use the `end` time of a given discount. DiscountEnd *SubscriptionScheduleAmendAmendmentAmendmentStartDiscountEndParams `form:"discount_end"` // A precise Unix timestamp for the amendment to start. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of three ways to pass the `amendment_start`. Type *string `form:"type"` } @@ -691,7 +690,7 @@ type SubscriptionScheduleAmendAmendmentItemActionAddDiscountDiscountEndParams st // Time span for the redeemed discount. Duration *SubscriptionScheduleAmendAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -760,7 +759,7 @@ type SubscriptionScheduleAmendAmendmentItemActionSetDiscountDiscountEndParams st // Time span for the redeemed discount. Duration *SubscriptionScheduleAmendAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"` // A precise Unix timestamp for the discount to end. Must be in the future. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // The type of calculation made to determine when the discount ends. Type *string `form:"type"` } @@ -895,7 +894,7 @@ type SubscriptionScheduleAmendPrebillingBillFromParams struct { // Start the prebilled period when a specified amendment begins. AmendmentStart *SubscriptionScheduleAmendPrebillingBillFromAmendmentStartParams `form:"amendment_start"` // Start the prebilled period at a precise integer timestamp, starting from the Unix epoch. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of several ways to pass the `bill_from` value. Type *string `form:"type"` } @@ -921,7 +920,7 @@ type SubscriptionScheduleAmendPrebillingBillUntilParams struct { // Time span for prebilling, starting from `bill_from`. Duration *SubscriptionScheduleAmendPrebillingBillUntilDurationParams `form:"duration"` // End the prebilled period at a precise integer timestamp, starting from the Unix epoch. - Timestamp *time.Time `form:"timestamp"` + Timestamp *int64 `form:"timestamp"` // Select one of several ways to pass the `bill_until` value. Type *string `form:"type"` } @@ -998,9 +997,9 @@ func (p *SubscriptionScheduleReleaseParams) AddExpand(f string) { // Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. type SubscriptionScheduleCurrentPhase struct { // The end of this phase of the subscription schedule. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // The start of this phase of the subscription schedule. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` } type SubscriptionScheduleDefaultSettingsInvoiceSettingsIssuer struct { // The connected account being referenced when `type` is `account`. @@ -1047,7 +1046,7 @@ type SubscriptionScheduleLastPriceMigrationErrorFailedTransition struct { // Details of the most recent price migration that failed for the subscription schedule. type SubscriptionScheduleLastPriceMigrationError struct { // The time at which the price migration encountered an error. - ErroredAt time.Time `json:"errored_at"` + ErroredAt int64 `json:"errored_at"` // The involved price pairs in each failed transition. FailedTransitions []*SubscriptionScheduleLastPriceMigrationErrorFailedTransition `json:"failed_transitions"` // The type of error encountered by the price migration. @@ -1057,7 +1056,7 @@ type SubscriptionScheduleLastPriceMigrationError struct { // Details to determine how long the discount should be applied for. type SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEndType `json:"type"` } @@ -1089,7 +1088,7 @@ type SubscriptionSchedulePhaseAddInvoiceItem struct { // Details to determine how long the discount should be applied for. type SubscriptionSchedulePhaseDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type SubscriptionSchedulePhaseDiscountDiscountEndType `json:"type"` } @@ -1127,7 +1126,7 @@ type SubscriptionSchedulePhaseInvoiceSettings struct { // Details to determine how long the discount should be applied for. type SubscriptionSchedulePhaseItemDiscountDiscountEnd struct { // The discount end timestamp. - Timestamp time.Time `json:"timestamp"` + Timestamp int64 `json:"timestamp"` // The discount end type. Type SubscriptionSchedulePhaseItemDiscountDiscountEndType `json:"type"` } @@ -1216,7 +1215,7 @@ type SubscriptionSchedulePhase struct { // The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts. Discounts []*SubscriptionSchedulePhaseDiscount `json:"discounts"` // The end of this phase of the subscription schedule. - EndDate time.Time `json:"end_date"` + EndDate int64 `json:"end_date"` // The invoice settings applicable during this phase. InvoiceSettings *SubscriptionSchedulePhaseInvoiceSettings `json:"invoice_settings"` // Subscription items to configure the subscription to during this phase of the subscription schedule. @@ -1230,13 +1229,13 @@ type SubscriptionSchedulePhase struct { // If the subscription schedule will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. ProrationBehavior SubscriptionSchedulePhaseProrationBehavior `json:"proration_behavior"` // The start of this phase of the subscription schedule. - StartDate time.Time `json:"start_date"` + StartDate int64 `json:"start_date"` // The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. TransferData *SubscriptionTransferData `json:"transfer_data"` // Specify behavior of the trial when crossing schedule phase boundaries TrialContinuation SubscriptionSchedulePhaseTrialContinuation `json:"trial_continuation"` // When the trial ends within the phase. - TrialEnd time.Time `json:"trial_end"` + TrialEnd int64 `json:"trial_end"` // Settings related to any trials on the subscription during this phase. TrialSettings *SubscriptionSchedulePhaseTrialSettings `json:"trial_settings"` } @@ -1246,9 +1245,9 @@ type SubscriptionSchedulePrebilling struct { // ID of the prebilling invoice. Invoice *Invoice `json:"invoice"` // The end of the last period for which the invoice pre-bills. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // The start of the first period for which the invoice pre-bills. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. UpdateBehavior SubscriptionSchedulePrebillingUpdateBehavior `json:"update_behavior"` } @@ -1263,11 +1262,11 @@ type SubscriptionSchedule struct { // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front. BillingBehavior SubscriptionScheduleBillingBehavior `json:"billing_behavior"` // Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. - CompletedAt time.Time `json:"completed_at"` + CompletedAt int64 `json:"completed_at"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. CurrentPhase *SubscriptionScheduleCurrentPhase `json:"current_phase"` // ID of the customer who owns the subscription schedule. @@ -1290,7 +1289,7 @@ type SubscriptionSchedule struct { // Time period and invoice for a Subscription billed in advance. Prebilling *SubscriptionSchedulePrebilling `json:"prebilling"` // Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. - ReleasedAt time.Time `json:"released_at"` + ReleasedAt int64 `json:"released_at"` // ID of the subscription once managed by the subscription schedule (if it is released). ReleasedSubscription *Subscription `json:"released_subscription"` // The present status of the subscription schedule. Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules). @@ -1318,314 +1317,11 @@ func (s *SubscriptionSchedule) UnmarshalJSON(data []byte) error { } type subscriptionSchedule SubscriptionSchedule - v := struct { - CanceledAt int64 `json:"canceled_at"` - CompletedAt int64 `json:"completed_at"` - Created int64 `json:"created"` - ReleasedAt int64 `json:"released_at"` - *subscriptionSchedule - }{ - subscriptionSchedule: (*subscriptionSchedule)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.CanceledAt = time.Unix(v.CanceledAt, 0) - s.CompletedAt = time.Unix(v.CompletedAt, 0) - s.Created = time.Unix(v.Created, 0) - s.ReleasedAt = time.Unix(v.ReleasedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionScheduleCurrentPhase. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionScheduleCurrentPhase) UnmarshalJSON(data []byte) error { - type subscriptionScheduleCurrentPhase SubscriptionScheduleCurrentPhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - *subscriptionScheduleCurrentPhase - }{ - subscriptionScheduleCurrentPhase: (*subscriptionScheduleCurrentPhase)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.EndDate = time.Unix(v.EndDate, 0) - s.StartDate = time.Unix(v.StartDate, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionScheduleLastPriceMigrationError. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionScheduleLastPriceMigrationError) UnmarshalJSON(data []byte) error { - type subscriptionScheduleLastPriceMigrationError SubscriptionScheduleLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - *subscriptionScheduleLastPriceMigrationError - }{ - subscriptionScheduleLastPriceMigrationError: (*subscriptionScheduleLastPriceMigrationError)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.ErroredAt = time.Unix(v.ErroredAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - }{ - subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd: (*subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionSchedulePhaseDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionSchedulePhaseDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type subscriptionSchedulePhaseDiscountDiscountEnd SubscriptionSchedulePhaseDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *subscriptionSchedulePhaseDiscountDiscountEnd - }{ - subscriptionSchedulePhaseDiscountDiscountEnd: (*subscriptionSchedulePhaseDiscountDiscountEnd)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionSchedulePhaseItemDiscountDiscountEnd. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionSchedulePhaseItemDiscountDiscountEnd) UnmarshalJSON(data []byte) error { - type subscriptionSchedulePhaseItemDiscountDiscountEnd SubscriptionSchedulePhaseItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - *subscriptionSchedulePhaseItemDiscountDiscountEnd - }{ - subscriptionSchedulePhaseItemDiscountDiscountEnd: (*subscriptionSchedulePhaseItemDiscountDiscountEnd)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a SubscriptionSchedulePhase. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionSchedulePhase) UnmarshalJSON(data []byte) error { - type subscriptionSchedulePhase SubscriptionSchedulePhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - *subscriptionSchedulePhase - }{ - subscriptionSchedulePhase: (*subscriptionSchedulePhase)(s), - } + var v subscriptionSchedule if err := json.Unmarshal(data, &v); err != nil { return err } - s.EndDate = time.Unix(v.EndDate, 0) - s.StartDate = time.Unix(v.StartDate, 0) - s.TrialEnd = time.Unix(v.TrialEnd, 0) + *s = SubscriptionSchedule(v) return nil } - -// UnmarshalJSON handles deserialization of a SubscriptionSchedulePrebilling. -// This custom unmarshaling is needed to handle the time fields correctly. -func (s *SubscriptionSchedulePrebilling) UnmarshalJSON(data []byte) error { - type subscriptionSchedulePrebilling SubscriptionSchedulePrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - *subscriptionSchedulePrebilling - }{ - subscriptionSchedulePrebilling: (*subscriptionSchedulePrebilling)(s), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - s.PeriodEnd = time.Unix(v.PeriodEnd, 0) - s.PeriodStart = time.Unix(v.PeriodStart, 0) - return nil -} - -// MarshalJSON handles serialization of a SubscriptionScheduleCurrentPhase. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionScheduleCurrentPhase) MarshalJSON() ([]byte, error) { - type subscriptionScheduleCurrentPhase SubscriptionScheduleCurrentPhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - subscriptionScheduleCurrentPhase - }{ - subscriptionScheduleCurrentPhase: (subscriptionScheduleCurrentPhase)(s), - EndDate: s.EndDate.Unix(), - StartDate: s.StartDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionScheduleLastPriceMigrationError. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionScheduleLastPriceMigrationError) MarshalJSON() ([]byte, error) { - type subscriptionScheduleLastPriceMigrationError SubscriptionScheduleLastPriceMigrationError - v := struct { - ErroredAt int64 `json:"errored_at"` - subscriptionScheduleLastPriceMigrationError - }{ - subscriptionScheduleLastPriceMigrationError: (subscriptionScheduleLastPriceMigrationError)(s), - ErroredAt: s.ErroredAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd SubscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd - }{ - subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd: (subscriptionSchedulePhaseAddInvoiceItemDiscountDiscountEnd)(s), - Timestamp: s.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedulePhaseDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedulePhaseDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type subscriptionSchedulePhaseDiscountDiscountEnd SubscriptionSchedulePhaseDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - subscriptionSchedulePhaseDiscountDiscountEnd - }{ - subscriptionSchedulePhaseDiscountDiscountEnd: (subscriptionSchedulePhaseDiscountDiscountEnd)(s), - Timestamp: s.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedulePhaseItemDiscountDiscountEnd. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedulePhaseItemDiscountDiscountEnd) MarshalJSON() ([]byte, error) { - type subscriptionSchedulePhaseItemDiscountDiscountEnd SubscriptionSchedulePhaseItemDiscountDiscountEnd - v := struct { - Timestamp int64 `json:"timestamp"` - subscriptionSchedulePhaseItemDiscountDiscountEnd - }{ - subscriptionSchedulePhaseItemDiscountDiscountEnd: (subscriptionSchedulePhaseItemDiscountDiscountEnd)(s), - Timestamp: s.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedulePhase. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedulePhase) MarshalJSON() ([]byte, error) { - type subscriptionSchedulePhase SubscriptionSchedulePhase - v := struct { - EndDate int64 `json:"end_date"` - StartDate int64 `json:"start_date"` - TrialEnd int64 `json:"trial_end"` - subscriptionSchedulePhase - }{ - subscriptionSchedulePhase: (subscriptionSchedulePhase)(s), - EndDate: s.EndDate.Unix(), - StartDate: s.StartDate.Unix(), - TrialEnd: s.TrialEnd.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedulePrebilling. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedulePrebilling) MarshalJSON() ([]byte, error) { - type subscriptionSchedulePrebilling SubscriptionSchedulePrebilling - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - subscriptionSchedulePrebilling - }{ - subscriptionSchedulePrebilling: (subscriptionSchedulePrebilling)(s), - PeriodEnd: s.PeriodEnd.Unix(), - PeriodStart: s.PeriodStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a SubscriptionSchedule. -// This custom marshaling is needed to handle the time fields correctly. -func (s SubscriptionSchedule) MarshalJSON() ([]byte, error) { - type subscriptionSchedule SubscriptionSchedule - v := struct { - CanceledAt int64 `json:"canceled_at"` - CompletedAt int64 `json:"completed_at"` - Created int64 `json:"created"` - ReleasedAt int64 `json:"released_at"` - subscriptionSchedule - }{ - subscriptionSchedule: (subscriptionSchedule)(s), - CanceledAt: s.CanceledAt.Unix(), - CompletedAt: s.CompletedAt.Unix(), - Created: s.Created.Unix(), - ReleasedAt: s.ReleasedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/tax_calculation.go b/tax_calculation.go index 7147506ec5..350ad69b53 100644 --- a/tax_calculation.go +++ b/tax_calculation.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of customer address provided. type TaxCalculationCustomerDetailsAddressSource string @@ -281,7 +276,7 @@ type TaxCalculationParams struct { // Shipping cost details to be used for the calculation. ShippingCost *TaxCalculationShippingCostParams `form:"shipping_cost"` // Timestamp of date at which the tax rules and rates in effect applies for the calculation. Measured in seconds since the Unix epoch. Can be up to 48 hours in the past, and up to 48 hours in the future. - TaxDate *time.Time `form:"tax_date"` + TaxDate *int64 `form:"tax_date"` } // AddExpand appends a new field to expand. @@ -483,7 +478,7 @@ type TaxCalculation struct { Customer string `json:"customer"` CustomerDetails *TaxCalculationCustomerDetails `json:"customer_details"` // Timestamp of date at which the tax calculation will expire. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the calculation. ID string `json:"id"` // The list of items the customer is purchasing. @@ -503,45 +498,5 @@ type TaxCalculation struct { // Breakdown of individual tax amounts that add up to the total. TaxBreakdown []*TaxCalculationTaxBreakdown `json:"tax_breakdown"` // Timestamp of date at which the tax rules and rates in effect applies for the calculation. - TaxDate time.Time `json:"tax_date"` -} - -// UnmarshalJSON handles deserialization of a TaxCalculation. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TaxCalculation) UnmarshalJSON(data []byte) error { - type taxCalculation TaxCalculation - v := struct { - ExpiresAt int64 `json:"expires_at"` - TaxDate int64 `json:"tax_date"` - *taxCalculation - }{ - taxCalculation: (*taxCalculation)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.ExpiresAt = time.Unix(v.ExpiresAt, 0) - t.TaxDate = time.Unix(v.TaxDate, 0) - return nil -} - -// MarshalJSON handles serialization of a TaxCalculation. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxCalculation) MarshalJSON() ([]byte, error) { - type taxCalculation TaxCalculation - v := struct { - ExpiresAt int64 `json:"expires_at"` - TaxDate int64 `json:"tax_date"` - taxCalculation - }{ - taxCalculation: (taxCalculation)(t), - ExpiresAt: t.ExpiresAt.Unix(), - TaxDate: t.TaxDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err + TaxDate int64 `json:"tax_date"` } diff --git a/tax_form.go b/tax_form.go index 8a13dabe2c..eb0cf3ffe6 100644 --- a/tax_form.go +++ b/tax_form.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Indicates the level of the jurisdiction where the form was filed. type TaxFormFilingStatusJurisdictionLevel string @@ -134,7 +131,7 @@ type TaxFormFilingStatusJurisdiction struct { // A list of tax filing statuses. Note that a filing status will only be included if the form has been filed directly with the jurisdiction's tax authority. type TaxFormFilingStatus struct { // Time when the filing status was updated. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` Jurisdiction *TaxFormFilingStatusJurisdiction `json:"jurisdiction"` // The current status of the filed form. Value TaxFormFilingStatusValue `json:"value"` @@ -182,7 +179,7 @@ type TaxForm struct { // The form that corrects this form, if any. CorrectedBy *TaxForm `json:"corrected_by"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` EUDac7 *TaxFormEUDac7 `json:"eu_dac7"` // A list of tax filing statuses. Note that a filing status will only be included if the form has been filed directly with the jurisdiction's tax authority. FilingStatuses []*TaxFormFilingStatus `json:"filing_statuses"` @@ -219,70 +216,11 @@ func (t *TaxForm) UnmarshalJSON(data []byte) error { } type taxForm TaxForm - v := struct { - Created int64 `json:"created"` - *taxForm - }{ - taxForm: (*taxForm)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TaxFormFilingStatus. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TaxFormFilingStatus) UnmarshalJSON(data []byte) error { - type taxFormFilingStatus TaxFormFilingStatus - v := struct { - EffectiveAt int64 `json:"effective_at"` - *taxFormFilingStatus - }{ - taxFormFilingStatus: (*taxFormFilingStatus)(t), - } + var v taxForm if err := json.Unmarshal(data, &v); err != nil { return err } - t.EffectiveAt = time.Unix(v.EffectiveAt, 0) + *t = TaxForm(v) return nil } - -// MarshalJSON handles serialization of a TaxFormFilingStatus. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxFormFilingStatus) MarshalJSON() ([]byte, error) { - type taxFormFilingStatus TaxFormFilingStatus - v := struct { - EffectiveAt int64 `json:"effective_at"` - taxFormFilingStatus - }{ - taxFormFilingStatus: (taxFormFilingStatus)(t), - EffectiveAt: t.EffectiveAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TaxForm. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxForm) MarshalJSON() ([]byte, error) { - type taxForm TaxForm - v := struct { - Created int64 `json:"created"` - taxForm - }{ - taxForm: (taxForm)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/tax_registration.go b/tax_registration.go index 3f82452060..85ccea3b36 100644 --- a/tax_registration.go +++ b/tax_registration.go @@ -6,11 +6,7 @@ package stripe -import ( - "encoding/json" - "github.com/stripe/stripe-go/v81/form" - "time" -) +import "github.com/stripe/stripe-go/v81/form" // Type of registration in `country`. type TaxRegistrationCountryOptionsAeType string @@ -2018,8 +2014,8 @@ type TaxRegistrationCountryOptionsParams struct { type TaxRegistrationParams struct { Params `form:"*"` // Time at which the Tax Registration becomes active. It can be either `now` to indicate the current time, or a future timestamp measured in seconds since the Unix epoch. - ActiveFrom *time.Time `form:"active_from"` - ActiveFromNow *bool `form:"-"` // See custom AppendTo + ActiveFrom *int64 `form:"active_from"` + ActiveFromNow *bool `form:"-"` // See custom AppendTo // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Country *string `form:"country"` // Specific options for a registration in the specified `country`. @@ -2027,8 +2023,8 @@ type TaxRegistrationParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. It can be either `now` to indicate the current time, or a timestamp measured in seconds since the Unix epoch. - ExpiresAt *time.Time `form:"expires_at"` - ExpiresAtNow *bool `form:"-"` // See custom AppendTo + ExpiresAt *int64 `form:"expires_at"` + ExpiresAtNow *bool `form:"-"` // See custom AppendTo } // AddExpand appends a new field to expand. @@ -2652,14 +2648,14 @@ type TaxRegistrationCountryOptions struct { type TaxRegistration struct { APIResource // Time at which the registration becomes active. Measured in seconds since the Unix epoch. - ActiveFrom time.Time `json:"active_from"` + ActiveFrom int64 `json:"active_from"` // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Country string `json:"country"` CountryOptions *TaxRegistrationCountryOptions `json:"country_options"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. Measured in seconds since the Unix epoch. - ExpiresAt time.Time `json:"expires_at"` + ExpiresAt int64 `json:"expires_at"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -2676,47 +2672,3 @@ type TaxRegistrationList struct { ListMeta Data []*TaxRegistration `json:"data"` } - -// UnmarshalJSON handles deserialization of a TaxRegistration. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TaxRegistration) UnmarshalJSON(data []byte) error { - type taxRegistration TaxRegistration - v := struct { - ActiveFrom int64 `json:"active_from"` - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - *taxRegistration - }{ - taxRegistration: (*taxRegistration)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.ActiveFrom = time.Unix(v.ActiveFrom, 0) - t.Created = time.Unix(v.Created, 0) - t.ExpiresAt = time.Unix(v.ExpiresAt, 0) - return nil -} - -// MarshalJSON handles serialization of a TaxRegistration. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxRegistration) MarshalJSON() ([]byte, error) { - type taxRegistration TaxRegistration - v := struct { - ActiveFrom int64 `json:"active_from"` - Created int64 `json:"created"` - ExpiresAt int64 `json:"expires_at"` - taxRegistration - }{ - taxRegistration: (taxRegistration)(t), - ActiveFrom: t.ActiveFrom.Unix(), - Created: t.Created.Unix(), - ExpiresAt: t.ExpiresAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/tax_transaction.go b/tax_transaction.go index 04cc065b0e..ba7b9e26c3 100644 --- a/tax_transaction.go +++ b/tax_transaction.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of customer address provided. type TaxTransactionCustomerDetailsAddressSource string @@ -255,7 +250,7 @@ type TaxTransactionCreateFromCalculationParams struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Metadata map[string]string `form:"metadata"` // The Unix timestamp representing when the tax liability is assumed or reduced, which determines the liability posting period and handling in tax liability reports. The timestamp must fall within the `tax_date` and the current time, unless the `tax_date` is scheduled in advance. Defaults to the current time. - PostedAt *time.Time `form:"posted_at"` + PostedAt *int64 `form:"posted_at"` // A custom order or sale identifier, such as 'myOrder_123'. Must be unique across all transactions, including reversals. Reference *string `form:"reference"` } @@ -430,7 +425,7 @@ type TaxTransactionShippingCost struct { type TaxTransaction struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. @@ -447,7 +442,7 @@ type TaxTransaction struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The Unix timestamp representing when the tax liability is assumed or reduced. - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` // A custom unique identifier, such as 'myOrder_123'. Reference string `json:"reference"` // If `type=reversal`, contains information about what was reversed. @@ -457,51 +452,7 @@ type TaxTransaction struct { // The shipping cost details for the transaction. ShippingCost *TaxTransactionShippingCost `json:"shipping_cost"` // Timestamp of date at which the tax rules and rates in effect applies for the calculation. - TaxDate time.Time `json:"tax_date"` + TaxDate int64 `json:"tax_date"` // If `reversal`, this transaction reverses an earlier transaction. Type TaxTransactionType `json:"type"` } - -// UnmarshalJSON handles deserialization of a TaxTransaction. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TaxTransaction) UnmarshalJSON(data []byte) error { - type taxTransaction TaxTransaction - v := struct { - Created int64 `json:"created"` - PostedAt int64 `json:"posted_at"` - TaxDate int64 `json:"tax_date"` - *taxTransaction - }{ - taxTransaction: (*taxTransaction)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - t.PostedAt = time.Unix(v.PostedAt, 0) - t.TaxDate = time.Unix(v.TaxDate, 0) - return nil -} - -// MarshalJSON handles serialization of a TaxTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxTransaction) MarshalJSON() ([]byte, error) { - type taxTransaction TaxTransaction - v := struct { - Created int64 `json:"created"` - PostedAt int64 `json:"posted_at"` - TaxDate int64 `json:"tax_date"` - taxTransaction - }{ - taxTransaction: (taxTransaction)(t), - Created: t.Created.Unix(), - PostedAt: t.PostedAt.Unix(), - TaxDate: t.TaxDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/taxdeductedatsource.go b/taxdeductedatsource.go index 6add5b7247..2f12f2182b 100644 --- a/taxdeductedatsource.go +++ b/taxdeductedatsource.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" type TaxDeductedAtSource struct { // Unique identifier for the object. @@ -17,9 +14,9 @@ type TaxDeductedAtSource struct { // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // The end of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period. - PeriodEnd time.Time `json:"period_end"` + PeriodEnd int64 `json:"period_end"` // The start of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period. - PeriodStart time.Time `json:"period_start"` + PeriodStart int64 `json:"period_start"` // The TAN that was supplied to Stripe when TDS was assessed TaxDeductionAccountNumber string `json:"tax_deduction_account_number"` } @@ -34,38 +31,11 @@ func (t *TaxDeductedAtSource) UnmarshalJSON(data []byte) error { } type taxDeductedAtSource TaxDeductedAtSource - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - *taxDeductedAtSource - }{ - taxDeductedAtSource: (*taxDeductedAtSource)(t), - } + var v taxDeductedAtSource if err := json.Unmarshal(data, &v); err != nil { return err } - t.PeriodEnd = time.Unix(v.PeriodEnd, 0) - t.PeriodStart = time.Unix(v.PeriodStart, 0) + *t = TaxDeductedAtSource(v) return nil } - -// MarshalJSON handles serialization of a TaxDeductedAtSource. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxDeductedAtSource) MarshalJSON() ([]byte, error) { - type taxDeductedAtSource TaxDeductedAtSource - v := struct { - PeriodEnd int64 `json:"period_end"` - PeriodStart int64 `json:"period_start"` - taxDeductedAtSource - }{ - taxDeductedAtSource: (taxDeductedAtSource)(t), - PeriodEnd: t.PeriodEnd.Unix(), - PeriodStart: t.PeriodStart.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/taxid.go b/taxid.go index b6fadb0d60..3b1bd60377 100644 --- a/taxid.go +++ b/taxid.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Type of owner referenced. type TaxIDOwnerType string @@ -202,7 +199,7 @@ type TaxID struct { // Two-letter ISO code representing the country of the tax ID. Country string `json:"country"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // ID of the customer. Customer *Customer `json:"customer"` Deleted bool `json:"deleted"` @@ -239,34 +236,11 @@ func (t *TaxID) UnmarshalJSON(data []byte) error { } type taxID TaxID - v := struct { - Created int64 `json:"created"` - *taxID - }{ - taxID: (*taxID)(t), - } + var v taxID if err := json.Unmarshal(data, &v); err != nil { return err } - t.Created = time.Unix(v.Created, 0) + *t = TaxID(v) return nil } - -// MarshalJSON handles serialization of a TaxID. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxID) MarshalJSON() ([]byte, error) { - type taxID TaxID - v := struct { - Created int64 `json:"created"` - taxID - }{ - taxID: (taxID)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/taxrate.go b/taxrate.go index eb7491f1e5..88e54fdae2 100644 --- a/taxrate.go +++ b/taxrate.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The level of the jurisdiction that imposes this tax rate. Will be `null` for manually defined tax rates. type TaxRateJurisdictionLevel string @@ -133,7 +130,7 @@ type TaxRate struct { // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Country string `json:"country"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. Description string `json:"description"` // The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. @@ -185,34 +182,11 @@ func (t *TaxRate) UnmarshalJSON(data []byte) error { } type taxRate TaxRate - v := struct { - Created int64 `json:"created"` - *taxRate - }{ - taxRate: (*taxRate)(t), - } + var v taxRate if err := json.Unmarshal(data, &v); err != nil { return err } - t.Created = time.Unix(v.Created, 0) + *t = TaxRate(v) return nil } - -// MarshalJSON handles serialization of a TaxRate. -// This custom marshaling is needed to handle the time fields correctly. -func (t TaxRate) MarshalJSON() ([]byte, error) { - type taxRate TaxRate - v := struct { - Created int64 `json:"created"` - taxRate - }{ - taxRate: (taxRate)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/terminal_readercollecteddata.go b/terminal_readercollecteddata.go index e778e84243..eeaf2ec889 100644 --- a/terminal_readercollecteddata.go +++ b/terminal_readercollecteddata.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The type of data collected by the reader. type TerminalReaderCollectedDataType string @@ -41,7 +36,7 @@ type TerminalReaderCollectedDataMagstripe struct { type TerminalReaderCollectedData struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -53,39 +48,3 @@ type TerminalReaderCollectedData struct { // The type of data collected by the reader. Type TerminalReaderCollectedDataType `json:"type"` } - -// UnmarshalJSON handles deserialization of a TerminalReaderCollectedData. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TerminalReaderCollectedData) UnmarshalJSON(data []byte) error { - type terminalReaderCollectedData TerminalReaderCollectedData - v := struct { - Created int64 `json:"created"` - *terminalReaderCollectedData - }{ - terminalReaderCollectedData: (*terminalReaderCollectedData)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TerminalReaderCollectedData. -// This custom marshaling is needed to handle the time fields correctly. -func (t TerminalReaderCollectedData) MarshalJSON() ([]byte, error) { - type terminalReaderCollectedData TerminalReaderCollectedData - v := struct { - Created int64 `json:"created"` - terminalReaderCollectedData - }{ - terminalReaderCollectedData: (terminalReaderCollectedData)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/testhelpers_testclock.go b/testhelpers_testclock.go index a661a70342..42fd5d4816 100644 --- a/testhelpers_testclock.go +++ b/testhelpers_testclock.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The status of the Test Clock. type TestHelpersTestClockStatus string @@ -27,7 +24,7 @@ type TestHelpersTestClockParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The initial frozen time for this test clock. - FrozenTime *time.Time `form:"frozen_time"` + FrozenTime *int64 `form:"frozen_time"` // The name for this test clock. Name *string `form:"name"` } @@ -55,7 +52,7 @@ type TestHelpersTestClockAdvanceParams struct { // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // The time to advance the test clock. Must be after the test clock's current frozen time. Cannot be more than two intervals in the future from the shortest subscription in this test clock. If there are no subscriptions in this test clock, it cannot be more than two years in the future. - FrozenTime *time.Time `form:"frozen_time"` + FrozenTime *int64 `form:"frozen_time"` } // AddExpand appends a new field to expand. @@ -65,7 +62,7 @@ func (p *TestHelpersTestClockAdvanceParams) AddExpand(f string) { type TestHelpersTestClockStatusDetailsAdvancing struct { // The `frozen_time` that the Test Clock is advancing towards. - TargetFrozenTime time.Time `json:"target_frozen_time"` + TargetFrozenTime int64 `json:"target_frozen_time"` } type TestHelpersTestClockStatusDetails struct { Advancing *TestHelpersTestClockStatusDetailsAdvancing `json:"advancing"` @@ -77,12 +74,12 @@ type TestHelpersTestClockStatusDetails struct { type TestHelpersTestClock struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` - Deleted bool `json:"deleted"` + Created int64 `json:"created"` + Deleted bool `json:"deleted"` // Time at which this clock is scheduled to auto delete. - DeletesAfter time.Time `json:"deletes_after"` + DeletesAfter int64 `json:"deletes_after"` // Time at which all objects belonging to this clock are frozen. - FrozenTime time.Time `json:"frozen_time"` + FrozenTime int64 `json:"frozen_time"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -113,78 +110,11 @@ func (t *TestHelpersTestClock) UnmarshalJSON(data []byte) error { } type testHelpersTestClock TestHelpersTestClock - v := struct { - Created int64 `json:"created"` - DeletesAfter int64 `json:"deletes_after"` - FrozenTime int64 `json:"frozen_time"` - *testHelpersTestClock - }{ - testHelpersTestClock: (*testHelpersTestClock)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - t.DeletesAfter = time.Unix(v.DeletesAfter, 0) - t.FrozenTime = time.Unix(v.FrozenTime, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TestHelpersTestClockStatusDetailsAdvancing. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TestHelpersTestClockStatusDetailsAdvancing) UnmarshalJSON(data []byte) error { - type testHelpersTestClockStatusDetailsAdvancing TestHelpersTestClockStatusDetailsAdvancing - v := struct { - TargetFrozenTime int64 `json:"target_frozen_time"` - *testHelpersTestClockStatusDetailsAdvancing - }{ - testHelpersTestClockStatusDetailsAdvancing: (*testHelpersTestClockStatusDetailsAdvancing)(t), - } + var v testHelpersTestClock if err := json.Unmarshal(data, &v); err != nil { return err } - t.TargetFrozenTime = time.Unix(v.TargetFrozenTime, 0) + *t = TestHelpersTestClock(v) return nil } - -// MarshalJSON handles serialization of a TestHelpersTestClockStatusDetailsAdvancing. -// This custom marshaling is needed to handle the time fields correctly. -func (t TestHelpersTestClockStatusDetailsAdvancing) MarshalJSON() ([]byte, error) { - type testHelpersTestClockStatusDetailsAdvancing TestHelpersTestClockStatusDetailsAdvancing - v := struct { - TargetFrozenTime int64 `json:"target_frozen_time"` - testHelpersTestClockStatusDetailsAdvancing - }{ - testHelpersTestClockStatusDetailsAdvancing: (testHelpersTestClockStatusDetailsAdvancing)(t), - TargetFrozenTime: t.TargetFrozenTime.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TestHelpersTestClock. -// This custom marshaling is needed to handle the time fields correctly. -func (t TestHelpersTestClock) MarshalJSON() ([]byte, error) { - type testHelpersTestClock TestHelpersTestClock - v := struct { - Created int64 `json:"created"` - DeletesAfter int64 `json:"deletes_after"` - FrozenTime int64 `json:"frozen_time"` - testHelpersTestClock - }{ - testHelpersTestClock: (testHelpersTestClock)(t), - Created: t.Created.Unix(), - DeletesAfter: t.DeletesAfter.Unix(), - FrozenTime: t.FrozenTime.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/testhelpersissuing_authorization.go b/testhelpersissuing_authorization.go index dcd5386200..e746046a50 100644 --- a/testhelpersissuing_authorization.go +++ b/testhelpersissuing_authorization.go @@ -6,8 +6,6 @@ package stripe -import "time" - // Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). type TestHelpersIssuingAuthorizationAmountDetailsParams struct { // The ATM withdrawal fee. @@ -259,7 +257,7 @@ type TestHelpersIssuingAuthorizationCapturePurchaseDetailsFlightSegmentParams st // Information about the flight that was purchased with this transaction. type TestHelpersIssuingAuthorizationCapturePurchaseDetailsFlightParams struct { // The time that the flight departed. - DepartureAt *time.Time `form:"departure_at"` + DepartureAt *int64 `form:"departure_at"` // The name of the passenger. PassengerName *string `form:"passenger_name"` // Whether the ticket is refundable. @@ -287,7 +285,7 @@ type TestHelpersIssuingAuthorizationCapturePurchaseDetailsFuelParams struct { // Information about lodging that was purchased with this transaction. type TestHelpersIssuingAuthorizationCapturePurchaseDetailsLodgingParams struct { // The time of checking into the lodging. - CheckInAt *time.Time `form:"check_in_at"` + CheckInAt *int64 `form:"check_in_at"` // The number of nights stayed at the lodging. Nights *int64 `form:"nights"` } diff --git a/testhelpersissuing_transaction.go b/testhelpersissuing_transaction.go index 8133776e8f..e7ca05a189 100644 --- a/testhelpersissuing_transaction.go +++ b/testhelpersissuing_transaction.go @@ -6,8 +6,6 @@ package stripe -import "time" - // Refund a test-mode Transaction. type TestHelpersIssuingTransactionRefundParams struct { Params `form:"*"` @@ -119,7 +117,7 @@ type TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsFlightSegment // Information about the flight that was purchased with this transaction. type TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsFlightParams struct { // The time that the flight departed. - DepartureAt *time.Time `form:"departure_at"` + DepartureAt *int64 `form:"departure_at"` // The name of the passenger. PassengerName *string `form:"passenger_name"` // Whether the ticket is refundable. @@ -147,7 +145,7 @@ type TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsFuelParams st // Information about lodging that was purchased with this transaction. type TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsLodgingParams struct { // The time of checking into the lodging. - CheckInAt *time.Time `form:"check_in_at"` + CheckInAt *int64 `form:"check_in_at"` // The number of nights stayed at the lodging. Nights *int64 `form:"nights"` } @@ -295,7 +293,7 @@ type TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsFlightSegme // Information about the flight that was purchased with this transaction. type TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsFlightParams struct { // The time that the flight departed. - DepartureAt *time.Time `form:"departure_at"` + DepartureAt *int64 `form:"departure_at"` // The name of the passenger. PassengerName *string `form:"passenger_name"` // Whether the ticket is refundable. @@ -323,7 +321,7 @@ type TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsFuelParams // Information about lodging that was purchased with this transaction. type TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsLodgingParams struct { // The time of checking into the lodging. - CheckInAt *time.Time `form:"check_in_at"` + CheckInAt *int64 `form:"check_in_at"` // The number of nights stayed at the lodging. Nights *int64 `form:"nights"` } diff --git a/token.go b/token.go index 1ac1300449..42043b1c80 100644 --- a/token.go +++ b/token.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Type of the token: `account`, `bank_account`, `card`, or `pii`. type TokenType string @@ -112,7 +107,7 @@ type Token struct { // IP address of the client that generates the token. ClientIP string `json:"client_ip"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Unique identifier for the object. ID string `json:"id"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -124,39 +119,3 @@ type Token struct { // Determines if you have already used this token (you can only use tokens once). Used bool `json:"used"` } - -// UnmarshalJSON handles deserialization of a Token. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *Token) UnmarshalJSON(data []byte) error { - type token Token - v := struct { - Created int64 `json:"created"` - *token - }{ - token: (*token)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a Token. -// This custom marshaling is needed to handle the time fields correctly. -func (t Token) MarshalJSON() ([]byte, error) { - type token Token - v := struct { - Created int64 `json:"created"` - token - }{ - token: (token)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/topup.go b/topup.go index 5530fde2f2..49eed390c9 100644 --- a/topup.go +++ b/topup.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The status of the top-up is either `canceled`, `failed`, `pending`, `reversed`, or `succeeded`. type TopupStatus string @@ -92,13 +89,13 @@ type Topup struct { // ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` // Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up. - ExpectedAvailabilityDate time.Time `json:"expected_availability_date"` + ExpectedAvailabilityDate int64 `json:"expected_availability_date"` // Error code explaining reason for top-up failure if available (see [the errors section](https://stripe.com/docs/api#errors) for a list of codes). FailureCode string `json:"failure_code"` // Message to user further explaining reason for top-up failure if available. @@ -141,38 +138,11 @@ func (t *Topup) UnmarshalJSON(data []byte) error { } type topup Topup - v := struct { - Created int64 `json:"created"` - ExpectedAvailabilityDate int64 `json:"expected_availability_date"` - *topup - }{ - topup: (*topup)(t), - } + var v topup if err := json.Unmarshal(data, &v); err != nil { return err } - t.Created = time.Unix(v.Created, 0) - t.ExpectedAvailabilityDate = time.Unix(v.ExpectedAvailabilityDate, 0) + *t = Topup(v) return nil } - -// MarshalJSON handles serialization of a Topup. -// This custom marshaling is needed to handle the time fields correctly. -func (t Topup) MarshalJSON() ([]byte, error) { - type topup Topup - v := struct { - Created int64 `json:"created"` - ExpectedAvailabilityDate int64 `json:"expected_availability_date"` - topup - }{ - topup: (topup)(t), - Created: t.Created.Unix(), - ExpectedAvailabilityDate: t.ExpectedAvailabilityDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/transfer.go b/transfer.go index c3d2d75d84..ebc2a92ae7 100644 --- a/transfer.go +++ b/transfer.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // The source balance this transfer came from. One of `card`, `fpx`, or `bank_account`. type TransferSourceType string @@ -97,7 +94,7 @@ type Transfer struct { // Balance transaction that describes the impact of this transfer on your account balance. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time that this record of the transfer was first created. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -143,34 +140,11 @@ func (t *Transfer) UnmarshalJSON(data []byte) error { } type transfer Transfer - v := struct { - Created int64 `json:"created"` - *transfer - }{ - transfer: (*transfer)(t), - } + var v transfer if err := json.Unmarshal(data, &v); err != nil { return err } - t.Created = time.Unix(v.Created, 0) + *t = Transfer(v) return nil } - -// MarshalJSON handles serialization of a Transfer. -// This custom marshaling is needed to handle the time fields correctly. -func (t Transfer) MarshalJSON() ([]byte, error) { - type transfer Transfer - v := struct { - Created int64 `json:"created"` - transfer - }{ - transfer: (transfer)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/transferreversal.go b/transferreversal.go index d38b79e84f..9ebd7f44fb 100644 --- a/transferreversal.go +++ b/transferreversal.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. type TransferReversalListParams struct { @@ -78,7 +75,7 @@ type TransferReversal struct { // Balance transaction that describes the impact on your account balance. BalanceTransaction *BalanceTransaction `json:"balance_transaction"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // Linked payment refund for the transfer reversal. @@ -112,34 +109,11 @@ func (t *TransferReversal) UnmarshalJSON(data []byte) error { } type transferReversal TransferReversal - v := struct { - Created int64 `json:"created"` - *transferReversal - }{ - transferReversal: (*transferReversal)(t), - } + var v transferReversal if err := json.Unmarshal(data, &v); err != nil { return err } - t.Created = time.Unix(v.Created, 0) + *t = TransferReversal(v) return nil } - -// MarshalJSON handles serialization of a TransferReversal. -// This custom marshaling is needed to handle the time fields correctly. -func (t TransferReversal) MarshalJSON() ([]byte, error) { - type transferReversal TransferReversal - v := struct { - Created int64 `json:"created"` - transferReversal - }{ - transferReversal: (transferReversal)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index 29a8328542..0f64913831 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The rails used to reverse the funds. type TreasuryCreditReversalNetwork string @@ -75,7 +70,7 @@ func (p *TreasuryCreditReversalParams) AddMetadata(key string, value string) { type TreasuryCreditReversalStatusTransitions struct { // Timestamp describing when the CreditReversal changed status to `posted` - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` } // You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. @@ -84,7 +79,7 @@ type TreasuryCreditReversal struct { // Amount (in cents) transferred. Amount int64 `json:"amount"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. @@ -116,75 +111,3 @@ type TreasuryCreditReversalList struct { ListMeta Data []*TreasuryCreditReversal `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryCreditReversalStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryCreditReversalStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryCreditReversalStatusTransitions TreasuryCreditReversalStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - *treasuryCreditReversalStatusTransitions - }{ - treasuryCreditReversalStatusTransitions: (*treasuryCreditReversalStatusTransitions)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.PostedAt = time.Unix(v.PostedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryCreditReversal. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryCreditReversal) UnmarshalJSON(data []byte) error { - type treasuryCreditReversal TreasuryCreditReversal - v := struct { - Created int64 `json:"created"` - *treasuryCreditReversal - }{ - treasuryCreditReversal: (*treasuryCreditReversal)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryCreditReversalStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryCreditReversalStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryCreditReversalStatusTransitions TreasuryCreditReversalStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - treasuryCreditReversalStatusTransitions - }{ - treasuryCreditReversalStatusTransitions: (treasuryCreditReversalStatusTransitions)(t), - PostedAt: t.PostedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryCreditReversal. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryCreditReversal) MarshalJSON() ([]byte, error) { - type treasuryCreditReversal TreasuryCreditReversal - v := struct { - Created int64 `json:"created"` - treasuryCreditReversal - }{ - treasuryCreditReversal: (treasuryCreditReversal)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index 593bcaad8f..0452bf9b9e 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The rails used to reverse the funds. type TreasuryDebitReversalNetwork string @@ -82,7 +77,7 @@ type TreasuryDebitReversalLinkedFlows struct { } type TreasuryDebitReversalStatusTransitions struct { // Timestamp describing when the DebitReversal changed status to `completed`. - CompletedAt time.Time `json:"completed_at"` + CompletedAt int64 `json:"completed_at"` } // You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. @@ -91,7 +86,7 @@ type TreasuryDebitReversal struct { // Amount (in cents) transferred. Amount int64 `json:"amount"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. @@ -125,75 +120,3 @@ type TreasuryDebitReversalList struct { ListMeta Data []*TreasuryDebitReversal `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryDebitReversalStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryDebitReversalStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryDebitReversalStatusTransitions TreasuryDebitReversalStatusTransitions - v := struct { - CompletedAt int64 `json:"completed_at"` - *treasuryDebitReversalStatusTransitions - }{ - treasuryDebitReversalStatusTransitions: (*treasuryDebitReversalStatusTransitions)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.CompletedAt = time.Unix(v.CompletedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryDebitReversal. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryDebitReversal) UnmarshalJSON(data []byte) error { - type treasuryDebitReversal TreasuryDebitReversal - v := struct { - Created int64 `json:"created"` - *treasuryDebitReversal - }{ - treasuryDebitReversal: (*treasuryDebitReversal)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryDebitReversalStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryDebitReversalStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryDebitReversalStatusTransitions TreasuryDebitReversalStatusTransitions - v := struct { - CompletedAt int64 `json:"completed_at"` - treasuryDebitReversalStatusTransitions - }{ - treasuryDebitReversalStatusTransitions: (treasuryDebitReversalStatusTransitions)(t), - CompletedAt: t.CompletedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryDebitReversal. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryDebitReversal) MarshalJSON() ([]byte, error) { - type treasuryDebitReversal TreasuryDebitReversal - v := struct { - Created int64 `json:"created"` - treasuryDebitReversal - }{ - treasuryDebitReversal: (treasuryDebitReversal)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index aa164d38f9..8a0c89d102 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The array of paths to active Features in the Features hash. type TreasuryFinancialAccountActiveFeature string @@ -499,7 +494,7 @@ type TreasuryFinancialAccount struct { // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Country string `json:"country"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // The display name for the FinancialAccount. Use this field to customize the names of the FinancialAccounts for your connected accounts. Unlike the `nickname` field, `display_name` is not internal metadata and will be exposed to connected accounts. DisplayName string `json:"display_name"` // Encodes whether a FinancialAccount has access to a particular Feature, with a `status` enum and associated `status_details`. @@ -537,39 +532,3 @@ type TreasuryFinancialAccountList struct { ListMeta Data []*TreasuryFinancialAccount `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryFinancialAccount. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryFinancialAccount) UnmarshalJSON(data []byte) error { - type treasuryFinancialAccount TreasuryFinancialAccount - v := struct { - Created int64 `json:"created"` - *treasuryFinancialAccount - }{ - treasuryFinancialAccount: (*treasuryFinancialAccount)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryFinancialAccount. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryFinancialAccount) MarshalJSON() ([]byte, error) { - type treasuryFinancialAccount TreasuryFinancialAccount - v := struct { - Created int64 `json:"created"` - treasuryFinancialAccount - }{ - treasuryFinancialAccount: (treasuryFinancialAccount)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index 1fa41f0b5c..dee382b727 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Reason for the failure. type TreasuryInboundTransferFailureDetailsCode string @@ -183,11 +178,11 @@ type TreasuryInboundTransferOriginPaymentMethodDetails struct { } type TreasuryInboundTransferStatusTransitions struct { // Timestamp describing when an InboundTransfer changed status to `canceled`. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Timestamp describing when an InboundTransfer changed status to `failed`. - FailedAt time.Time `json:"failed_at"` + FailedAt int64 `json:"failed_at"` // Timestamp describing when an InboundTransfer changed status to `succeeded`. - SucceededAt time.Time `json:"succeeded_at"` + SucceededAt int64 `json:"succeeded_at"` } // Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. @@ -200,7 +195,7 @@ type TreasuryInboundTransfer struct { // Returns `true` if the InboundTransfer is able to be canceled. Cancelable bool `json:"cancelable"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -241,83 +236,3 @@ type TreasuryInboundTransferList struct { ListMeta Data []*TreasuryInboundTransfer `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryInboundTransferStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryInboundTransferStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryInboundTransferStatusTransitions TreasuryInboundTransferStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - SucceededAt int64 `json:"succeeded_at"` - *treasuryInboundTransferStatusTransitions - }{ - treasuryInboundTransferStatusTransitions: (*treasuryInboundTransferStatusTransitions)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.CanceledAt = time.Unix(v.CanceledAt, 0) - t.FailedAt = time.Unix(v.FailedAt, 0) - t.SucceededAt = time.Unix(v.SucceededAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryInboundTransfer. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryInboundTransfer) UnmarshalJSON(data []byte) error { - type treasuryInboundTransfer TreasuryInboundTransfer - v := struct { - Created int64 `json:"created"` - *treasuryInboundTransfer - }{ - treasuryInboundTransfer: (*treasuryInboundTransfer)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryInboundTransferStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryInboundTransferStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryInboundTransferStatusTransitions TreasuryInboundTransferStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - SucceededAt int64 `json:"succeeded_at"` - treasuryInboundTransferStatusTransitions - }{ - treasuryInboundTransferStatusTransitions: (treasuryInboundTransferStatusTransitions)(t), - CanceledAt: t.CanceledAt.Unix(), - FailedAt: t.FailedAt.Unix(), - SucceededAt: t.SucceededAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryInboundTransfer. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryInboundTransfer) MarshalJSON() ([]byte, error) { - type treasuryInboundTransfer TreasuryInboundTransfer - v := struct { - Created int64 `json:"created"` - treasuryInboundTransfer - }{ - treasuryInboundTransfer: (treasuryInboundTransfer)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index ecc60a41b6..ea2424fe74 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The rails used to send funds. type TreasuryOutboundPaymentDestinationPaymentMethodDetailsFinancialAccountNetwork string @@ -297,13 +292,13 @@ type TreasuryOutboundPaymentReturnedDetails struct { } type TreasuryOutboundPaymentStatusTransitions struct { // Timestamp describing when an OutboundPayment changed status to `canceled`. - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Timestamp describing when an OutboundPayment changed status to `failed`. - FailedAt time.Time `json:"failed_at"` + FailedAt int64 `json:"failed_at"` // Timestamp describing when an OutboundPayment changed status to `posted`. - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` // Timestamp describing when an OutboundPayment changed status to `returned`. - ReturnedAt time.Time `json:"returned_at"` + ReturnedAt int64 `json:"returned_at"` } type TreasuryOutboundPaymentTrackingDetailsACH struct { // ACH trace ID of the OutboundPayment for payments sent over the `ach` network. @@ -338,7 +333,7 @@ type TreasuryOutboundPayment struct { // Returns `true` if the object can be canceled, and `false` otherwise. Cancelable bool `json:"cancelable"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // ID of the [customer](https://stripe.com/docs/api/customers) to whom an OutboundPayment is sent. @@ -352,7 +347,7 @@ type TreasuryOutboundPayment struct { // Details about the end user. EndUserDetails *TreasuryOutboundPaymentEndUserDetails `json:"end_user_details"` // The date when funds are expected to arrive in the destination account. - ExpectedArrivalDate time.Time `json:"expected_arrival_date"` + ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. @@ -384,91 +379,3 @@ type TreasuryOutboundPaymentList struct { ListMeta Data []*TreasuryOutboundPayment `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryOutboundPaymentStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryOutboundPaymentStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryOutboundPaymentStatusTransitions TreasuryOutboundPaymentStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - PostedAt int64 `json:"posted_at"` - ReturnedAt int64 `json:"returned_at"` - *treasuryOutboundPaymentStatusTransitions - }{ - treasuryOutboundPaymentStatusTransitions: (*treasuryOutboundPaymentStatusTransitions)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.CanceledAt = time.Unix(v.CanceledAt, 0) - t.FailedAt = time.Unix(v.FailedAt, 0) - t.PostedAt = time.Unix(v.PostedAt, 0) - t.ReturnedAt = time.Unix(v.ReturnedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryOutboundPayment. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryOutboundPayment) UnmarshalJSON(data []byte) error { - type treasuryOutboundPayment TreasuryOutboundPayment - v := struct { - Created int64 `json:"created"` - ExpectedArrivalDate int64 `json:"expected_arrival_date"` - *treasuryOutboundPayment - }{ - treasuryOutboundPayment: (*treasuryOutboundPayment)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - t.ExpectedArrivalDate = time.Unix(v.ExpectedArrivalDate, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryOutboundPaymentStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryOutboundPaymentStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryOutboundPaymentStatusTransitions TreasuryOutboundPaymentStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - PostedAt int64 `json:"posted_at"` - ReturnedAt int64 `json:"returned_at"` - treasuryOutboundPaymentStatusTransitions - }{ - treasuryOutboundPaymentStatusTransitions: (treasuryOutboundPaymentStatusTransitions)(t), - CanceledAt: t.CanceledAt.Unix(), - FailedAt: t.FailedAt.Unix(), - PostedAt: t.PostedAt.Unix(), - ReturnedAt: t.ReturnedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryOutboundPayment. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryOutboundPayment) MarshalJSON() ([]byte, error) { - type treasuryOutboundPayment TreasuryOutboundPayment - v := struct { - Created int64 `json:"created"` - ExpectedArrivalDate int64 `json:"expected_arrival_date"` - treasuryOutboundPayment - }{ - treasuryOutboundPayment: (treasuryOutboundPayment)(t), - Created: t.Created.Unix(), - ExpectedArrivalDate: t.ExpectedArrivalDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index b9609b0241..c531bc125e 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // The rails used to send funds. type TreasuryOutboundTransferDestinationPaymentMethodDetailsFinancialAccountNetwork string @@ -266,13 +261,13 @@ type TreasuryOutboundTransferReturnedDetails struct { } type TreasuryOutboundTransferStatusTransitions struct { // Timestamp describing when an OutboundTransfer changed status to `canceled` - CanceledAt time.Time `json:"canceled_at"` + CanceledAt int64 `json:"canceled_at"` // Timestamp describing when an OutboundTransfer changed status to `failed` - FailedAt time.Time `json:"failed_at"` + FailedAt int64 `json:"failed_at"` // Timestamp describing when an OutboundTransfer changed status to `posted` - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` // Timestamp describing when an OutboundTransfer changed status to `returned` - ReturnedAt time.Time `json:"returned_at"` + ReturnedAt int64 `json:"returned_at"` } type TreasuryOutboundTransferTrackingDetailsACH struct { // ACH trace ID of the OutboundTransfer for transfers sent over the `ach` network. @@ -307,7 +302,7 @@ type TreasuryOutboundTransfer struct { // Returns `true` if the object can be canceled, and `false` otherwise. Cancelable bool `json:"cancelable"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -316,7 +311,7 @@ type TreasuryOutboundTransfer struct { DestinationPaymentMethod string `json:"destination_payment_method"` DestinationPaymentMethodDetails *TreasuryOutboundTransferDestinationPaymentMethodDetails `json:"destination_payment_method_details"` // The date when funds are expected to arrive in the destination account. - ExpectedArrivalDate time.Time `json:"expected_arrival_date"` + ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. @@ -350,91 +345,3 @@ type TreasuryOutboundTransferList struct { ListMeta Data []*TreasuryOutboundTransfer `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryOutboundTransferStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryOutboundTransferStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryOutboundTransferStatusTransitions TreasuryOutboundTransferStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - PostedAt int64 `json:"posted_at"` - ReturnedAt int64 `json:"returned_at"` - *treasuryOutboundTransferStatusTransitions - }{ - treasuryOutboundTransferStatusTransitions: (*treasuryOutboundTransferStatusTransitions)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.CanceledAt = time.Unix(v.CanceledAt, 0) - t.FailedAt = time.Unix(v.FailedAt, 0) - t.PostedAt = time.Unix(v.PostedAt, 0) - t.ReturnedAt = time.Unix(v.ReturnedAt, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryOutboundTransfer. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryOutboundTransfer) UnmarshalJSON(data []byte) error { - type treasuryOutboundTransfer TreasuryOutboundTransfer - v := struct { - Created int64 `json:"created"` - ExpectedArrivalDate int64 `json:"expected_arrival_date"` - *treasuryOutboundTransfer - }{ - treasuryOutboundTransfer: (*treasuryOutboundTransfer)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - t.ExpectedArrivalDate = time.Unix(v.ExpectedArrivalDate, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryOutboundTransferStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryOutboundTransferStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryOutboundTransferStatusTransitions TreasuryOutboundTransferStatusTransitions - v := struct { - CanceledAt int64 `json:"canceled_at"` - FailedAt int64 `json:"failed_at"` - PostedAt int64 `json:"posted_at"` - ReturnedAt int64 `json:"returned_at"` - treasuryOutboundTransferStatusTransitions - }{ - treasuryOutboundTransferStatusTransitions: (treasuryOutboundTransferStatusTransitions)(t), - CanceledAt: t.CanceledAt.Unix(), - FailedAt: t.FailedAt.Unix(), - PostedAt: t.PostedAt.Unix(), - ReturnedAt: t.ReturnedAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryOutboundTransfer. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryOutboundTransfer) MarshalJSON() ([]byte, error) { - type treasuryOutboundTransfer TreasuryOutboundTransfer - v := struct { - Created int64 `json:"created"` - ExpectedArrivalDate int64 `json:"expected_arrival_date"` - treasuryOutboundTransfer - }{ - treasuryOutboundTransfer: (treasuryOutboundTransfer)(t), - Created: t.Created.Unix(), - ExpectedArrivalDate: t.ExpectedArrivalDate.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 54f7a50d1e..ce17fa593f 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen. type TreasuryReceivedCreditFailureCode string @@ -231,7 +226,7 @@ type TreasuryReceivedCreditNetworkDetails struct { // Details describing when a ReceivedCredit may be reversed. type TreasuryReceivedCreditReversalDetails struct { // Time before which a ReceivedCredit can be reversed. - Deadline time.Time `json:"deadline"` + Deadline int64 `json:"deadline"` // Set if a ReceivedCredit cannot be reversed. RestrictedReason TreasuryReceivedCreditReversalDetailsRestrictedReason `json:"restricted_reason"` } @@ -242,7 +237,7 @@ type TreasuryReceivedCredit struct { // Amount (in cents) transferred. Amount int64 `json:"amount"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -279,75 +274,3 @@ type TreasuryReceivedCreditList struct { ListMeta Data []*TreasuryReceivedCredit `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryReceivedCreditReversalDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryReceivedCreditReversalDetails) UnmarshalJSON(data []byte) error { - type treasuryReceivedCreditReversalDetails TreasuryReceivedCreditReversalDetails - v := struct { - Deadline int64 `json:"deadline"` - *treasuryReceivedCreditReversalDetails - }{ - treasuryReceivedCreditReversalDetails: (*treasuryReceivedCreditReversalDetails)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Deadline = time.Unix(v.Deadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryReceivedCredit. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryReceivedCredit) UnmarshalJSON(data []byte) error { - type treasuryReceivedCredit TreasuryReceivedCredit - v := struct { - Created int64 `json:"created"` - *treasuryReceivedCredit - }{ - treasuryReceivedCredit: (*treasuryReceivedCredit)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryReceivedCreditReversalDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryReceivedCreditReversalDetails) MarshalJSON() ([]byte, error) { - type treasuryReceivedCreditReversalDetails TreasuryReceivedCreditReversalDetails - v := struct { - Deadline int64 `json:"deadline"` - treasuryReceivedCreditReversalDetails - }{ - treasuryReceivedCreditReversalDetails: (treasuryReceivedCreditReversalDetails)(t), - Deadline: t.Deadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryReceivedCredit. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryReceivedCredit) MarshalJSON() ([]byte, error) { - type treasuryReceivedCredit TreasuryReceivedCredit - v := struct { - Created int64 `json:"created"` - treasuryReceivedCredit - }{ - treasuryReceivedCredit: (treasuryReceivedCredit)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 646bb5d6b9..98baa98b74 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Reason for the failure. A ReceivedDebit might fail because the FinancialAccount doesn't have sufficient funds, is closed, or is frozen. type TreasuryReceivedDebitFailureCode string @@ -182,7 +177,7 @@ type TreasuryReceivedDebitNetworkDetails struct { // Details describing when a ReceivedDebit might be reversed. type TreasuryReceivedDebitReversalDetails struct { // Time before which a ReceivedDebit can be reversed. - Deadline time.Time `json:"deadline"` + Deadline int64 `json:"deadline"` // Set if a ReceivedDebit can't be reversed. RestrictedReason TreasuryReceivedDebitReversalDetailsRestrictedReason `json:"restricted_reason"` } @@ -193,7 +188,7 @@ type TreasuryReceivedDebit struct { // Amount (in cents) transferred. Amount int64 `json:"amount"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -230,75 +225,3 @@ type TreasuryReceivedDebitList struct { ListMeta Data []*TreasuryReceivedDebit `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryReceivedDebitReversalDetails. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryReceivedDebitReversalDetails) UnmarshalJSON(data []byte) error { - type treasuryReceivedDebitReversalDetails TreasuryReceivedDebitReversalDetails - v := struct { - Deadline int64 `json:"deadline"` - *treasuryReceivedDebitReversalDetails - }{ - treasuryReceivedDebitReversalDetails: (*treasuryReceivedDebitReversalDetails)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Deadline = time.Unix(v.Deadline, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryReceivedDebit. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryReceivedDebit) UnmarshalJSON(data []byte) error { - type treasuryReceivedDebit TreasuryReceivedDebit - v := struct { - Created int64 `json:"created"` - *treasuryReceivedDebit - }{ - treasuryReceivedDebit: (*treasuryReceivedDebit)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryReceivedDebitReversalDetails. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryReceivedDebitReversalDetails) MarshalJSON() ([]byte, error) { - type treasuryReceivedDebitReversalDetails TreasuryReceivedDebitReversalDetails - v := struct { - Deadline int64 `json:"deadline"` - treasuryReceivedDebitReversalDetails - }{ - treasuryReceivedDebitReversalDetails: (treasuryReceivedDebitReversalDetails)(t), - Deadline: t.Deadline.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryReceivedDebit. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryReceivedDebit) MarshalJSON() ([]byte, error) { - type treasuryReceivedDebit TreasuryReceivedDebit - v := struct { - Created int64 `json:"created"` - treasuryReceivedDebit - }{ - treasuryReceivedDebit: (treasuryReceivedDebit)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_transaction.go b/treasury_transaction.go index d0182abc8b..e122f56bdd 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -6,10 +6,7 @@ package stripe -import ( - "encoding/json" - "time" -) +import "encoding/json" // Type of the flow that created the Transaction. Set to the same value as `flow_type`. type TreasuryTransactionFlowDetailsType string @@ -144,9 +141,9 @@ type TreasuryTransactionFlowDetails struct { } type TreasuryTransactionStatusTransitions struct { // Timestamp describing when the Transaction changed status to `posted`. - PostedAt time.Time `json:"posted_at"` + PostedAt int64 `json:"posted_at"` // Timestamp describing when the Transaction changed status to `void`. - VoidAt time.Time `json:"void_at"` + VoidAt int64 `json:"void_at"` } // Transactions represent changes to a [FinancialAccount's](https://stripe.com/docs/api#financial_accounts) balance. @@ -157,7 +154,7 @@ type TreasuryTransaction struct { // Change to a FinancialAccount's balance BalanceImpact *TreasuryTransactionBalanceImpact `json:"balance_impact"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -200,74 +197,11 @@ func (t *TreasuryTransaction) UnmarshalJSON(data []byte) error { } type treasuryTransaction TreasuryTransaction - v := struct { - Created int64 `json:"created"` - *treasuryTransaction - }{ - treasuryTransaction: (*treasuryTransaction)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - return nil -} - -// UnmarshalJSON handles deserialization of a TreasuryTransactionStatusTransitions. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryTransactionStatusTransitions) UnmarshalJSON(data []byte) error { - type treasuryTransactionStatusTransitions TreasuryTransactionStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - VoidAt int64 `json:"void_at"` - *treasuryTransactionStatusTransitions - }{ - treasuryTransactionStatusTransitions: (*treasuryTransactionStatusTransitions)(t), - } + var v treasuryTransaction if err := json.Unmarshal(data, &v); err != nil { return err } - t.PostedAt = time.Unix(v.PostedAt, 0) - t.VoidAt = time.Unix(v.VoidAt, 0) + *t = TreasuryTransaction(v) return nil } - -// MarshalJSON handles serialization of a TreasuryTransactionStatusTransitions. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryTransactionStatusTransitions) MarshalJSON() ([]byte, error) { - type treasuryTransactionStatusTransitions TreasuryTransactionStatusTransitions - v := struct { - PostedAt int64 `json:"posted_at"` - VoidAt int64 `json:"void_at"` - treasuryTransactionStatusTransitions - }{ - treasuryTransactionStatusTransitions: (treasuryTransactionStatusTransitions)(t), - PostedAt: t.PostedAt.Unix(), - VoidAt: t.VoidAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} - -// MarshalJSON handles serialization of a TreasuryTransaction. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryTransaction) MarshalJSON() ([]byte, error) { - type treasuryTransaction TreasuryTransaction - v := struct { - Created int64 `json:"created"` - treasuryTransaction - }{ - treasuryTransaction: (treasuryTransaction)(t), - Created: t.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index e11d39bf30..c65e1645e0 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // Type of the flow that created the Transaction. Set to the same value as `flow_type`. type TreasuryTransactionEntryFlowDetailsType string @@ -158,11 +153,11 @@ type TreasuryTransactionEntry struct { // Change to a FinancialAccount's balance BalanceImpact *TreasuryTransactionEntryBalanceImpact `json:"balance_impact"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` + Created int64 `json:"created"` // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Currency Currency `json:"currency"` // When the TransactionEntry will impact the FinancialAccount's balance. - EffectiveAt time.Time `json:"effective_at"` + EffectiveAt int64 `json:"effective_at"` // The FinancialAccount associated with this object. FinancialAccount string `json:"financial_account"` // Token of the flow associated with the TransactionEntry. @@ -189,43 +184,3 @@ type TreasuryTransactionEntryList struct { ListMeta Data []*TreasuryTransactionEntry `json:"data"` } - -// UnmarshalJSON handles deserialization of a TreasuryTransactionEntry. -// This custom unmarshaling is needed to handle the time fields correctly. -func (t *TreasuryTransactionEntry) UnmarshalJSON(data []byte) error { - type treasuryTransactionEntry TreasuryTransactionEntry - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - *treasuryTransactionEntry - }{ - treasuryTransactionEntry: (*treasuryTransactionEntry)(t), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - t.Created = time.Unix(v.Created, 0) - t.EffectiveAt = time.Unix(v.EffectiveAt, 0) - return nil -} - -// MarshalJSON handles serialization of a TreasuryTransactionEntry. -// This custom marshaling is needed to handle the time fields correctly. -func (t TreasuryTransactionEntry) MarshalJSON() ([]byte, error) { - type treasuryTransactionEntry TreasuryTransactionEntry - v := struct { - Created int64 `json:"created"` - EffectiveAt int64 `json:"effective_at"` - treasuryTransactionEntry - }{ - treasuryTransactionEntry: (treasuryTransactionEntry)(t), - Created: t.Created.Unix(), - EffectiveAt: t.EffectiveAt.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} diff --git a/usagerecord.go b/usagerecord.go index b5776fd15c..482f19307e 100644 --- a/usagerecord.go +++ b/usagerecord.go @@ -6,11 +6,7 @@ package stripe -import ( - "encoding/json" - "github.com/stripe/stripe-go/v81/form" - "time" -) +import "github.com/stripe/stripe-go/v81/form" // Possible values for the action parameter on usage record creation. const ( @@ -35,8 +31,8 @@ type UsageRecordParams struct { // The usage quantity for the specified timestamp. Quantity *int64 `form:"quantity"` // The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`, and must not be in the future. When passing `"now"`, Stripe records usage for the current time. Default is `"now"` if a value is not provided. - Timestamp *time.Time `form:"timestamp"` - TimestampNow *bool `form:"-"` // See custom AppendTo + Timestamp *int64 `form:"timestamp"` + TimestampNow *bool `form:"-"` // See custom AppendTo } // AddExpand appends a new field to expand. @@ -70,41 +66,5 @@ type UsageRecord struct { // The ID of the subscription item this usage record contains data for. SubscriptionItem string `json:"subscription_item"` // The timestamp when this usage occurred. - Timestamp time.Time `json:"timestamp"` -} - -// UnmarshalJSON handles deserialization of an UsageRecord. -// This custom unmarshaling is needed to handle the time fields correctly. -func (u *UsageRecord) UnmarshalJSON(data []byte) error { - type usageRecord UsageRecord - v := struct { - Timestamp int64 `json:"timestamp"` - *usageRecord - }{ - usageRecord: (*usageRecord)(u), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - u.Timestamp = time.Unix(v.Timestamp, 0) - return nil -} - -// MarshalJSON handles serialization of an UsageRecord. -// This custom marshaling is needed to handle the time fields correctly. -func (u UsageRecord) MarshalJSON() ([]byte, error) { - type usageRecord UsageRecord - v := struct { - Timestamp int64 `json:"timestamp"` - usageRecord - }{ - usageRecord: (usageRecord)(u), - Timestamp: u.Timestamp.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err + Timestamp int64 `json:"timestamp"` } diff --git a/webhookendpoint.go b/webhookendpoint.go index ae6af611f4..70b8d403f5 100644 --- a/webhookendpoint.go +++ b/webhookendpoint.go @@ -6,11 +6,6 @@ package stripe -import ( - "encoding/json" - "time" -) - // You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard. type WebhookEndpointParams struct { Params `form:"*"` @@ -74,8 +69,8 @@ type WebhookEndpoint struct { // The ID of the associated Connect application. Application string `json:"application"` // Time at which the object was created. Measured in seconds since the Unix epoch. - Created time.Time `json:"created"` - Deleted bool `json:"deleted"` + Created int64 `json:"created"` + Deleted bool `json:"deleted"` // An optional description of what the webhook is used for. Description string `json:"description"` // The list of events to enable for this endpoint. `['*']` indicates that all events are enabled, except those that require explicit selection. @@ -102,39 +97,3 @@ type WebhookEndpointList struct { ListMeta Data []*WebhookEndpoint `json:"data"` } - -// UnmarshalJSON handles deserialization of a WebhookEndpoint. -// This custom unmarshaling is needed to handle the time fields correctly. -func (w *WebhookEndpoint) UnmarshalJSON(data []byte) error { - type webhookEndpoint WebhookEndpoint - v := struct { - Created int64 `json:"created"` - *webhookEndpoint - }{ - webhookEndpoint: (*webhookEndpoint)(w), - } - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - w.Created = time.Unix(v.Created, 0) - return nil -} - -// MarshalJSON handles serialization of a WebhookEndpoint. -// This custom marshaling is needed to handle the time fields correctly. -func (w WebhookEndpoint) MarshalJSON() ([]byte, error) { - type webhookEndpoint WebhookEndpoint - v := struct { - Created int64 `json:"created"` - webhookEndpoint - }{ - webhookEndpoint: (webhookEndpoint)(w), - Created: w.Created.Unix(), - } - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - return b, err -} From cd6d26e4fc5371ce5be08e5b67cc27f33d4c76f6 Mon Sep 17 00:00:00 2001 From: Michael Broshi <94012587+mbroshi-stripe@users.noreply.github.com> Date: Wed, 5 Feb 2025 12:04:20 -0800 Subject: [PATCH 7/8] Add GetParams methods to root params objects (#1983) Add GetParams methods --- account.go | 16 ++++ accountlink.go | 8 ++ accountsession.go | 8 ++ applepaydomain.go | 8 ++ applicationfee.go | 8 ++ apps_secret.go | 24 ++++++ balance.go | 8 ++ balancetransaction.go | 8 ++ bankaccount.go | 8 ++ billing_alert.go | 32 ++++++++ billing_creditbalancesummary.go | 8 ++ billing_creditbalancetransaction.go | 8 ++ billing_creditgrant.go | 24 ++++++ billing_meter.go | 24 ++++++ billing_meterevent.go | 8 ++ billing_metereventadjustment.go | 8 ++ billingportal_configuration.go | 8 ++ billingportal_session.go | 8 ++ capability.go | 8 ++ card.go | 8 ++ cashbalance.go | 8 ++ charge.go | 16 ++++ checkout_session.go | 16 ++++ climate_order.go | 16 ++++ climate_product.go | 8 ++ climate_supplier.go | 8 ++ confirmationtoken.go | 8 ++ countryspec.go | 8 ++ coupon.go | 8 ++ creditnote.go | 24 ++++++ customer.go | 32 ++++++++ customerbalancetransaction.go | 8 ++ customercashbalancetransaction.go | 8 ++ customersession.go | 8 ++ dispute.go | 8 ++ entitlements_activeentitlement.go | 8 ++ entitlements_feature.go | 8 ++ ephemeralkey.go | 8 ++ event.go | 8 ++ feerefund.go | 8 ++ file.go | 8 ++ filelink.go | 8 ++ financialconnections_account.go | 40 ++++++++++ financialconnections_session.go | 8 ++ financialconnections_transaction.go | 8 ++ forwarding_request.go | 8 ++ identity_verificationreport.go | 8 ++ identity_verificationsession.go | 24 ++++++ invoice.go | 88 +++++++++++++++++++++ invoiceitem.go | 8 ++ invoicelineitem.go | 8 ++ invoicerenderingtemplate.go | 24 ++++++ issuing_authorization.go | 24 ++++++ issuing_card.go | 8 ++ issuing_cardholder.go | 8 ++ issuing_dispute.go | 16 ++++ issuing_personalizationdesign.go | 8 ++ issuing_physicalbundle.go | 8 ++ issuing_token.go | 8 ++ issuing_transaction.go | 8 ++ loginlink.go | 8 ++ mandate.go | 8 ++ paymentintent.go | 56 +++++++++++++ paymentlink.go | 8 ++ paymentmethod.go | 24 ++++++ paymentmethodconfiguration.go | 8 ++ paymentmethoddomain.go | 16 ++++ paymentsource.go | 16 ++++ payout.go | 16 ++++ person.go | 8 ++ plan.go | 8 ++ price.go | 8 ++ product.go | 8 ++ productfeature.go | 8 ++ promotioncode.go | 8 ++ quote.go | 40 ++++++++++ radar_earlyfraudwarning.go | 8 ++ radar_valuelist.go | 8 ++ radar_valuelistitem.go | 8 ++ refund.go | 16 ++++ reporting_reportrun.go | 8 ++ reporting_reporttype.go | 8 ++ review.go | 16 ++++ setupintent.go | 32 ++++++++ shippingrate.go | 8 ++ sigma_scheduledqueryrun.go | 8 ++ source.go | 16 ++++ subscription.go | 32 ++++++++ subscriptionitem.go | 8 ++ subscriptionschedule.go | 24 ++++++ tax_calculation.go | 8 ++ tax_registration.go | 8 ++ tax_settings.go | 8 ++ tax_transaction.go | 24 ++++++ taxcode.go | 8 ++ taxid.go | 8 ++ taxrate.go | 8 ++ terminal_configuration.go | 8 ++ terminal_connectiontoken.go | 8 ++ terminal_location.go | 8 ++ terminal_reader.go | 48 +++++++++++ testhelpers_confirmationtoken.go | 8 ++ testhelpers_customer.go | 8 ++ testhelpers_refund.go | 8 ++ testhelpers_testclock.go | 16 ++++ testhelpersissuing_authorization.go | 56 +++++++++++++ testhelpersissuing_card.go | 40 ++++++++++ testhelpersissuing_personalizationdesign.go | 24 ++++++ testhelpersissuing_transaction.go | 24 ++++++ testhelpersterminal_reader.go | 8 ++ testhelperstreasury_inboundtransfer.go | 24 ++++++ testhelperstreasury_outboundpayment.go | 32 ++++++++ testhelperstreasury_outboundtransfer.go | 32 ++++++++ testhelperstreasury_receivedcredit.go | 8 ++ testhelperstreasury_receiveddebit.go | 8 ++ testing/testing.go | 5 +- token.go | 8 ++ topup.go | 8 ++ transfer.go | 8 ++ transferreversal.go | 8 ++ treasury_creditreversal.go | 8 ++ treasury_debitreversal.go | 8 ++ treasury_financialaccount.go | 32 ++++++++ treasury_inboundtransfer.go | 16 ++++ treasury_outboundpayment.go | 16 ++++ treasury_outboundtransfer.go | 16 ++++ treasury_receivedcredit.go | 8 ++ treasury_receiveddebit.go | 8 ++ treasury_transaction.go | 8 ++ treasury_transactionentry.go | 8 ++ usagerecord.go | 8 ++ webhookendpoint.go | 8 ++ 132 files changed, 1860 insertions(+), 1 deletion(-) diff --git a/account.go b/account.go index 5e3fa805d1..65e9bdb518 100644 --- a/account.go +++ b/account.go @@ -278,6 +278,14 @@ type AccountParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AccountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1209,6 +1217,14 @@ type AccountRejectParams struct { Reason *string `form:"reason"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AccountRejectParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AccountRejectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/accountlink.go b/accountlink.go index 8db8768bce..966878565e 100644 --- a/accountlink.go +++ b/accountlink.go @@ -51,6 +51,14 @@ type AccountLinkParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AccountLinkParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AccountLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/accountsession.go b/accountsession.go index 7624e19d95..887d3ff144 100644 --- a/accountsession.go +++ b/accountsession.go @@ -303,6 +303,14 @@ type AccountSessionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AccountSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AccountSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/applepaydomain.go b/applepaydomain.go index cd5424de51..8a60c90974 100644 --- a/applepaydomain.go +++ b/applepaydomain.go @@ -14,6 +14,14 @@ type ApplePayDomainParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ApplePayDomainParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ApplePayDomainParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/applicationfee.go b/applicationfee.go index 5067c53512..21b83758cb 100644 --- a/applicationfee.go +++ b/applicationfee.go @@ -42,6 +42,14 @@ type ApplicationFeeParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ApplicationFeeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ApplicationFeeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/apps_secret.go b/apps_secret.go index ce2af32544..ceda94178c 100644 --- a/apps_secret.go +++ b/apps_secret.go @@ -60,6 +60,14 @@ type AppsSecretParams struct { Scope *AppsSecretScopeParams `form:"scope"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AppsSecretParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AppsSecretParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -84,6 +92,14 @@ type AppsSecretFindParams struct { Scope *AppsSecretFindScopeParams `form:"scope"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AppsSecretFindParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AppsSecretFindParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -108,6 +124,14 @@ type AppsSecretDeleteWhereParams struct { Scope *AppsSecretDeleteWhereScopeParams `form:"scope"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *AppsSecretDeleteWhereParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *AppsSecretDeleteWhereParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/balance.go b/balance.go index c16b5ed27d..fcc089bf1e 100644 --- a/balance.go +++ b/balance.go @@ -25,6 +25,14 @@ type BalanceParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BalanceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/balancetransaction.go b/balancetransaction.go index e76f72a458..5501f548f0 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -156,6 +156,14 @@ type BalanceTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BalanceTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/bankaccount.go b/bankaccount.go index ee20041eef..8e6a49b0f2 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -363,6 +363,14 @@ func (p *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) } } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BankAccountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BankAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_alert.go b/billing_alert.go index 8993f803ed..6a4957bb40 100644 --- a/billing_alert.go +++ b/billing_alert.go @@ -88,6 +88,14 @@ type BillingAlertParams struct { UsageThreshold *BillingAlertUsageThresholdParams `form:"usage_threshold"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingAlertParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingAlertParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -100,6 +108,14 @@ type BillingAlertActivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingAlertActivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingAlertActivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -112,6 +128,14 @@ type BillingAlertArchiveParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingAlertArchiveParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingAlertArchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -124,6 +148,14 @@ type BillingAlertDeactivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingAlertDeactivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingAlertDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditbalancesummary.go b/billing_creditbalancesummary.go index 4a9543ed7a..bbddd491e3 100644 --- a/billing_creditbalancesummary.go +++ b/billing_creditbalancesummary.go @@ -49,6 +49,14 @@ type BillingCreditBalanceSummaryParams struct { Filter *BillingCreditBalanceSummaryFilterParams `form:"filter"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingCreditBalanceSummaryParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingCreditBalanceSummaryParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditbalancetransaction.go b/billing_creditbalancetransaction.go index 5127b2be75..9147e31f07 100644 --- a/billing_creditbalancetransaction.go +++ b/billing_creditbalancetransaction.go @@ -75,6 +75,14 @@ type BillingCreditBalanceTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingCreditBalanceTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingCreditBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditgrant.go b/billing_creditgrant.go index 179dca83af..b832c36d41 100644 --- a/billing_creditgrant.go +++ b/billing_creditgrant.go @@ -98,6 +98,14 @@ type BillingCreditGrantParams struct { Name *string `form:"name"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingCreditGrantParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingCreditGrantParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -119,6 +127,14 @@ type BillingCreditGrantExpireParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingCreditGrantExpireParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingCreditGrantExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -131,6 +147,14 @@ type BillingCreditGrantVoidGrantParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingCreditGrantVoidGrantParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingCreditGrantVoidGrantParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_meter.go b/billing_meter.go index f6f53bf4f2..30b034c377 100644 --- a/billing_meter.go +++ b/billing_meter.go @@ -96,6 +96,14 @@ type BillingMeterParams struct { ValueSettings *BillingMeterValueSettingsParams `form:"value_settings"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingMeterParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingMeterParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -108,6 +116,14 @@ type BillingMeterDeactivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingMeterDeactivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingMeterDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -120,6 +136,14 @@ type BillingMeterReactivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingMeterReactivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingMeterReactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_meterevent.go b/billing_meterevent.go index e16178f892..e25b0e748e 100644 --- a/billing_meterevent.go +++ b/billing_meterevent.go @@ -21,6 +21,14 @@ type BillingMeterEventParams struct { Timestamp *int64 `form:"timestamp"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingMeterEventParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingMeterEventParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_metereventadjustment.go b/billing_metereventadjustment.go index 6121355c8c..efb3ed15ae 100644 --- a/billing_metereventadjustment.go +++ b/billing_metereventadjustment.go @@ -42,6 +42,14 @@ type BillingMeterEventAdjustmentParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingMeterEventAdjustmentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingMeterEventAdjustmentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billingportal_configuration.go b/billingportal_configuration.go index 7c3db0f08c..c2df50df1f 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -225,6 +225,14 @@ type BillingPortalConfigurationParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingPortalConfigurationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingPortalConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billingportal_session.go b/billingportal_session.go index 07ef744de6..a5a57b2a12 100644 --- a/billingportal_session.go +++ b/billingportal_session.go @@ -146,6 +146,14 @@ type BillingPortalSessionParams struct { ReturnURL *string `form:"return_url"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *BillingPortalSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *BillingPortalSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/capability.go b/capability.go index f0bdbc5a0f..99ef492670 100644 --- a/capability.go +++ b/capability.go @@ -77,6 +77,14 @@ type CapabilityParams struct { Requested *bool `form:"requested"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CapabilityParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CapabilityParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/card.go b/card.go index 34eaa0091b..afcf520b0f 100644 --- a/card.go +++ b/card.go @@ -253,6 +253,14 @@ func (p *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, ke } } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/cashbalance.go b/cashbalance.go index c5b15881a7..2c33c88912 100644 --- a/cashbalance.go +++ b/cashbalance.go @@ -25,6 +25,14 @@ type CashBalanceParams struct { Customer *string `form:"-"` // Included in URL } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CashBalanceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CashBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/charge.go b/charge.go index 6a25738f32..6e56a1dc04 100644 --- a/charge.go +++ b/charge.go @@ -500,6 +500,14 @@ func (p *ChargeParams) SetSource(sp interface{}) error { return err } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ChargeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ChargeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -573,6 +581,14 @@ type ChargeCaptureParams struct { TransferGroup *string `form:"transfer_group"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ChargeCaptureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ChargeCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/checkout_session.go b/checkout_session.go index 9b846ed435..999afb1543 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -2482,6 +2482,14 @@ type CheckoutSessionParams struct { UIMode *string `form:"ui_mode"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CheckoutSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CheckoutSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2518,6 +2526,14 @@ type CheckoutSessionExpireParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CheckoutSessionExpireParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CheckoutSessionExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_order.go b/climate_order.go index 3fb9867c80..66de632add 100644 --- a/climate_order.go +++ b/climate_order.go @@ -67,6 +67,14 @@ type ClimateOrderParams struct { Product *string `form:"product"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ClimateOrderParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ClimateOrderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -91,6 +99,14 @@ type ClimateOrderCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ClimateOrderCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ClimateOrderCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_product.go b/climate_product.go index 433cd79bf0..c3bce3857c 100644 --- a/climate_product.go +++ b/climate_product.go @@ -27,6 +27,14 @@ type ClimateProductParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ClimateProductParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ClimateProductParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_supplier.go b/climate_supplier.go index 406e87b70f..205f32b206 100644 --- a/climate_supplier.go +++ b/climate_supplier.go @@ -35,6 +35,14 @@ type ClimateSupplierParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ClimateSupplierParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ClimateSupplierParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/confirmationtoken.go b/confirmationtoken.go index 4bcbd41d43..651ad889e8 100644 --- a/confirmationtoken.go +++ b/confirmationtoken.go @@ -445,6 +445,14 @@ type ConfirmationTokenParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ConfirmationTokenParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ConfirmationTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/countryspec.go b/countryspec.go index 9752cc5612..9852de8e56 100644 --- a/countryspec.go +++ b/countryspec.go @@ -28,6 +28,14 @@ type CountrySpecParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CountrySpecParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CountrySpecParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/coupon.go b/coupon.go index 974cb29b3a..d8d512cdd1 100644 --- a/coupon.go +++ b/coupon.go @@ -49,6 +49,14 @@ type CouponParams struct { RedeemBy *int64 `form:"redeem_by"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CouponParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CouponParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/creditnote.go b/creditnote.go index 602a4e3fa5..4b2203b817 100644 --- a/creditnote.go +++ b/creditnote.go @@ -192,6 +192,14 @@ type CreditNoteParams struct { ShippingCost *CreditNoteShippingCostParams `form:"shipping_cost"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CreditNoteParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CreditNoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -277,6 +285,14 @@ type CreditNotePreviewParams struct { ShippingCost *CreditNotePreviewShippingCostParams `form:"shipping_cost"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CreditNotePreviewParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CreditNotePreviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -383,6 +399,14 @@ type CreditNoteVoidCreditNoteParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CreditNoteVoidCreditNoteParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CreditNoteVoidCreditNoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customer.go b/customer.go index b43bdf5847..73298e7baf 100644 --- a/customer.go +++ b/customer.go @@ -93,6 +93,14 @@ type CustomerParams struct { Validate *bool `form:"validate"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -172,6 +180,14 @@ type CustomerDeleteDiscountParams struct { Params `form:"*"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerDeleteDiscountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first. type CustomerListParams struct { ListParams `form:"*"` @@ -225,6 +241,14 @@ type CustomerRetrievePaymentMethodParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerRetrievePaymentMethodParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerRetrievePaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -280,6 +304,14 @@ type CustomerCreateFundingInstructionsParams struct { FundingType *string `form:"funding_type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerCreateFundingInstructionsParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerCreateFundingInstructionsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customerbalancetransaction.go b/customerbalancetransaction.go index f6e610c72c..26fa6d8474 100644 --- a/customerbalancetransaction.go +++ b/customerbalancetransaction.go @@ -54,6 +54,14 @@ type CustomerBalanceTransactionParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerBalanceTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customercashbalancetransaction.go b/customercashbalancetransaction.go index 5ff50e549d..84c06883c6 100644 --- a/customercashbalancetransaction.go +++ b/customercashbalancetransaction.go @@ -67,6 +67,14 @@ type CustomerCashBalanceTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerCashBalanceTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerCashBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customersession.go b/customersession.go index be63c10e4d..618c3d1f67 100644 --- a/customersession.go +++ b/customersession.go @@ -125,6 +125,14 @@ type CustomerSessionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *CustomerSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *CustomerSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/dispute.go b/dispute.go index 2dd2a78b49..9f07500e13 100644 --- a/dispute.go +++ b/dispute.go @@ -153,6 +153,14 @@ type DisputeParams struct { Submit *bool `form:"submit"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *DisputeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *DisputeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/entitlements_activeentitlement.go b/entitlements_activeentitlement.go index 43cad64601..d728348cc0 100644 --- a/entitlements_activeentitlement.go +++ b/entitlements_activeentitlement.go @@ -27,6 +27,14 @@ type EntitlementsActiveEntitlementParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *EntitlementsActiveEntitlementParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *EntitlementsActiveEntitlementParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/entitlements_feature.go b/entitlements_feature.go index 709229eabd..ab80170d15 100644 --- a/entitlements_feature.go +++ b/entitlements_feature.go @@ -39,6 +39,14 @@ type EntitlementsFeatureParams struct { Name *string `form:"name"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *EntitlementsFeatureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *EntitlementsFeatureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/ephemeralkey.go b/ephemeralkey.go index dfba39c04f..cd180ac6b9 100644 --- a/ephemeralkey.go +++ b/ephemeralkey.go @@ -24,6 +24,14 @@ type EphemeralKeyParams struct { StripeVersion *string `form:"-"` // This goes in the `Stripe-Version` header } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *EphemeralKeyParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *EphemeralKeyParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/event.go b/event.go index c22d2f23cb..9c8e648758 100644 --- a/event.go +++ b/event.go @@ -287,6 +287,14 @@ type EventParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *EventParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *EventParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/feerefund.go b/feerefund.go index 183d1290a6..1b0c9b11cf 100644 --- a/feerefund.go +++ b/feerefund.go @@ -21,6 +21,14 @@ type FeeRefundParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FeeRefundParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FeeRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/file.go b/file.go index bcd7de16a6..3af5d37d06 100644 --- a/file.go +++ b/file.go @@ -96,6 +96,14 @@ type FileParams struct { Purpose *string `form:"purpose"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FileParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FileParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/filelink.go b/filelink.go index 4c5ae8608d..ced2ca2a43 100644 --- a/filelink.go +++ b/filelink.go @@ -42,6 +42,14 @@ type FileLinkParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FileLinkParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FileLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_account.go b/financialconnections_account.go index 07816095d4..4728b6beba 100644 --- a/financialconnections_account.go +++ b/financialconnections_account.go @@ -160,6 +160,14 @@ type FinancialConnectionsAccountParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsAccountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -187,6 +195,14 @@ type FinancialConnectionsAccountDisconnectParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsAccountDisconnectParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountDisconnectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -201,6 +217,14 @@ type FinancialConnectionsAccountRefreshParams struct { Features []*string `form:"features"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsAccountRefreshParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountRefreshParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -215,6 +239,14 @@ type FinancialConnectionsAccountSubscribeParams struct { Features []*string `form:"features"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsAccountSubscribeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountSubscribeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -229,6 +261,14 @@ type FinancialConnectionsAccountUnsubscribeParams struct { Features []*string `form:"features"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsAccountUnsubscribeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountUnsubscribeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_session.go b/financialconnections_session.go index 1718c989ff..7280292264 100644 --- a/financialconnections_session.go +++ b/financialconnections_session.go @@ -67,6 +67,14 @@ type FinancialConnectionsSessionParams struct { ReturnURL *string `form:"return_url"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_transaction.go b/financialconnections_transaction.go index 6c0ae205d4..c6c1b78bba 100644 --- a/financialconnections_transaction.go +++ b/financialconnections_transaction.go @@ -49,6 +49,14 @@ type FinancialConnectionsTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *FinancialConnectionsTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *FinancialConnectionsTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/forwarding_request.go b/forwarding_request.go index bb2bdd8989..9c84b0b2aa 100644 --- a/forwarding_request.go +++ b/forwarding_request.go @@ -73,6 +73,14 @@ type ForwardingRequestParams struct { URL *string `form:"url"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ForwardingRequestParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ForwardingRequestParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/identity_verificationreport.go b/identity_verificationreport.go index ec90020791..34ee81ecdb 100644 --- a/identity_verificationreport.go +++ b/identity_verificationreport.go @@ -171,6 +171,14 @@ type IdentityVerificationReportParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IdentityVerificationReportParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IdentityVerificationReportParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/identity_verificationsession.go b/identity_verificationsession.go index e838cff98d..c347492025 100644 --- a/identity_verificationsession.go +++ b/identity_verificationsession.go @@ -158,6 +158,14 @@ type IdentityVerificationSessionParams struct { VerificationFlow *string `form:"verification_flow"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IdentityVerificationSessionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -181,6 +189,14 @@ type IdentityVerificationSessionCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IdentityVerificationSessionCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -211,6 +227,14 @@ type IdentityVerificationSessionRedactParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IdentityVerificationSessionRedactParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionRedactParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoice.go b/invoice.go index ececb1d833..362d1dde85 100644 --- a/invoice.go +++ b/invoice.go @@ -344,6 +344,14 @@ type InvoiceParams struct { TransferData *InvoiceTransferDataParams `form:"transfer_data"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1238,6 +1246,14 @@ type InvoiceUpcomingParams struct { SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceUpcomingParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceUpcomingParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2068,6 +2084,14 @@ type InvoiceAddLinesParams struct { Lines []*InvoiceAddLinesLineParams `form:"lines"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceAddLinesParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceAddLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2082,6 +2106,14 @@ type InvoiceFinalizeInvoiceParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceFinalizeInvoiceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceFinalizeInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2094,6 +2126,14 @@ type InvoiceMarkUncollectibleParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceMarkUncollectibleParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceMarkUncollectibleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2120,6 +2160,14 @@ type InvoicePayParams struct { Source *string `form:"source"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoicePayParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoicePayParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2144,6 +2192,14 @@ type InvoiceRemoveLinesParams struct { Lines []*InvoiceRemoveLinesLineParams `form:"lines"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceRemoveLinesParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceRemoveLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2158,6 +2214,14 @@ type InvoiceSendInvoiceParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceSendInvoiceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceSendInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2302,6 +2366,14 @@ type InvoiceUpdateLinesParams struct { Lines []*InvoiceUpdateLinesLineParams `form:"lines"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceUpdateLinesParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceUpdateLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2316,6 +2388,14 @@ type InvoiceVoidInvoiceParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceVoidInvoiceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceVoidInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2880,6 +2960,14 @@ type InvoiceCreatePreviewParams struct { SubscriptionDetails *InvoiceCreatePreviewSubscriptionDetailsParams `form:"subscription_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceCreatePreviewParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceCreatePreviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoiceitem.go b/invoiceitem.go index ef8a191ae0..0a4b8bca0f 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -51,6 +51,14 @@ type InvoiceItemParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceItemParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoicelineitem.go b/invoicelineitem.go index d416969987..4fbb3ce0ac 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -148,6 +148,14 @@ type InvoiceLineItemParams struct { TaxRates []*string `form:"tax_rates"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceLineItemParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceLineItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoicerenderingtemplate.go b/invoicerenderingtemplate.go index e797719c45..9c482dac43 100644 --- a/invoicerenderingtemplate.go +++ b/invoicerenderingtemplate.go @@ -36,6 +36,14 @@ type InvoiceRenderingTemplateParams struct { Version *int64 `form:"version"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceRenderingTemplateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -48,6 +56,14 @@ type InvoiceRenderingTemplateArchiveParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceRenderingTemplateArchiveParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateArchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -60,6 +76,14 @@ type InvoiceRenderingTemplateUnarchiveParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *InvoiceRenderingTemplateUnarchiveParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_authorization.go b/issuing_authorization.go index 0d08c71e57..6e6d6c7c04 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -213,6 +213,14 @@ type IssuingAuthorizationParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingAuthorizationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -239,6 +247,14 @@ type IssuingAuthorizationApproveParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingAuthorizationApproveParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingAuthorizationApproveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -263,6 +279,14 @@ type IssuingAuthorizationDeclineParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingAuthorizationDeclineParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingAuthorizationDeclineParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_card.go b/issuing_card.go index 425afaded7..8665a40adb 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -271,6 +271,14 @@ type IssuingCardParams struct { CancellationReason *string `form:"cancellation_reason"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_cardholder.go b/issuing_cardholder.go index 48ab969733..e08da3653f 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -211,6 +211,14 @@ type IssuingCardholderParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingCardholderParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingCardholderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_dispute.go b/issuing_dispute.go index 08eebc5be4..c269231e34 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -284,6 +284,14 @@ type IssuingDisputeParams struct { Treasury *IssuingDisputeTreasuryParams `form:"treasury"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingDisputeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingDisputeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -307,6 +315,14 @@ type IssuingDisputeSubmitParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingDisputeSubmitParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingDisputeSubmitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_personalizationdesign.go b/issuing_personalizationdesign.go index b8f2d1b2c1..eacc600667 100644 --- a/issuing_personalizationdesign.go +++ b/issuing_personalizationdesign.go @@ -115,6 +115,14 @@ type IssuingPersonalizationDesignParams struct { TransferLookupKey *bool `form:"transfer_lookup_key"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingPersonalizationDesignParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingPersonalizationDesignParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_physicalbundle.go b/issuing_physicalbundle.go index 197ec285c7..7aa31a793b 100644 --- a/issuing_physicalbundle.go +++ b/issuing_physicalbundle.go @@ -80,6 +80,14 @@ type IssuingPhysicalBundleParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingPhysicalBundleParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingPhysicalBundleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_token.go b/issuing_token.go index 5a47bb1b45..2e4b0aea5f 100644 --- a/issuing_token.go +++ b/issuing_token.go @@ -142,6 +142,14 @@ type IssuingTokenParams struct { Status *string `form:"status"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingTokenParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_transaction.go b/issuing_transaction.go index afc1b7839f..a0af857958 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -85,6 +85,14 @@ type IssuingTransactionParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *IssuingTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *IssuingTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/loginlink.go b/loginlink.go index 16acb4a2d9..088edcccbf 100644 --- a/loginlink.go +++ b/loginlink.go @@ -16,6 +16,14 @@ type LoginLinkParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *LoginLinkParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *LoginLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/mandate.go b/mandate.go index 0ab7002d11..2911d4e12d 100644 --- a/mandate.go +++ b/mandate.go @@ -117,6 +117,14 @@ type MandateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *MandateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *MandateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentintent.go b/paymentintent.go index 9f3d53edbf..62314b8f00 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -2455,6 +2455,14 @@ type PaymentIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2501,6 +2509,14 @@ type PaymentIntentApplyCustomerBalanceParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentApplyCustomerBalanceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentApplyCustomerBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2519,6 +2535,14 @@ type PaymentIntentCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2552,6 +2576,14 @@ type PaymentIntentCaptureParams struct { TransferData *PaymentIntentTransferDataParams `form:"transfer_data"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentCaptureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2648,6 +2680,14 @@ type PaymentIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentConfirmParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentConfirmParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2703,6 +2743,14 @@ type PaymentIntentIncrementAuthorizationParams struct { TransferData *PaymentIntentIncrementAuthorizationTransferDataParams `form:"transfer_data"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentIncrementAuthorizationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentIncrementAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2728,6 +2776,14 @@ type PaymentIntentVerifyMicrodepositsParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentIntentVerifyMicrodepositsParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentIntentVerifyMicrodepositsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentlink.go b/paymentlink.go index e0915d65c3..0289762bc0 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -663,6 +663,14 @@ type PaymentLinkParams struct { TransferData *PaymentLinkTransferDataParams `form:"transfer_data"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentLinkParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethod.go b/paymentmethod.go index ecb7b8ce58..bbdeae9bfa 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -736,6 +736,14 @@ type PaymentMethodParams struct { PaymentMethod *string `form:"payment_method"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -771,6 +779,14 @@ type PaymentMethodAttachParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodAttachParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodAttachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -783,6 +799,14 @@ type PaymentMethodDetachParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodDetachParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodDetachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethodconfiguration.go b/paymentmethodconfiguration.go index f4d5c92d42..100de23427 100644 --- a/paymentmethodconfiguration.go +++ b/paymentmethodconfiguration.go @@ -1433,6 +1433,14 @@ type PaymentMethodConfigurationParams struct { Zip *PaymentMethodConfigurationZipParams `form:"zip"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodConfigurationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethoddomain.go b/paymentmethoddomain.go index 03ad7e5b47..878118effa 100644 --- a/paymentmethoddomain.go +++ b/paymentmethoddomain.go @@ -78,6 +78,14 @@ type PaymentMethodDomainParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodDomainParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodDomainParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -95,6 +103,14 @@ type PaymentMethodDomainValidateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentMethodDomainValidateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentMethodDomainValidateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentsource.go b/paymentsource.go index 333cec6516..9c1e9b8dd3 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -115,6 +115,14 @@ type PaymentSourceParams struct { Validate *bool `form:"validate"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentSourceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentSourceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -151,6 +159,14 @@ type PaymentSourceVerifyParams struct { Values []*string `form:"values"` // Values is used when verifying sources } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PaymentSourceVerifyParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PaymentSourceVerifyParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/payout.go b/payout.go index c7a63bcd55..1a7df48e2f 100644 --- a/payout.go +++ b/payout.go @@ -139,6 +139,14 @@ type PayoutParams struct { StatementDescriptor *string `form:"statement_descriptor"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PayoutParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PayoutParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -164,6 +172,14 @@ type PayoutReverseParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PayoutReverseParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PayoutReverseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/person.go b/person.go index 0bde2384a4..d7c95bc0ff 100644 --- a/person.go +++ b/person.go @@ -130,6 +130,14 @@ type PersonParams struct { Verification *PersonVerificationParams `form:"verification"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PersonParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PersonParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/plan.go b/plan.go index fbf57dae40..b0a83b10be 100644 --- a/plan.go +++ b/plan.go @@ -115,6 +115,14 @@ type PlanParams struct { UsageType *string `form:"usage_type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PlanParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PlanParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/price.go b/price.go index b35cca413e..bdabacf476 100644 --- a/price.go +++ b/price.go @@ -314,6 +314,14 @@ type PriceParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PriceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PriceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/product.go b/product.go index e096227467..e99a212c99 100644 --- a/product.go +++ b/product.go @@ -62,6 +62,14 @@ type ProductParams struct { URL *string `form:"url"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ProductParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ProductParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/productfeature.go b/productfeature.go index b69f75e9e1..55fd98e8fa 100644 --- a/productfeature.go +++ b/productfeature.go @@ -16,6 +16,14 @@ type ProductFeatureParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ProductFeatureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ProductFeatureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/promotioncode.go b/promotioncode.go index ad37d381e7..ef866867be 100644 --- a/promotioncode.go +++ b/promotioncode.go @@ -75,6 +75,14 @@ type PromotionCodeParams struct { Restrictions *PromotionCodeRestrictionsParams `form:"restrictions"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *PromotionCodeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *PromotionCodeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/quote.go b/quote.go index 6906b23ec6..eee88a72d7 100644 --- a/quote.go +++ b/quote.go @@ -338,6 +338,14 @@ type QuoteParams struct { TransferData *QuoteTransferDataParams `form:"transfer_data"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *QuoteParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *QuoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -385,6 +393,14 @@ type QuoteAcceptParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *QuoteAcceptParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *QuoteAcceptParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -397,6 +413,14 @@ type QuoteCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *QuoteCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *QuoteCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -411,6 +435,14 @@ type QuoteFinalizeQuoteParams struct { ExpiresAt *int64 `form:"expires_at"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *QuoteFinalizeQuoteParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *QuoteFinalizeQuoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -423,6 +455,14 @@ type QuotePDFParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *QuotePDFParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *QuotePDFParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_earlyfraudwarning.go b/radar_earlyfraudwarning.go index dffebc1c11..cc92efbe4b 100644 --- a/radar_earlyfraudwarning.go +++ b/radar_earlyfraudwarning.go @@ -49,6 +49,14 @@ type RadarEarlyFraudWarningParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *RadarEarlyFraudWarningParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *RadarEarlyFraudWarningParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_valuelist.go b/radar_valuelist.go index e3f232237d..a4d633f926 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -38,6 +38,14 @@ type RadarValueListParams struct { Name *string `form:"name"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *RadarValueListParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *RadarValueListParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index 9a4a09d1c4..d29d230895 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -17,6 +17,14 @@ type RadarValueListItemParams struct { ValueList *string `form:"value_list"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *RadarValueListItemParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *RadarValueListItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/refund.go b/refund.go index 48853e3d8e..36dcd0ccf5 100644 --- a/refund.go +++ b/refund.go @@ -111,6 +111,14 @@ type RefundParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *RefundParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *RefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -134,6 +142,14 @@ type RefundCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *RefundCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *RefundCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 7df5ad998f..35a7c31188 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -66,6 +66,14 @@ type ReportingReportRunParams struct { ReportType *string `form:"report_type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ReportingReportRunParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ReportingReportRunParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/reporting_reporttype.go b/reporting_reporttype.go index 7073e50a70..dcf6d9490c 100644 --- a/reporting_reporttype.go +++ b/reporting_reporttype.go @@ -25,6 +25,14 @@ type ReportingReportTypeParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ReportingReportTypeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ReportingReportTypeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/review.go b/review.go index 0bfa222645..27f96de1a9 100644 --- a/review.go +++ b/review.go @@ -66,6 +66,14 @@ type ReviewParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ReviewParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ReviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -78,6 +86,14 @@ type ReviewApproveParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ReviewApproveParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ReviewApproveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/setupintent.go b/setupintent.go index e53ea3fcd9..97d1d51d95 100644 --- a/setupintent.go +++ b/setupintent.go @@ -923,6 +923,14 @@ type SetupIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SetupIntentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SetupIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -948,6 +956,14 @@ type SetupIntentCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SetupIntentCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SetupIntentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1320,6 +1336,14 @@ type SetupIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SetupIntentConfirmParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SetupIntentConfirmParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1336,6 +1360,14 @@ type SetupIntentVerifyMicrodepositsParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SetupIntentVerifyMicrodepositsParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SetupIntentVerifyMicrodepositsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/shippingrate.go b/shippingrate.go index 0ae5ca22ed..fd6055b375 100644 --- a/shippingrate.go +++ b/shippingrate.go @@ -145,6 +145,14 @@ type ShippingRateParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *ShippingRateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *ShippingRateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/sigma_scheduledqueryrun.go b/sigma_scheduledqueryrun.go index 4fdd86d99b..e73e9b4e35 100644 --- a/sigma_scheduledqueryrun.go +++ b/sigma_scheduledqueryrun.go @@ -36,6 +36,14 @@ type SigmaScheduledQueryRunParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SigmaScheduledQueryRunParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SigmaScheduledQueryRunParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/source.go b/source.go index 61b589539c..43934a78ef 100644 --- a/source.go +++ b/source.go @@ -118,6 +118,14 @@ type SourceDetachParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SourceDetachParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SourceDetachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -161,6 +169,14 @@ type SourceParams struct { Usage *string `form:"usage"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SourceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SourceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscription.go b/subscription.go index 551ea8a9ec..1e3b5f5e05 100644 --- a/subscription.go +++ b/subscription.go @@ -309,6 +309,14 @@ type SubscriptionCancelParams struct { Prorate *bool `form:"prorate"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -408,6 +416,14 @@ type SubscriptionParams struct { TrialSettings *SubscriptionTrialSettingsParams `form:"trial_settings"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -714,6 +730,14 @@ type SubscriptionDeleteDiscountParams struct { Params `form:"*"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionDeleteDiscountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // Filter subscriptions by their automatic tax settings. type SubscriptionListAutomaticTaxParams struct { // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. @@ -802,6 +826,14 @@ type SubscriptionResumeParams struct { ProrationDate *int64 `form:"proration_date"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionResumeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionResumeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscriptionitem.go b/subscriptionitem.go index a133126ffd..ac3b8796d8 100644 --- a/subscriptionitem.go +++ b/subscriptionitem.go @@ -50,6 +50,14 @@ type SubscriptionItemParams struct { TaxRates []*string `form:"tax_rates"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionItemParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscriptionschedule.go b/subscriptionschedule.go index c2ed57a510..ff596b885a 100644 --- a/subscriptionschedule.go +++ b/subscriptionschedule.go @@ -361,6 +361,14 @@ type SubscriptionScheduleParams struct { StartDateNow *bool `form:"-"` // See custom AppendTo } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionScheduleParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionScheduleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -393,6 +401,14 @@ type SubscriptionScheduleCancelParams struct { Prorate *bool `form:"prorate"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionScheduleCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionScheduleCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -407,6 +423,14 @@ type SubscriptionScheduleReleaseParams struct { PreserveCancelDate *bool `form:"preserve_cancel_date"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *SubscriptionScheduleReleaseParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *SubscriptionScheduleReleaseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_calculation.go b/tax_calculation.go index 350ad69b53..db8048224e 100644 --- a/tax_calculation.go +++ b/tax_calculation.go @@ -279,6 +279,14 @@ type TaxCalculationParams struct { TaxDate *int64 `form:"tax_date"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxCalculationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxCalculationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_registration.go b/tax_registration.go index 85ccea3b36..809bdaa049 100644 --- a/tax_registration.go +++ b/tax_registration.go @@ -2027,6 +2027,14 @@ type TaxRegistrationParams struct { ExpiresAtNow *bool `form:"-"` // See custom AppendTo } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxRegistrationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxRegistrationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_settings.go b/tax_settings.go index 6fec34b3c2..1a27192d9c 100644 --- a/tax_settings.go +++ b/tax_settings.go @@ -36,6 +36,14 @@ type TaxSettingsParams struct { HeadOffice *TaxSettingsHeadOfficeParams `form:"head_office"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxSettingsParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxSettingsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_transaction.go b/tax_transaction.go index ba7b9e26c3..aae7b12b74 100644 --- a/tax_transaction.go +++ b/tax_transaction.go @@ -222,6 +222,14 @@ type TaxTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -255,6 +263,14 @@ type TaxTransactionCreateFromCalculationParams struct { Reference *string `form:"reference"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxTransactionCreateFromCalculationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxTransactionCreateFromCalculationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -323,6 +339,14 @@ type TaxTransactionCreateReversalParams struct { ShippingCost *TaxTransactionCreateReversalShippingCostParams `form:"shipping_cost"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxTransactionCreateReversalParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxTransactionCreateReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxcode.go b/taxcode.go index 11bdd7fdef..95dac968e8 100644 --- a/taxcode.go +++ b/taxcode.go @@ -27,6 +27,14 @@ type TaxCodeParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxCodeParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxCodeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxid.go b/taxid.go index 3b1bd60377..8d04cbf605 100644 --- a/taxid.go +++ b/taxid.go @@ -150,6 +150,14 @@ type TaxIDParams struct { Value *string `form:"value"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxIDParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxIDParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxrate.go b/taxrate.go index 88e54fdae2..ff61e036f0 100644 --- a/taxrate.go +++ b/taxrate.go @@ -98,6 +98,14 @@ type TaxRateParams struct { TaxType *string `form:"tax_type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TaxRateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TaxRateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_configuration.go b/terminal_configuration.go index b5d8829651..cd5d5bbca9 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -27,6 +27,14 @@ type TerminalConfigurationParams struct { VerifoneP400 *TerminalConfigurationVerifoneP400Params `form:"verifone_p400"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalConfigurationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_connectiontoken.go b/terminal_connectiontoken.go index df53320bd6..5169973d53 100644 --- a/terminal_connectiontoken.go +++ b/terminal_connectiontoken.go @@ -15,6 +15,14 @@ type TerminalConnectionTokenParams struct { Location *string `form:"location"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalConnectionTokenParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalConnectionTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_location.go b/terminal_location.go index ce572430dd..eb458ffc34 100644 --- a/terminal_location.go +++ b/terminal_location.go @@ -23,6 +23,14 @@ type TerminalLocationParams struct { Metadata map[string]string `form:"metadata"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalLocationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalLocationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_reader.go b/terminal_reader.go index 79352094d1..0c07d210d5 100644 --- a/terminal_reader.go +++ b/terminal_reader.go @@ -84,6 +84,14 @@ type TerminalReaderParams struct { RegistrationCode *string `form:"registration_code"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -125,6 +133,14 @@ type TerminalReaderCancelActionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderCancelActionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderCancelActionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -159,6 +175,14 @@ type TerminalReaderProcessPaymentIntentParams struct { ProcessConfig *TerminalReaderProcessPaymentIntentProcessConfigParams `form:"process_config"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderProcessPaymentIntentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderProcessPaymentIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -183,6 +207,14 @@ type TerminalReaderProcessSetupIntentParams struct { SetupIntent *string `form:"setup_intent"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderProcessSetupIntentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderProcessSetupIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -215,6 +247,14 @@ type TerminalReaderRefundPaymentParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderRefundPaymentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderRefundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -262,6 +302,14 @@ type TerminalReaderSetReaderDisplayParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TerminalReaderSetReaderDisplayParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TerminalReaderSetReaderDisplayParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_confirmationtoken.go b/testhelpers_confirmationtoken.go index 394b9eb14a..f443ed3cd7 100644 --- a/testhelpers_confirmationtoken.go +++ b/testhelpers_confirmationtoken.go @@ -363,6 +363,14 @@ type TestHelpersConfirmationTokenParams struct { Shipping *TestHelpersConfirmationTokenShippingParams `form:"shipping"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersConfirmationTokenParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersConfirmationTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_customer.go b/testhelpers_customer.go index dc6b7de6b8..e048efc725 100644 --- a/testhelpers_customer.go +++ b/testhelpers_customer.go @@ -19,6 +19,14 @@ type TestHelpersCustomerFundCashBalanceParams struct { Reference *string `form:"reference"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersCustomerFundCashBalanceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersCustomerFundCashBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_refund.go b/testhelpers_refund.go index fbba1dd22f..24ede248a9 100644 --- a/testhelpers_refund.go +++ b/testhelpers_refund.go @@ -13,6 +13,14 @@ type TestHelpersRefundExpireParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersRefundExpireParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersRefundExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_testclock.go b/testhelpers_testclock.go index 42fd5d4816..811c76e3d2 100644 --- a/testhelpers_testclock.go +++ b/testhelpers_testclock.go @@ -29,6 +29,14 @@ type TestHelpersTestClockParams struct { Name *string `form:"name"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTestClockParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTestClockParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -55,6 +63,14 @@ type TestHelpersTestClockAdvanceParams struct { FrozenTime *int64 `form:"frozen_time"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTestClockAdvanceParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTestClockAdvanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_authorization.go b/testhelpersissuing_authorization.go index e746046a50..66f894c80c 100644 --- a/testhelpersissuing_authorization.go +++ b/testhelpersissuing_authorization.go @@ -177,6 +177,14 @@ type TestHelpersIssuingAuthorizationParams struct { Wallet *string `form:"wallet"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -327,6 +335,14 @@ type TestHelpersIssuingAuthorizationCaptureParams struct { PurchaseDetails *TestHelpersIssuingAuthorizationCapturePurchaseDetailsParams `form:"purchase_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationCaptureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -339,6 +355,14 @@ type TestHelpersIssuingAuthorizationExpireParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationExpireParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -427,6 +451,14 @@ type TestHelpersIssuingAuthorizationFinalizeAmountParams struct { Fuel *TestHelpersIssuingAuthorizationFinalizeAmountFuelParams `form:"fuel"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationFinalizeAmountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationFinalizeAmountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -441,6 +473,14 @@ type TestHelpersIssuingAuthorizationRespondParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationRespondParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationRespondParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -457,6 +497,14 @@ type TestHelpersIssuingAuthorizationIncrementParams struct { IsAmountControllable *bool `form:"is_amount_controllable"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationIncrementParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationIncrementParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -471,6 +519,14 @@ type TestHelpersIssuingAuthorizationReverseParams struct { ReverseAmount *int64 `form:"reverse_amount"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingAuthorizationReverseParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationReverseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_card.go b/testhelpersissuing_card.go index c42a3ff9fb..e553245d56 100644 --- a/testhelpersissuing_card.go +++ b/testhelpersissuing_card.go @@ -13,6 +13,14 @@ type TestHelpersIssuingCardDeliverCardParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingCardDeliverCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardDeliverCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -25,6 +33,14 @@ type TestHelpersIssuingCardFailCardParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingCardFailCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardFailCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -37,6 +53,14 @@ type TestHelpersIssuingCardReturnCardParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingCardReturnCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardReturnCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -49,6 +73,14 @@ type TestHelpersIssuingCardShipCardParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingCardShipCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardShipCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -61,6 +93,14 @@ type TestHelpersIssuingCardSubmitCardParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingCardSubmitCardParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardSubmitCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_personalizationdesign.go b/testhelpersissuing_personalizationdesign.go index 72b58bbc45..2673a9a2d9 100644 --- a/testhelpersissuing_personalizationdesign.go +++ b/testhelpersissuing_personalizationdesign.go @@ -13,6 +13,14 @@ type TestHelpersIssuingPersonalizationDesignActivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingPersonalizationDesignActivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignActivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -25,6 +33,14 @@ type TestHelpersIssuingPersonalizationDesignDeactivateParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingPersonalizationDesignDeactivateParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -47,6 +63,14 @@ type TestHelpersIssuingPersonalizationDesignRejectParams struct { RejectionReasons *TestHelpersIssuingPersonalizationDesignRejectRejectionReasonsParams `form:"rejection_reasons"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingPersonalizationDesignRejectParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignRejectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_transaction.go b/testhelpersissuing_transaction.go index e7ca05a189..75b88f06f4 100644 --- a/testhelpersissuing_transaction.go +++ b/testhelpersissuing_transaction.go @@ -15,6 +15,14 @@ type TestHelpersIssuingTransactionRefundParams struct { RefundAmount *int64 `form:"refund_amount"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingTransactionRefundParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -191,6 +199,14 @@ type TestHelpersIssuingTransactionCreateForceCaptureParams struct { PurchaseDetails *TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsParams `form:"purchase_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingTransactionCreateForceCaptureParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionCreateForceCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -367,6 +383,14 @@ type TestHelpersIssuingTransactionCreateUnlinkedRefundParams struct { PurchaseDetails *TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsParams `form:"purchase_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersIssuingTransactionCreateUnlinkedRefundParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionCreateUnlinkedRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersterminal_reader.go b/testhelpersterminal_reader.go index abab5df94e..5cca70415f 100644 --- a/testhelpersterminal_reader.go +++ b/testhelpersterminal_reader.go @@ -33,6 +33,14 @@ type TestHelpersTerminalReaderPresentPaymentMethodParams struct { Type *string `form:"type"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTerminalReaderPresentPaymentMethodParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTerminalReaderPresentPaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_inboundtransfer.go b/testhelperstreasury_inboundtransfer.go index bc55de0e93..6dce9c71ee 100644 --- a/testhelperstreasury_inboundtransfer.go +++ b/testhelperstreasury_inboundtransfer.go @@ -21,6 +21,14 @@ type TestHelpersTreasuryInboundTransferFailParams struct { FailureDetails *TestHelpersTreasuryInboundTransferFailFailureDetailsParams `form:"failure_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryInboundTransferFailParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -33,6 +41,14 @@ type TestHelpersTreasuryInboundTransferReturnInboundTransferParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryInboundTransferReturnInboundTransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferReturnInboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -45,6 +61,14 @@ type TestHelpersTreasuryInboundTransferSucceedParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryInboundTransferSucceedParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferSucceedParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_outboundpayment.go b/testhelperstreasury_outboundpayment.go index c82c08a79d..12f8a15c9c 100644 --- a/testhelperstreasury_outboundpayment.go +++ b/testhelperstreasury_outboundpayment.go @@ -41,6 +41,14 @@ type TestHelpersTreasuryOutboundPaymentParams struct { TrackingDetails *TestHelpersTreasuryOutboundPaymentTrackingDetailsParams `form:"tracking_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundPaymentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -53,6 +61,14 @@ type TestHelpersTreasuryOutboundPaymentFailParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundPaymentFailParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -65,6 +81,14 @@ type TestHelpersTreasuryOutboundPaymentPostParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundPaymentPostParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentPostParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -85,6 +109,14 @@ type TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams struct { ReturnedDetails *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentReturnedDetailsParams `form:"returned_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_outboundtransfer.go b/testhelperstreasury_outboundtransfer.go index b3044bd3d5..cbbbf25892 100644 --- a/testhelperstreasury_outboundtransfer.go +++ b/testhelperstreasury_outboundtransfer.go @@ -41,6 +41,14 @@ type TestHelpersTreasuryOutboundTransferParams struct { TrackingDetails *TestHelpersTreasuryOutboundTransferTrackingDetailsParams `form:"tracking_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundTransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -53,6 +61,14 @@ type TestHelpersTreasuryOutboundTransferFailParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundTransferFailParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -65,6 +81,14 @@ type TestHelpersTreasuryOutboundTransferPostParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundTransferPostParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferPostParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -85,6 +109,14 @@ type TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams struct { ReturnedDetails *TestHelpersTreasuryOutboundTransferReturnOutboundTransferReturnedDetailsParams `form:"returned_details"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_receivedcredit.go b/testhelperstreasury_receivedcredit.go index 23b2a26072..e7b3a16464 100644 --- a/testhelperstreasury_receivedcredit.go +++ b/testhelperstreasury_receivedcredit.go @@ -43,6 +43,14 @@ type TestHelpersTreasuryReceivedCreditParams struct { Network *string `form:"network"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryReceivedCreditParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryReceivedCreditParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_receiveddebit.go b/testhelperstreasury_receiveddebit.go index f19c306872..7310650863 100644 --- a/testhelperstreasury_receiveddebit.go +++ b/testhelperstreasury_receiveddebit.go @@ -43,6 +43,14 @@ type TestHelpersTreasuryReceivedDebitParams struct { Network *string `form:"network"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TestHelpersTreasuryReceivedDebitParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryReceivedDebitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testing/testing.go b/testing/testing.go index f59c22a124..dd7689ae98 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -30,6 +30,9 @@ const ( // TestMerchantID is a token that can be used to represent a merchant ID in // simple tests. TestMerchantID = "acct_123" + + // TestApiKey is a test API token that can be used in tests against stripe-mock. + TestApiKey = "sk_test_myTestKey" ) func init() { @@ -82,7 +85,7 @@ func init() { os.Exit(1) } - stripe.Key = "sk_test_myTestKey" + stripe.Key = TestApiKey // Configure a backend for stripe-mock and set it for both the API and // Uploads (unlike the real Stripe API, stripe-mock supports both these diff --git a/token.go b/token.go index 42043b1c80..fc49d8b9af 100644 --- a/token.go +++ b/token.go @@ -39,6 +39,14 @@ type TokenParams struct { PII *TokenPIIParams `form:"pii"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TokenParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/topup.go b/topup.go index 49eed390c9..f137a2a579 100644 --- a/topup.go +++ b/topup.go @@ -63,6 +63,14 @@ type TopupParams struct { TransferGroup *string `form:"transfer_group"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TopupParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TopupParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/transfer.go b/transfer.go index ebc2a92ae7..ac310d9993 100644 --- a/transfer.go +++ b/transfer.go @@ -61,6 +61,14 @@ type TransferParams struct { TransferGroup *string `form:"transfer_group"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/transferreversal.go b/transferreversal.go index 9ebd7f44fb..95c86dc880 100644 --- a/transferreversal.go +++ b/transferreversal.go @@ -41,6 +41,14 @@ type TransferReversalParams struct { RefundApplicationFee *bool `form:"refund_application_fee"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TransferReversalParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TransferReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index 0f64913831..f726e01246 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -54,6 +54,14 @@ type TreasuryCreditReversalParams struct { ReceivedCredit *string `form:"received_credit"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryCreditReversalParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryCreditReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index 0452bf9b9e..b5057f57ef 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -56,6 +56,14 @@ type TreasuryDebitReversalParams struct { ReceivedDebit *string `form:"received_debit"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryDebitReversalParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryDebitReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index bc91e84f9c..ec596b6dd0 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -257,6 +257,14 @@ type TreasuryFinancialAccountParams struct { SupportedCurrencies []*string `form:"supported_currencies"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryFinancialAccountParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -288,6 +296,14 @@ type TreasuryFinancialAccountRetrieveFeaturesParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryFinancialAccountRetrieveFeaturesParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountRetrieveFeaturesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -396,6 +412,14 @@ type TreasuryFinancialAccountUpdateFeaturesParams struct { OutboundTransfers *TreasuryFinancialAccountUpdateFeaturesOutboundTransfersParams `form:"outbound_transfers"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryFinancialAccountUpdateFeaturesParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountUpdateFeaturesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -420,6 +444,14 @@ type TreasuryFinancialAccountCloseParams struct { ForwardingSettings *TreasuryFinancialAccountCloseForwardingSettingsParams `form:"forwarding_settings"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryFinancialAccountCloseParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountCloseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index dee382b727..e145bf841b 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -108,6 +108,14 @@ type TreasuryInboundTransferParams struct { StatementDescriptor *string `form:"statement_descriptor"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryInboundTransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryInboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -129,6 +137,14 @@ type TreasuryInboundTransferCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryInboundTransferCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryInboundTransferCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index ea2424fe74..eba93c419a 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -208,6 +208,14 @@ type TreasuryOutboundPaymentParams struct { StatementDescriptor *string `form:"statement_descriptor"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryOutboundPaymentParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -229,6 +237,14 @@ type TreasuryOutboundPaymentCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryOutboundPaymentCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryOutboundPaymentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index c25f755020..083613db6d 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -149,6 +149,14 @@ type TreasuryOutboundTransferParams struct { StatementDescriptor *string `form:"statement_descriptor"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryOutboundTransferParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -170,6 +178,14 @@ type TreasuryOutboundTransferCancelParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryOutboundTransferCancelParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryOutboundTransferCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 8d0faf0e22..4260d1798b 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -120,6 +120,14 @@ type TreasuryReceivedCreditParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryReceivedCreditParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryReceivedCreditParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 57fdc54666..d0ef827cab 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -100,6 +100,14 @@ type TreasuryReceivedDebitParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryReceivedDebitParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryReceivedDebitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_transaction.go b/treasury_transaction.go index e122f56bdd..c1e1c91d15 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -89,6 +89,14 @@ type TreasuryTransactionParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryTransactionParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index c65e1645e0..ca3e3decf4 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -96,6 +96,14 @@ type TreasuryTransactionEntryParams struct { Expand []*string `form:"expand"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *TreasuryTransactionEntryParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *TreasuryTransactionEntryParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/usagerecord.go b/usagerecord.go index 482f19307e..98af9aeb36 100644 --- a/usagerecord.go +++ b/usagerecord.go @@ -35,6 +35,14 @@ type UsageRecordParams struct { TimestampNow *bool `form:"-"` // See custom AppendTo } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *UsageRecordParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *UsageRecordParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/webhookendpoint.go b/webhookendpoint.go index 70b8d403f5..4d80bc2e6d 100644 --- a/webhookendpoint.go +++ b/webhookendpoint.go @@ -29,6 +29,14 @@ type WebhookEndpointParams struct { APIVersion *string `form:"api_version"` } +// GetParams is a nil-safe implementation of the ParamsContainer interface. +func (p *WebhookEndpointParams) GetParams() *Params { + if p == nil { + return nil + } + return &p.Params +} + // AddExpand appends a new field to expand. func (p *WebhookEndpointParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) From fb9b421b7690cdb514c078fc1f0fa533c8b397ca Mon Sep 17 00:00:00 2001 From: Michael Broshi <94012587+mbroshi-stripe@users.noreply.github.com> Date: Thu, 6 Feb 2025 04:38:15 -0800 Subject: [PATCH 8/8] Revert "Add GetParams methods to root params objects" (#1984) Revert "Add GetParams methods to root params objects (#1983)" This reverts commit cd6d26e4fc5371ce5be08e5b67cc27f33d4c76f6. --- account.go | 16 ---- accountlink.go | 8 -- accountsession.go | 8 -- applepaydomain.go | 8 -- applicationfee.go | 8 -- apps_secret.go | 24 ------ balance.go | 8 -- balancetransaction.go | 8 -- bankaccount.go | 8 -- billing_alert.go | 32 -------- billing_creditbalancesummary.go | 8 -- billing_creditbalancetransaction.go | 8 -- billing_creditgrant.go | 24 ------ billing_meter.go | 24 ------ billing_meterevent.go | 8 -- billing_metereventadjustment.go | 8 -- billingportal_configuration.go | 8 -- billingportal_session.go | 8 -- capability.go | 8 -- card.go | 8 -- cashbalance.go | 8 -- charge.go | 16 ---- checkout_session.go | 16 ---- climate_order.go | 16 ---- climate_product.go | 8 -- climate_supplier.go | 8 -- confirmationtoken.go | 8 -- countryspec.go | 8 -- coupon.go | 8 -- creditnote.go | 24 ------ customer.go | 32 -------- customerbalancetransaction.go | 8 -- customercashbalancetransaction.go | 8 -- customersession.go | 8 -- dispute.go | 8 -- entitlements_activeentitlement.go | 8 -- entitlements_feature.go | 8 -- ephemeralkey.go | 8 -- event.go | 8 -- feerefund.go | 8 -- file.go | 8 -- filelink.go | 8 -- financialconnections_account.go | 40 ---------- financialconnections_session.go | 8 -- financialconnections_transaction.go | 8 -- forwarding_request.go | 8 -- identity_verificationreport.go | 8 -- identity_verificationsession.go | 24 ------ invoice.go | 88 --------------------- invoiceitem.go | 8 -- invoicelineitem.go | 8 -- invoicerenderingtemplate.go | 24 ------ issuing_authorization.go | 24 ------ issuing_card.go | 8 -- issuing_cardholder.go | 8 -- issuing_dispute.go | 16 ---- issuing_personalizationdesign.go | 8 -- issuing_physicalbundle.go | 8 -- issuing_token.go | 8 -- issuing_transaction.go | 8 -- loginlink.go | 8 -- mandate.go | 8 -- paymentintent.go | 56 ------------- paymentlink.go | 8 -- paymentmethod.go | 24 ------ paymentmethodconfiguration.go | 8 -- paymentmethoddomain.go | 16 ---- paymentsource.go | 16 ---- payout.go | 16 ---- person.go | 8 -- plan.go | 8 -- price.go | 8 -- product.go | 8 -- productfeature.go | 8 -- promotioncode.go | 8 -- quote.go | 40 ---------- radar_earlyfraudwarning.go | 8 -- radar_valuelist.go | 8 -- radar_valuelistitem.go | 8 -- refund.go | 16 ---- reporting_reportrun.go | 8 -- reporting_reporttype.go | 8 -- review.go | 16 ---- setupintent.go | 32 -------- shippingrate.go | 8 -- sigma_scheduledqueryrun.go | 8 -- source.go | 16 ---- subscription.go | 32 -------- subscriptionitem.go | 8 -- subscriptionschedule.go | 24 ------ tax_calculation.go | 8 -- tax_registration.go | 8 -- tax_settings.go | 8 -- tax_transaction.go | 24 ------ taxcode.go | 8 -- taxid.go | 8 -- taxrate.go | 8 -- terminal_configuration.go | 8 -- terminal_connectiontoken.go | 8 -- terminal_location.go | 8 -- terminal_reader.go | 48 ----------- testhelpers_confirmationtoken.go | 8 -- testhelpers_customer.go | 8 -- testhelpers_refund.go | 8 -- testhelpers_testclock.go | 16 ---- testhelpersissuing_authorization.go | 56 ------------- testhelpersissuing_card.go | 40 ---------- testhelpersissuing_personalizationdesign.go | 24 ------ testhelpersissuing_transaction.go | 24 ------ testhelpersterminal_reader.go | 8 -- testhelperstreasury_inboundtransfer.go | 24 ------ testhelperstreasury_outboundpayment.go | 32 -------- testhelperstreasury_outboundtransfer.go | 32 -------- testhelperstreasury_receivedcredit.go | 8 -- testhelperstreasury_receiveddebit.go | 8 -- testing/testing.go | 5 +- token.go | 8 -- topup.go | 8 -- transfer.go | 8 -- transferreversal.go | 8 -- treasury_creditreversal.go | 8 -- treasury_debitreversal.go | 8 -- treasury_financialaccount.go | 32 -------- treasury_inboundtransfer.go | 16 ---- treasury_outboundpayment.go | 16 ---- treasury_outboundtransfer.go | 16 ---- treasury_receivedcredit.go | 8 -- treasury_receiveddebit.go | 8 -- treasury_transaction.go | 8 -- treasury_transactionentry.go | 8 -- usagerecord.go | 8 -- webhookendpoint.go | 8 -- 132 files changed, 1 insertion(+), 1860 deletions(-) diff --git a/account.go b/account.go index 65e9bdb518..5e3fa805d1 100644 --- a/account.go +++ b/account.go @@ -278,14 +278,6 @@ type AccountParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AccountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1217,14 +1209,6 @@ type AccountRejectParams struct { Reason *string `form:"reason"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AccountRejectParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AccountRejectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/accountlink.go b/accountlink.go index 966878565e..8db8768bce 100644 --- a/accountlink.go +++ b/accountlink.go @@ -51,14 +51,6 @@ type AccountLinkParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AccountLinkParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AccountLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/accountsession.go b/accountsession.go index 887d3ff144..7624e19d95 100644 --- a/accountsession.go +++ b/accountsession.go @@ -303,14 +303,6 @@ type AccountSessionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AccountSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AccountSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/applepaydomain.go b/applepaydomain.go index 8a60c90974..cd5424de51 100644 --- a/applepaydomain.go +++ b/applepaydomain.go @@ -14,14 +14,6 @@ type ApplePayDomainParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ApplePayDomainParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ApplePayDomainParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/applicationfee.go b/applicationfee.go index 21b83758cb..5067c53512 100644 --- a/applicationfee.go +++ b/applicationfee.go @@ -42,14 +42,6 @@ type ApplicationFeeParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ApplicationFeeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ApplicationFeeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/apps_secret.go b/apps_secret.go index ceda94178c..ce2af32544 100644 --- a/apps_secret.go +++ b/apps_secret.go @@ -60,14 +60,6 @@ type AppsSecretParams struct { Scope *AppsSecretScopeParams `form:"scope"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AppsSecretParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AppsSecretParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -92,14 +84,6 @@ type AppsSecretFindParams struct { Scope *AppsSecretFindScopeParams `form:"scope"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AppsSecretFindParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AppsSecretFindParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -124,14 +108,6 @@ type AppsSecretDeleteWhereParams struct { Scope *AppsSecretDeleteWhereScopeParams `form:"scope"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *AppsSecretDeleteWhereParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *AppsSecretDeleteWhereParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/balance.go b/balance.go index fcc089bf1e..c16b5ed27d 100644 --- a/balance.go +++ b/balance.go @@ -25,14 +25,6 @@ type BalanceParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BalanceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/balancetransaction.go b/balancetransaction.go index 5501f548f0..e76f72a458 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -156,14 +156,6 @@ type BalanceTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BalanceTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/bankaccount.go b/bankaccount.go index 8e6a49b0f2..ee20041eef 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -363,14 +363,6 @@ func (p *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) } } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BankAccountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BankAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_alert.go b/billing_alert.go index 6a4957bb40..8993f803ed 100644 --- a/billing_alert.go +++ b/billing_alert.go @@ -88,14 +88,6 @@ type BillingAlertParams struct { UsageThreshold *BillingAlertUsageThresholdParams `form:"usage_threshold"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingAlertParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingAlertParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -108,14 +100,6 @@ type BillingAlertActivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingAlertActivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingAlertActivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -128,14 +112,6 @@ type BillingAlertArchiveParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingAlertArchiveParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingAlertArchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -148,14 +124,6 @@ type BillingAlertDeactivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingAlertDeactivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingAlertDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditbalancesummary.go b/billing_creditbalancesummary.go index bbddd491e3..4a9543ed7a 100644 --- a/billing_creditbalancesummary.go +++ b/billing_creditbalancesummary.go @@ -49,14 +49,6 @@ type BillingCreditBalanceSummaryParams struct { Filter *BillingCreditBalanceSummaryFilterParams `form:"filter"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingCreditBalanceSummaryParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingCreditBalanceSummaryParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditbalancetransaction.go b/billing_creditbalancetransaction.go index 9147e31f07..5127b2be75 100644 --- a/billing_creditbalancetransaction.go +++ b/billing_creditbalancetransaction.go @@ -75,14 +75,6 @@ type BillingCreditBalanceTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingCreditBalanceTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingCreditBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_creditgrant.go b/billing_creditgrant.go index b832c36d41..179dca83af 100644 --- a/billing_creditgrant.go +++ b/billing_creditgrant.go @@ -98,14 +98,6 @@ type BillingCreditGrantParams struct { Name *string `form:"name"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingCreditGrantParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingCreditGrantParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -127,14 +119,6 @@ type BillingCreditGrantExpireParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingCreditGrantExpireParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingCreditGrantExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -147,14 +131,6 @@ type BillingCreditGrantVoidGrantParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingCreditGrantVoidGrantParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingCreditGrantVoidGrantParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_meter.go b/billing_meter.go index 30b034c377..f6f53bf4f2 100644 --- a/billing_meter.go +++ b/billing_meter.go @@ -96,14 +96,6 @@ type BillingMeterParams struct { ValueSettings *BillingMeterValueSettingsParams `form:"value_settings"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingMeterParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingMeterParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -116,14 +108,6 @@ type BillingMeterDeactivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingMeterDeactivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingMeterDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -136,14 +120,6 @@ type BillingMeterReactivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingMeterReactivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingMeterReactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_meterevent.go b/billing_meterevent.go index e25b0e748e..e16178f892 100644 --- a/billing_meterevent.go +++ b/billing_meterevent.go @@ -21,14 +21,6 @@ type BillingMeterEventParams struct { Timestamp *int64 `form:"timestamp"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingMeterEventParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingMeterEventParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billing_metereventadjustment.go b/billing_metereventadjustment.go index efb3ed15ae..6121355c8c 100644 --- a/billing_metereventadjustment.go +++ b/billing_metereventadjustment.go @@ -42,14 +42,6 @@ type BillingMeterEventAdjustmentParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingMeterEventAdjustmentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingMeterEventAdjustmentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billingportal_configuration.go b/billingportal_configuration.go index c2df50df1f..7c3db0f08c 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -225,14 +225,6 @@ type BillingPortalConfigurationParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingPortalConfigurationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingPortalConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/billingportal_session.go b/billingportal_session.go index a5a57b2a12..07ef744de6 100644 --- a/billingportal_session.go +++ b/billingportal_session.go @@ -146,14 +146,6 @@ type BillingPortalSessionParams struct { ReturnURL *string `form:"return_url"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *BillingPortalSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *BillingPortalSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/capability.go b/capability.go index 99ef492670..f0bdbc5a0f 100644 --- a/capability.go +++ b/capability.go @@ -77,14 +77,6 @@ type CapabilityParams struct { Requested *bool `form:"requested"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CapabilityParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CapabilityParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/card.go b/card.go index afcf520b0f..34eaa0091b 100644 --- a/card.go +++ b/card.go @@ -253,14 +253,6 @@ func (p *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, ke } } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/cashbalance.go b/cashbalance.go index 2c33c88912..c5b15881a7 100644 --- a/cashbalance.go +++ b/cashbalance.go @@ -25,14 +25,6 @@ type CashBalanceParams struct { Customer *string `form:"-"` // Included in URL } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CashBalanceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CashBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/charge.go b/charge.go index 6e56a1dc04..6a25738f32 100644 --- a/charge.go +++ b/charge.go @@ -500,14 +500,6 @@ func (p *ChargeParams) SetSource(sp interface{}) error { return err } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ChargeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ChargeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -581,14 +573,6 @@ type ChargeCaptureParams struct { TransferGroup *string `form:"transfer_group"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ChargeCaptureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ChargeCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/checkout_session.go b/checkout_session.go index 999afb1543..9b846ed435 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -2482,14 +2482,6 @@ type CheckoutSessionParams struct { UIMode *string `form:"ui_mode"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CheckoutSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CheckoutSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2526,14 +2518,6 @@ type CheckoutSessionExpireParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CheckoutSessionExpireParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CheckoutSessionExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_order.go b/climate_order.go index 66de632add..3fb9867c80 100644 --- a/climate_order.go +++ b/climate_order.go @@ -67,14 +67,6 @@ type ClimateOrderParams struct { Product *string `form:"product"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ClimateOrderParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ClimateOrderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -99,14 +91,6 @@ type ClimateOrderCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ClimateOrderCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ClimateOrderCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_product.go b/climate_product.go index c3bce3857c..433cd79bf0 100644 --- a/climate_product.go +++ b/climate_product.go @@ -27,14 +27,6 @@ type ClimateProductParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ClimateProductParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ClimateProductParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/climate_supplier.go b/climate_supplier.go index 205f32b206..406e87b70f 100644 --- a/climate_supplier.go +++ b/climate_supplier.go @@ -35,14 +35,6 @@ type ClimateSupplierParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ClimateSupplierParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ClimateSupplierParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/confirmationtoken.go b/confirmationtoken.go index 651ad889e8..4bcbd41d43 100644 --- a/confirmationtoken.go +++ b/confirmationtoken.go @@ -445,14 +445,6 @@ type ConfirmationTokenParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ConfirmationTokenParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ConfirmationTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/countryspec.go b/countryspec.go index 9852de8e56..9752cc5612 100644 --- a/countryspec.go +++ b/countryspec.go @@ -28,14 +28,6 @@ type CountrySpecParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CountrySpecParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CountrySpecParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/coupon.go b/coupon.go index d8d512cdd1..974cb29b3a 100644 --- a/coupon.go +++ b/coupon.go @@ -49,14 +49,6 @@ type CouponParams struct { RedeemBy *int64 `form:"redeem_by"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CouponParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CouponParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/creditnote.go b/creditnote.go index 4b2203b817..602a4e3fa5 100644 --- a/creditnote.go +++ b/creditnote.go @@ -192,14 +192,6 @@ type CreditNoteParams struct { ShippingCost *CreditNoteShippingCostParams `form:"shipping_cost"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CreditNoteParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CreditNoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -285,14 +277,6 @@ type CreditNotePreviewParams struct { ShippingCost *CreditNotePreviewShippingCostParams `form:"shipping_cost"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CreditNotePreviewParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CreditNotePreviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -399,14 +383,6 @@ type CreditNoteVoidCreditNoteParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CreditNoteVoidCreditNoteParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CreditNoteVoidCreditNoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customer.go b/customer.go index 73298e7baf..b43bdf5847 100644 --- a/customer.go +++ b/customer.go @@ -93,14 +93,6 @@ type CustomerParams struct { Validate *bool `form:"validate"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -180,14 +172,6 @@ type CustomerDeleteDiscountParams struct { Params `form:"*"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerDeleteDiscountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first. type CustomerListParams struct { ListParams `form:"*"` @@ -241,14 +225,6 @@ type CustomerRetrievePaymentMethodParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerRetrievePaymentMethodParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerRetrievePaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -304,14 +280,6 @@ type CustomerCreateFundingInstructionsParams struct { FundingType *string `form:"funding_type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerCreateFundingInstructionsParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerCreateFundingInstructionsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customerbalancetransaction.go b/customerbalancetransaction.go index 26fa6d8474..f6e610c72c 100644 --- a/customerbalancetransaction.go +++ b/customerbalancetransaction.go @@ -54,14 +54,6 @@ type CustomerBalanceTransactionParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerBalanceTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customercashbalancetransaction.go b/customercashbalancetransaction.go index 84c06883c6..5ff50e549d 100644 --- a/customercashbalancetransaction.go +++ b/customercashbalancetransaction.go @@ -67,14 +67,6 @@ type CustomerCashBalanceTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerCashBalanceTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerCashBalanceTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/customersession.go b/customersession.go index 618c3d1f67..be63c10e4d 100644 --- a/customersession.go +++ b/customersession.go @@ -125,14 +125,6 @@ type CustomerSessionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *CustomerSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *CustomerSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/dispute.go b/dispute.go index 9f07500e13..2dd2a78b49 100644 --- a/dispute.go +++ b/dispute.go @@ -153,14 +153,6 @@ type DisputeParams struct { Submit *bool `form:"submit"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *DisputeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *DisputeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/entitlements_activeentitlement.go b/entitlements_activeentitlement.go index d728348cc0..43cad64601 100644 --- a/entitlements_activeentitlement.go +++ b/entitlements_activeentitlement.go @@ -27,14 +27,6 @@ type EntitlementsActiveEntitlementParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *EntitlementsActiveEntitlementParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *EntitlementsActiveEntitlementParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/entitlements_feature.go b/entitlements_feature.go index ab80170d15..709229eabd 100644 --- a/entitlements_feature.go +++ b/entitlements_feature.go @@ -39,14 +39,6 @@ type EntitlementsFeatureParams struct { Name *string `form:"name"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *EntitlementsFeatureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *EntitlementsFeatureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/ephemeralkey.go b/ephemeralkey.go index cd180ac6b9..dfba39c04f 100644 --- a/ephemeralkey.go +++ b/ephemeralkey.go @@ -24,14 +24,6 @@ type EphemeralKeyParams struct { StripeVersion *string `form:"-"` // This goes in the `Stripe-Version` header } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *EphemeralKeyParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *EphemeralKeyParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/event.go b/event.go index 9c8e648758..c22d2f23cb 100644 --- a/event.go +++ b/event.go @@ -287,14 +287,6 @@ type EventParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *EventParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *EventParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/feerefund.go b/feerefund.go index 1b0c9b11cf..183d1290a6 100644 --- a/feerefund.go +++ b/feerefund.go @@ -21,14 +21,6 @@ type FeeRefundParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FeeRefundParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FeeRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/file.go b/file.go index 3af5d37d06..bcd7de16a6 100644 --- a/file.go +++ b/file.go @@ -96,14 +96,6 @@ type FileParams struct { Purpose *string `form:"purpose"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FileParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FileParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/filelink.go b/filelink.go index ced2ca2a43..4c5ae8608d 100644 --- a/filelink.go +++ b/filelink.go @@ -42,14 +42,6 @@ type FileLinkParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FileLinkParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FileLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_account.go b/financialconnections_account.go index 4728b6beba..07816095d4 100644 --- a/financialconnections_account.go +++ b/financialconnections_account.go @@ -160,14 +160,6 @@ type FinancialConnectionsAccountParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsAccountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -195,14 +187,6 @@ type FinancialConnectionsAccountDisconnectParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsAccountDisconnectParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountDisconnectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -217,14 +201,6 @@ type FinancialConnectionsAccountRefreshParams struct { Features []*string `form:"features"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsAccountRefreshParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountRefreshParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -239,14 +215,6 @@ type FinancialConnectionsAccountSubscribeParams struct { Features []*string `form:"features"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsAccountSubscribeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountSubscribeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -261,14 +229,6 @@ type FinancialConnectionsAccountUnsubscribeParams struct { Features []*string `form:"features"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsAccountUnsubscribeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsAccountUnsubscribeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_session.go b/financialconnections_session.go index 7280292264..1718c989ff 100644 --- a/financialconnections_session.go +++ b/financialconnections_session.go @@ -67,14 +67,6 @@ type FinancialConnectionsSessionParams struct { ReturnURL *string `form:"return_url"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/financialconnections_transaction.go b/financialconnections_transaction.go index c6c1b78bba..6c0ae205d4 100644 --- a/financialconnections_transaction.go +++ b/financialconnections_transaction.go @@ -49,14 +49,6 @@ type FinancialConnectionsTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *FinancialConnectionsTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *FinancialConnectionsTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/forwarding_request.go b/forwarding_request.go index 9c84b0b2aa..bb2bdd8989 100644 --- a/forwarding_request.go +++ b/forwarding_request.go @@ -73,14 +73,6 @@ type ForwardingRequestParams struct { URL *string `form:"url"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ForwardingRequestParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ForwardingRequestParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/identity_verificationreport.go b/identity_verificationreport.go index 34ee81ecdb..ec90020791 100644 --- a/identity_verificationreport.go +++ b/identity_verificationreport.go @@ -171,14 +171,6 @@ type IdentityVerificationReportParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IdentityVerificationReportParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IdentityVerificationReportParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/identity_verificationsession.go b/identity_verificationsession.go index c347492025..e838cff98d 100644 --- a/identity_verificationsession.go +++ b/identity_verificationsession.go @@ -158,14 +158,6 @@ type IdentityVerificationSessionParams struct { VerificationFlow *string `form:"verification_flow"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IdentityVerificationSessionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -189,14 +181,6 @@ type IdentityVerificationSessionCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IdentityVerificationSessionCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -227,14 +211,6 @@ type IdentityVerificationSessionRedactParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IdentityVerificationSessionRedactParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IdentityVerificationSessionRedactParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoice.go b/invoice.go index 362d1dde85..ececb1d833 100644 --- a/invoice.go +++ b/invoice.go @@ -344,14 +344,6 @@ type InvoiceParams struct { TransferData *InvoiceTransferDataParams `form:"transfer_data"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1246,14 +1238,6 @@ type InvoiceUpcomingParams struct { SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceUpcomingParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceUpcomingParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2084,14 +2068,6 @@ type InvoiceAddLinesParams struct { Lines []*InvoiceAddLinesLineParams `form:"lines"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceAddLinesParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceAddLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2106,14 +2082,6 @@ type InvoiceFinalizeInvoiceParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceFinalizeInvoiceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceFinalizeInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2126,14 +2094,6 @@ type InvoiceMarkUncollectibleParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceMarkUncollectibleParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceMarkUncollectibleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2160,14 +2120,6 @@ type InvoicePayParams struct { Source *string `form:"source"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoicePayParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoicePayParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2192,14 +2144,6 @@ type InvoiceRemoveLinesParams struct { Lines []*InvoiceRemoveLinesLineParams `form:"lines"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceRemoveLinesParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceRemoveLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2214,14 +2158,6 @@ type InvoiceSendInvoiceParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceSendInvoiceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceSendInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2366,14 +2302,6 @@ type InvoiceUpdateLinesParams struct { Lines []*InvoiceUpdateLinesLineParams `form:"lines"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceUpdateLinesParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceUpdateLinesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2388,14 +2316,6 @@ type InvoiceVoidInvoiceParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceVoidInvoiceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceVoidInvoiceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2960,14 +2880,6 @@ type InvoiceCreatePreviewParams struct { SubscriptionDetails *InvoiceCreatePreviewSubscriptionDetailsParams `form:"subscription_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceCreatePreviewParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceCreatePreviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoiceitem.go b/invoiceitem.go index 0a4b8bca0f..ef8a191ae0 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -51,14 +51,6 @@ type InvoiceItemParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceItemParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoicelineitem.go b/invoicelineitem.go index 4fbb3ce0ac..d416969987 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -148,14 +148,6 @@ type InvoiceLineItemParams struct { TaxRates []*string `form:"tax_rates"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceLineItemParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceLineItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/invoicerenderingtemplate.go b/invoicerenderingtemplate.go index 9c482dac43..e797719c45 100644 --- a/invoicerenderingtemplate.go +++ b/invoicerenderingtemplate.go @@ -36,14 +36,6 @@ type InvoiceRenderingTemplateParams struct { Version *int64 `form:"version"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceRenderingTemplateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -56,14 +48,6 @@ type InvoiceRenderingTemplateArchiveParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceRenderingTemplateArchiveParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateArchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -76,14 +60,6 @@ type InvoiceRenderingTemplateUnarchiveParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *InvoiceRenderingTemplateUnarchiveParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *InvoiceRenderingTemplateUnarchiveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_authorization.go b/issuing_authorization.go index 6e6d6c7c04..0d08c71e57 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -213,14 +213,6 @@ type IssuingAuthorizationParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingAuthorizationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -247,14 +239,6 @@ type IssuingAuthorizationApproveParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingAuthorizationApproveParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingAuthorizationApproveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -279,14 +263,6 @@ type IssuingAuthorizationDeclineParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingAuthorizationDeclineParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingAuthorizationDeclineParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_card.go b/issuing_card.go index 8665a40adb..425afaded7 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -271,14 +271,6 @@ type IssuingCardParams struct { CancellationReason *string `form:"cancellation_reason"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_cardholder.go b/issuing_cardholder.go index e08da3653f..48ab969733 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -211,14 +211,6 @@ type IssuingCardholderParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingCardholderParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingCardholderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_dispute.go b/issuing_dispute.go index c269231e34..08eebc5be4 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -284,14 +284,6 @@ type IssuingDisputeParams struct { Treasury *IssuingDisputeTreasuryParams `form:"treasury"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingDisputeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingDisputeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -315,14 +307,6 @@ type IssuingDisputeSubmitParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingDisputeSubmitParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingDisputeSubmitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_personalizationdesign.go b/issuing_personalizationdesign.go index eacc600667..b8f2d1b2c1 100644 --- a/issuing_personalizationdesign.go +++ b/issuing_personalizationdesign.go @@ -115,14 +115,6 @@ type IssuingPersonalizationDesignParams struct { TransferLookupKey *bool `form:"transfer_lookup_key"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingPersonalizationDesignParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingPersonalizationDesignParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_physicalbundle.go b/issuing_physicalbundle.go index 7aa31a793b..197ec285c7 100644 --- a/issuing_physicalbundle.go +++ b/issuing_physicalbundle.go @@ -80,14 +80,6 @@ type IssuingPhysicalBundleParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingPhysicalBundleParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingPhysicalBundleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_token.go b/issuing_token.go index 2e4b0aea5f..5a47bb1b45 100644 --- a/issuing_token.go +++ b/issuing_token.go @@ -142,14 +142,6 @@ type IssuingTokenParams struct { Status *string `form:"status"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingTokenParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/issuing_transaction.go b/issuing_transaction.go index a0af857958..afc1b7839f 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -85,14 +85,6 @@ type IssuingTransactionParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *IssuingTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *IssuingTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/loginlink.go b/loginlink.go index 088edcccbf..16acb4a2d9 100644 --- a/loginlink.go +++ b/loginlink.go @@ -16,14 +16,6 @@ type LoginLinkParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *LoginLinkParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *LoginLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/mandate.go b/mandate.go index 2911d4e12d..0ab7002d11 100644 --- a/mandate.go +++ b/mandate.go @@ -117,14 +117,6 @@ type MandateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *MandateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *MandateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentintent.go b/paymentintent.go index 62314b8f00..9f3d53edbf 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -2455,14 +2455,6 @@ type PaymentIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2509,14 +2501,6 @@ type PaymentIntentApplyCustomerBalanceParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentApplyCustomerBalanceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentApplyCustomerBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2535,14 +2519,6 @@ type PaymentIntentCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2576,14 +2552,6 @@ type PaymentIntentCaptureParams struct { TransferData *PaymentIntentTransferDataParams `form:"transfer_data"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentCaptureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2680,14 +2648,6 @@ type PaymentIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentConfirmParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentConfirmParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2743,14 +2703,6 @@ type PaymentIntentIncrementAuthorizationParams struct { TransferData *PaymentIntentIncrementAuthorizationTransferDataParams `form:"transfer_data"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentIncrementAuthorizationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentIncrementAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -2776,14 +2728,6 @@ type PaymentIntentVerifyMicrodepositsParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentIntentVerifyMicrodepositsParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentIntentVerifyMicrodepositsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentlink.go b/paymentlink.go index 0289762bc0..e0915d65c3 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -663,14 +663,6 @@ type PaymentLinkParams struct { TransferData *PaymentLinkTransferDataParams `form:"transfer_data"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentLinkParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentLinkParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethod.go b/paymentmethod.go index bbdeae9bfa..ecb7b8ce58 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -736,14 +736,6 @@ type PaymentMethodParams struct { PaymentMethod *string `form:"payment_method"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -779,14 +771,6 @@ type PaymentMethodAttachParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodAttachParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodAttachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -799,14 +783,6 @@ type PaymentMethodDetachParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodDetachParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodDetachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethodconfiguration.go b/paymentmethodconfiguration.go index 100de23427..f4d5c92d42 100644 --- a/paymentmethodconfiguration.go +++ b/paymentmethodconfiguration.go @@ -1433,14 +1433,6 @@ type PaymentMethodConfigurationParams struct { Zip *PaymentMethodConfigurationZipParams `form:"zip"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodConfigurationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentmethoddomain.go b/paymentmethoddomain.go index 878118effa..03ad7e5b47 100644 --- a/paymentmethoddomain.go +++ b/paymentmethoddomain.go @@ -78,14 +78,6 @@ type PaymentMethodDomainParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodDomainParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodDomainParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -103,14 +95,6 @@ type PaymentMethodDomainValidateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentMethodDomainValidateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentMethodDomainValidateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/paymentsource.go b/paymentsource.go index 9c1e9b8dd3..333cec6516 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -115,14 +115,6 @@ type PaymentSourceParams struct { Validate *bool `form:"validate"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentSourceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentSourceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -159,14 +151,6 @@ type PaymentSourceVerifyParams struct { Values []*string `form:"values"` // Values is used when verifying sources } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PaymentSourceVerifyParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PaymentSourceVerifyParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/payout.go b/payout.go index 1a7df48e2f..c7a63bcd55 100644 --- a/payout.go +++ b/payout.go @@ -139,14 +139,6 @@ type PayoutParams struct { StatementDescriptor *string `form:"statement_descriptor"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PayoutParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PayoutParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -172,14 +164,6 @@ type PayoutReverseParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PayoutReverseParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PayoutReverseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/person.go b/person.go index d7c95bc0ff..0bde2384a4 100644 --- a/person.go +++ b/person.go @@ -130,14 +130,6 @@ type PersonParams struct { Verification *PersonVerificationParams `form:"verification"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PersonParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PersonParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/plan.go b/plan.go index b0a83b10be..fbf57dae40 100644 --- a/plan.go +++ b/plan.go @@ -115,14 +115,6 @@ type PlanParams struct { UsageType *string `form:"usage_type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PlanParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PlanParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/price.go b/price.go index bdabacf476..b35cca413e 100644 --- a/price.go +++ b/price.go @@ -314,14 +314,6 @@ type PriceParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PriceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PriceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/product.go b/product.go index e99a212c99..e096227467 100644 --- a/product.go +++ b/product.go @@ -62,14 +62,6 @@ type ProductParams struct { URL *string `form:"url"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ProductParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ProductParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/productfeature.go b/productfeature.go index 55fd98e8fa..b69f75e9e1 100644 --- a/productfeature.go +++ b/productfeature.go @@ -16,14 +16,6 @@ type ProductFeatureParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ProductFeatureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ProductFeatureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/promotioncode.go b/promotioncode.go index ef866867be..ad37d381e7 100644 --- a/promotioncode.go +++ b/promotioncode.go @@ -75,14 +75,6 @@ type PromotionCodeParams struct { Restrictions *PromotionCodeRestrictionsParams `form:"restrictions"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *PromotionCodeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *PromotionCodeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/quote.go b/quote.go index eee88a72d7..6906b23ec6 100644 --- a/quote.go +++ b/quote.go @@ -338,14 +338,6 @@ type QuoteParams struct { TransferData *QuoteTransferDataParams `form:"transfer_data"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *QuoteParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *QuoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -393,14 +385,6 @@ type QuoteAcceptParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *QuoteAcceptParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *QuoteAcceptParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -413,14 +397,6 @@ type QuoteCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *QuoteCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *QuoteCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -435,14 +411,6 @@ type QuoteFinalizeQuoteParams struct { ExpiresAt *int64 `form:"expires_at"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *QuoteFinalizeQuoteParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *QuoteFinalizeQuoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -455,14 +423,6 @@ type QuotePDFParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *QuotePDFParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *QuotePDFParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_earlyfraudwarning.go b/radar_earlyfraudwarning.go index cc92efbe4b..dffebc1c11 100644 --- a/radar_earlyfraudwarning.go +++ b/radar_earlyfraudwarning.go @@ -49,14 +49,6 @@ type RadarEarlyFraudWarningParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *RadarEarlyFraudWarningParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *RadarEarlyFraudWarningParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_valuelist.go b/radar_valuelist.go index a4d633f926..e3f232237d 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -38,14 +38,6 @@ type RadarValueListParams struct { Name *string `form:"name"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *RadarValueListParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *RadarValueListParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index d29d230895..9a4a09d1c4 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -17,14 +17,6 @@ type RadarValueListItemParams struct { ValueList *string `form:"value_list"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *RadarValueListItemParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *RadarValueListItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/refund.go b/refund.go index 36dcd0ccf5..48853e3d8e 100644 --- a/refund.go +++ b/refund.go @@ -111,14 +111,6 @@ type RefundParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *RefundParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *RefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -142,14 +134,6 @@ type RefundCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *RefundCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *RefundCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 35a7c31188..7df5ad998f 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -66,14 +66,6 @@ type ReportingReportRunParams struct { ReportType *string `form:"report_type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ReportingReportRunParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ReportingReportRunParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/reporting_reporttype.go b/reporting_reporttype.go index dcf6d9490c..7073e50a70 100644 --- a/reporting_reporttype.go +++ b/reporting_reporttype.go @@ -25,14 +25,6 @@ type ReportingReportTypeParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ReportingReportTypeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ReportingReportTypeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/review.go b/review.go index 27f96de1a9..0bfa222645 100644 --- a/review.go +++ b/review.go @@ -66,14 +66,6 @@ type ReviewParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ReviewParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ReviewParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -86,14 +78,6 @@ type ReviewApproveParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ReviewApproveParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ReviewApproveParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/setupintent.go b/setupintent.go index 97d1d51d95..e53ea3fcd9 100644 --- a/setupintent.go +++ b/setupintent.go @@ -923,14 +923,6 @@ type SetupIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SetupIntentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SetupIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -956,14 +948,6 @@ type SetupIntentCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SetupIntentCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SetupIntentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1336,14 +1320,6 @@ type SetupIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SetupIntentConfirmParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SetupIntentConfirmParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -1360,14 +1336,6 @@ type SetupIntentVerifyMicrodepositsParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SetupIntentVerifyMicrodepositsParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SetupIntentVerifyMicrodepositsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/shippingrate.go b/shippingrate.go index fd6055b375..0ae5ca22ed 100644 --- a/shippingrate.go +++ b/shippingrate.go @@ -145,14 +145,6 @@ type ShippingRateParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *ShippingRateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *ShippingRateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/sigma_scheduledqueryrun.go b/sigma_scheduledqueryrun.go index e73e9b4e35..4fdd86d99b 100644 --- a/sigma_scheduledqueryrun.go +++ b/sigma_scheduledqueryrun.go @@ -36,14 +36,6 @@ type SigmaScheduledQueryRunParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SigmaScheduledQueryRunParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SigmaScheduledQueryRunParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/source.go b/source.go index 43934a78ef..61b589539c 100644 --- a/source.go +++ b/source.go @@ -118,14 +118,6 @@ type SourceDetachParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SourceDetachParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SourceDetachParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -169,14 +161,6 @@ type SourceParams struct { Usage *string `form:"usage"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SourceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SourceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscription.go b/subscription.go index 1e3b5f5e05..551ea8a9ec 100644 --- a/subscription.go +++ b/subscription.go @@ -309,14 +309,6 @@ type SubscriptionCancelParams struct { Prorate *bool `form:"prorate"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -416,14 +408,6 @@ type SubscriptionParams struct { TrialSettings *SubscriptionTrialSettingsParams `form:"trial_settings"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -730,14 +714,6 @@ type SubscriptionDeleteDiscountParams struct { Params `form:"*"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionDeleteDiscountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // Filter subscriptions by their automatic tax settings. type SubscriptionListAutomaticTaxParams struct { // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. @@ -826,14 +802,6 @@ type SubscriptionResumeParams struct { ProrationDate *int64 `form:"proration_date"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionResumeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionResumeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscriptionitem.go b/subscriptionitem.go index ac3b8796d8..a133126ffd 100644 --- a/subscriptionitem.go +++ b/subscriptionitem.go @@ -50,14 +50,6 @@ type SubscriptionItemParams struct { TaxRates []*string `form:"tax_rates"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionItemParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionItemParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/subscriptionschedule.go b/subscriptionschedule.go index ff596b885a..c2ed57a510 100644 --- a/subscriptionschedule.go +++ b/subscriptionschedule.go @@ -361,14 +361,6 @@ type SubscriptionScheduleParams struct { StartDateNow *bool `form:"-"` // See custom AppendTo } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionScheduleParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionScheduleParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -401,14 +393,6 @@ type SubscriptionScheduleCancelParams struct { Prorate *bool `form:"prorate"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionScheduleCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionScheduleCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -423,14 +407,6 @@ type SubscriptionScheduleReleaseParams struct { PreserveCancelDate *bool `form:"preserve_cancel_date"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *SubscriptionScheduleReleaseParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *SubscriptionScheduleReleaseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_calculation.go b/tax_calculation.go index db8048224e..350ad69b53 100644 --- a/tax_calculation.go +++ b/tax_calculation.go @@ -279,14 +279,6 @@ type TaxCalculationParams struct { TaxDate *int64 `form:"tax_date"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxCalculationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxCalculationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_registration.go b/tax_registration.go index 809bdaa049..85ccea3b36 100644 --- a/tax_registration.go +++ b/tax_registration.go @@ -2027,14 +2027,6 @@ type TaxRegistrationParams struct { ExpiresAtNow *bool `form:"-"` // See custom AppendTo } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxRegistrationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxRegistrationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_settings.go b/tax_settings.go index 1a27192d9c..6fec34b3c2 100644 --- a/tax_settings.go +++ b/tax_settings.go @@ -36,14 +36,6 @@ type TaxSettingsParams struct { HeadOffice *TaxSettingsHeadOfficeParams `form:"head_office"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxSettingsParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxSettingsParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/tax_transaction.go b/tax_transaction.go index aae7b12b74..ba7b9e26c3 100644 --- a/tax_transaction.go +++ b/tax_transaction.go @@ -222,14 +222,6 @@ type TaxTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -263,14 +255,6 @@ type TaxTransactionCreateFromCalculationParams struct { Reference *string `form:"reference"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxTransactionCreateFromCalculationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxTransactionCreateFromCalculationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -339,14 +323,6 @@ type TaxTransactionCreateReversalParams struct { ShippingCost *TaxTransactionCreateReversalShippingCostParams `form:"shipping_cost"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxTransactionCreateReversalParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxTransactionCreateReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxcode.go b/taxcode.go index 95dac968e8..11bdd7fdef 100644 --- a/taxcode.go +++ b/taxcode.go @@ -27,14 +27,6 @@ type TaxCodeParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxCodeParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxCodeParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxid.go b/taxid.go index 8d04cbf605..3b1bd60377 100644 --- a/taxid.go +++ b/taxid.go @@ -150,14 +150,6 @@ type TaxIDParams struct { Value *string `form:"value"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxIDParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxIDParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/taxrate.go b/taxrate.go index ff61e036f0..88e54fdae2 100644 --- a/taxrate.go +++ b/taxrate.go @@ -98,14 +98,6 @@ type TaxRateParams struct { TaxType *string `form:"tax_type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TaxRateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TaxRateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_configuration.go b/terminal_configuration.go index cd5d5bbca9..b5d8829651 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -27,14 +27,6 @@ type TerminalConfigurationParams struct { VerifoneP400 *TerminalConfigurationVerifoneP400Params `form:"verifone_p400"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalConfigurationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalConfigurationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_connectiontoken.go b/terminal_connectiontoken.go index 5169973d53..df53320bd6 100644 --- a/terminal_connectiontoken.go +++ b/terminal_connectiontoken.go @@ -15,14 +15,6 @@ type TerminalConnectionTokenParams struct { Location *string `form:"location"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalConnectionTokenParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalConnectionTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_location.go b/terminal_location.go index eb458ffc34..ce572430dd 100644 --- a/terminal_location.go +++ b/terminal_location.go @@ -23,14 +23,6 @@ type TerminalLocationParams struct { Metadata map[string]string `form:"metadata"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalLocationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalLocationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/terminal_reader.go b/terminal_reader.go index 0c07d210d5..79352094d1 100644 --- a/terminal_reader.go +++ b/terminal_reader.go @@ -84,14 +84,6 @@ type TerminalReaderParams struct { RegistrationCode *string `form:"registration_code"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -133,14 +125,6 @@ type TerminalReaderCancelActionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderCancelActionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderCancelActionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -175,14 +159,6 @@ type TerminalReaderProcessPaymentIntentParams struct { ProcessConfig *TerminalReaderProcessPaymentIntentProcessConfigParams `form:"process_config"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderProcessPaymentIntentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderProcessPaymentIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -207,14 +183,6 @@ type TerminalReaderProcessSetupIntentParams struct { SetupIntent *string `form:"setup_intent"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderProcessSetupIntentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderProcessSetupIntentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -247,14 +215,6 @@ type TerminalReaderRefundPaymentParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderRefundPaymentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderRefundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -302,14 +262,6 @@ type TerminalReaderSetReaderDisplayParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TerminalReaderSetReaderDisplayParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TerminalReaderSetReaderDisplayParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_confirmationtoken.go b/testhelpers_confirmationtoken.go index f443ed3cd7..394b9eb14a 100644 --- a/testhelpers_confirmationtoken.go +++ b/testhelpers_confirmationtoken.go @@ -363,14 +363,6 @@ type TestHelpersConfirmationTokenParams struct { Shipping *TestHelpersConfirmationTokenShippingParams `form:"shipping"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersConfirmationTokenParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersConfirmationTokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_customer.go b/testhelpers_customer.go index e048efc725..dc6b7de6b8 100644 --- a/testhelpers_customer.go +++ b/testhelpers_customer.go @@ -19,14 +19,6 @@ type TestHelpersCustomerFundCashBalanceParams struct { Reference *string `form:"reference"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersCustomerFundCashBalanceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersCustomerFundCashBalanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_refund.go b/testhelpers_refund.go index 24ede248a9..fbba1dd22f 100644 --- a/testhelpers_refund.go +++ b/testhelpers_refund.go @@ -13,14 +13,6 @@ type TestHelpersRefundExpireParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersRefundExpireParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersRefundExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpers_testclock.go b/testhelpers_testclock.go index 811c76e3d2..42fd5d4816 100644 --- a/testhelpers_testclock.go +++ b/testhelpers_testclock.go @@ -29,14 +29,6 @@ type TestHelpersTestClockParams struct { Name *string `form:"name"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTestClockParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTestClockParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -63,14 +55,6 @@ type TestHelpersTestClockAdvanceParams struct { FrozenTime *int64 `form:"frozen_time"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTestClockAdvanceParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTestClockAdvanceParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_authorization.go b/testhelpersissuing_authorization.go index 66f894c80c..e746046a50 100644 --- a/testhelpersissuing_authorization.go +++ b/testhelpersissuing_authorization.go @@ -177,14 +177,6 @@ type TestHelpersIssuingAuthorizationParams struct { Wallet *string `form:"wallet"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -335,14 +327,6 @@ type TestHelpersIssuingAuthorizationCaptureParams struct { PurchaseDetails *TestHelpersIssuingAuthorizationCapturePurchaseDetailsParams `form:"purchase_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationCaptureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -355,14 +339,6 @@ type TestHelpersIssuingAuthorizationExpireParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationExpireParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationExpireParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -451,14 +427,6 @@ type TestHelpersIssuingAuthorizationFinalizeAmountParams struct { Fuel *TestHelpersIssuingAuthorizationFinalizeAmountFuelParams `form:"fuel"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationFinalizeAmountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationFinalizeAmountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -473,14 +441,6 @@ type TestHelpersIssuingAuthorizationRespondParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationRespondParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationRespondParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -497,14 +457,6 @@ type TestHelpersIssuingAuthorizationIncrementParams struct { IsAmountControllable *bool `form:"is_amount_controllable"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationIncrementParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationIncrementParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -519,14 +471,6 @@ type TestHelpersIssuingAuthorizationReverseParams struct { ReverseAmount *int64 `form:"reverse_amount"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingAuthorizationReverseParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingAuthorizationReverseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_card.go b/testhelpersissuing_card.go index e553245d56..c42a3ff9fb 100644 --- a/testhelpersissuing_card.go +++ b/testhelpersissuing_card.go @@ -13,14 +13,6 @@ type TestHelpersIssuingCardDeliverCardParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingCardDeliverCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardDeliverCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -33,14 +25,6 @@ type TestHelpersIssuingCardFailCardParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingCardFailCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardFailCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -53,14 +37,6 @@ type TestHelpersIssuingCardReturnCardParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingCardReturnCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardReturnCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -73,14 +49,6 @@ type TestHelpersIssuingCardShipCardParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingCardShipCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardShipCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -93,14 +61,6 @@ type TestHelpersIssuingCardSubmitCardParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingCardSubmitCardParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingCardSubmitCardParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_personalizationdesign.go b/testhelpersissuing_personalizationdesign.go index 2673a9a2d9..72b58bbc45 100644 --- a/testhelpersissuing_personalizationdesign.go +++ b/testhelpersissuing_personalizationdesign.go @@ -13,14 +13,6 @@ type TestHelpersIssuingPersonalizationDesignActivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingPersonalizationDesignActivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignActivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -33,14 +25,6 @@ type TestHelpersIssuingPersonalizationDesignDeactivateParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingPersonalizationDesignDeactivateParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignDeactivateParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -63,14 +47,6 @@ type TestHelpersIssuingPersonalizationDesignRejectParams struct { RejectionReasons *TestHelpersIssuingPersonalizationDesignRejectRejectionReasonsParams `form:"rejection_reasons"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingPersonalizationDesignRejectParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingPersonalizationDesignRejectParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersissuing_transaction.go b/testhelpersissuing_transaction.go index 75b88f06f4..e7ca05a189 100644 --- a/testhelpersissuing_transaction.go +++ b/testhelpersissuing_transaction.go @@ -15,14 +15,6 @@ type TestHelpersIssuingTransactionRefundParams struct { RefundAmount *int64 `form:"refund_amount"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingTransactionRefundParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -199,14 +191,6 @@ type TestHelpersIssuingTransactionCreateForceCaptureParams struct { PurchaseDetails *TestHelpersIssuingTransactionCreateForceCapturePurchaseDetailsParams `form:"purchase_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingTransactionCreateForceCaptureParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionCreateForceCaptureParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -383,14 +367,6 @@ type TestHelpersIssuingTransactionCreateUnlinkedRefundParams struct { PurchaseDetails *TestHelpersIssuingTransactionCreateUnlinkedRefundPurchaseDetailsParams `form:"purchase_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersIssuingTransactionCreateUnlinkedRefundParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersIssuingTransactionCreateUnlinkedRefundParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelpersterminal_reader.go b/testhelpersterminal_reader.go index 5cca70415f..abab5df94e 100644 --- a/testhelpersterminal_reader.go +++ b/testhelpersterminal_reader.go @@ -33,14 +33,6 @@ type TestHelpersTerminalReaderPresentPaymentMethodParams struct { Type *string `form:"type"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTerminalReaderPresentPaymentMethodParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTerminalReaderPresentPaymentMethodParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_inboundtransfer.go b/testhelperstreasury_inboundtransfer.go index 6dce9c71ee..bc55de0e93 100644 --- a/testhelperstreasury_inboundtransfer.go +++ b/testhelperstreasury_inboundtransfer.go @@ -21,14 +21,6 @@ type TestHelpersTreasuryInboundTransferFailParams struct { FailureDetails *TestHelpersTreasuryInboundTransferFailFailureDetailsParams `form:"failure_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryInboundTransferFailParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -41,14 +33,6 @@ type TestHelpersTreasuryInboundTransferReturnInboundTransferParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryInboundTransferReturnInboundTransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferReturnInboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -61,14 +45,6 @@ type TestHelpersTreasuryInboundTransferSucceedParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryInboundTransferSucceedParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryInboundTransferSucceedParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_outboundpayment.go b/testhelperstreasury_outboundpayment.go index 12f8a15c9c..c82c08a79d 100644 --- a/testhelperstreasury_outboundpayment.go +++ b/testhelperstreasury_outboundpayment.go @@ -41,14 +41,6 @@ type TestHelpersTreasuryOutboundPaymentParams struct { TrackingDetails *TestHelpersTreasuryOutboundPaymentTrackingDetailsParams `form:"tracking_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundPaymentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -61,14 +53,6 @@ type TestHelpersTreasuryOutboundPaymentFailParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundPaymentFailParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -81,14 +65,6 @@ type TestHelpersTreasuryOutboundPaymentPostParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundPaymentPostParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentPostParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -109,14 +85,6 @@ type TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams struct { ReturnedDetails *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentReturnedDetailsParams `form:"returned_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_outboundtransfer.go b/testhelperstreasury_outboundtransfer.go index cbbbf25892..b3044bd3d5 100644 --- a/testhelperstreasury_outboundtransfer.go +++ b/testhelperstreasury_outboundtransfer.go @@ -41,14 +41,6 @@ type TestHelpersTreasuryOutboundTransferParams struct { TrackingDetails *TestHelpersTreasuryOutboundTransferTrackingDetailsParams `form:"tracking_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundTransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -61,14 +53,6 @@ type TestHelpersTreasuryOutboundTransferFailParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundTransferFailParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferFailParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -81,14 +65,6 @@ type TestHelpersTreasuryOutboundTransferPostParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundTransferPostParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferPostParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -109,14 +85,6 @@ type TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams struct { ReturnedDetails *TestHelpersTreasuryOutboundTransferReturnOutboundTransferReturnedDetailsParams `form:"returned_details"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_receivedcredit.go b/testhelperstreasury_receivedcredit.go index e7b3a16464..23b2a26072 100644 --- a/testhelperstreasury_receivedcredit.go +++ b/testhelperstreasury_receivedcredit.go @@ -43,14 +43,6 @@ type TestHelpersTreasuryReceivedCreditParams struct { Network *string `form:"network"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryReceivedCreditParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryReceivedCreditParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testhelperstreasury_receiveddebit.go b/testhelperstreasury_receiveddebit.go index 7310650863..f19c306872 100644 --- a/testhelperstreasury_receiveddebit.go +++ b/testhelperstreasury_receiveddebit.go @@ -43,14 +43,6 @@ type TestHelpersTreasuryReceivedDebitParams struct { Network *string `form:"network"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TestHelpersTreasuryReceivedDebitParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TestHelpersTreasuryReceivedDebitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/testing/testing.go b/testing/testing.go index dd7689ae98..f59c22a124 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -30,9 +30,6 @@ const ( // TestMerchantID is a token that can be used to represent a merchant ID in // simple tests. TestMerchantID = "acct_123" - - // TestApiKey is a test API token that can be used in tests against stripe-mock. - TestApiKey = "sk_test_myTestKey" ) func init() { @@ -85,7 +82,7 @@ func init() { os.Exit(1) } - stripe.Key = TestApiKey + stripe.Key = "sk_test_myTestKey" // Configure a backend for stripe-mock and set it for both the API and // Uploads (unlike the real Stripe API, stripe-mock supports both these diff --git a/token.go b/token.go index fc49d8b9af..42043b1c80 100644 --- a/token.go +++ b/token.go @@ -39,14 +39,6 @@ type TokenParams struct { PII *TokenPIIParams `form:"pii"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TokenParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TokenParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/topup.go b/topup.go index f137a2a579..49eed390c9 100644 --- a/topup.go +++ b/topup.go @@ -63,14 +63,6 @@ type TopupParams struct { TransferGroup *string `form:"transfer_group"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TopupParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TopupParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/transfer.go b/transfer.go index ac310d9993..ebc2a92ae7 100644 --- a/transfer.go +++ b/transfer.go @@ -61,14 +61,6 @@ type TransferParams struct { TransferGroup *string `form:"transfer_group"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/transferreversal.go b/transferreversal.go index 95c86dc880..9ebd7f44fb 100644 --- a/transferreversal.go +++ b/transferreversal.go @@ -41,14 +41,6 @@ type TransferReversalParams struct { RefundApplicationFee *bool `form:"refund_application_fee"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TransferReversalParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TransferReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index f726e01246..0f64913831 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -54,14 +54,6 @@ type TreasuryCreditReversalParams struct { ReceivedCredit *string `form:"received_credit"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryCreditReversalParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryCreditReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index b5057f57ef..0452bf9b9e 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -56,14 +56,6 @@ type TreasuryDebitReversalParams struct { ReceivedDebit *string `form:"received_debit"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryDebitReversalParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryDebitReversalParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index ec596b6dd0..bc91e84f9c 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -257,14 +257,6 @@ type TreasuryFinancialAccountParams struct { SupportedCurrencies []*string `form:"supported_currencies"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryFinancialAccountParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -296,14 +288,6 @@ type TreasuryFinancialAccountRetrieveFeaturesParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryFinancialAccountRetrieveFeaturesParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountRetrieveFeaturesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -412,14 +396,6 @@ type TreasuryFinancialAccountUpdateFeaturesParams struct { OutboundTransfers *TreasuryFinancialAccountUpdateFeaturesOutboundTransfersParams `form:"outbound_transfers"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryFinancialAccountUpdateFeaturesParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountUpdateFeaturesParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -444,14 +420,6 @@ type TreasuryFinancialAccountCloseParams struct { ForwardingSettings *TreasuryFinancialAccountCloseForwardingSettingsParams `form:"forwarding_settings"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryFinancialAccountCloseParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryFinancialAccountCloseParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index e145bf841b..dee382b727 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -108,14 +108,6 @@ type TreasuryInboundTransferParams struct { StatementDescriptor *string `form:"statement_descriptor"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryInboundTransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryInboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -137,14 +129,6 @@ type TreasuryInboundTransferCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryInboundTransferCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryInboundTransferCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index eba93c419a..ea2424fe74 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -208,14 +208,6 @@ type TreasuryOutboundPaymentParams struct { StatementDescriptor *string `form:"statement_descriptor"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryOutboundPaymentParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryOutboundPaymentParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -237,14 +229,6 @@ type TreasuryOutboundPaymentCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryOutboundPaymentCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryOutboundPaymentCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index 083613db6d..c25f755020 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -149,14 +149,6 @@ type TreasuryOutboundTransferParams struct { StatementDescriptor *string `form:"statement_descriptor"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryOutboundTransferParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryOutboundTransferParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) @@ -178,14 +170,6 @@ type TreasuryOutboundTransferCancelParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryOutboundTransferCancelParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryOutboundTransferCancelParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 4260d1798b..8d0faf0e22 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -120,14 +120,6 @@ type TreasuryReceivedCreditParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryReceivedCreditParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryReceivedCreditParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index d0ef827cab..57fdc54666 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -100,14 +100,6 @@ type TreasuryReceivedDebitParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryReceivedDebitParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryReceivedDebitParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_transaction.go b/treasury_transaction.go index c1e1c91d15..e122f56bdd 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -89,14 +89,6 @@ type TreasuryTransactionParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryTransactionParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryTransactionParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index ca3e3decf4..c65e1645e0 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -96,14 +96,6 @@ type TreasuryTransactionEntryParams struct { Expand []*string `form:"expand"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *TreasuryTransactionEntryParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *TreasuryTransactionEntryParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/usagerecord.go b/usagerecord.go index 98af9aeb36..482f19307e 100644 --- a/usagerecord.go +++ b/usagerecord.go @@ -35,14 +35,6 @@ type UsageRecordParams struct { TimestampNow *bool `form:"-"` // See custom AppendTo } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *UsageRecordParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *UsageRecordParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) diff --git a/webhookendpoint.go b/webhookendpoint.go index 4d80bc2e6d..70b8d403f5 100644 --- a/webhookendpoint.go +++ b/webhookendpoint.go @@ -29,14 +29,6 @@ type WebhookEndpointParams struct { APIVersion *string `form:"api_version"` } -// GetParams is a nil-safe implementation of the ParamsContainer interface. -func (p *WebhookEndpointParams) GetParams() *Params { - if p == nil { - return nil - } - return &p.Params -} - // AddExpand appends a new field to expand. func (p *WebhookEndpointParams) AddExpand(f string) { p.Expand = append(p.Expand, &f)