{-# 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.
    BankAccount -> Maybe BankAccountAccount'Variants
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
    BankAccount -> Maybe Text
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
    BankAccount -> Maybe Text
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.
    BankAccount -> Maybe [BankAccountAvailablePayoutMethods']
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
    BankAccount -> Maybe Text
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
    BankAccount -> Text
bankAccountCountry :: Data.Text.Internal.Text,
    -- | currency: Three-letter [ISO code for the currency](https:\/\/stripe.com\/docs\/payouts) paid out to the bank account.
    BankAccount -> Text
bankAccountCurrency :: Data.Text.Internal.Text,
    -- | customer: The ID of the customer that the bank account is associated with.
    BankAccount -> Maybe BankAccountCustomer'Variants
bankAccountCustomer :: (GHC.Maybe.Maybe BankAccountCustomer'Variants),
    -- | default_for_currency: Whether this bank account is the default external account for its currency.
    BankAccount -> Maybe Bool
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
    BankAccount -> Maybe Text
bankAccountFingerprint :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BankAccount -> Text
bankAccountId :: Data.Text.Internal.Text,
    -- | last4: The last four digits of the bank account number.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BankAccount -> Text
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.
    BankAccount -> Maybe Object
bankAccountMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | routing_number: The routing transit number for the bank account.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    BankAccount -> Maybe Text
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
    BankAccount -> Text
bankAccountStatus :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> BankAccount -> ShowS
[BankAccount] -> ShowS
BankAccount -> String
(Int -> BankAccount -> ShowS)
-> (BankAccount -> String)
-> ([BankAccount] -> ShowS)
-> Show BankAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BankAccount] -> ShowS
$cshowList :: [BankAccount] -> ShowS
show :: BankAccount -> String
$cshow :: BankAccount -> String
showsPrec :: Int -> BankAccount -> ShowS
$cshowsPrec :: Int -> BankAccount -> ShowS
GHC.Show.Show,
      BankAccount -> BankAccount -> Bool
(BankAccount -> BankAccount -> Bool)
-> (BankAccount -> BankAccount -> Bool) -> Eq BankAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BankAccount -> BankAccount -> Bool
$c/= :: BankAccount -> BankAccount -> Bool
== :: BankAccount -> BankAccount -> Bool
$c== :: BankAccount -> BankAccount -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON BankAccount where
  toJSON :: BankAccount -> Value
toJSON BankAccount
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"account" Text -> Maybe BankAccountAccount'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe BankAccountAccount'Variants
bankAccountAccount BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"account_holder_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountAccountHolderName BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"account_holder_type" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountAccountHolderType BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"available_payout_methods" Text -> Maybe [BankAccountAvailablePayoutMethods'] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe [BankAccountAvailablePayoutMethods']
bankAccountAvailablePayoutMethods BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"bank_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountBankName BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"country" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountCountry BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountCurrency BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> Maybe BankAccountCustomer'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe BankAccountCustomer'Variants
bankAccountCustomer BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"default_for_currency" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Bool
bankAccountDefaultForCurrency BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"fingerprint" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountFingerprint BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountId BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"last4" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountLast4 BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Object
bankAccountMetadata BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"routing_number" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountRoutingNumber BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountStatus BankAccount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"bank_account" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: BankAccount -> Encoding
toEncoding BankAccount
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"account" Text -> Maybe BankAccountAccount'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe BankAccountAccount'Variants
bankAccountAccount BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"account_holder_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountAccountHolderName BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"account_holder_type" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountAccountHolderType BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"available_payout_methods" Text -> Maybe [BankAccountAvailablePayoutMethods'] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe [BankAccountAvailablePayoutMethods']
bankAccountAvailablePayoutMethods BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"bank_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountBankName BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"country" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountCountry BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountCurrency BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> Maybe BankAccountCustomer'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe BankAccountCustomer'Variants
bankAccountCustomer BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"default_for_currency" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Bool
bankAccountDefaultForCurrency BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"fingerprint" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountFingerprint BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountId BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"last4" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountLast4 BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Object
bankAccountMetadata BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"routing_number" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Maybe Text
bankAccountRoutingNumber BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= BankAccount -> Text
bankAccountStatus BankAccount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"bank_account"))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON BankAccount where
  parseJSON :: Value -> Parser BankAccount
parseJSON = String
-> (Object -> Parser BankAccount) -> Value -> Parser BankAccount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"BankAccount" (\Object
obj -> (((((((((((((((Maybe BankAccountAccount'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe [BankAccountAvailablePayoutMethods']
 -> Maybe Text
 -> Text
 -> Text
 -> Maybe BankAccountCustomer'Variants
 -> Maybe Bool
 -> Maybe Text
 -> Text
 -> Text
 -> Maybe Object
 -> Maybe Text
 -> Text
 -> BankAccount)
-> Parser
     (Maybe BankAccountAccount'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe [BankAccountAvailablePayoutMethods']
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe BankAccountAccount'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [BankAccountAvailablePayoutMethods']
-> Maybe Text
-> Text
-> Text
-> Maybe BankAccountCustomer'Variants
-> Maybe Bool
-> Maybe Text
-> Text
-> Text
-> Maybe Object
-> Maybe Text
-> Text
-> BankAccount
BankAccount Parser
  (Maybe BankAccountAccount'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe [BankAccountAvailablePayoutMethods']
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe BankAccountAccount'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [BankAccountAvailablePayoutMethods']
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe BankAccountAccount'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"account")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [BankAccountAvailablePayoutMethods']
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [BankAccountAvailablePayoutMethods']
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"account_holder_name")) Parser
  (Maybe Text
   -> Maybe [BankAccountAvailablePayoutMethods']
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe Text)
-> Parser
     (Maybe [BankAccountAvailablePayoutMethods']
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"account_holder_type")) Parser
  (Maybe [BankAccountAvailablePayoutMethods']
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe [BankAccountAvailablePayoutMethods'])
-> Parser
     (Maybe Text
      -> Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe [BankAccountAvailablePayoutMethods'])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"available_payout_methods")) Parser
  (Maybe Text
   -> Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"bank_name")) Parser
  (Text
   -> Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser Text
-> Parser
     (Text
      -> Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"country")) Parser
  (Text
   -> Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser Text
-> Parser
     (Maybe BankAccountCustomer'Variants
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"currency")) Parser
  (Maybe BankAccountCustomer'Variants
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe BankAccountCustomer'Variants)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe BankAccountCustomer'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"customer")) Parser
  (Maybe Bool
   -> Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Text
      -> Text
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"default_for_currency")) Parser
  (Maybe Text
   -> Text
   -> Text
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> BankAccount)
-> Parser (Maybe Text)
-> Parser
     (Text -> Text -> Maybe Object -> Maybe Text -> Text -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"fingerprint")) Parser
  (Text -> Text -> Maybe Object -> Maybe Text -> Text -> BankAccount)
-> Parser Text
-> Parser
     (Text -> Maybe Object -> Maybe Text -> Text -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id")) Parser (Text -> Maybe Object -> Maybe Text -> Text -> BankAccount)
-> Parser Text
-> Parser (Maybe Object -> Maybe Text -> Text -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"last4")) Parser (Maybe Object -> Maybe Text -> Text -> BankAccount)
-> Parser (Maybe Object)
-> Parser (Maybe Text -> Text -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser (Maybe Text -> Text -> BankAccount)
-> Parser (Maybe Text) -> Parser (Text -> BankAccount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"routing_number")) Parser (Text -> BankAccount) -> Parser Text -> Parser BankAccount
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"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 :: Text -> Text -> Text -> Text -> Text -> BankAccount
mkBankAccount Text
bankAccountCountry Text
bankAccountCurrency Text
bankAccountId Text
bankAccountLast4 Text
bankAccountStatus =
  BankAccount :: Maybe BankAccountAccount'Variants
-> Maybe Text
-> Maybe Text
-> Maybe [BankAccountAvailablePayoutMethods']
-> Maybe Text
-> Text
-> Text
-> Maybe BankAccountCustomer'Variants
-> Maybe Bool
-> Maybe Text
-> Text
-> Text
-> Maybe Object
-> Maybe Text
-> Text
-> BankAccount
BankAccount
    { bankAccountAccount :: Maybe BankAccountAccount'Variants
bankAccountAccount = Maybe BankAccountAccount'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountAccountHolderName :: Maybe Text
bankAccountAccountHolderName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountAccountHolderType :: Maybe Text
bankAccountAccountHolderType = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountAvailablePayoutMethods :: Maybe [BankAccountAvailablePayoutMethods']
bankAccountAvailablePayoutMethods = Maybe [BankAccountAvailablePayoutMethods']
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountBankName :: Maybe Text
bankAccountBankName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountCountry :: Text
bankAccountCountry = Text
bankAccountCountry,
      bankAccountCurrency :: Text
bankAccountCurrency = Text
bankAccountCurrency,
      bankAccountCustomer :: Maybe BankAccountCustomer'Variants
bankAccountCustomer = Maybe BankAccountCustomer'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountDefaultForCurrency :: Maybe Bool
bankAccountDefaultForCurrency = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountFingerprint :: Maybe Text
bankAccountFingerprint = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountId :: Text
bankAccountId = Text
bankAccountId,
      bankAccountLast4 :: Text
bankAccountLast4 = Text
bankAccountLast4,
      bankAccountMetadata :: Maybe Object
bankAccountMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountRoutingNumber :: Maybe Text
bankAccountRoutingNumber = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      bankAccountStatus :: Text
bankAccountStatus = Text
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 (Int -> BankAccountAccount'Variants -> ShowS
[BankAccountAccount'Variants] -> ShowS
BankAccountAccount'Variants -> String
(Int -> BankAccountAccount'Variants -> ShowS)
-> (BankAccountAccount'Variants -> String)
-> ([BankAccountAccount'Variants] -> ShowS)
-> Show BankAccountAccount'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BankAccountAccount'Variants] -> ShowS
$cshowList :: [BankAccountAccount'Variants] -> ShowS
show :: BankAccountAccount'Variants -> String
$cshow :: BankAccountAccount'Variants -> String
showsPrec :: Int -> BankAccountAccount'Variants -> ShowS
$cshowsPrec :: Int -> BankAccountAccount'Variants -> ShowS
GHC.Show.Show, BankAccountAccount'Variants -> BankAccountAccount'Variants -> Bool
(BankAccountAccount'Variants
 -> BankAccountAccount'Variants -> Bool)
-> (BankAccountAccount'Variants
    -> BankAccountAccount'Variants -> Bool)
-> Eq BankAccountAccount'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BankAccountAccount'Variants -> BankAccountAccount'Variants -> Bool
$c/= :: BankAccountAccount'Variants -> BankAccountAccount'Variants -> Bool
== :: BankAccountAccount'Variants -> BankAccountAccount'Variants -> Bool
$c== :: BankAccountAccount'Variants -> BankAccountAccount'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BankAccountAccount'Variants where
  toJSON :: BankAccountAccount'Variants -> Value
toJSON (BankAccountAccount'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (BankAccountAccount'Account Account
a) = Account -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Account
a

instance Data.Aeson.Types.FromJSON.FromJSON BankAccountAccount'Variants where
  parseJSON :: Value -> Parser BankAccountAccount'Variants
parseJSON Value
val = case (Text -> BankAccountAccount'Variants
BankAccountAccount'Text (Text -> BankAccountAccount'Variants)
-> Result Text -> Result BankAccountAccount'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BankAccountAccount'Variants
-> Result BankAccountAccount'Variants
-> Result BankAccountAccount'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Account -> BankAccountAccount'Variants
BankAccountAccount'Account (Account -> BankAccountAccount'Variants)
-> Result Account -> Result BankAccountAccount'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Account
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BankAccountAccount'Variants
-> Result BankAccountAccount'Variants
-> Result BankAccountAccount'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result BankAccountAccount'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success BankAccountAccount'Variants
a -> BankAccountAccount'Variants -> Parser BankAccountAccount'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure BankAccountAccount'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser BankAccountAccount'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
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 (Int -> BankAccountAvailablePayoutMethods' -> ShowS
[BankAccountAvailablePayoutMethods'] -> ShowS
BankAccountAvailablePayoutMethods' -> String
(Int -> BankAccountAvailablePayoutMethods' -> ShowS)
-> (BankAccountAvailablePayoutMethods' -> String)
-> ([BankAccountAvailablePayoutMethods'] -> ShowS)
-> Show BankAccountAvailablePayoutMethods'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BankAccountAvailablePayoutMethods'] -> ShowS
$cshowList :: [BankAccountAvailablePayoutMethods'] -> ShowS
show :: BankAccountAvailablePayoutMethods' -> String
$cshow :: BankAccountAvailablePayoutMethods' -> String
showsPrec :: Int -> BankAccountAvailablePayoutMethods' -> ShowS
$cshowsPrec :: Int -> BankAccountAvailablePayoutMethods' -> ShowS
GHC.Show.Show, BankAccountAvailablePayoutMethods'
-> BankAccountAvailablePayoutMethods' -> Bool
(BankAccountAvailablePayoutMethods'
 -> BankAccountAvailablePayoutMethods' -> Bool)
-> (BankAccountAvailablePayoutMethods'
    -> BankAccountAvailablePayoutMethods' -> Bool)
-> Eq BankAccountAvailablePayoutMethods'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BankAccountAvailablePayoutMethods'
-> BankAccountAvailablePayoutMethods' -> Bool
$c/= :: BankAccountAvailablePayoutMethods'
-> BankAccountAvailablePayoutMethods' -> Bool
== :: BankAccountAvailablePayoutMethods'
-> BankAccountAvailablePayoutMethods' -> Bool
$c== :: BankAccountAvailablePayoutMethods'
-> BankAccountAvailablePayoutMethods' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BankAccountAvailablePayoutMethods' where
  toJSON :: BankAccountAvailablePayoutMethods' -> Value
toJSON (BankAccountAvailablePayoutMethods'Other Value
val) = Value
val
  toJSON (BankAccountAvailablePayoutMethods'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (BankAccountAvailablePayoutMethods'
BankAccountAvailablePayoutMethods'EnumInstant) = Value
"instant"
  toJSON (BankAccountAvailablePayoutMethods'
BankAccountAvailablePayoutMethods'EnumStandard) = Value
"standard"

instance Data.Aeson.Types.FromJSON.FromJSON BankAccountAvailablePayoutMethods' where
  parseJSON :: Value -> Parser BankAccountAvailablePayoutMethods'
parseJSON Value
val =
    BankAccountAvailablePayoutMethods'
-> Parser BankAccountAvailablePayoutMethods'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"instant" -> BankAccountAvailablePayoutMethods'
BankAccountAvailablePayoutMethods'EnumInstant
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"standard" -> BankAccountAvailablePayoutMethods'
BankAccountAvailablePayoutMethods'EnumStandard
            | Bool
GHC.Base.otherwise -> Value -> BankAccountAvailablePayoutMethods'
BankAccountAvailablePayoutMethods'Other Value
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 (Int -> BankAccountCustomer'Variants -> ShowS
[BankAccountCustomer'Variants] -> ShowS
BankAccountCustomer'Variants -> String
(Int -> BankAccountCustomer'Variants -> ShowS)
-> (BankAccountCustomer'Variants -> String)
-> ([BankAccountCustomer'Variants] -> ShowS)
-> Show BankAccountCustomer'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BankAccountCustomer'Variants] -> ShowS
$cshowList :: [BankAccountCustomer'Variants] -> ShowS
show :: BankAccountCustomer'Variants -> String
$cshow :: BankAccountCustomer'Variants -> String
showsPrec :: Int -> BankAccountCustomer'Variants -> ShowS
$cshowsPrec :: Int -> BankAccountCustomer'Variants -> ShowS
GHC.Show.Show, BankAccountCustomer'Variants
-> BankAccountCustomer'Variants -> Bool
(BankAccountCustomer'Variants
 -> BankAccountCustomer'Variants -> Bool)
-> (BankAccountCustomer'Variants
    -> BankAccountCustomer'Variants -> Bool)
-> Eq BankAccountCustomer'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BankAccountCustomer'Variants
-> BankAccountCustomer'Variants -> Bool
$c/= :: BankAccountCustomer'Variants
-> BankAccountCustomer'Variants -> Bool
== :: BankAccountCustomer'Variants
-> BankAccountCustomer'Variants -> Bool
$c== :: BankAccountCustomer'Variants
-> BankAccountCustomer'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BankAccountCustomer'Variants where
  toJSON :: BankAccountCustomer'Variants -> Value
toJSON (BankAccountCustomer'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (BankAccountCustomer'Customer Customer
a) = Customer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Customer
a
  toJSON (BankAccountCustomer'DeletedCustomer DeletedCustomer
a) = DeletedCustomer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON DeletedCustomer
a

instance Data.Aeson.Types.FromJSON.FromJSON BankAccountCustomer'Variants where
  parseJSON :: Value -> Parser BankAccountCustomer'Variants
parseJSON Value
val = case (Text -> BankAccountCustomer'Variants
BankAccountCustomer'Text (Text -> BankAccountCustomer'Variants)
-> Result Text -> Result BankAccountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Customer -> BankAccountCustomer'Variants
BankAccountCustomer'Customer (Customer -> BankAccountCustomer'Variants)
-> Result Customer -> Result BankAccountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Customer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedCustomer -> BankAccountCustomer'Variants
BankAccountCustomer'DeletedCustomer (DeletedCustomer -> BankAccountCustomer'Variants)
-> Result DeletedCustomer -> Result BankAccountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result DeletedCustomer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
-> Result BankAccountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result BankAccountCustomer'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
    Data.Aeson.Types.Internal.Success BankAccountCustomer'Variants
a -> BankAccountCustomer'Variants -> Parser BankAccountCustomer'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure BankAccountCustomer'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser BankAccountCustomer'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a