{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the types generated from the schema PaymentMethod
module RecurlyClient.Types.PaymentMethod where

import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified RecurlyClient.Common
import RecurlyClient.TypeAlias
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.PaymentMethod@ in the specification.
data PaymentMethod = PaymentMethod
    { PaymentMethod -> Maybe PaymentMethodAccount_type
paymentMethodAccount_type :: (GHC.Maybe.Maybe PaymentMethodAccount_type)
    -- ^ account_type: The bank account type. Only present for ACH payment methods.
    , PaymentMethod -> Maybe Text
paymentMethodBilling_agreement_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ billing_agreement_id: Billing Agreement identifier. Only present for Amazon or Paypal payment methods.
    , PaymentMethod -> Maybe PaymentMethodCard_network_preference
paymentMethodCard_network_preference :: (GHC.Maybe.Maybe PaymentMethodCard_network_preference)
    -- ^ card_network_preference: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network.
    , PaymentMethod -> Maybe PaymentMethodCard_type
paymentMethodCard_type :: (GHC.Maybe.Maybe PaymentMethodCard_type)
    -- ^ card_type: Visa, MasterCard, American Express, Discover, JCB, etc.
    , PaymentMethod -> Maybe Text
paymentMethodCc_bin_country :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ cc_bin_country: The 2-letter ISO 3166-1 alpha-2 country code associated with the card\'s issuer, if known.
    , PaymentMethod -> Maybe Int
paymentMethodExp_month :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ exp_month: Expiration month.
    --
    -- Constraints:
    --
    -- * Maximum length of 2
    , PaymentMethod -> Maybe Int
paymentMethodExp_year :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ exp_year: Expiration year.
    --
    -- Constraints:
    --
    -- * Maximum length of 4
    , PaymentMethod -> Maybe Text
paymentMethodFirst_six :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ first_six: Credit card number\'s first six digits.
    --
    -- Constraints:
    --
    -- * Maximum length of 6
    , PaymentMethod -> Maybe PaymentMethodFunding_source
paymentMethodFunding_source :: (GHC.Maybe.Maybe PaymentMethodFunding_source)
    -- ^ funding_source: The funding source of the card, if known.
    , PaymentMethod -> Maybe PaymentMethodGateway_attributes
paymentMethodGateway_attributes :: (GHC.Maybe.Maybe PaymentMethodGateway_attributes)
    -- ^ gateway_attributes: Gateway specific attributes associated with this PaymentMethod
    , PaymentMethod -> Maybe Text
paymentMethodGateway_code :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ gateway_code: An identifier for a specific payment gateway.
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , PaymentMethod -> Maybe Text
paymentMethodGateway_token :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ gateway_token: A token used in place of a credit card in order to perform transactions.
    --
    -- Constraints:
    --
    -- * Maximum length of 50
    , PaymentMethod -> Maybe Text
paymentMethodLast_four :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ last_four: Credit card number\'s last four digits. Will refer to bank account if payment method is ACH.
    --
    -- Constraints:
    --
    -- * Maximum length of 4
    , PaymentMethod -> Maybe Text
paymentMethodLast_two :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ last_two: The IBAN bank account\'s last two digits.
    --
    -- Constraints:
    --
    -- * Maximum length of 2
    , PaymentMethod -> Maybe Text
paymentMethodName_on_account :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ name_on_account: The name associated with the bank account.
    , PaymentMethod -> Maybe PaymentMethodObject
paymentMethodObject :: (GHC.Maybe.Maybe PaymentMethodObject)
    -- ^ object
    , PaymentMethod -> Maybe Text
paymentMethodRouting_number :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ routing_number: The bank account\'s routing number. Only present for ACH payment methods.
    , PaymentMethod -> Maybe Text
paymentMethodRouting_number_bank :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ routing_number_bank: The bank name of this routing number.
    , PaymentMethod -> Maybe Text
paymentMethodUsername :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ username: Username of the associated payment method. Currently only associated with Venmo.
    }
    deriving
        ( Int -> PaymentMethod -> ShowS
[PaymentMethod] -> ShowS
PaymentMethod -> String
(Int -> PaymentMethod -> ShowS)
-> (PaymentMethod -> String)
-> ([PaymentMethod] -> ShowS)
-> Show PaymentMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethod -> ShowS
showsPrec :: Int -> PaymentMethod -> ShowS
$cshow :: PaymentMethod -> String
show :: PaymentMethod -> String
$cshowList :: [PaymentMethod] -> ShowS
showList :: [PaymentMethod] -> ShowS
GHC.Show.Show
        , PaymentMethod -> PaymentMethod -> Bool
(PaymentMethod -> PaymentMethod -> Bool)
-> (PaymentMethod -> PaymentMethod -> Bool) -> Eq PaymentMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethod -> PaymentMethod -> Bool
== :: PaymentMethod -> PaymentMethod -> Bool
$c/= :: PaymentMethod -> PaymentMethod -> Bool
/= :: PaymentMethod -> PaymentMethod -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethod where
    toJSON :: PaymentMethod -> Value
toJSON PaymentMethod
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair]
-> (PaymentMethodAccount_type -> [Pair])
-> Maybe PaymentMethodAccount_type
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodAccount_type -> Pair)
-> PaymentMethodAccount_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account_type" Key -> PaymentMethodAccount_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodAccount_type
paymentMethodAccount_type PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"billing_agreement_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodBilling_agreement_id PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (PaymentMethodCard_network_preference -> [Pair])
-> Maybe PaymentMethodCard_network_preference
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodCard_network_preference -> Pair)
-> PaymentMethodCard_network_preference
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"card_network_preference" Key -> PaymentMethodCard_network_preference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodCard_network_preference
paymentMethodCard_network_preference PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (PaymentMethodCard_type -> [Pair])
-> Maybe PaymentMethodCard_type
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodCard_type -> Pair)
-> PaymentMethodCard_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"card_type" Key -> PaymentMethodCard_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodCard_type
paymentMethodCard_type PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"cc_bin_country" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodCc_bin_country PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"exp_month" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Int
paymentMethodExp_month PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"exp_year" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Int
paymentMethodExp_year PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"first_six" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodFirst_six PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (PaymentMethodFunding_source -> [Pair])
-> Maybe PaymentMethodFunding_source
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodFunding_source -> Pair)
-> PaymentMethodFunding_source
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"funding_source" Key -> PaymentMethodFunding_source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodFunding_source
paymentMethodFunding_source PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (PaymentMethodGateway_attributes -> [Pair])
-> Maybe PaymentMethodGateway_attributes
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodGateway_attributes -> Pair)
-> PaymentMethodGateway_attributes
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_attributes" Key -> PaymentMethodGateway_attributes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodGateway_attributes
paymentMethodGateway_attributes PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodGateway_code PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_token" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodGateway_token PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"last_four" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodLast_four PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"last_two" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodLast_two PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name_on_account" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodName_on_account PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (PaymentMethodObject -> [Pair])
-> Maybe PaymentMethodObject
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (PaymentMethodObject -> Pair) -> PaymentMethodObject -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> PaymentMethodObject -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodObject
paymentMethodObject PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"routing_number" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodRouting_number PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"routing_number_bank" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodRouting_number_bank PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"username" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodUsername PaymentMethod
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: PaymentMethod -> Encoding
toEncoding PaymentMethod
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series]
-> (PaymentMethodAccount_type -> [Series])
-> Maybe PaymentMethodAccount_type
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodAccount_type -> Series)
-> PaymentMethodAccount_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account_type" Key -> PaymentMethodAccount_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodAccount_type
paymentMethodAccount_type PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"billing_agreement_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodBilling_agreement_id PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (PaymentMethodCard_network_preference -> [Series])
-> Maybe PaymentMethodCard_network_preference
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodCard_network_preference -> Series)
-> PaymentMethodCard_network_preference
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"card_network_preference" Key -> PaymentMethodCard_network_preference -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodCard_network_preference
paymentMethodCard_network_preference PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (PaymentMethodCard_type -> [Series])
-> Maybe PaymentMethodCard_type
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodCard_type -> Series)
-> PaymentMethodCard_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"card_type" Key -> PaymentMethodCard_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodCard_type
paymentMethodCard_type PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"cc_bin_country" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodCc_bin_country PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"exp_month" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Int
paymentMethodExp_month PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"exp_year" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Int
paymentMethodExp_year PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"first_six" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodFirst_six PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (PaymentMethodFunding_source -> [Series])
-> Maybe PaymentMethodFunding_source
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodFunding_source -> Series)
-> PaymentMethodFunding_source
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"funding_source" Key -> PaymentMethodFunding_source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodFunding_source
paymentMethodFunding_source PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (PaymentMethodGateway_attributes -> [Series])
-> Maybe PaymentMethodGateway_attributes
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodGateway_attributes -> Series)
-> PaymentMethodGateway_attributes
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_attributes" Key -> PaymentMethodGateway_attributes -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodGateway_attributes
paymentMethodGateway_attributes PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodGateway_code PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"gateway_token" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodGateway_token PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"last_four" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodLast_four PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"last_two" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodLast_two PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name_on_account" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodName_on_account PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (PaymentMethodObject -> [Series])
-> Maybe PaymentMethodObject
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PaymentMethodObject -> Series)
-> PaymentMethodObject
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> PaymentMethodObject -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe PaymentMethodObject
paymentMethodObject PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"routing_number" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodRouting_number PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"routing_number_bank" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodRouting_number_bank PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"username" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethod -> Maybe Text
paymentMethodUsername PaymentMethod
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethod where
    parseJSON :: Value -> Parser PaymentMethod
parseJSON = String
-> (Object -> Parser PaymentMethod)
-> Value
-> Parser PaymentMethod
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethod" (\Object
obj -> (((((((((((((((((((Maybe PaymentMethodAccount_type
 -> Maybe Text
 -> Maybe PaymentMethodCard_network_preference
 -> Maybe PaymentMethodCard_type
 -> Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> Maybe PaymentMethodFunding_source
 -> Maybe PaymentMethodGateway_attributes
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe PaymentMethodObject
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> PaymentMethod)
-> Parser
     (Maybe PaymentMethodAccount_type
      -> Maybe Text
      -> Maybe PaymentMethodCard_network_preference
      -> Maybe PaymentMethodCard_type
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe PaymentMethodAccount_type
-> Maybe Text
-> Maybe PaymentMethodCard_network_preference
-> Maybe PaymentMethodCard_type
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe PaymentMethodFunding_source
-> Maybe PaymentMethodGateway_attributes
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PaymentMethodObject
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PaymentMethod
PaymentMethod Parser
  (Maybe PaymentMethodAccount_type
   -> Maybe Text
   -> Maybe PaymentMethodCard_network_preference
   -> Maybe PaymentMethodCard_type
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe PaymentMethodAccount_type)
-> Parser
     (Maybe Text
      -> Maybe PaymentMethodCard_network_preference
      -> Maybe PaymentMethodCard_type
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PaymentMethodAccount_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"account_type")) Parser
  (Maybe Text
   -> Maybe PaymentMethodCard_network_preference
   -> Maybe PaymentMethodCard_type
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe PaymentMethodCard_network_preference
      -> Maybe PaymentMethodCard_type
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"billing_agreement_id")) Parser
  (Maybe PaymentMethodCard_network_preference
   -> Maybe PaymentMethodCard_type
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe PaymentMethodCard_network_preference)
-> Parser
     (Maybe PaymentMethodCard_type
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Key -> Parser (Maybe PaymentMethodCard_network_preference)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"card_network_preference")) Parser
  (Maybe PaymentMethodCard_type
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe PaymentMethodCard_type)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PaymentMethodCard_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"card_type")) Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"cc_bin_country")) Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"exp_month")) Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"exp_year")) Parser
  (Maybe Text
   -> Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe PaymentMethodFunding_source
      -> Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"first_six")) Parser
  (Maybe PaymentMethodFunding_source
   -> Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe PaymentMethodFunding_source)
-> Parser
     (Maybe PaymentMethodGateway_attributes
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PaymentMethodFunding_source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"funding_source")) Parser
  (Maybe PaymentMethodGateway_attributes
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe PaymentMethodGateway_attributes)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PaymentMethodGateway_attributes)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"gateway_attributes")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"gateway_code")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"gateway_token")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"last_four")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PaymentMethodObject
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"last_two")) Parser
  (Maybe Text
   -> Maybe PaymentMethodObject
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser
     (Maybe PaymentMethodObject
      -> Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"name_on_account")) Parser
  (Maybe PaymentMethodObject
   -> Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethod)
-> Parser (Maybe PaymentMethodObject)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PaymentMethodObject)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser (Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethod)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"routing_number")) Parser (Maybe Text -> Maybe Text -> PaymentMethod)
-> Parser (Maybe Text) -> Parser (Maybe Text -> PaymentMethod)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"routing_number_bank")) Parser (Maybe Text -> PaymentMethod)
-> Parser (Maybe Text) -> Parser PaymentMethod
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"username"))

-- | Create a new 'PaymentMethod' with all required fields.
mkPaymentMethod :: PaymentMethod
mkPaymentMethod :: PaymentMethod
mkPaymentMethod =
    PaymentMethod
        { paymentMethodAccount_type :: Maybe PaymentMethodAccount_type
paymentMethodAccount_type = Maybe PaymentMethodAccount_type
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodBilling_agreement_id :: Maybe Text
paymentMethodBilling_agreement_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodCard_network_preference :: Maybe PaymentMethodCard_network_preference
paymentMethodCard_network_preference = Maybe PaymentMethodCard_network_preference
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodCard_type :: Maybe PaymentMethodCard_type
paymentMethodCard_type = Maybe PaymentMethodCard_type
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodCc_bin_country :: Maybe Text
paymentMethodCc_bin_country = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodExp_month :: Maybe Int
paymentMethodExp_month = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodExp_year :: Maybe Int
paymentMethodExp_year = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodFirst_six :: Maybe Text
paymentMethodFirst_six = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodFunding_source :: Maybe PaymentMethodFunding_source
paymentMethodFunding_source = Maybe PaymentMethodFunding_source
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodGateway_attributes :: Maybe PaymentMethodGateway_attributes
paymentMethodGateway_attributes = Maybe PaymentMethodGateway_attributes
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodGateway_code :: Maybe Text
paymentMethodGateway_code = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodGateway_token :: Maybe Text
paymentMethodGateway_token = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodLast_four :: Maybe Text
paymentMethodLast_four = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodLast_two :: Maybe Text
paymentMethodLast_two = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodName_on_account :: Maybe Text
paymentMethodName_on_account = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodObject :: Maybe PaymentMethodObject
paymentMethodObject = Maybe PaymentMethodObject
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodRouting_number :: Maybe Text
paymentMethodRouting_number = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodRouting_number_bank :: Maybe Text
paymentMethodRouting_number_bank = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , paymentMethodUsername :: Maybe Text
paymentMethodUsername = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        }

{- | Defines the enum schema located at @components.schemas.PaymentMethod.properties.account_type@ in the specification.

The bank account type. Only present for ACH payment methods.
-}
data PaymentMethodAccount_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      PaymentMethodAccount_typeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      PaymentMethodAccount_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"checking"@
      PaymentMethodAccount_typeEnumChecking
    | -- | Represents the JSON value @"savings"@
      PaymentMethodAccount_typeEnumSavings
    deriving (Int -> PaymentMethodAccount_type -> ShowS
[PaymentMethodAccount_type] -> ShowS
PaymentMethodAccount_type -> String
(Int -> PaymentMethodAccount_type -> ShowS)
-> (PaymentMethodAccount_type -> String)
-> ([PaymentMethodAccount_type] -> ShowS)
-> Show PaymentMethodAccount_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodAccount_type -> ShowS
showsPrec :: Int -> PaymentMethodAccount_type -> ShowS
$cshow :: PaymentMethodAccount_type -> String
show :: PaymentMethodAccount_type -> String
$cshowList :: [PaymentMethodAccount_type] -> ShowS
showList :: [PaymentMethodAccount_type] -> ShowS
GHC.Show.Show, PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool
(PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool)
-> (PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool)
-> Eq PaymentMethodAccount_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool
== :: PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool
$c/= :: PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool
/= :: PaymentMethodAccount_type -> PaymentMethodAccount_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodAccount_type where
    toJSON :: PaymentMethodAccount_type -> Value
toJSON (PaymentMethodAccount_typeOther Value
val) = Value
val
    toJSON (PaymentMethodAccount_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (PaymentMethodAccount_type
PaymentMethodAccount_typeEnumChecking) = Value
"checking"
    toJSON (PaymentMethodAccount_type
PaymentMethodAccount_typeEnumSavings) = Value
"savings"
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodAccount_type where
    parseJSON :: Value -> Parser PaymentMethodAccount_type
parseJSON Value
val =
        PaymentMethodAccount_type -> Parser PaymentMethodAccount_type
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"checking" -> PaymentMethodAccount_type
PaymentMethodAccount_typeEnumChecking
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"savings" -> PaymentMethodAccount_type
PaymentMethodAccount_typeEnumSavings
                | Bool
GHC.Base.otherwise -> Value -> PaymentMethodAccount_type
PaymentMethodAccount_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.PaymentMethod.properties.card_network_preference@ in the specification.

Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network.
-}
data PaymentMethodCard_network_preference
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      PaymentMethodCard_network_preferenceOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      PaymentMethodCard_network_preferenceTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"Bancontact"@
      PaymentMethodCard_network_preferenceEnumBancontact
    | -- | Represents the JSON value @"CartesBancaires"@
      PaymentMethodCard_network_preferenceEnumCartesBancaires
    | -- | Represents the JSON value @"Dankort"@
      PaymentMethodCard_network_preferenceEnumDankort
    | -- | Represents the JSON value @"MasterCard"@
      PaymentMethodCard_network_preferenceEnumMasterCard
    | -- | Represents the JSON value @"Visa"@
      PaymentMethodCard_network_preferenceEnumVisa
    deriving (Int -> PaymentMethodCard_network_preference -> ShowS
[PaymentMethodCard_network_preference] -> ShowS
PaymentMethodCard_network_preference -> String
(Int -> PaymentMethodCard_network_preference -> ShowS)
-> (PaymentMethodCard_network_preference -> String)
-> ([PaymentMethodCard_network_preference] -> ShowS)
-> Show PaymentMethodCard_network_preference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodCard_network_preference -> ShowS
showsPrec :: Int -> PaymentMethodCard_network_preference -> ShowS
$cshow :: PaymentMethodCard_network_preference -> String
show :: PaymentMethodCard_network_preference -> String
$cshowList :: [PaymentMethodCard_network_preference] -> ShowS
showList :: [PaymentMethodCard_network_preference] -> ShowS
GHC.Show.Show, PaymentMethodCard_network_preference
-> PaymentMethodCard_network_preference -> Bool
(PaymentMethodCard_network_preference
 -> PaymentMethodCard_network_preference -> Bool)
-> (PaymentMethodCard_network_preference
    -> PaymentMethodCard_network_preference -> Bool)
-> Eq PaymentMethodCard_network_preference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodCard_network_preference
-> PaymentMethodCard_network_preference -> Bool
== :: PaymentMethodCard_network_preference
-> PaymentMethodCard_network_preference -> Bool
$c/= :: PaymentMethodCard_network_preference
-> PaymentMethodCard_network_preference -> Bool
/= :: PaymentMethodCard_network_preference
-> PaymentMethodCard_network_preference -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCard_network_preference where
    toJSON :: PaymentMethodCard_network_preference -> Value
toJSON (PaymentMethodCard_network_preferenceOther Value
val) = Value
val
    toJSON (PaymentMethodCard_network_preferenceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumBancontact) = Value
"Bancontact"
    toJSON (PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumCartesBancaires) = Value
"CartesBancaires"
    toJSON (PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumDankort) = Value
"Dankort"
    toJSON (PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumMasterCard) = Value
"MasterCard"
    toJSON (PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumVisa) = Value
"Visa"
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCard_network_preference where
    parseJSON :: Value -> Parser PaymentMethodCard_network_preference
parseJSON Value
val =
        PaymentMethodCard_network_preference
-> Parser PaymentMethodCard_network_preference
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Bancontact" -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumBancontact
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"CartesBancaires" -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumCartesBancaires
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Dankort" -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumDankort
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"MasterCard" -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumMasterCard
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Visa" -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceEnumVisa
                | Bool
GHC.Base.otherwise -> Value -> PaymentMethodCard_network_preference
PaymentMethodCard_network_preferenceOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.PaymentMethod.properties.card_type@ in the specification.

Visa, MasterCard, American Express, Discover, JCB, etc.
-}
data PaymentMethodCard_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      PaymentMethodCard_typeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      PaymentMethodCard_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"American Express"@
      PaymentMethodCard_typeEnumAmerican_Express
    | -- | Represents the JSON value @"Dankort"@
      PaymentMethodCard_typeEnumDankort
    | -- | Represents the JSON value @"Diners Club"@
      PaymentMethodCard_typeEnumDiners_Club
    | -- | Represents the JSON value @"Discover"@
      PaymentMethodCard_typeEnumDiscover
    | -- | Represents the JSON value @"ELO"@
      PaymentMethodCard_typeEnumELO
    | -- | Represents the JSON value @"Forbrugsforeningen"@
      PaymentMethodCard_typeEnumForbrugsforeningen
    | -- | Represents the JSON value @"Hipercard"@
      PaymentMethodCard_typeEnumHipercard
    | -- | Represents the JSON value @"JCB"@
      PaymentMethodCard_typeEnumJCB
    | -- | Represents the JSON value @"Laser"@
      PaymentMethodCard_typeEnumLaser
    | -- | Represents the JSON value @"Maestro"@
      PaymentMethodCard_typeEnumMaestro
    | -- | Represents the JSON value @"MasterCard"@
      PaymentMethodCard_typeEnumMasterCard
    | -- | Represents the JSON value @"Test Card"@
      PaymentMethodCard_typeEnumTest_Card
    | -- | Represents the JSON value @"Union Pay"@
      PaymentMethodCard_typeEnumUnion_Pay
    | -- | Represents the JSON value @"Unknown"@
      PaymentMethodCard_typeEnumUnknown
    | -- | Represents the JSON value @"Visa"@
      PaymentMethodCard_typeEnumVisa
    | -- | Represents the JSON value @"Tarjeta Naranja"@
      PaymentMethodCard_typeEnumTarjeta_Naranja
    deriving (Int -> PaymentMethodCard_type -> ShowS
[PaymentMethodCard_type] -> ShowS
PaymentMethodCard_type -> String
(Int -> PaymentMethodCard_type -> ShowS)
-> (PaymentMethodCard_type -> String)
-> ([PaymentMethodCard_type] -> ShowS)
-> Show PaymentMethodCard_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodCard_type -> ShowS
showsPrec :: Int -> PaymentMethodCard_type -> ShowS
$cshow :: PaymentMethodCard_type -> String
show :: PaymentMethodCard_type -> String
$cshowList :: [PaymentMethodCard_type] -> ShowS
showList :: [PaymentMethodCard_type] -> ShowS
GHC.Show.Show, PaymentMethodCard_type -> PaymentMethodCard_type -> Bool
(PaymentMethodCard_type -> PaymentMethodCard_type -> Bool)
-> (PaymentMethodCard_type -> PaymentMethodCard_type -> Bool)
-> Eq PaymentMethodCard_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodCard_type -> PaymentMethodCard_type -> Bool
== :: PaymentMethodCard_type -> PaymentMethodCard_type -> Bool
$c/= :: PaymentMethodCard_type -> PaymentMethodCard_type -> Bool
/= :: PaymentMethodCard_type -> PaymentMethodCard_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCard_type where
    toJSON :: PaymentMethodCard_type -> Value
toJSON (PaymentMethodCard_typeOther Value
val) = Value
val
    toJSON (PaymentMethodCard_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumAmerican_Express) = Value
"American Express"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumDankort) = Value
"Dankort"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumDiners_Club) = Value
"Diners Club"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumDiscover) = Value
"Discover"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumELO) = Value
"ELO"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumForbrugsforeningen) = Value
"Forbrugsforeningen"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumHipercard) = Value
"Hipercard"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumJCB) = Value
"JCB"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumLaser) = Value
"Laser"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumMaestro) = Value
"Maestro"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumMasterCard) = Value
"MasterCard"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumTest_Card) = Value
"Test Card"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumUnion_Pay) = Value
"Union Pay"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumUnknown) = Value
"Unknown"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumVisa) = Value
"Visa"
    toJSON (PaymentMethodCard_type
PaymentMethodCard_typeEnumTarjeta_Naranja) = Value
"Tarjeta Naranja"
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCard_type where
    parseJSON :: Value -> Parser PaymentMethodCard_type
parseJSON Value
val =
        PaymentMethodCard_type -> Parser PaymentMethodCard_type
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"American Express" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumAmerican_Express
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Dankort" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumDankort
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Diners Club" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumDiners_Club
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Discover" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumDiscover
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ELO" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumELO
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Forbrugsforeningen" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumForbrugsforeningen
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Hipercard" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumHipercard
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"JCB" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumJCB
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Laser" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumLaser
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Maestro" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumMaestro
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"MasterCard" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumMasterCard
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Test Card" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumTest_Card
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Union Pay" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumUnion_Pay
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Unknown" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumUnknown
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Visa" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumVisa
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"Tarjeta Naranja" -> PaymentMethodCard_type
PaymentMethodCard_typeEnumTarjeta_Naranja
                | Bool
GHC.Base.otherwise -> Value -> PaymentMethodCard_type
PaymentMethodCard_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.PaymentMethod.properties.funding_source@ in the specification.

The funding source of the card, if known.
-}
data PaymentMethodFunding_source
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      PaymentMethodFunding_sourceOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      PaymentMethodFunding_sourceTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"credit"@
      PaymentMethodFunding_sourceEnumCredit
    | -- | Represents the JSON value @"debit"@
      PaymentMethodFunding_sourceEnumDebit
    | -- | Represents the JSON value @"charge"@
      PaymentMethodFunding_sourceEnumCharge
    | -- | Represents the JSON value @"prepaid"@
      PaymentMethodFunding_sourceEnumPrepaid
    | -- | Represents the JSON value @"deferred_debit"@
      PaymentMethodFunding_sourceEnumDeferred_debit
    deriving (Int -> PaymentMethodFunding_source -> ShowS
[PaymentMethodFunding_source] -> ShowS
PaymentMethodFunding_source -> String
(Int -> PaymentMethodFunding_source -> ShowS)
-> (PaymentMethodFunding_source -> String)
-> ([PaymentMethodFunding_source] -> ShowS)
-> Show PaymentMethodFunding_source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodFunding_source -> ShowS
showsPrec :: Int -> PaymentMethodFunding_source -> ShowS
$cshow :: PaymentMethodFunding_source -> String
show :: PaymentMethodFunding_source -> String
$cshowList :: [PaymentMethodFunding_source] -> ShowS
showList :: [PaymentMethodFunding_source] -> ShowS
GHC.Show.Show, PaymentMethodFunding_source -> PaymentMethodFunding_source -> Bool
(PaymentMethodFunding_source
 -> PaymentMethodFunding_source -> Bool)
-> (PaymentMethodFunding_source
    -> PaymentMethodFunding_source -> Bool)
-> Eq PaymentMethodFunding_source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodFunding_source -> PaymentMethodFunding_source -> Bool
== :: PaymentMethodFunding_source -> PaymentMethodFunding_source -> Bool
$c/= :: PaymentMethodFunding_source -> PaymentMethodFunding_source -> Bool
/= :: PaymentMethodFunding_source -> PaymentMethodFunding_source -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodFunding_source where
    toJSON :: PaymentMethodFunding_source -> Value
toJSON (PaymentMethodFunding_sourceOther Value
val) = Value
val
    toJSON (PaymentMethodFunding_sourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumCredit) = Value
"credit"
    toJSON (PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumDebit) = Value
"debit"
    toJSON (PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumCharge) = Value
"charge"
    toJSON (PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumPrepaid) = Value
"prepaid"
    toJSON (PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumDeferred_debit) = Value
"deferred_debit"
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodFunding_source where
    parseJSON :: Value -> Parser PaymentMethodFunding_source
parseJSON Value
val =
        PaymentMethodFunding_source -> Parser PaymentMethodFunding_source
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"credit" -> PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumCredit
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"debit" -> PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumDebit
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"charge" -> PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumCharge
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"prepaid" -> PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumPrepaid
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"deferred_debit" -> PaymentMethodFunding_source
PaymentMethodFunding_sourceEnumDeferred_debit
                | Bool
GHC.Base.otherwise -> Value -> PaymentMethodFunding_source
PaymentMethodFunding_sourceOther Value
val
            )

{- | Defines the object schema located at @components.schemas.PaymentMethod.properties.gateway_attributes@ in the specification.

Gateway specific attributes associated with this PaymentMethod
-}
data PaymentMethodGateway_attributes = PaymentMethodGateway_attributes
    { PaymentMethodGateway_attributes -> Maybe Text
paymentMethodGateway_attributesAccount_reference :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ account_reference: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response.
    --
    -- Constraints:
    --
    -- * Maximum length of 264
    }
    deriving
        ( Int -> PaymentMethodGateway_attributes -> ShowS
[PaymentMethodGateway_attributes] -> ShowS
PaymentMethodGateway_attributes -> String
(Int -> PaymentMethodGateway_attributes -> ShowS)
-> (PaymentMethodGateway_attributes -> String)
-> ([PaymentMethodGateway_attributes] -> ShowS)
-> Show PaymentMethodGateway_attributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodGateway_attributes -> ShowS
showsPrec :: Int -> PaymentMethodGateway_attributes -> ShowS
$cshow :: PaymentMethodGateway_attributes -> String
show :: PaymentMethodGateway_attributes -> String
$cshowList :: [PaymentMethodGateway_attributes] -> ShowS
showList :: [PaymentMethodGateway_attributes] -> ShowS
GHC.Show.Show
        , PaymentMethodGateway_attributes
-> PaymentMethodGateway_attributes -> Bool
(PaymentMethodGateway_attributes
 -> PaymentMethodGateway_attributes -> Bool)
-> (PaymentMethodGateway_attributes
    -> PaymentMethodGateway_attributes -> Bool)
-> Eq PaymentMethodGateway_attributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodGateway_attributes
-> PaymentMethodGateway_attributes -> Bool
== :: PaymentMethodGateway_attributes
-> PaymentMethodGateway_attributes -> Bool
$c/= :: PaymentMethodGateway_attributes
-> PaymentMethodGateway_attributes -> Bool
/= :: PaymentMethodGateway_attributes
-> PaymentMethodGateway_attributes -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodGateway_attributes where
    toJSON :: PaymentMethodGateway_attributes -> Value
toJSON PaymentMethodGateway_attributes
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account_reference" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (PaymentMethodGateway_attributes -> Maybe Text
paymentMethodGateway_attributesAccount_reference PaymentMethodGateway_attributes
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: PaymentMethodGateway_attributes -> Encoding
toEncoding PaymentMethodGateway_attributes
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account_reference" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (PaymentMethodGateway_attributes -> Maybe Text
paymentMethodGateway_attributesAccount_reference PaymentMethodGateway_attributes
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodGateway_attributes where
    parseJSON :: Value -> Parser PaymentMethodGateway_attributes
parseJSON = String
-> (Object -> Parser PaymentMethodGateway_attributes)
-> Value
-> Parser PaymentMethodGateway_attributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodGateway_attributes" (\Object
obj -> (Maybe Text -> PaymentMethodGateway_attributes)
-> Parser (Maybe Text -> PaymentMethodGateway_attributes)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text -> PaymentMethodGateway_attributes
PaymentMethodGateway_attributes Parser (Maybe Text -> PaymentMethodGateway_attributes)
-> Parser (Maybe Text) -> Parser PaymentMethodGateway_attributes
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"account_reference"))

-- | Create a new 'PaymentMethodGateway_attributes' with all required fields.
mkPaymentMethodGateway_attributes :: PaymentMethodGateway_attributes
mkPaymentMethodGateway_attributes :: PaymentMethodGateway_attributes
mkPaymentMethodGateway_attributes = PaymentMethodGateway_attributes{paymentMethodGateway_attributesAccount_reference :: Maybe Text
paymentMethodGateway_attributesAccount_reference = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing}

-- | Defines the enum schema located at @components.schemas.PaymentMethod.properties.object@ in the specification.
data PaymentMethodObject
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      PaymentMethodObjectOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      PaymentMethodObjectTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"bacs"@
      PaymentMethodObjectEnumBacs
    | -- | Represents the JSON value @"amazon"@
      PaymentMethodObjectEnumAmazon
    | -- | Represents the JSON value @"amazon_billing_agreement"@
      PaymentMethodObjectEnumAmazon_billing_agreement
    | -- | Represents the JSON value @"apple_pay"@
      PaymentMethodObjectEnumApple_pay
    | -- | Represents the JSON value @"bank_account_info"@
      PaymentMethodObjectEnumBank_account_info
    | -- | Represents the JSON value @"braintree_apple_pay"@
      PaymentMethodObjectEnumBraintree_apple_pay
    | -- | Represents the JSON value @"check"@
      PaymentMethodObjectEnumCheck
    | -- | Represents the JSON value @"credit_card"@
      PaymentMethodObjectEnumCredit_card
    | -- | Represents the JSON value @"eft"@
      PaymentMethodObjectEnumEft
    | -- | Represents the JSON value @"gateway_token"@
      PaymentMethodObjectEnumGateway_token
    | -- | Represents the JSON value @"google_pay"@
      PaymentMethodObjectEnumGoogle_pay
    | -- | Represents the JSON value @"iban_bank_account"@
      PaymentMethodObjectEnumIban_bank_account
    | -- | Represents the JSON value @"money_order"@
      PaymentMethodObjectEnumMoney_order
    | -- | Represents the JSON value @"other"@
      PaymentMethodObjectEnumOther
    | -- | Represents the JSON value @"paypal"@
      PaymentMethodObjectEnumPaypal
    | -- | Represents the JSON value @"paypal_billing_agreement"@
      PaymentMethodObjectEnumPaypal_billing_agreement
    | -- | Represents the JSON value @"roku"@
      PaymentMethodObjectEnumRoku
    | -- | Represents the JSON value @"sepadirectdebit"@
      PaymentMethodObjectEnumSepadirectdebit
    | -- | Represents the JSON value @"venmo"@
      PaymentMethodObjectEnumVenmo
    | -- | Represents the JSON value @"wire_transfer"@
      PaymentMethodObjectEnumWire_transfer
    | -- | Represents the JSON value @"braintree_v_zero"@
      PaymentMethodObjectEnumBraintree_v_zero
    | -- | Represents the JSON value @"boleto"@
      PaymentMethodObjectEnumBoleto
    | -- | Represents the JSON value @"cash_app"@
      PaymentMethodObjectEnumCash_app
    deriving (Int -> PaymentMethodObject -> ShowS
[PaymentMethodObject] -> ShowS
PaymentMethodObject -> String
(Int -> PaymentMethodObject -> ShowS)
-> (PaymentMethodObject -> String)
-> ([PaymentMethodObject] -> ShowS)
-> Show PaymentMethodObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentMethodObject -> ShowS
showsPrec :: Int -> PaymentMethodObject -> ShowS
$cshow :: PaymentMethodObject -> String
show :: PaymentMethodObject -> String
$cshowList :: [PaymentMethodObject] -> ShowS
showList :: [PaymentMethodObject] -> ShowS
GHC.Show.Show, PaymentMethodObject -> PaymentMethodObject -> Bool
(PaymentMethodObject -> PaymentMethodObject -> Bool)
-> (PaymentMethodObject -> PaymentMethodObject -> Bool)
-> Eq PaymentMethodObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentMethodObject -> PaymentMethodObject -> Bool
== :: PaymentMethodObject -> PaymentMethodObject -> Bool
$c/= :: PaymentMethodObject -> PaymentMethodObject -> Bool
/= :: PaymentMethodObject -> PaymentMethodObject -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodObject where
    toJSON :: PaymentMethodObject -> Value
toJSON (PaymentMethodObjectOther Value
val) = Value
val
    toJSON (PaymentMethodObjectTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumBacs) = Value
"bacs"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumAmazon) = Value
"amazon"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumAmazon_billing_agreement) = Value
"amazon_billing_agreement"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumApple_pay) = Value
"apple_pay"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumBank_account_info) = Value
"bank_account_info"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumBraintree_apple_pay) = Value
"braintree_apple_pay"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumCheck) = Value
"check"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumCredit_card) = Value
"credit_card"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumEft) = Value
"eft"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumGateway_token) = Value
"gateway_token"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumGoogle_pay) = Value
"google_pay"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumIban_bank_account) = Value
"iban_bank_account"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumMoney_order) = Value
"money_order"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumOther) = Value
"other"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumPaypal) = Value
"paypal"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumPaypal_billing_agreement) = Value
"paypal_billing_agreement"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumRoku) = Value
"roku"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumSepadirectdebit) = Value
"sepadirectdebit"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumVenmo) = Value
"venmo"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumWire_transfer) = Value
"wire_transfer"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumBraintree_v_zero) = Value
"braintree_v_zero"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumBoleto) = Value
"boleto"
    toJSON (PaymentMethodObject
PaymentMethodObjectEnumCash_app) = Value
"cash_app"
instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodObject where
    parseJSON :: Value -> Parser PaymentMethodObject
parseJSON Value
val =
        PaymentMethodObject -> Parser PaymentMethodObject
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"bacs" -> PaymentMethodObject
PaymentMethodObjectEnumBacs
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"amazon" -> PaymentMethodObject
PaymentMethodObjectEnumAmazon
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"amazon_billing_agreement" -> PaymentMethodObject
PaymentMethodObjectEnumAmazon_billing_agreement
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"apple_pay" -> PaymentMethodObject
PaymentMethodObjectEnumApple_pay
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"bank_account_info" -> PaymentMethodObject
PaymentMethodObjectEnumBank_account_info
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"braintree_apple_pay" -> PaymentMethodObject
PaymentMethodObjectEnumBraintree_apple_pay
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"check" -> PaymentMethodObject
PaymentMethodObjectEnumCheck
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"credit_card" -> PaymentMethodObject
PaymentMethodObjectEnumCredit_card
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"eft" -> PaymentMethodObject
PaymentMethodObjectEnumEft
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"gateway_token" -> PaymentMethodObject
PaymentMethodObjectEnumGateway_token
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"google_pay" -> PaymentMethodObject
PaymentMethodObjectEnumGoogle_pay
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"iban_bank_account" -> PaymentMethodObject
PaymentMethodObjectEnumIban_bank_account
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"money_order" -> PaymentMethodObject
PaymentMethodObjectEnumMoney_order
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"other" -> PaymentMethodObject
PaymentMethodObjectEnumOther
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"paypal" -> PaymentMethodObject
PaymentMethodObjectEnumPaypal
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"paypal_billing_agreement" -> PaymentMethodObject
PaymentMethodObjectEnumPaypal_billing_agreement
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"roku" -> PaymentMethodObject
PaymentMethodObjectEnumRoku
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sepadirectdebit" -> PaymentMethodObject
PaymentMethodObjectEnumSepadirectdebit
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"venmo" -> PaymentMethodObject
PaymentMethodObjectEnumVenmo
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"wire_transfer" -> PaymentMethodObject
PaymentMethodObjectEnumWire_transfer
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"braintree_v_zero" -> PaymentMethodObject
PaymentMethodObjectEnumBraintree_v_zero
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"boleto" -> PaymentMethodObject
PaymentMethodObjectEnumBoleto
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"cash_app" -> PaymentMethodObject
PaymentMethodObjectEnumCash_app
                | Bool
GHC.Base.otherwise -> Value -> PaymentMethodObject
PaymentMethodObjectOther Value
val
            )