{-# LANGUAGE MultiWayIf #-} -- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator. {-# LANGUAGE OverloadedStrings #-} -- | Contains the types generated from the schema BankAccount module StripeAPI.Types.BankAccount where import qualified Control.Monad.Fail import qualified Data.Aeson import qualified Data.Aeson as Data.Aeson.Encoding.Internal import qualified Data.Aeson as Data.Aeson.Types import qualified Data.Aeson as Data.Aeson.Types.FromJSON import qualified Data.Aeson as Data.Aeson.Types.Internal import qualified Data.Aeson as Data.Aeson.Types.ToJSON import qualified Data.ByteString.Char8 import qualified Data.ByteString.Char8 as Data.ByteString.Internal import qualified Data.Functor import qualified Data.Scientific import qualified Data.Text import qualified Data.Text.Internal import qualified Data.Time.Calendar as Data.Time.Calendar.Days import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime import qualified GHC.Base import qualified GHC.Classes import qualified GHC.Int import qualified GHC.Show import qualified GHC.Types import qualified StripeAPI.Common import StripeAPI.TypeAlias import {-# SOURCE #-} StripeAPI.Types.Account import {-# SOURCE #-} StripeAPI.Types.Customer import {-# SOURCE #-} StripeAPI.Types.DeletedCustomer import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.bank_account@ in the specification. -- -- These bank accounts are payment methods on \`Customer\` objects. -- -- On the other hand [External Accounts](https:\/\/stripe.com\/docs\/api\#external_accounts) are transfer -- destinations on \`Account\` objects for [Custom accounts](https:\/\/stripe.com\/docs\/connect\/custom-accounts). -- They can be bank accounts or debit cards as well, and are documented in the links above. -- -- Related guide: [Bank Debits and Transfers](https:\/\/stripe.com\/docs\/payments\/bank-debits-transfers). data BankAccount = BankAccount { -- | account: The ID of the account that the bank account is associated with. bankAccountAccount :: (GHC.Maybe.Maybe BankAccountAccount'Variants), -- | account_holder_name: The name of the person or business that owns the bank account. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountAccountHolderName :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | account_holder_type: The type of entity that holds the account. This can be either \`individual\` or \`company\`. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountAccountHolderType :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | available_payout_methods: A set of available payout methods for this bank account. Only values from this set should be passed as the \`method\` when creating a payout. bankAccountAvailablePayoutMethods :: (GHC.Maybe.Maybe ([BankAccountAvailablePayoutMethods'])), -- | bank_name: Name of the bank associated with the routing number (e.g., \`WELLS FARGO\`). -- -- Constraints: -- -- * Maximum length of 5000 bankAccountBankName :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | country: Two-letter ISO code representing the country the bank account is located in. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountCountry :: Data.Text.Internal.Text, -- | currency: Three-letter [ISO code for the currency](https:\/\/stripe.com\/docs\/payouts) paid out to the bank account. bankAccountCurrency :: Data.Text.Internal.Text, -- | customer: The ID of the customer that the bank account is associated with. bankAccountCustomer :: (GHC.Maybe.Maybe BankAccountCustomer'Variants), -- | default_for_currency: Whether this bank account is the default external account for its currency. bankAccountDefaultForCurrency :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | fingerprint: Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountFingerprint :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountId :: Data.Text.Internal.Text, -- | last4: The last four digits of the bank account number. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountLast4 :: Data.Text.Internal.Text, -- | metadata: 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. bankAccountMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | routing_number: The routing transit number for the bank account. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountRoutingNumber :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | status: For bank accounts, possible values are \`new\`, \`validated\`, \`verified\`, \`verification_failed\`, or \`errored\`. A bank account that hasn\'t had any activity or validation performed is \`new\`. If Stripe can determine that the bank account exists, its status will be \`validated\`. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be \`verified\`. If the verification failed for any reason, such as microdeposit failure, the status will be \`verification_failed\`. If a transfer sent to this bank account fails, we\'ll set the status to \`errored\` and will not continue to send transfers until the bank details are updated. -- -- For external accounts, possible values are \`new\` and \`errored\`. Validations aren\'t run against external accounts because they\'re only used for payouts. This means the other statuses don\'t apply. If a transfer fails, the status is set to \`errored\` and transfers are stopped until account details are updated. -- -- Constraints: -- -- * Maximum length of 5000 bankAccountStatus :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON BankAccount where toJSON obj = Data.Aeson.Types.Internal.object ("account" Data.Aeson.Types.ToJSON..= bankAccountAccount obj : "account_holder_name" Data.Aeson.Types.ToJSON..= bankAccountAccountHolderName obj : "account_holder_type" Data.Aeson.Types.ToJSON..= bankAccountAccountHolderType obj : "available_payout_methods" Data.Aeson.Types.ToJSON..= bankAccountAvailablePayoutMethods obj : "bank_name" Data.Aeson.Types.ToJSON..= bankAccountBankName obj : "country" Data.Aeson.Types.ToJSON..= bankAccountCountry obj : "currency" Data.Aeson.Types.ToJSON..= bankAccountCurrency obj : "customer" Data.Aeson.Types.ToJSON..= bankAccountCustomer obj : "default_for_currency" Data.Aeson.Types.ToJSON..= bankAccountDefaultForCurrency obj : "fingerprint" Data.Aeson.Types.ToJSON..= bankAccountFingerprint obj : "id" Data.Aeson.Types.ToJSON..= bankAccountId obj : "last4" Data.Aeson.Types.ToJSON..= bankAccountLast4 obj : "metadata" Data.Aeson.Types.ToJSON..= bankAccountMetadata obj : "routing_number" Data.Aeson.Types.ToJSON..= bankAccountRoutingNumber obj : "status" Data.Aeson.Types.ToJSON..= bankAccountStatus obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "bank_account" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("account" Data.Aeson.Types.ToJSON..= bankAccountAccount obj) GHC.Base.<> (("account_holder_name" Data.Aeson.Types.ToJSON..= bankAccountAccountHolderName obj) GHC.Base.<> (("account_holder_type" Data.Aeson.Types.ToJSON..= bankAccountAccountHolderType obj) GHC.Base.<> (("available_payout_methods" Data.Aeson.Types.ToJSON..= bankAccountAvailablePayoutMethods obj) GHC.Base.<> (("bank_name" Data.Aeson.Types.ToJSON..= bankAccountBankName obj) GHC.Base.<> (("country" Data.Aeson.Types.ToJSON..= bankAccountCountry obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= bankAccountCurrency obj) GHC.Base.<> (("customer" Data.Aeson.Types.ToJSON..= bankAccountCustomer obj) GHC.Base.<> (("default_for_currency" Data.Aeson.Types.ToJSON..= bankAccountDefaultForCurrency obj) GHC.Base.<> (("fingerprint" Data.Aeson.Types.ToJSON..= bankAccountFingerprint obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= bankAccountId obj) GHC.Base.<> (("last4" Data.Aeson.Types.ToJSON..= bankAccountLast4 obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= bankAccountMetadata obj) GHC.Base.<> (("routing_number" Data.Aeson.Types.ToJSON..= bankAccountRoutingNumber obj) GHC.Base.<> (("status" Data.Aeson.Types.ToJSON..= bankAccountStatus obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "bank_account")))))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON BankAccount where parseJSON = Data.Aeson.Types.FromJSON.withObject "BankAccount" (\obj -> ((((((((((((((GHC.Base.pure BankAccount GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "account")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "account_holder_name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "account_holder_type")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "available_payout_methods")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "bank_name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "country")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "customer")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "default_for_currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "fingerprint")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "last4")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "routing_number")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "status")) -- | Create a new 'BankAccount' with all required fields. mkBankAccount :: -- | 'bankAccountCountry' Data.Text.Internal.Text -> -- | 'bankAccountCurrency' Data.Text.Internal.Text -> -- | 'bankAccountId' Data.Text.Internal.Text -> -- | 'bankAccountLast4' Data.Text.Internal.Text -> -- | 'bankAccountStatus' Data.Text.Internal.Text -> BankAccount mkBankAccount bankAccountCountry bankAccountCurrency bankAccountId bankAccountLast4 bankAccountStatus = BankAccount { bankAccountAccount = GHC.Maybe.Nothing, bankAccountAccountHolderName = GHC.Maybe.Nothing, bankAccountAccountHolderType = GHC.Maybe.Nothing, bankAccountAvailablePayoutMethods = GHC.Maybe.Nothing, bankAccountBankName = GHC.Maybe.Nothing, bankAccountCountry = bankAccountCountry, bankAccountCurrency = bankAccountCurrency, bankAccountCustomer = GHC.Maybe.Nothing, bankAccountDefaultForCurrency = GHC.Maybe.Nothing, bankAccountFingerprint = GHC.Maybe.Nothing, bankAccountId = bankAccountId, bankAccountLast4 = bankAccountLast4, bankAccountMetadata = GHC.Maybe.Nothing, bankAccountRoutingNumber = GHC.Maybe.Nothing, bankAccountStatus = bankAccountStatus } -- | Defines the oneOf schema located at @components.schemas.bank_account.properties.account.anyOf@ in the specification. -- -- The ID of the account that the bank account is associated with. data BankAccountAccount'Variants = BankAccountAccount'Text Data.Text.Internal.Text | BankAccountAccount'Account Account deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON BankAccountAccount'Variants where toJSON (BankAccountAccount'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (BankAccountAccount'Account a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON BankAccountAccount'Variants where parseJSON val = case (BankAccountAccount'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((BankAccountAccount'Account Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Defines the enum schema located at @components.schemas.bank_account.properties.available_payout_methods.items@ in the specification. data BankAccountAvailablePayoutMethods' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. BankAccountAvailablePayoutMethods'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. BankAccountAvailablePayoutMethods'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"instant"@ BankAccountAvailablePayoutMethods'EnumInstant | -- | Represents the JSON value @"standard"@ BankAccountAvailablePayoutMethods'EnumStandard deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON BankAccountAvailablePayoutMethods' where toJSON (BankAccountAvailablePayoutMethods'Other val) = val toJSON (BankAccountAvailablePayoutMethods'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (BankAccountAvailablePayoutMethods'EnumInstant) = "instant" toJSON (BankAccountAvailablePayoutMethods'EnumStandard) = "standard" instance Data.Aeson.Types.FromJSON.FromJSON BankAccountAvailablePayoutMethods' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "instant" -> BankAccountAvailablePayoutMethods'EnumInstant | val GHC.Classes.== "standard" -> BankAccountAvailablePayoutMethods'EnumStandard | GHC.Base.otherwise -> BankAccountAvailablePayoutMethods'Other val ) -- | Defines the oneOf schema located at @components.schemas.bank_account.properties.customer.anyOf@ in the specification. -- -- The ID of the customer that the bank account is associated with. data BankAccountCustomer'Variants = BankAccountCustomer'Text Data.Text.Internal.Text | BankAccountCustomer'Customer Customer | BankAccountCustomer'DeletedCustomer DeletedCustomer deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON BankAccountCustomer'Variants where toJSON (BankAccountCustomer'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (BankAccountCustomer'Customer a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (BankAccountCustomer'DeletedCustomer a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON BankAccountCustomer'Variants where parseJSON val = case (BankAccountCustomer'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((BankAccountCustomer'Customer Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((BankAccountCustomer'DeletedCustomer Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched")) of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a