{-# 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 postSetupIntents
module StripeAPI.Operations.PostSetupIntents 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/setup_intents
--
-- \<p>Creates a SetupIntent object.\<\/p>
--
-- \<p>After the SetupIntent is created, attach a payment method and \<a href=\"\/docs\/api\/setup_intents\/confirm\">confirm\<\/a>
-- to collect any required permissions to charge the payment method later.\<\/p>
postSetupIntents ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | The request body to send
  GHC.Maybe.Maybe PostSetupIntentsRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostSetupIntentsResponse)
postSetupIntents body =
  GHC.Base.fmap
    ( \response_0 ->
        GHC.Base.fmap
          ( Data.Either.either PostSetupIntentsResponseError 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) ->
                                   PostSetupIntentsResponse200
                                     Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            SetupIntent
                                                      )
                                 | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) ->
                                   PostSetupIntentsResponseDefault
                                     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/setup_intents") GHC.Base.mempty body StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostSetupIntentsRequestBody = PostSetupIntentsRequestBody
  { -- | confirm: Set to \`true\` to attempt to confirm this SetupIntent immediately. This parameter defaults to \`false\`. If the payment method attached is a card, a return_url may be provided in case additional authentication is required.
    postSetupIntentsRequestBodyConfirm :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | customer: ID of the Customer this SetupIntent belongs to, if one exists.
    --
    -- If present, the SetupIntent\'s payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    postSetupIntentsRequestBodyCustomer :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | description: An arbitrary string attached to the object. Often useful for displaying to users.
    --
    -- Constraints:
    --
    -- * Maximum length of 1000
    postSetupIntentsRequestBodyDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | expand: Specifies which fields in the response should be expanded.
    postSetupIntentsRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | mandate_data: This hash contains details about the Mandate to create. This parameter can only be used with [\`confirm=true\`](https:\/\/stripe.com\/docs\/api\/setup_intents\/create\#create_setup_intent-confirm).
    postSetupIntentsRequestBodyMandateData :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyMandateData'),
    -- | 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\`.
    postSetupIntentsRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | on_behalf_of: The Stripe account ID for which this SetupIntent is created.
    postSetupIntentsRequestBodyOnBehalfOf :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | payment_method: ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    postSetupIntentsRequestBodyPaymentMethod :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | payment_method_options: Payment-method-specific configuration for this SetupIntent.
    postSetupIntentsRequestBodyPaymentMethodOptions :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'),
    -- | payment_method_types: The list of payment method types (e.g. card) that this SetupIntent is allowed to use. If this is not provided, defaults to [\"card\"].
    postSetupIntentsRequestBodyPaymentMethodTypes :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | return_url: The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method\'s app or site. If you\'d prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter can only be used with [\`confirm=true\`](https:\/\/stripe.com\/docs\/api\/setup_intents\/create\#create_setup_intent-confirm).
    postSetupIntentsRequestBodyReturnUrl :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | single_use: If this hash is populated, this SetupIntent will generate a single_use Mandate on success.
    postSetupIntentsRequestBodySingleUse :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodySingleUse'),
    -- | usage: Indicates how the payment method is intended to be used in the future. If not provided, this value defaults to \`off_session\`.
    postSetupIntentsRequestBodyUsage :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyUsage')
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBody where
  toJSON obj = Data.Aeson.Types.Internal.object ("confirm" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyConfirm obj : "customer" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyCustomer obj : "description" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyDescription obj : "expand" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyExpand obj : "mandate_data" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData obj : "metadata" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMetadata obj : "on_behalf_of" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyOnBehalfOf obj : "payment_method" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethod obj : "payment_method_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions obj : "payment_method_types" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodTypes obj : "return_url" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyReturnUrl obj : "single_use" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse obj : "usage" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyUsage obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("confirm" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyConfirm obj) GHC.Base.<> (("customer" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyCustomer obj) GHC.Base.<> (("description" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyDescription obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyExpand obj) GHC.Base.<> (("mandate_data" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMetadata obj) GHC.Base.<> (("on_behalf_of" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyOnBehalfOf obj) GHC.Base.<> (("payment_method" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethod obj) GHC.Base.<> (("payment_method_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions obj) GHC.Base.<> (("payment_method_types" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodTypes obj) GHC.Base.<> (("return_url" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyReturnUrl obj) GHC.Base.<> (("single_use" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse obj) GHC.Base.<> ("usage" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyUsage obj)))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBody where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBody" (\obj -> ((((((((((((GHC.Base.pure PostSetupIntentsRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "confirm")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "customer")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "mandate_data")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "on_behalf_of")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "payment_method")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "payment_method_options")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "payment_method_types")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "return_url")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "single_use")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "usage"))

-- | Create a new 'PostSetupIntentsRequestBody' with all required fields.
mkPostSetupIntentsRequestBody :: PostSetupIntentsRequestBody
mkPostSetupIntentsRequestBody =
  PostSetupIntentsRequestBody
    { postSetupIntentsRequestBodyConfirm = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyCustomer = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyDescription = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyExpand = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyMandateData = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyMetadata = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyOnBehalfOf = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethod = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodTypes = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyReturnUrl = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodySingleUse = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyUsage = GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.mandate_data@ in the specification.
--
-- This hash contains details about the Mandate to create. This parameter can only be used with [\`confirm=true\`](https:\/\/stripe.com\/docs\/api\/setup_intents\/create\#create_setup_intent-confirm).
data PostSetupIntentsRequestBodyMandateData' = PostSetupIntentsRequestBodyMandateData'
  { -- | customer_acceptance
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance :: PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyMandateData' where
  toJSON obj = Data.Aeson.Types.Internal.object ("customer_acceptance" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("customer_acceptance" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance obj)

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyMandateData' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyMandateData'" (\obj -> GHC.Base.pure PostSetupIntentsRequestBodyMandateData' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "customer_acceptance"))

-- | Create a new 'PostSetupIntentsRequestBodyMandateData'' with all required fields.
mkPostSetupIntentsRequestBodyMandateData' ::
  -- | 'postSetupIntentsRequestBodyMandateData'CustomerAcceptance'
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance' ->
  PostSetupIntentsRequestBodyMandateData'
mkPostSetupIntentsRequestBodyMandateData' postSetupIntentsRequestBodyMandateData'CustomerAcceptance = PostSetupIntentsRequestBodyMandateData' {postSetupIntentsRequestBodyMandateData'CustomerAcceptance = postSetupIntentsRequestBodyMandateData'CustomerAcceptance}

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.mandate_data.properties.customer_acceptance@ in the specification.
data PostSetupIntentsRequestBodyMandateData'CustomerAcceptance' = PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'
  { -- | accepted_at
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'AcceptedAt :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | offline
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Offline :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | online
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'),
    -- | type
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type :: PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance' where
  toJSON obj = Data.Aeson.Types.Internal.object ("accepted_at" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'AcceptedAt obj : "offline" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Offline obj : "online" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online obj : "type" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("accepted_at" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'AcceptedAt obj) GHC.Base.<> (("offline" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Offline obj) GHC.Base.<> (("online" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online obj) GHC.Base.<> ("type" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type obj))))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'" (\obj -> (((GHC.Base.pure PostSetupIntentsRequestBodyMandateData'CustomerAcceptance' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "accepted_at")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "offline")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "online")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type"))

-- | Create a new 'PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'' with all required fields.
mkPostSetupIntentsRequestBodyMandateData'CustomerAcceptance' ::
  -- | 'postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type' ->
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'
mkPostSetupIntentsRequestBodyMandateData'CustomerAcceptance' postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type =
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'
    { postSetupIntentsRequestBodyMandateData'CustomerAcceptance'AcceptedAt = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Offline = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type = postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type
    }

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.mandate_data.properties.customer_acceptance.properties.online@ in the specification.
data PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' = PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'
  { -- | ip_address
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress :: Data.Text.Internal.Text,
    -- | user_agent
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' where
  toJSON obj = Data.Aeson.Types.Internal.object ("ip_address" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress obj : "user_agent" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("ip_address" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress obj) GHC.Base.<> ("user_agent" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent obj))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'" (\obj -> (GHC.Base.pure PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "ip_address")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "user_agent"))

-- | Create a new 'PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'' with all required fields.
mkPostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' ::
  -- | 'postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress'
  Data.Text.Internal.Text ->
  -- | 'postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent'
  Data.Text.Internal.Text ->
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'
mkPostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online' postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent =
  PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'
    { postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress = postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'IpAddress,
      postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent = postSetupIntentsRequestBodyMandateData'CustomerAcceptance'Online'UserAgent
    }

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.mandate_data.properties.customer_acceptance.properties.type@ in the specification.
data PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'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.
    PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"offline"@
    PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOffline
  | -- | Represents the JSON value @"online"@
    PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOnline
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type' where
  toJSON (PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'Other val) = val
  toJSON (PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOffline) = "offline"
  toJSON (PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOnline) = "online"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "offline" -> PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOffline
            | val GHC.Classes.== "online" -> PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'EnumOnline
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyMandateData'CustomerAcceptance'Type'Other val
      )

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options@ in the specification.
--
-- Payment-method-specific configuration for this SetupIntent.
data PostSetupIntentsRequestBodyPaymentMethodOptions' = PostSetupIntentsRequestBodyPaymentMethodOptions'
  { -- | acss_debit
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'),
    -- | card
    postSetupIntentsRequestBodyPaymentMethodOptions'Card :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'Card'),
    -- | sepa_debit
    postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit')
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions' where
  toJSON obj = Data.Aeson.Types.Internal.object ("acss_debit" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit obj : "card" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'Card obj : "sepa_debit" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("acss_debit" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit obj) GHC.Base.<> (("card" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'Card obj) GHC.Base.<> ("sepa_debit" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit obj)))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyPaymentMethodOptions'" (\obj -> ((GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "acss_debit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "card")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "sepa_debit"))

-- | Create a new 'PostSetupIntentsRequestBodyPaymentMethodOptions'' with all required fields.
mkPostSetupIntentsRequestBodyPaymentMethodOptions' :: PostSetupIntentsRequestBodyPaymentMethodOptions'
mkPostSetupIntentsRequestBodyPaymentMethodOptions' =
  PostSetupIntentsRequestBodyPaymentMethodOptions'
    { postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'Card = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit = GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' = PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'
  { -- | currency
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'),
    -- | mandate_options
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'),
    -- | verification_method
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod')
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' where
  toJSON obj = Data.Aeson.Types.Internal.object ("currency" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency obj : "mandate_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions obj : "verification_method" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("currency" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency obj) GHC.Base.<> (("mandate_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions obj) GHC.Base.<> ("verification_method" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod obj)))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'" (\obj -> ((GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "mandate_options")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "verification_method"))

-- | Create a new 'PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'' with all required fields.
mkPostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' :: PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'
mkPostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit' =
  PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'
    { postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod = GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.currency@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'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.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"cad"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumCad
  | -- | Represents the JSON value @"usd"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumUsd
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency' where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'Other val) = val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumCad) = "cad"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumUsd) = "usd"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "cad" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumCad
            | val GHC.Classes.== "usd" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'EnumUsd
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'Currency'Other val
      )

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.mandate_options@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' = PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'
  { -- | custom_mandate_url
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Variants),
    -- | interval_description
    --
    -- Constraints:
    --
    -- * Maximum length of 500
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'IntervalDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | payment_schedule
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'),
    -- | transaction_type
    postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType')
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' where
  toJSON obj = Data.Aeson.Types.Internal.object ("custom_mandate_url" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl obj : "interval_description" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'IntervalDescription obj : "payment_schedule" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule obj : "transaction_type" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("custom_mandate_url" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl obj) GHC.Base.<> (("interval_description" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'IntervalDescription obj) GHC.Base.<> (("payment_schedule" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule obj) GHC.Base.<> ("transaction_type" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType obj))))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'" (\obj -> (((GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "custom_mandate_url")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "interval_description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "payment_schedule")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "transaction_type"))

-- | Create a new 'PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'' with all required fields.
mkPostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' :: PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'
mkPostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions' =
  PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'
    { postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'IntervalDescription = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule = GHC.Maybe.Nothing,
      postSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType = GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.mandate_options.properties.custom_mandate_url.anyOf@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Variants
  = -- | Represents the JSON value @""@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'EmptyString
  | PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Text Data.Text.Internal.Text
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Variants where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Text a) = Data.Aeson.Types.ToJSON.toJSON a
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'EmptyString) = ""

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Variants where
  parseJSON val =
    if
        | val GHC.Classes.== "" -> GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'EmptyString
        | GHC.Base.otherwise -> case (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'CustomMandateUrl'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched" of
          Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a
          Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.mandate_options.properties.payment_schedule@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'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.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"combined"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumCombined
  | -- | Represents the JSON value @"interval"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumInterval
  | -- | Represents the JSON value @"sporadic"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumSporadic
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule' where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'Other val) = val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumCombined) = "combined"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumInterval) = "interval"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumSporadic) = "sporadic"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "combined" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumCombined
            | val GHC.Classes.== "interval" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumInterval
            | val GHC.Classes.== "sporadic" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'EnumSporadic
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'PaymentSchedule'Other val
      )

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.mandate_options.properties.transaction_type@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'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.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"business"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumBusiness
  | -- | Represents the JSON value @"personal"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumPersonal
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType' where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'Other val) = val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumBusiness) = "business"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumPersonal) = "personal"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "business" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumBusiness
            | val GHC.Classes.== "personal" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'EnumPersonal
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'MandateOptions'TransactionType'Other val
      )

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.acss_debit.properties.verification_method@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'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.
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"automatic"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumAutomatic
  | -- | Represents the JSON value @"instant"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumInstant
  | -- | Represents the JSON value @"microdeposits"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumMicrodeposits
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod' where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'Other val) = val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumAutomatic) = "automatic"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumInstant) = "instant"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumMicrodeposits) = "microdeposits"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "automatic" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumAutomatic
            | val GHC.Classes.== "instant" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumInstant
            | val GHC.Classes.== "microdeposits" -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'EnumMicrodeposits
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyPaymentMethodOptions'AcssDebit'VerificationMethod'Other val
      )

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.card@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'Card' = PostSetupIntentsRequestBodyPaymentMethodOptions'Card'
  { -- | request_three_d_secure
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    postSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure :: (GHC.Maybe.Maybe PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure')
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'Card' where
  toJSON obj = Data.Aeson.Types.Internal.object ("request_three_d_secure" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("request_three_d_secure" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure obj)

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'Card' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyPaymentMethodOptions'Card'" (\obj -> GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions'Card' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "request_three_d_secure"))

-- | Create a new 'PostSetupIntentsRequestBodyPaymentMethodOptions'Card'' with all required fields.
mkPostSetupIntentsRequestBodyPaymentMethodOptions'Card' :: PostSetupIntentsRequestBodyPaymentMethodOptions'Card'
mkPostSetupIntentsRequestBodyPaymentMethodOptions'Card' = PostSetupIntentsRequestBodyPaymentMethodOptions'Card' {postSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure = GHC.Maybe.Nothing}

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.card.properties.request_three_d_secure@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'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.
    PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"any"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAny
  | -- | Represents the JSON value @"automatic"@
    PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAutomatic
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure' where
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'Other val) = val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAny) = "any"
  toJSON (PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAutomatic) = "automatic"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "any" -> PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAny
            | val GHC.Classes.== "automatic" -> PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'EnumAutomatic
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyPaymentMethodOptions'Card'RequestThreeDSecure'Other val
      )

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.payment_method_options.properties.sepa_debit@ in the specification.
data PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' = PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'
  { -- | mandate_options
    postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'MandateOptions :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object)
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' where
  toJSON obj = Data.Aeson.Types.Internal.object ("mandate_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'MandateOptions obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("mandate_options" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'MandateOptions obj)

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'" (\obj -> GHC.Base.pure PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "mandate_options"))

-- | Create a new 'PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'' with all required fields.
mkPostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' :: PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'
mkPostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' = PostSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit' {postSetupIntentsRequestBodyPaymentMethodOptions'SepaDebit'MandateOptions = GHC.Maybe.Nothing}

-- | Defines the object schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.single_use@ in the specification.
--
-- If this hash is populated, this SetupIntent will generate a single_use Mandate on success.
data PostSetupIntentsRequestBodySingleUse' = PostSetupIntentsRequestBodySingleUse'
  { -- | amount
    postSetupIntentsRequestBodySingleUse'Amount :: GHC.Types.Int,
    -- | currency
    postSetupIntentsRequestBodySingleUse'Currency :: Data.Text.Internal.Text
  }
  deriving
    ( GHC.Show.Show,
      GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodySingleUse' where
  toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse'Amount obj : "currency" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse'Currency obj : GHC.Base.mempty)
  toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse'Amount obj) GHC.Base.<> ("currency" Data.Aeson.Types.ToJSON..= postSetupIntentsRequestBodySingleUse'Currency obj))

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodySingleUse' where
  parseJSON = Data.Aeson.Types.FromJSON.withObject "PostSetupIntentsRequestBodySingleUse'" (\obj -> (GHC.Base.pure PostSetupIntentsRequestBodySingleUse' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency"))

-- | Create a new 'PostSetupIntentsRequestBodySingleUse'' with all required fields.
mkPostSetupIntentsRequestBodySingleUse' ::
  -- | 'postSetupIntentsRequestBodySingleUse'Amount'
  GHC.Types.Int ->
  -- | 'postSetupIntentsRequestBodySingleUse'Currency'
  Data.Text.Internal.Text ->
  PostSetupIntentsRequestBodySingleUse'
mkPostSetupIntentsRequestBodySingleUse' postSetupIntentsRequestBodySingleUse'Amount postSetupIntentsRequestBodySingleUse'Currency =
  PostSetupIntentsRequestBodySingleUse'
    { postSetupIntentsRequestBodySingleUse'Amount = postSetupIntentsRequestBodySingleUse'Amount,
      postSetupIntentsRequestBodySingleUse'Currency = postSetupIntentsRequestBodySingleUse'Currency
    }

-- | Defines the enum schema located at @paths.\/v1\/setup_intents.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.usage@ in the specification.
--
-- Indicates how the payment method is intended to be used in the future. If not provided, this value defaults to \`off_session\`.
data PostSetupIntentsRequestBodyUsage'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PostSetupIntentsRequestBodyUsage'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.
    PostSetupIntentsRequestBodyUsage'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"off_session"@
    PostSetupIntentsRequestBodyUsage'EnumOffSession
  | -- | Represents the JSON value @"on_session"@
    PostSetupIntentsRequestBodyUsage'EnumOnSession
  deriving (GHC.Show.Show, GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostSetupIntentsRequestBodyUsage' where
  toJSON (PostSetupIntentsRequestBodyUsage'Other val) = val
  toJSON (PostSetupIntentsRequestBodyUsage'Typed val) = Data.Aeson.Types.ToJSON.toJSON val
  toJSON (PostSetupIntentsRequestBodyUsage'EnumOffSession) = "off_session"
  toJSON (PostSetupIntentsRequestBodyUsage'EnumOnSession) = "on_session"

instance Data.Aeson.Types.FromJSON.FromJSON PostSetupIntentsRequestBodyUsage' where
  parseJSON val =
    GHC.Base.pure
      ( if
            | val GHC.Classes.== "off_session" -> PostSetupIntentsRequestBodyUsage'EnumOffSession
            | val GHC.Classes.== "on_session" -> PostSetupIntentsRequestBodyUsage'EnumOnSession
            | GHC.Base.otherwise -> PostSetupIntentsRequestBodyUsage'Other val
      )

-- | Represents a response of the operation 'postSetupIntents'.
--
-- 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), 'PostSetupIntentsResponseError' is used.
data PostSetupIntentsResponse
  = -- | Means either no matching case available or a parse error
    PostSetupIntentsResponseError GHC.Base.String
  | -- | Successful response.
    PostSetupIntentsResponse200 SetupIntent
  | -- | Error response.
    PostSetupIntentsResponseDefault Error
  deriving (GHC.Show.Show, GHC.Classes.Eq)