{-# 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 postAccountsAccountBankAccountsId module StripeAPI.Operations.PostAccountsAccountBankAccountsId 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/accounts/{account}/bank_accounts/{id} -- -- \

Updates the metadata, account holder name, and account holder type of a bank account belonging to a \Custom account\<\/a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.\<\/p> -- -- \

You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.\<\/p> postAccountsAccountBankAccountsId :: forall m. StripeAPI.Common.MonadHTTP m => -- | Contains all available parameters of this operation (query and path parameters) PostAccountsAccountBankAccountsIdParameters -> -- | The request body to send GHC.Maybe.Maybe PostAccountsAccountBankAccountsIdRequestBody -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostAccountsAccountBankAccountsIdResponse) postAccountsAccountBankAccountsId parameters body = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either PostAccountsAccountBankAccountsIdResponseError GHC.Base.id GHC.Base.. ( \response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> PostAccountsAccountBankAccountsIdResponse200 Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String ExternalAccount ) | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) -> PostAccountsAccountBankAccountsIdResponseDefault Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String Error ) | GHC.Base.otherwise -> Data.Either.Left "Missing default response type" ) response_0 ) response_0 ) (StripeAPI.Common.doBodyCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "POST") (Data.Text.pack ("/v1/accounts/" GHC.Base.++ (Data.ByteString.Char8.unpack (Network.HTTP.Types.URI.urlEncode GHC.Types.True GHC.Base.$ (Data.ByteString.Char8.pack GHC.Base.$ StripeAPI.Common.stringifyModel (postAccountsAccountBankAccountsIdParametersPathAccount parameters))) GHC.Base.++ ("/bank_accounts/" GHC.Base.++ (Data.ByteString.Char8.unpack (Network.HTTP.Types.URI.urlEncode GHC.Types.True GHC.Base.$ (Data.ByteString.Char8.pack GHC.Base.$ StripeAPI.Common.stringifyModel (postAccountsAccountBankAccountsIdParametersPathId parameters))) GHC.Base.++ ""))))) GHC.Base.mempty body StripeAPI.Common.RequestBodyEncodingFormData) -- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/bank_accounts\/{id}.POST.parameters@ in the specification. data PostAccountsAccountBankAccountsIdParameters = PostAccountsAccountBankAccountsIdParameters { -- | pathAccount: Represents the parameter named \'account\' -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdParametersPathAccount :: Data.Text.Internal.Text, -- | pathId: Represents the parameter named \'id\' postAccountsAccountBankAccountsIdParametersPathId :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountBankAccountsIdParameters where toJSON obj = Data.Aeson.Types.Internal.object ("pathAccount" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdParametersPathAccount obj : "pathId" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdParametersPathId obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("pathAccount" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdParametersPathAccount obj) GHC.Base.<> ("pathId" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdParametersPathId obj)) instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountBankAccountsIdParameters where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostAccountsAccountBankAccountsIdParameters" (\obj -> (GHC.Base.pure PostAccountsAccountBankAccountsIdParameters GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "pathAccount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "pathId")) -- | Create a new 'PostAccountsAccountBankAccountsIdParameters' with all required fields. mkPostAccountsAccountBankAccountsIdParameters :: -- | 'postAccountsAccountBankAccountsIdParametersPathAccount' Data.Text.Internal.Text -> -- | 'postAccountsAccountBankAccountsIdParametersPathId' Data.Text.Internal.Text -> PostAccountsAccountBankAccountsIdParameters mkPostAccountsAccountBankAccountsIdParameters postAccountsAccountBankAccountsIdParametersPathAccount postAccountsAccountBankAccountsIdParametersPathId = PostAccountsAccountBankAccountsIdParameters { postAccountsAccountBankAccountsIdParametersPathAccount = postAccountsAccountBankAccountsIdParametersPathAccount, postAccountsAccountBankAccountsIdParametersPathId = postAccountsAccountBankAccountsIdParametersPathId } -- | Defines the object schema located at @paths.\/v1\/accounts\/{account}\/bank_accounts\/{id}.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification. data PostAccountsAccountBankAccountsIdRequestBody = PostAccountsAccountBankAccountsIdRequestBody { -- | account_holder_name: The name of the person or business that owns the bank account. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAccountHolderName :: (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 postAccountsAccountBankAccountsIdRequestBodyAccountHolderType :: (GHC.Maybe.Maybe PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'), -- | address_city: City\/District\/Suburb\/Town\/Village. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_country: Billing address country, if provided when creating card. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_line1: Address line 1 (Street address\/PO Box\/Company name). -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressLine1 :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_line2: Address line 2 (Apartment\/Suite\/Unit\/Building). -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressLine2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_state: State\/County\/Province\/Region. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressState :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_zip: ZIP or postal code. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyAddressZip :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | default_for_currency: When set to true, this becomes the default external account for its currency. postAccountsAccountBankAccountsIdRequestBodyDefaultForCurrency :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | exp_month: Two digit number representing the card’s expiration month. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyExpMonth :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | exp_year: Four digit number representing the card’s expiration year. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyExpYear :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | expand: Specifies which fields in the response should be expanded. postAccountsAccountBankAccountsIdRequestBodyExpand :: (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\`. postAccountsAccountBankAccountsIdRequestBodyMetadata :: (GHC.Maybe.Maybe PostAccountsAccountBankAccountsIdRequestBodyMetadata'Variants), -- | name: Cardholder name. -- -- Constraints: -- -- * Maximum length of 5000 postAccountsAccountBankAccountsIdRequestBodyName :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountBankAccountsIdRequestBody where toJSON obj = Data.Aeson.Types.Internal.object ("account_holder_name" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAccountHolderName obj : "account_holder_type" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAccountHolderType obj : "address_city" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressCity obj : "address_country" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressCountry obj : "address_line1" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressLine1 obj : "address_line2" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressLine2 obj : "address_state" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressState obj : "address_zip" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressZip obj : "default_for_currency" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyDefaultForCurrency obj : "exp_month" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpMonth obj : "exp_year" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpYear obj : "expand" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpand obj : "metadata" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyMetadata obj : "name" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyName obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("account_holder_name" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAccountHolderName obj) GHC.Base.<> (("account_holder_type" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAccountHolderType obj) GHC.Base.<> (("address_city" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressCity obj) GHC.Base.<> (("address_country" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressCountry obj) GHC.Base.<> (("address_line1" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressLine1 obj) GHC.Base.<> (("address_line2" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressLine2 obj) GHC.Base.<> (("address_state" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressState obj) GHC.Base.<> (("address_zip" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyAddressZip obj) GHC.Base.<> (("default_for_currency" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyDefaultForCurrency obj) GHC.Base.<> (("exp_month" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpMonth obj) GHC.Base.<> (("exp_year" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpYear obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyExpand obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyMetadata obj) GHC.Base.<> ("name" Data.Aeson.Types.ToJSON..= postAccountsAccountBankAccountsIdRequestBodyName obj)))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountBankAccountsIdRequestBody where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostAccountsAccountBankAccountsIdRequestBody" (\obj -> (((((((((((((GHC.Base.pure PostAccountsAccountBankAccountsIdRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "account_holder_name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "account_holder_type")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_city")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_country")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_line1")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_line2")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_state")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "address_zip")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "default_for_currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "exp_month")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "exp_year")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "name")) -- | Create a new 'PostAccountsAccountBankAccountsIdRequestBody' with all required fields. mkPostAccountsAccountBankAccountsIdRequestBody :: PostAccountsAccountBankAccountsIdRequestBody mkPostAccountsAccountBankAccountsIdRequestBody = PostAccountsAccountBankAccountsIdRequestBody { postAccountsAccountBankAccountsIdRequestBodyAccountHolderName = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAccountHolderType = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressCity = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressCountry = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressLine1 = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressLine2 = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressState = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyAddressZip = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyDefaultForCurrency = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyExpMonth = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyExpYear = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyExpand = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyMetadata = GHC.Maybe.Nothing, postAccountsAccountBankAccountsIdRequestBodyName = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/accounts\/{account}\/bank_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 PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'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. PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @""@ PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumEmptyString | -- | Represents the JSON value @"company"@ PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumCompany | -- | Represents the JSON value @"individual"@ PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumIndividual deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType' where toJSON (PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'Other val) = val toJSON (PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumEmptyString) = "" toJSON (PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumCompany) = "company" toJSON (PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumIndividual) = "individual" instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "" -> PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumEmptyString | val GHC.Classes.== "company" -> PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumCompany | val GHC.Classes.== "individual" -> PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'EnumIndividual | GHC.Base.otherwise -> PostAccountsAccountBankAccountsIdRequestBodyAccountHolderType'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/accounts\/{account}\/bank_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 PostAccountsAccountBankAccountsIdRequestBodyMetadata'Variants = -- | Represents the JSON value @""@ PostAccountsAccountBankAccountsIdRequestBodyMetadata'EmptyString | PostAccountsAccountBankAccountsIdRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostAccountsAccountBankAccountsIdRequestBodyMetadata'Variants where toJSON (PostAccountsAccountBankAccountsIdRequestBodyMetadata'Object a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostAccountsAccountBankAccountsIdRequestBodyMetadata'EmptyString) = "" instance Data.Aeson.Types.FromJSON.FromJSON PostAccountsAccountBankAccountsIdRequestBodyMetadata'Variants where parseJSON val = if | val GHC.Classes.== "" -> GHC.Base.pure PostAccountsAccountBankAccountsIdRequestBodyMetadata'EmptyString | GHC.Base.otherwise -> case (PostAccountsAccountBankAccountsIdRequestBodyMetadata'Object Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a -- | Represents a response of the operation 'postAccountsAccountBankAccountsId'. -- -- 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), 'PostAccountsAccountBankAccountsIdResponseError' is used. data PostAccountsAccountBankAccountsIdResponse = -- | Means either no matching case available or a parse error PostAccountsAccountBankAccountsIdResponseError GHC.Base.String | -- | Successful response. PostAccountsAccountBankAccountsIdResponse200 ExternalAccount | -- | Error response. PostAccountsAccountBankAccountsIdResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq)