{-# 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 postCustomersCustomerSources module StripeAPI.Operations.PostCustomersCustomerSources 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/customers/{customer}/sources -- -- \

When you create a new credit card, you must specify a customer or recipient on which to create it.\<\/p> -- -- \

If the card’s owner has no default card, then the new card will become the default. -- However, if the owner already has a default, then it will not change. -- To change the default, you should \update the customer\<\/a> to have a new \default_source\<\/code>.\<\/p> postCustomersCustomerSources :: forall m. StripeAPI.Common.MonadHTTP m => -- | customer | Constraints: Maximum length of 5000 Data.Text.Internal.Text -> -- | The request body to send GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBody -> -- | Monadic computation which returns the result of the operation StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostCustomersCustomerSourcesResponse) postCustomersCustomerSources customer body = GHC.Base.fmap ( \response_0 -> GHC.Base.fmap ( Data.Either.either PostCustomersCustomerSourcesResponseError 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) -> PostCustomersCustomerSourcesResponse200 Data.Functor.<$> ( Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String PaymentSource ) | GHC.Base.const GHC.Types.True (Network.HTTP.Client.Types.responseStatus response) -> PostCustomersCustomerSourcesResponseDefault 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/customers/" 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 customer)) GHC.Base.++ "/sources"))) GHC.Base.mempty body StripeAPI.Common.RequestBodyEncodingFormData) -- | Defines the object schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification. data PostCustomersCustomerSourcesRequestBody = PostCustomersCustomerSourcesRequestBody { -- | alipay_account: A token returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js) representing the user’s Alipay account details. -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyAlipayAccount :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | bank_account: Either a token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js), or a dictionary containing a user\'s bank account details. postCustomersCustomerSourcesRequestBodyBankAccount :: (GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBodyBankAccount'Variants), -- | card: A token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js). postCustomersCustomerSourcesRequestBodyCard :: (GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBodyCard'Variants), -- | expand: Specifies which fields in the response should be expanded. postCustomersCustomerSourcesRequestBodyExpand :: (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\`. postCustomersCustomerSourcesRequestBodyMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | source: Please refer to full [documentation](https:\/\/stripe.com\/docs\/api) instead. -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodySource :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBody where toJSON obj = Data.Aeson.Types.Internal.object ("alipay_account" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyAlipayAccount obj : "bank_account" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount obj : "card" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard obj : "expand" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyExpand obj : "metadata" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyMetadata obj : "source" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodySource obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("alipay_account" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyAlipayAccount obj) GHC.Base.<> (("bank_account" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount obj) GHC.Base.<> (("card" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard obj) GHC.Base.<> (("expand" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyExpand obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyMetadata obj) GHC.Base.<> ("source" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodySource obj)))))) instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBody where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostCustomersCustomerSourcesRequestBody" (\obj -> (((((GHC.Base.pure PostCustomersCustomerSourcesRequestBody GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "alipay_account")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "bank_account")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "card")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "expand")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "source")) -- | Create a new 'PostCustomersCustomerSourcesRequestBody' with all required fields. mkPostCustomersCustomerSourcesRequestBody :: PostCustomersCustomerSourcesRequestBody mkPostCustomersCustomerSourcesRequestBody = PostCustomersCustomerSourcesRequestBody { postCustomersCustomerSourcesRequestBodyAlipayAccount = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyBankAccount = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyExpand = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyMetadata = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodySource = GHC.Maybe.Nothing } -- | Defines the object schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.bank_account.anyOf@ in the specification. data PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 = PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 { -- | account_holder_name -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderName :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | account_holder_type -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType :: (GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'), -- | account_number -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber :: Data.Text.Internal.Text, -- | country -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country :: Data.Text.Internal.Text, -- | currency postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Currency :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | object -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object :: (GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'), -- | routing_number -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1RoutingNumber :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("account_holder_name" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderName obj : "account_holder_type" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType obj : "account_number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber obj : "country" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country obj : "currency" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Currency obj : "object" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object obj : "routing_number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1RoutingNumber obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("account_holder_name" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderName obj) GHC.Base.<> (("account_holder_type" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType obj) GHC.Base.<> (("account_number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber obj) GHC.Base.<> (("country" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Currency obj) GHC.Base.<> (("object" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object obj) GHC.Base.<> ("routing_number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1RoutingNumber obj))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1" (\obj -> ((((((GHC.Base.pure PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 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..: "account_number")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "country")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "object")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "routing_number")) -- | Create a new 'PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1' with all required fields. mkPostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 :: -- | 'postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber' Data.Text.Internal.Text -> -- | 'postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country' Data.Text.Internal.Text -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 mkPostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country = PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 { postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderName = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber = postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountNumber, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country = postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Country, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Currency = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyBankAccount'OneOf1RoutingNumber = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.bank_account.anyOf.properties.account_holder_type@ in the specification. data PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'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. PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"company"@ PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumCompany | -- | Represents the JSON value @"individual"@ PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumIndividual deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType' where toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'Other val) = val toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumCompany) = "company" toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumIndividual) = "individual" instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "company" -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumCompany | val GHC.Classes.== "individual" -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'EnumIndividual | GHC.Base.otherwise -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1AccountHolderType'Other val ) -- | Defines the enum schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.bank_account.anyOf.properties.object@ in the specification. data PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'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. PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"bank_account"@ PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'EnumBankAccount deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object' where toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'Other val) = val toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'EnumBankAccount) = "bank_account" instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "bank_account" -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'EnumBankAccount | GHC.Base.otherwise -> PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1Object'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.bank_account.anyOf@ in the specification. -- -- Either a token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js), or a dictionary containing a user\'s bank account details. data PostCustomersCustomerSourcesRequestBodyBankAccount'Variants = PostCustomersCustomerSourcesRequestBodyBankAccount'PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 | PostCustomersCustomerSourcesRequestBodyBankAccount'Text Data.Text.Internal.Text deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyBankAccount'Variants where toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostCustomersCustomerSourcesRequestBodyBankAccount'Text a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyBankAccount'Variants where parseJSON val = case (PostCustomersCustomerSourcesRequestBodyBankAccount'PostCustomersCustomerSourcesRequestBodyBankAccount'OneOf1 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((PostCustomersCustomerSourcesRequestBodyBankAccount'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 object schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.card.anyOf@ in the specification. data PostCustomersCustomerSourcesRequestBodyCard'OneOf1 = PostCustomersCustomerSourcesRequestBodyCard'OneOf1 { -- | address_city -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_country -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_line1 -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine1 :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_line2 -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_state -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressState :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | address_zip -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressZip :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | cvc -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1Cvc :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | exp_month postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth :: GHC.Types.Int, -- | exp_year postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear :: GHC.Types.Int, -- | metadata postCustomersCustomerSourcesRequestBodyCard'OneOf1Metadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | name -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1Name :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | number -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1Number :: Data.Text.Internal.Text, -- | object -- -- Constraints: -- -- * Maximum length of 5000 postCustomersCustomerSourcesRequestBodyCard'OneOf1Object :: (GHC.Maybe.Maybe PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyCard'OneOf1 where toJSON obj = Data.Aeson.Types.Internal.object ("address_city" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCity obj : "address_country" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCountry obj : "address_line1" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine1 obj : "address_line2" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine2 obj : "address_state" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressState obj : "address_zip" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressZip obj : "cvc" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Cvc obj : "exp_month" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth obj : "exp_year" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear obj : "metadata" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Metadata obj : "name" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Name obj : "number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Number obj : "object" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Object obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("address_city" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCity obj) GHC.Base.<> (("address_country" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCountry obj) GHC.Base.<> (("address_line1" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine1 obj) GHC.Base.<> (("address_line2" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine2 obj) GHC.Base.<> (("address_state" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressState obj) GHC.Base.<> (("address_zip" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressZip obj) GHC.Base.<> (("cvc" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Cvc obj) GHC.Base.<> (("exp_month" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth obj) GHC.Base.<> (("exp_year" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Metadata obj) GHC.Base.<> (("name" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Name obj) GHC.Base.<> (("number" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Number obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= postCustomersCustomerSourcesRequestBodyCard'OneOf1Object obj))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyCard'OneOf1 where parseJSON = Data.Aeson.Types.FromJSON.withObject "PostCustomersCustomerSourcesRequestBodyCard'OneOf1" (\obj -> ((((((((((((GHC.Base.pure PostCustomersCustomerSourcesRequestBodyCard'OneOf1 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..:? "cvc")) 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..:? "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "name")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "number")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "object")) -- | Create a new 'PostCustomersCustomerSourcesRequestBodyCard'OneOf1' with all required fields. mkPostCustomersCustomerSourcesRequestBodyCard'OneOf1 :: -- | 'postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth' GHC.Types.Int -> -- | 'postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear' GHC.Types.Int -> -- | 'postCustomersCustomerSourcesRequestBodyCard'OneOf1Number' Data.Text.Internal.Text -> PostCustomersCustomerSourcesRequestBodyCard'OneOf1 mkPostCustomersCustomerSourcesRequestBodyCard'OneOf1 postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear postCustomersCustomerSourcesRequestBodyCard'OneOf1Number = PostCustomersCustomerSourcesRequestBodyCard'OneOf1 { postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCity = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressCountry = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine1 = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressLine2 = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressState = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1AddressZip = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1Cvc = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth = postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpMonth, postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear = postCustomersCustomerSourcesRequestBodyCard'OneOf1ExpYear, postCustomersCustomerSourcesRequestBodyCard'OneOf1Metadata = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1Name = GHC.Maybe.Nothing, postCustomersCustomerSourcesRequestBodyCard'OneOf1Number = postCustomersCustomerSourcesRequestBodyCard'OneOf1Number, postCustomersCustomerSourcesRequestBodyCard'OneOf1Object = GHC.Maybe.Nothing } -- | Defines the enum schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.card.anyOf.properties.object@ in the specification. data PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'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. PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"card"@ PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'EnumCard deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object' where toJSON (PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'Other val) = val toJSON (PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'EnumCard) = "card" instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "card" -> PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'EnumCard | GHC.Base.otherwise -> PostCustomersCustomerSourcesRequestBodyCard'OneOf1Object'Other val ) -- | Defines the oneOf schema located at @paths.\/v1\/customers\/{customer}\/sources.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.card.anyOf@ in the specification. -- -- A token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js). data PostCustomersCustomerSourcesRequestBodyCard'Variants = PostCustomersCustomerSourcesRequestBodyCard'PostCustomersCustomerSourcesRequestBodyCard'OneOf1 PostCustomersCustomerSourcesRequestBodyCard'OneOf1 | PostCustomersCustomerSourcesRequestBodyCard'Text Data.Text.Internal.Text deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PostCustomersCustomerSourcesRequestBodyCard'Variants where toJSON (PostCustomersCustomerSourcesRequestBodyCard'PostCustomersCustomerSourcesRequestBodyCard'OneOf1 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PostCustomersCustomerSourcesRequestBodyCard'Text a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON PostCustomersCustomerSourcesRequestBodyCard'Variants where parseJSON val = case (PostCustomersCustomerSourcesRequestBodyCard'PostCustomersCustomerSourcesRequestBodyCard'OneOf1 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((PostCustomersCustomerSourcesRequestBodyCard'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 -- | Represents a response of the operation 'postCustomersCustomerSources'. -- -- 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), 'PostCustomersCustomerSourcesResponseError' is used. data PostCustomersCustomerSourcesResponse = -- | Means either no matching case available or a parse error PostCustomersCustomerSourcesResponseError GHC.Base.String | -- | Successful response. PostCustomersCustomerSourcesResponse200 PaymentSource | -- | Error response. PostCustomersCustomerSourcesResponseDefault Error deriving (GHC.Show.Show, GHC.Classes.Eq)