{-# LANGUAGE ExplicitForAll #-}
{-# 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 different functions to run the operation postAccountExternalAccountsId
module StripeAPI.Operations.PostAccountExternalAccountsId where

import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
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.Either
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 Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | > POST /v1/account/external_accounts/{id}
--
-- \<p>Updates the metadata, account holder name, and account holder type of a bank account belonging to a \<a href=\"\/docs\/connect\/custom-accounts\">Custom account\<\/a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.\<\/p>
--
-- \<p>You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.\<\/p>
postAccountExternalAccountsId ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | id
  Data.Text.Internal.Text ->
  -- | The request body to send
  GHC.Maybe.Maybe PostAccountExternalAccountsIdRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostAccountExternalAccountsIdResponse)
postAccountExternalAccountsId :: Text
-> Maybe PostAccountExternalAccountsIdRequestBody
-> ClientT m (Response PostAccountExternalAccountsIdResponse)
postAccountExternalAccountsId
  Text
id
  Maybe PostAccountExternalAccountsIdRequestBody
body =
    (Response ByteString
 -> Response PostAccountExternalAccountsIdResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response PostAccountExternalAccountsIdResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
      ( \Response ByteString
response_0 ->
          (ByteString -> PostAccountExternalAccountsIdResponse)
-> Response ByteString
-> Response PostAccountExternalAccountsIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
            ( (String -> PostAccountExternalAccountsIdResponse)
-> (PostAccountExternalAccountsIdResponse
    -> PostAccountExternalAccountsIdResponse)
-> Either String PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostAccountExternalAccountsIdResponse
PostAccountExternalAccountsIdResponseError PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse
forall a. a -> a
GHC.Base.id
                (Either String PostAccountExternalAccountsIdResponse
 -> PostAccountExternalAccountsIdResponse)
-> (ByteString
    -> Either String PostAccountExternalAccountsIdResponse)
-> ByteString
-> PostAccountExternalAccountsIdResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                               if
                                   | (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                     ExternalAccount -> PostAccountExternalAccountsIdResponse
PostAccountExternalAccountsIdResponse200
                                       (ExternalAccount -> PostAccountExternalAccountsIdResponse)
-> Either String ExternalAccount
-> Either String PostAccountExternalAccountsIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String ExternalAccount
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              ExternalAccount
                                                        )
                                   | Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                     Error -> PostAccountExternalAccountsIdResponse
PostAccountExternalAccountsIdResponseDefault
                                       (Error -> PostAccountExternalAccountsIdResponse)
-> Either String Error
-> Either String PostAccountExternalAccountsIdResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                            Data.Either.Either
                                                              GHC.Base.String
                                                              Error
                                                        )
                                   | Bool
GHC.Base.otherwise -> String -> Either String PostAccountExternalAccountsIdResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                           )
                  Response ByteString
response_0
            )
            Response ByteString
response_0
      )
      (Text
-> Text
-> [QueryParameter]
-> Maybe PostAccountExternalAccountsIdRequestBody
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack (String
"/v1/account/external_accounts/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel Text
id)) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
""))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostAccountExternalAccountsIdRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/account\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostAccountExternalAccountsIdRequestBody = PostAccountExternalAccountsIdRequestBody
  { -- | account_holder_name: The name of the person or business that owns the bank account.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAccountHolderName :: (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
    PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountExternalAccountsIdRequestBodyAccountHolderType :: (GHC.Maybe.Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'),
    -- | address_city: City\/District\/Suburb\/Town\/Village.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_country: Billing address country, if provided when creating card.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line1: Address line 1 (Street address\/PO Box\/Company name).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine1 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line2: Address line 2 (Apartment\/Suite\/Unit\/Building).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_state: State\/County\/Province\/Region.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressState :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_zip: ZIP or postal code.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressZip :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | default_for_currency: When set to true, this becomes the default external account for its currency.
    PostAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountExternalAccountsIdRequestBodyDefaultForCurrency :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | exp_month: Two digit number representing the card’s expiration month.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpMonth :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | exp_year: Four digit number representing the card’s expiration year.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpYear :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | expand: Specifies which fields in the response should be expanded.
    PostAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountExternalAccountsIdRequestBodyExpand :: (GHC.Maybe.Maybe ([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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`.
    PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountExternalAccountsIdRequestBodyMetadata :: (GHC.Maybe.Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants),
    -- | name: Cardholder name.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PostAccountExternalAccountsIdRequestBody -> String -> String
[PostAccountExternalAccountsIdRequestBody] -> String -> String
PostAccountExternalAccountsIdRequestBody -> String
(Int
 -> PostAccountExternalAccountsIdRequestBody -> String -> String)
-> (PostAccountExternalAccountsIdRequestBody -> String)
-> ([PostAccountExternalAccountsIdRequestBody] -> String -> String)
-> Show PostAccountExternalAccountsIdRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountExternalAccountsIdRequestBody] -> String -> String
$cshowList :: [PostAccountExternalAccountsIdRequestBody] -> String -> String
show :: PostAccountExternalAccountsIdRequestBody -> String
$cshow :: PostAccountExternalAccountsIdRequestBody -> String
showsPrec :: Int -> PostAccountExternalAccountsIdRequestBody -> String -> String
$cshowsPrec :: Int -> PostAccountExternalAccountsIdRequestBody -> String -> String
GHC.Show.Show,
      PostAccountExternalAccountsIdRequestBody
-> PostAccountExternalAccountsIdRequestBody -> Bool
(PostAccountExternalAccountsIdRequestBody
 -> PostAccountExternalAccountsIdRequestBody -> Bool)
-> (PostAccountExternalAccountsIdRequestBody
    -> PostAccountExternalAccountsIdRequestBody -> Bool)
-> Eq PostAccountExternalAccountsIdRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountExternalAccountsIdRequestBody
-> PostAccountExternalAccountsIdRequestBody -> Bool
$c/= :: PostAccountExternalAccountsIdRequestBody
-> PostAccountExternalAccountsIdRequestBody -> Bool
== :: PostAccountExternalAccountsIdRequestBody
-> PostAccountExternalAccountsIdRequestBody -> Bool
$c== :: PostAccountExternalAccountsIdRequestBody
-> PostAccountExternalAccountsIdRequestBody -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountExternalAccountsIdRequestBody where
  toJSON :: PostAccountExternalAccountsIdRequestBody -> Value
toJSON PostAccountExternalAccountsIdRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"account_holder_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAccountHolderName PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"account_holder_type" Text
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountExternalAccountsIdRequestBodyAccountHolderType PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_city" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCity PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCountry PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line1" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine1 PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line2" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine2 PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_state" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressState PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_zip" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressZip PostAccountExternalAccountsIdRequestBody
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..= PostAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountExternalAccountsIdRequestBodyDefaultForCurrency PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_month" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpMonth PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_year" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpYear PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountExternalAccountsIdRequestBodyExpand PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountExternalAccountsIdRequestBodyMetadata PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyName PostAccountExternalAccountsIdRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostAccountExternalAccountsIdRequestBody -> Encoding
toEncoding PostAccountExternalAccountsIdRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"account_holder_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAccountHolderName PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"account_holder_type" Text
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountExternalAccountsIdRequestBodyAccountHolderType PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_city" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCity PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCountry PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line1" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine1 PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line2" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine2 PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_state" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressState PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_zip" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyAddressZip PostAccountExternalAccountsIdRequestBody
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..= PostAccountExternalAccountsIdRequestBody -> Maybe Bool
postAccountExternalAccountsIdRequestBodyDefaultForCurrency PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_month" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpMonth PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_year" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyExpYear PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe [Text]
postAccountExternalAccountsIdRequestBodyExpand PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountExternalAccountsIdRequestBodyMetadata PostAccountExternalAccountsIdRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostAccountExternalAccountsIdRequestBody -> Maybe Text
postAccountExternalAccountsIdRequestBodyName PostAccountExternalAccountsIdRequestBody
obj))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostAccountExternalAccountsIdRequestBody where
  parseJSON :: Value -> Parser PostAccountExternalAccountsIdRequestBody
parseJSON = String
-> (Object -> Parser PostAccountExternalAccountsIdRequestBody)
-> Value
-> Parser PostAccountExternalAccountsIdRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostAccountExternalAccountsIdRequestBody" (\Object
obj -> ((((((((((((((Maybe Text
 -> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> Maybe Text
 -> PostAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe Text
      -> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Maybe Text
-> PostAccountExternalAccountsIdRequestBody
PostAccountExternalAccountsIdRequestBody Parser
  (Maybe Text
   -> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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 PostAccountExternalAccountsIdRequestBodyAccountHolderType'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType')
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"account_holder_type")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_city")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_country")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_line1")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_line2")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_state")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"address_zip")) Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"exp_month")) Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text
      -> PostAccountExternalAccountsIdRequestBody)
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
"exp_year")) Parser
  (Maybe [Text]
   -> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text
   -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe [Text])
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
      -> Maybe Text -> PostAccountExternalAccountsIdRequestBody)
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
"expand")) Parser
  (Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
   -> Maybe Text -> PostAccountExternalAccountsIdRequestBody)
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants)
-> Parser (Maybe Text -> PostAccountExternalAccountsIdRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser (Maybe Text -> PostAccountExternalAccountsIdRequestBody)
-> Parser (Maybe Text)
-> Parser PostAccountExternalAccountsIdRequestBody
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
"name"))

-- | Create a new 'PostAccountExternalAccountsIdRequestBody' with all required fields.
mkPostAccountExternalAccountsIdRequestBody :: PostAccountExternalAccountsIdRequestBody
mkPostAccountExternalAccountsIdRequestBody :: PostAccountExternalAccountsIdRequestBody
mkPostAccountExternalAccountsIdRequestBody =
  PostAccountExternalAccountsIdRequestBody :: Maybe Text
-> Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Maybe Text
-> PostAccountExternalAccountsIdRequestBody
PostAccountExternalAccountsIdRequestBody
    { postAccountExternalAccountsIdRequestBodyAccountHolderName :: Maybe Text
postAccountExternalAccountsIdRequestBodyAccountHolderName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAccountHolderType :: Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
postAccountExternalAccountsIdRequestBodyAccountHolderType = Maybe PostAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressCity :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCity = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressCountry :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressLine1 :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine1 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressLine2 :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressLine2 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressState :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyAddressZip :: Maybe Text
postAccountExternalAccountsIdRequestBodyAddressZip = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyDefaultForCurrency :: Maybe Bool
postAccountExternalAccountsIdRequestBodyDefaultForCurrency = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyExpMonth :: Maybe Text
postAccountExternalAccountsIdRequestBodyExpMonth = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyExpYear :: Maybe Text
postAccountExternalAccountsIdRequestBodyExpYear = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyExpand :: Maybe [Text]
postAccountExternalAccountsIdRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyMetadata :: Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
postAccountExternalAccountsIdRequestBodyMetadata = Maybe PostAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postAccountExternalAccountsIdRequestBodyName :: Maybe Text
postAccountExternalAccountsIdRequestBodyName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/account\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.account_holder_type@ in the specification.
--
-- The type of entity that holds the account. This can be either \`individual\` or \`company\`.
data PostAccountExternalAccountsIdRequestBodyAccountHolderType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'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.
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @""@
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString
  | -- | Represents the JSON value @"company"@
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany
  | -- | Represents the JSON value @"individual"@
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual
  deriving (Int
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
[PostAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
(Int
 -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> String
 -> String)
-> (PostAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> String)
-> ([PostAccountExternalAccountsIdRequestBodyAccountHolderType']
    -> String -> String)
-> Show PostAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
$cshowList :: [PostAccountExternalAccountsIdRequestBodyAccountHolderType']
-> String -> String
show :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
$cshow :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
showsPrec :: Int
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
$cshowsPrec :: Int
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> String
-> String
GHC.Show.Show, PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
(PostAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
 -> Bool)
-> (PostAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
    -> Bool)
-> Eq PostAccountExternalAccountsIdRequestBodyAccountHolderType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
$c/= :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
== :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
$c== :: PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountExternalAccountsIdRequestBodyAccountHolderType' where
  toJSON :: PostAccountExternalAccountsIdRequestBodyAccountHolderType' -> Value
toJSON (PostAccountExternalAccountsIdRequestBodyAccountHolderType'Other Value
val) = Value
val
  toJSON (PostAccountExternalAccountsIdRequestBodyAccountHolderType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString) = Value
""
  toJSON (PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany) = Value
"company"
  toJSON (PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual) = Value
"individual"

instance Data.Aeson.Types.FromJSON.FromJSON PostAccountExternalAccountsIdRequestBodyAccountHolderType' where
  parseJSON :: Value
-> Parser
     PostAccountExternalAccountsIdRequestBodyAccountHolderType'
parseJSON Value
val =
    PostAccountExternalAccountsIdRequestBodyAccountHolderType'
-> Parser
     PostAccountExternalAccountsIdRequestBodyAccountHolderType'
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
"" -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumEmptyString
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"company" -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumCompany
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"individual" -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'EnumIndividual
            | Bool
GHC.Base.otherwise -> Value -> PostAccountExternalAccountsIdRequestBodyAccountHolderType'
PostAccountExternalAccountsIdRequestBodyAccountHolderType'Other Value
val
      )

-- | Defines the oneOf schema located at @paths.\/v1\/account\/external_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.metadata.anyOf@ in the specification.
--
-- 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\`.
data PostAccountExternalAccountsIdRequestBodyMetadata'Variants
  = -- | Represents the JSON value @""@
    PostAccountExternalAccountsIdRequestBodyMetadata'EmptyString
  | PostAccountExternalAccountsIdRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
  deriving (Int
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
[PostAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
PostAccountExternalAccountsIdRequestBodyMetadata'Variants -> String
(Int
 -> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> String
 -> String)
-> (PostAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> String)
-> ([PostAccountExternalAccountsIdRequestBodyMetadata'Variants]
    -> String -> String)
-> Show PostAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
$cshowList :: [PostAccountExternalAccountsIdRequestBodyMetadata'Variants]
-> String -> String
show :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants -> String
$cshow :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants -> String
showsPrec :: Int
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
$cshowsPrec :: Int
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> String
-> String
GHC.Show.Show, PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
(PostAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
 -> Bool)
-> (PostAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
    -> Bool)
-> Eq PostAccountExternalAccountsIdRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
$c/= :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
== :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
$c== :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> PostAccountExternalAccountsIdRequestBodyMetadata'Variants
-> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostAccountExternalAccountsIdRequestBodyMetadata'Variants where
  toJSON :: PostAccountExternalAccountsIdRequestBodyMetadata'Variants -> Value
toJSON (PostAccountExternalAccountsIdRequestBodyMetadata'Object Object
a) = Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Object
a
  toJSON (PostAccountExternalAccountsIdRequestBodyMetadata'Variants
PostAccountExternalAccountsIdRequestBodyMetadata'EmptyString) = Value
""

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

-- | Represents a response of the operation 'postAccountExternalAccountsId'.
--
-- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'PostAccountExternalAccountsIdResponseError' is used.
data PostAccountExternalAccountsIdResponse
  = -- | Means either no matching case available or a parse error
    PostAccountExternalAccountsIdResponseError GHC.Base.String
  | -- | Successful response.
    PostAccountExternalAccountsIdResponse200 ExternalAccount
  | -- | Error response.
    PostAccountExternalAccountsIdResponseDefault Error
  deriving (Int -> PostAccountExternalAccountsIdResponse -> String -> String
[PostAccountExternalAccountsIdResponse] -> String -> String
PostAccountExternalAccountsIdResponse -> String
(Int -> PostAccountExternalAccountsIdResponse -> String -> String)
-> (PostAccountExternalAccountsIdResponse -> String)
-> ([PostAccountExternalAccountsIdResponse] -> String -> String)
-> Show PostAccountExternalAccountsIdResponse
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostAccountExternalAccountsIdResponse] -> String -> String
$cshowList :: [PostAccountExternalAccountsIdResponse] -> String -> String
show :: PostAccountExternalAccountsIdResponse -> String
$cshow :: PostAccountExternalAccountsIdResponse -> String
showsPrec :: Int -> PostAccountExternalAccountsIdResponse -> String -> String
$cshowsPrec :: Int -> PostAccountExternalAccountsIdResponse -> String -> String
GHC.Show.Show, PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse -> Bool
(PostAccountExternalAccountsIdResponse
 -> PostAccountExternalAccountsIdResponse -> Bool)
-> (PostAccountExternalAccountsIdResponse
    -> PostAccountExternalAccountsIdResponse -> Bool)
-> Eq PostAccountExternalAccountsIdResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse -> Bool
$c/= :: PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse -> Bool
== :: PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse -> Bool
$c== :: PostAccountExternalAccountsIdResponse
-> PostAccountExternalAccountsIdResponse -> Bool
GHC.Classes.Eq)