{-# 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 PaymentMethodCard
module StripeAPI.Types.PaymentMethodCard 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.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified StripeAPI.Common
import StripeAPI.TypeAlias
import {-# SOURCE #-} StripeAPI.Types.CardGeneratedFromPaymentMethodDetails
import {-# SOURCE #-} StripeAPI.Types.Networks
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardChecks
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardGeneratedCard
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardWallet
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardWalletMasterpass
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardWalletVisaCheckout
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodDetailsCardPresent
import {-# SOURCE #-} StripeAPI.Types.SetupAttempt
import {-# SOURCE #-} StripeAPI.Types.ThreeDSecureUsage
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.payment_method_card@ in the specification.
data PaymentMethodCard = PaymentMethodCard
  { -- | brand: Card brand. Can be \`amex\`, \`diners\`, \`discover\`, \`jcb\`, \`mastercard\`, \`unionpay\`, \`visa\`, or \`unknown\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCard -> Text
paymentMethodCardBrand :: Data.Text.Internal.Text,
    -- | checks: Checks on Card address and CVC if provided.
    PaymentMethodCard -> Maybe PaymentMethodCardChecks'
paymentMethodCardChecks :: (GHC.Maybe.Maybe PaymentMethodCardChecks'),
    -- | country: Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you\'ve collected.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCard -> Maybe Text
paymentMethodCardCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | exp_month: Two-digit number representing the card\'s expiration month.
    PaymentMethodCard -> Int
paymentMethodCardExpMonth :: GHC.Types.Int,
    -- | exp_year: Four-digit number representing the card\'s expiration year.
    PaymentMethodCard -> Int
paymentMethodCardExpYear :: GHC.Types.Int,
    -- | fingerprint: Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
    --
    -- *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.*
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCard -> Maybe Text
paymentMethodCardFingerprint :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | funding: Card funding type. Can be \`credit\`, \`debit\`, \`prepaid\`, or \`unknown\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCard -> Text
paymentMethodCardFunding :: Data.Text.Internal.Text,
    -- | generated_from: Details of the original PaymentMethod that created this object.
    PaymentMethodCard -> Maybe PaymentMethodCardGeneratedFrom'
paymentMethodCardGeneratedFrom :: (GHC.Maybe.Maybe PaymentMethodCardGeneratedFrom'),
    -- | last4: The last four digits of the card.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCard -> Text
paymentMethodCardLast4 :: Data.Text.Internal.Text,
    -- | networks: Contains information about card networks that can be used to process the payment.
    PaymentMethodCard -> Maybe PaymentMethodCardNetworks'
paymentMethodCardNetworks :: (GHC.Maybe.Maybe PaymentMethodCardNetworks'),
    -- | three_d_secure_usage: Contains details on how this Card maybe be used for 3D Secure authentication.
    PaymentMethodCard -> Maybe PaymentMethodCardThreeDSecureUsage'
paymentMethodCardThreeDSecureUsage :: (GHC.Maybe.Maybe PaymentMethodCardThreeDSecureUsage'),
    -- | wallet: If this Card is part of a card wallet, this contains the details of the card wallet.
    PaymentMethodCard -> Maybe PaymentMethodCardWallet'
paymentMethodCardWallet :: (GHC.Maybe.Maybe PaymentMethodCardWallet')
  }
  deriving
    ( Int -> PaymentMethodCard -> ShowS
[PaymentMethodCard] -> ShowS
PaymentMethodCard -> String
(Int -> PaymentMethodCard -> ShowS)
-> (PaymentMethodCard -> String)
-> ([PaymentMethodCard] -> ShowS)
-> Show PaymentMethodCard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCard] -> ShowS
$cshowList :: [PaymentMethodCard] -> ShowS
show :: PaymentMethodCard -> String
$cshow :: PaymentMethodCard -> String
showsPrec :: Int -> PaymentMethodCard -> ShowS
$cshowsPrec :: Int -> PaymentMethodCard -> ShowS
GHC.Show.Show,
      PaymentMethodCard -> PaymentMethodCard -> Bool
(PaymentMethodCard -> PaymentMethodCard -> Bool)
-> (PaymentMethodCard -> PaymentMethodCard -> Bool)
-> Eq PaymentMethodCard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCard -> PaymentMethodCard -> Bool
$c/= :: PaymentMethodCard -> PaymentMethodCard -> Bool
== :: PaymentMethodCard -> PaymentMethodCard -> Bool
$c== :: PaymentMethodCard -> PaymentMethodCard -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCard where
  toJSON :: PaymentMethodCard -> Value
toJSON PaymentMethodCard
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"brand" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardBrand PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"checks" Text -> Maybe PaymentMethodCardChecks' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardChecks'
paymentMethodCardChecks PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe Text
paymentMethodCardCountry PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_month" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Int
paymentMethodCardExpMonth PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"exp_year" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Int
paymentMethodCardExpYear PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"fingerprint" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe Text
paymentMethodCardFingerprint PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"funding" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardFunding PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"generated_from" Text -> Maybe PaymentMethodCardGeneratedFrom' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardGeneratedFrom'
paymentMethodCardGeneratedFrom PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"last4" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardLast4 PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"networks" Text -> Maybe PaymentMethodCardNetworks' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardNetworks'
paymentMethodCardNetworks PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"three_d_secure_usage" Text -> Maybe PaymentMethodCardThreeDSecureUsage' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardThreeDSecureUsage'
paymentMethodCardThreeDSecureUsage PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"wallet" Text -> Maybe PaymentMethodCardWallet' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardWallet'
paymentMethodCardWallet PaymentMethodCard
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCard -> Encoding
toEncoding PaymentMethodCard
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"brand" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardBrand PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"checks" Text -> Maybe PaymentMethodCardChecks' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardChecks'
paymentMethodCardChecks PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe Text
paymentMethodCardCountry PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_month" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Int
paymentMethodCardExpMonth PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"exp_year" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Int
paymentMethodCardExpYear PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"fingerprint" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe Text
paymentMethodCardFingerprint PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"funding" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardFunding PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"generated_from" Text -> Maybe PaymentMethodCardGeneratedFrom' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardGeneratedFrom'
paymentMethodCardGeneratedFrom PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"last4" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Text
paymentMethodCardLast4 PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"networks" Text -> Maybe PaymentMethodCardNetworks' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardNetworks'
paymentMethodCardNetworks PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"three_d_secure_usage" Text -> Maybe PaymentMethodCardThreeDSecureUsage' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardThreeDSecureUsage'
paymentMethodCardThreeDSecureUsage PaymentMethodCard
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"wallet" Text -> Maybe PaymentMethodCardWallet' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCard -> Maybe PaymentMethodCardWallet'
paymentMethodCardWallet PaymentMethodCard
obj))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCard where
  parseJSON :: Value -> Parser PaymentMethodCard
parseJSON = String
-> (Object -> Parser PaymentMethodCard)
-> Value
-> Parser PaymentMethodCard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCard" (\Object
obj -> ((((((((((((Text
 -> Maybe PaymentMethodCardChecks'
 -> Maybe Text
 -> Int
 -> Int
 -> Maybe Text
 -> Text
 -> Maybe PaymentMethodCardGeneratedFrom'
 -> Text
 -> Maybe PaymentMethodCardNetworks'
 -> Maybe PaymentMethodCardThreeDSecureUsage'
 -> Maybe PaymentMethodCardWallet'
 -> PaymentMethodCard)
-> Parser
     (Text
      -> Maybe PaymentMethodCardChecks'
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text
-> Maybe PaymentMethodCardChecks'
-> Maybe Text
-> Int
-> Int
-> Maybe Text
-> Text
-> Maybe PaymentMethodCardGeneratedFrom'
-> Text
-> Maybe PaymentMethodCardNetworks'
-> Maybe PaymentMethodCardThreeDSecureUsage'
-> Maybe PaymentMethodCardWallet'
-> PaymentMethodCard
PaymentMethodCard Parser
  (Text
   -> Maybe PaymentMethodCardChecks'
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser Text
-> Parser
     (Maybe PaymentMethodCardChecks'
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"brand")) Parser
  (Maybe PaymentMethodCardChecks'
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser (Maybe PaymentMethodCardChecks')
-> Parser
     (Maybe Text
      -> Int
      -> Int
      -> Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardChecks')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"checks")) Parser
  (Maybe Text
   -> Int
   -> Int
   -> Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser (Maybe Text)
-> Parser
     (Int
      -> Int
      -> Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"country")) Parser
  (Int
   -> Int
   -> Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser Int
-> Parser
     (Int
      -> Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"exp_month")) Parser
  (Int
   -> Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser Int
-> Parser
     (Maybe Text
      -> Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"exp_year")) Parser
  (Maybe Text
   -> Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"fingerprint")) Parser
  (Text
   -> Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser Text
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'
      -> Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"funding")) Parser
  (Maybe PaymentMethodCardGeneratedFrom'
   -> Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser (Maybe PaymentMethodCardGeneratedFrom')
-> Parser
     (Text
      -> Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardGeneratedFrom')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"generated_from")) Parser
  (Text
   -> Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser Text
-> Parser
     (Maybe PaymentMethodCardNetworks'
      -> Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet'
      -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"last4")) Parser
  (Maybe PaymentMethodCardNetworks'
   -> Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet'
   -> PaymentMethodCard)
-> Parser (Maybe PaymentMethodCardNetworks')
-> Parser
     (Maybe PaymentMethodCardThreeDSecureUsage'
      -> Maybe PaymentMethodCardWallet' -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardNetworks')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"networks")) Parser
  (Maybe PaymentMethodCardThreeDSecureUsage'
   -> Maybe PaymentMethodCardWallet' -> PaymentMethodCard)
-> Parser (Maybe PaymentMethodCardThreeDSecureUsage')
-> Parser (Maybe PaymentMethodCardWallet' -> PaymentMethodCard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PaymentMethodCardThreeDSecureUsage')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"three_d_secure_usage")) Parser (Maybe PaymentMethodCardWallet' -> PaymentMethodCard)
-> Parser (Maybe PaymentMethodCardWallet')
-> Parser PaymentMethodCard
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardWallet')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"wallet"))

-- | Create a new 'PaymentMethodCard' with all required fields.
mkPaymentMethodCard ::
  -- | 'paymentMethodCardBrand'
  Data.Text.Internal.Text ->
  -- | 'paymentMethodCardExpMonth'
  GHC.Types.Int ->
  -- | 'paymentMethodCardExpYear'
  GHC.Types.Int ->
  -- | 'paymentMethodCardFunding'
  Data.Text.Internal.Text ->
  -- | 'paymentMethodCardLast4'
  Data.Text.Internal.Text ->
  PaymentMethodCard
mkPaymentMethodCard :: Text -> Int -> Int -> Text -> Text -> PaymentMethodCard
mkPaymentMethodCard Text
paymentMethodCardBrand Int
paymentMethodCardExpMonth Int
paymentMethodCardExpYear Text
paymentMethodCardFunding Text
paymentMethodCardLast4 =
  PaymentMethodCard :: Text
-> Maybe PaymentMethodCardChecks'
-> Maybe Text
-> Int
-> Int
-> Maybe Text
-> Text
-> Maybe PaymentMethodCardGeneratedFrom'
-> Text
-> Maybe PaymentMethodCardNetworks'
-> Maybe PaymentMethodCardThreeDSecureUsage'
-> Maybe PaymentMethodCardWallet'
-> PaymentMethodCard
PaymentMethodCard
    { paymentMethodCardBrand :: Text
paymentMethodCardBrand = Text
paymentMethodCardBrand,
      paymentMethodCardChecks :: Maybe PaymentMethodCardChecks'
paymentMethodCardChecks = Maybe PaymentMethodCardChecks'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardCountry :: Maybe Text
paymentMethodCardCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardExpMonth :: Int
paymentMethodCardExpMonth = Int
paymentMethodCardExpMonth,
      paymentMethodCardExpYear :: Int
paymentMethodCardExpYear = Int
paymentMethodCardExpYear,
      paymentMethodCardFingerprint :: Maybe Text
paymentMethodCardFingerprint = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardFunding :: Text
paymentMethodCardFunding = Text
paymentMethodCardFunding,
      paymentMethodCardGeneratedFrom :: Maybe PaymentMethodCardGeneratedFrom'
paymentMethodCardGeneratedFrom = Maybe PaymentMethodCardGeneratedFrom'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardLast4 :: Text
paymentMethodCardLast4 = Text
paymentMethodCardLast4,
      paymentMethodCardNetworks :: Maybe PaymentMethodCardNetworks'
paymentMethodCardNetworks = Maybe PaymentMethodCardNetworks'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardThreeDSecureUsage :: Maybe PaymentMethodCardThreeDSecureUsage'
paymentMethodCardThreeDSecureUsage = Maybe PaymentMethodCardThreeDSecureUsage'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet :: Maybe PaymentMethodCardWallet'
paymentMethodCardWallet = Maybe PaymentMethodCardWallet'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.checks.anyOf@ in the specification.
--
-- Checks on Card address and CVC if provided.
data PaymentMethodCardChecks' = PaymentMethodCardChecks'
  { -- | address_line1_check: If a address line1 was provided, results of the check, one of \`pass\`, \`fail\`, \`unavailable\`, or \`unchecked\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressLine1Check :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_postal_code_check: If a address postal code was provided, results of the check, one of \`pass\`, \`fail\`, \`unavailable\`, or \`unchecked\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressPostalCodeCheck :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | cvc_check: If a CVC was provided, results of the check, one of \`pass\`, \`fail\`, \`unavailable\`, or \`unchecked\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'CvcCheck :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PaymentMethodCardChecks' -> ShowS
[PaymentMethodCardChecks'] -> ShowS
PaymentMethodCardChecks' -> String
(Int -> PaymentMethodCardChecks' -> ShowS)
-> (PaymentMethodCardChecks' -> String)
-> ([PaymentMethodCardChecks'] -> ShowS)
-> Show PaymentMethodCardChecks'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardChecks'] -> ShowS
$cshowList :: [PaymentMethodCardChecks'] -> ShowS
show :: PaymentMethodCardChecks' -> String
$cshow :: PaymentMethodCardChecks' -> String
showsPrec :: Int -> PaymentMethodCardChecks' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardChecks' -> ShowS
GHC.Show.Show,
      PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool
(PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool)
-> (PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool)
-> Eq PaymentMethodCardChecks'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool
$c/= :: PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool
== :: PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool
$c== :: PaymentMethodCardChecks' -> PaymentMethodCardChecks' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardChecks' where
  toJSON :: PaymentMethodCardChecks' -> Value
toJSON PaymentMethodCardChecks'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"address_line1_check" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressLine1Check PaymentMethodCardChecks'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_postal_code_check" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressPostalCodeCheck PaymentMethodCardChecks'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"cvc_check" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'CvcCheck PaymentMethodCardChecks'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardChecks' -> Encoding
toEncoding PaymentMethodCardChecks'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"address_line1_check" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressLine1Check PaymentMethodCardChecks'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_postal_code_check" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'AddressPostalCodeCheck PaymentMethodCardChecks'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"cvc_check" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardChecks' -> Maybe Text
paymentMethodCardChecks'CvcCheck PaymentMethodCardChecks'
obj)))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardChecks' where
  parseJSON :: Value -> Parser PaymentMethodCardChecks'
parseJSON = String
-> (Object -> Parser PaymentMethodCardChecks')
-> Value
-> Parser PaymentMethodCardChecks'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardChecks'" (\Object
obj -> (((Maybe Text
 -> Maybe Text -> Maybe Text -> PaymentMethodCardChecks')
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> PaymentMethodCardChecks')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethodCardChecks'
PaymentMethodCardChecks' Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> PaymentMethodCardChecks')
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> PaymentMethodCardChecks')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"address_line1_check")) Parser (Maybe Text -> Maybe Text -> PaymentMethodCardChecks')
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PaymentMethodCardChecks')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"address_postal_code_check")) Parser (Maybe Text -> PaymentMethodCardChecks')
-> Parser (Maybe Text) -> Parser PaymentMethodCardChecks'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"cvc_check"))

-- | Create a new 'PaymentMethodCardChecks'' with all required fields.
mkPaymentMethodCardChecks' :: PaymentMethodCardChecks'
mkPaymentMethodCardChecks' :: PaymentMethodCardChecks'
mkPaymentMethodCardChecks' =
  PaymentMethodCardChecks' :: Maybe Text -> Maybe Text -> Maybe Text -> PaymentMethodCardChecks'
PaymentMethodCardChecks'
    { paymentMethodCardChecks'AddressLine1Check :: Maybe Text
paymentMethodCardChecks'AddressLine1Check = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardChecks'AddressPostalCodeCheck :: Maybe Text
paymentMethodCardChecks'AddressPostalCodeCheck = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardChecks'CvcCheck :: Maybe Text
paymentMethodCardChecks'CvcCheck = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.generated_from.anyOf@ in the specification.
--
-- Details of the original PaymentMethod that created this object.
data PaymentMethodCardGeneratedFrom' = PaymentMethodCardGeneratedFrom'
  { -- | charge: The charge that created this object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardGeneratedFrom' -> Maybe Text
paymentMethodCardGeneratedFrom'Charge :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | payment_method_details: Transaction-specific details of the payment method used in the payment.
    PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
paymentMethodCardGeneratedFrom'PaymentMethodDetails :: (GHC.Maybe.Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'),
    -- | setup_attempt: The ID of the SetupAttempt that generated this PaymentMethod, if any.
    PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
paymentMethodCardGeneratedFrom'SetupAttempt :: (GHC.Maybe.Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants)
  }
  deriving
    ( Int -> PaymentMethodCardGeneratedFrom' -> ShowS
[PaymentMethodCardGeneratedFrom'] -> ShowS
PaymentMethodCardGeneratedFrom' -> String
(Int -> PaymentMethodCardGeneratedFrom' -> ShowS)
-> (PaymentMethodCardGeneratedFrom' -> String)
-> ([PaymentMethodCardGeneratedFrom'] -> ShowS)
-> Show PaymentMethodCardGeneratedFrom'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardGeneratedFrom'] -> ShowS
$cshowList :: [PaymentMethodCardGeneratedFrom'] -> ShowS
show :: PaymentMethodCardGeneratedFrom' -> String
$cshow :: PaymentMethodCardGeneratedFrom' -> String
showsPrec :: Int -> PaymentMethodCardGeneratedFrom' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardGeneratedFrom' -> ShowS
GHC.Show.Show,
      PaymentMethodCardGeneratedFrom'
-> PaymentMethodCardGeneratedFrom' -> Bool
(PaymentMethodCardGeneratedFrom'
 -> PaymentMethodCardGeneratedFrom' -> Bool)
-> (PaymentMethodCardGeneratedFrom'
    -> PaymentMethodCardGeneratedFrom' -> Bool)
-> Eq PaymentMethodCardGeneratedFrom'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardGeneratedFrom'
-> PaymentMethodCardGeneratedFrom' -> Bool
$c/= :: PaymentMethodCardGeneratedFrom'
-> PaymentMethodCardGeneratedFrom' -> Bool
== :: PaymentMethodCardGeneratedFrom'
-> PaymentMethodCardGeneratedFrom' -> Bool
$c== :: PaymentMethodCardGeneratedFrom'
-> PaymentMethodCardGeneratedFrom' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardGeneratedFrom' where
  toJSON :: PaymentMethodCardGeneratedFrom' -> Value
toJSON PaymentMethodCardGeneratedFrom'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"charge" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom' -> Maybe Text
paymentMethodCardGeneratedFrom'Charge PaymentMethodCardGeneratedFrom'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"payment_method_details" Text
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
paymentMethodCardGeneratedFrom'PaymentMethodDetails PaymentMethodCardGeneratedFrom'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"setup_attempt" Text
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
paymentMethodCardGeneratedFrom'SetupAttempt PaymentMethodCardGeneratedFrom'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardGeneratedFrom' -> Encoding
toEncoding PaymentMethodCardGeneratedFrom'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"charge" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom' -> Maybe Text
paymentMethodCardGeneratedFrom'Charge PaymentMethodCardGeneratedFrom'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"payment_method_details" Text
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
paymentMethodCardGeneratedFrom'PaymentMethodDetails PaymentMethodCardGeneratedFrom'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"setup_attempt" Text
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
paymentMethodCardGeneratedFrom'SetupAttempt PaymentMethodCardGeneratedFrom'
obj)))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardGeneratedFrom' where
  parseJSON :: Value -> Parser PaymentMethodCardGeneratedFrom'
parseJSON = String
-> (Object -> Parser PaymentMethodCardGeneratedFrom')
-> Value
-> Parser PaymentMethodCardGeneratedFrom'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardGeneratedFrom'" (\Object
obj -> (((Maybe Text
 -> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
 -> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
 -> PaymentMethodCardGeneratedFrom')
-> Parser
     (Maybe Text
      -> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
      -> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
      -> PaymentMethodCardGeneratedFrom')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'
PaymentMethodCardGeneratedFrom' Parser
  (Maybe Text
   -> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
   -> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
   -> PaymentMethodCardGeneratedFrom')
-> Parser (Maybe Text)
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
      -> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
      -> PaymentMethodCardGeneratedFrom')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"charge")) Parser
  (Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
   -> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
   -> PaymentMethodCardGeneratedFrom')
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
      -> PaymentMethodCardGeneratedFrom')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"payment_method_details")) Parser
  (Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
   -> PaymentMethodCardGeneratedFrom')
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants)
-> Parser PaymentMethodCardGeneratedFrom'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"setup_attempt"))

-- | Create a new 'PaymentMethodCardGeneratedFrom'' with all required fields.
mkPaymentMethodCardGeneratedFrom' :: PaymentMethodCardGeneratedFrom'
mkPaymentMethodCardGeneratedFrom' :: PaymentMethodCardGeneratedFrom'
mkPaymentMethodCardGeneratedFrom' =
  PaymentMethodCardGeneratedFrom' :: Maybe Text
-> Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'
PaymentMethodCardGeneratedFrom'
    { paymentMethodCardGeneratedFrom'Charge :: Maybe Text
paymentMethodCardGeneratedFrom'Charge = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardGeneratedFrom'PaymentMethodDetails :: Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
paymentMethodCardGeneratedFrom'PaymentMethodDetails = Maybe PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardGeneratedFrom'SetupAttempt :: Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
paymentMethodCardGeneratedFrom'SetupAttempt = Maybe PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.generated_from.anyOf.properties.payment_method_details.anyOf@ in the specification.
--
-- Transaction-specific details of the payment method used in the payment.
data PaymentMethodCardGeneratedFrom'PaymentMethodDetails' = PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
  { -- | card_present:
    PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Maybe PaymentMethodDetailsCardPresent
paymentMethodCardGeneratedFrom'PaymentMethodDetails'CardPresent :: (GHC.Maybe.Maybe PaymentMethodDetailsCardPresent),
    -- | type: The type of payment method transaction-specific details from the transaction that generated this \`card\` payment method. Always \`card_present\`.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Maybe Text
paymentMethodCardGeneratedFrom'PaymentMethodDetails'Type :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> ShowS
[PaymentMethodCardGeneratedFrom'PaymentMethodDetails'] -> ShowS
PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> String
(Int
 -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> ShowS)
-> (PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> String)
-> ([PaymentMethodCardGeneratedFrom'PaymentMethodDetails']
    -> ShowS)
-> Show PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardGeneratedFrom'PaymentMethodDetails'] -> ShowS
$cshowList :: [PaymentMethodCardGeneratedFrom'PaymentMethodDetails'] -> ShowS
show :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> String
$cshow :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> String
showsPrec :: Int
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> ShowS
$cshowsPrec :: Int
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> ShowS
GHC.Show.Show,
      PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool
(PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
 -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool)
-> (PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
    -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool)
-> Eq PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool
$c/= :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool
== :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool
$c== :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardGeneratedFrom'PaymentMethodDetails' where
  toJSON :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Value
toJSON PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"card_present" Text -> Maybe PaymentMethodDetailsCardPresent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Maybe PaymentMethodDetailsCardPresent
paymentMethodCardGeneratedFrom'PaymentMethodDetails'CardPresent PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Maybe Text
paymentMethodCardGeneratedFrom'PaymentMethodDetails'Type PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Encoding
toEncoding PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"card_present" Text -> Maybe PaymentMethodDetailsCardPresent -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
-> Maybe PaymentMethodDetailsCardPresent
paymentMethodCardGeneratedFrom'PaymentMethodDetails'CardPresent PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"type" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardGeneratedFrom'PaymentMethodDetails' -> Maybe Text
paymentMethodCardGeneratedFrom'PaymentMethodDetails'Type PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
obj))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardGeneratedFrom'PaymentMethodDetails' where
  parseJSON :: Value
-> Parser PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
parseJSON = String
-> (Object
    -> Parser PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
-> Value
-> Parser PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardGeneratedFrom'PaymentMethodDetails'" (\Object
obj -> ((Maybe PaymentMethodDetailsCardPresent
 -> Maybe Text
 -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
-> Parser
     (Maybe PaymentMethodDetailsCardPresent
      -> Maybe Text
      -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe PaymentMethodDetailsCardPresent
-> Maybe Text
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
PaymentMethodCardGeneratedFrom'PaymentMethodDetails' Parser
  (Maybe PaymentMethodDetailsCardPresent
   -> Maybe Text
   -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
-> Parser (Maybe PaymentMethodDetailsCardPresent)
-> Parser
     (Maybe Text
      -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodDetailsCardPresent)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"card_present")) Parser
  (Maybe Text
   -> PaymentMethodCardGeneratedFrom'PaymentMethodDetails')
-> Parser (Maybe Text)
-> Parser PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"type"))

-- | Create a new 'PaymentMethodCardGeneratedFrom'PaymentMethodDetails'' with all required fields.
mkPaymentMethodCardGeneratedFrom'PaymentMethodDetails' :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
mkPaymentMethodCardGeneratedFrom'PaymentMethodDetails' :: PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
mkPaymentMethodCardGeneratedFrom'PaymentMethodDetails' =
  PaymentMethodCardGeneratedFrom'PaymentMethodDetails' :: Maybe PaymentMethodDetailsCardPresent
-> Maybe Text
-> PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
PaymentMethodCardGeneratedFrom'PaymentMethodDetails'
    { paymentMethodCardGeneratedFrom'PaymentMethodDetails'CardPresent :: Maybe PaymentMethodDetailsCardPresent
paymentMethodCardGeneratedFrom'PaymentMethodDetails'CardPresent = Maybe PaymentMethodDetailsCardPresent
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardGeneratedFrom'PaymentMethodDetails'Type :: Maybe Text
paymentMethodCardGeneratedFrom'PaymentMethodDetails'Type = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.payment_method_card.properties.generated_from.anyOf.properties.setup_attempt.anyOf@ in the specification.
--
-- The ID of the SetupAttempt that generated this PaymentMethod, if any.
data PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
  = PaymentMethodCardGeneratedFrom'SetupAttempt'Text Data.Text.Internal.Text
  | PaymentMethodCardGeneratedFrom'SetupAttempt'SetupAttempt SetupAttempt
  deriving (Int
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> ShowS
[PaymentMethodCardGeneratedFrom'SetupAttempt'Variants] -> ShowS
PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> String
(Int
 -> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> ShowS)
-> (PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> String)
-> ([PaymentMethodCardGeneratedFrom'SetupAttempt'Variants]
    -> ShowS)
-> Show PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardGeneratedFrom'SetupAttempt'Variants] -> ShowS
$cshowList :: [PaymentMethodCardGeneratedFrom'SetupAttempt'Variants] -> ShowS
show :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> String
$cshow :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> String
showsPrec :: Int
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> ShowS
$cshowsPrec :: Int
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> ShowS
GHC.Show.Show, PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool
(PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
 -> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool)
-> (PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
    -> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool)
-> Eq PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool
$c/= :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool
== :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool
$c== :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants
-> PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardGeneratedFrom'SetupAttempt'Variants where
  toJSON :: PaymentMethodCardGeneratedFrom'SetupAttempt'Variants -> Value
toJSON (PaymentMethodCardGeneratedFrom'SetupAttempt'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (PaymentMethodCardGeneratedFrom'SetupAttempt'SetupAttempt SetupAttempt
a) = SetupAttempt -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON SetupAttempt
a

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

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.networks.anyOf@ in the specification.
--
-- Contains information about card networks that can be used to process the payment.
data PaymentMethodCardNetworks' = PaymentMethodCardNetworks'
  { -- | available: All available networks for the card.
    PaymentMethodCardNetworks' -> Maybe [Text]
paymentMethodCardNetworks'Available :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | preferred: The preferred network for the card.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardNetworks' -> Maybe Text
paymentMethodCardNetworks'Preferred :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PaymentMethodCardNetworks' -> ShowS
[PaymentMethodCardNetworks'] -> ShowS
PaymentMethodCardNetworks' -> String
(Int -> PaymentMethodCardNetworks' -> ShowS)
-> (PaymentMethodCardNetworks' -> String)
-> ([PaymentMethodCardNetworks'] -> ShowS)
-> Show PaymentMethodCardNetworks'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardNetworks'] -> ShowS
$cshowList :: [PaymentMethodCardNetworks'] -> ShowS
show :: PaymentMethodCardNetworks' -> String
$cshow :: PaymentMethodCardNetworks' -> String
showsPrec :: Int -> PaymentMethodCardNetworks' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardNetworks' -> ShowS
GHC.Show.Show,
      PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool
(PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool)
-> (PaymentMethodCardNetworks'
    -> PaymentMethodCardNetworks' -> Bool)
-> Eq PaymentMethodCardNetworks'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool
$c/= :: PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool
== :: PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool
$c== :: PaymentMethodCardNetworks' -> PaymentMethodCardNetworks' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardNetworks' where
  toJSON :: PaymentMethodCardNetworks' -> Value
toJSON PaymentMethodCardNetworks'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"available" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardNetworks' -> Maybe [Text]
paymentMethodCardNetworks'Available PaymentMethodCardNetworks'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"preferred" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardNetworks' -> Maybe Text
paymentMethodCardNetworks'Preferred PaymentMethodCardNetworks'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardNetworks' -> Encoding
toEncoding PaymentMethodCardNetworks'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"available" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardNetworks' -> Maybe [Text]
paymentMethodCardNetworks'Available PaymentMethodCardNetworks'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"preferred" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardNetworks' -> Maybe Text
paymentMethodCardNetworks'Preferred PaymentMethodCardNetworks'
obj))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardNetworks' where
  parseJSON :: Value -> Parser PaymentMethodCardNetworks'
parseJSON = String
-> (Object -> Parser PaymentMethodCardNetworks')
-> Value
-> Parser PaymentMethodCardNetworks'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardNetworks'" (\Object
obj -> ((Maybe [Text] -> Maybe Text -> PaymentMethodCardNetworks')
-> Parser
     (Maybe [Text] -> Maybe Text -> PaymentMethodCardNetworks')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe [Text] -> Maybe Text -> PaymentMethodCardNetworks'
PaymentMethodCardNetworks' Parser (Maybe [Text] -> Maybe Text -> PaymentMethodCardNetworks')
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> PaymentMethodCardNetworks')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"available")) Parser (Maybe Text -> PaymentMethodCardNetworks')
-> Parser (Maybe Text) -> Parser PaymentMethodCardNetworks'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"preferred"))

-- | Create a new 'PaymentMethodCardNetworks'' with all required fields.
mkPaymentMethodCardNetworks' :: PaymentMethodCardNetworks'
mkPaymentMethodCardNetworks' :: PaymentMethodCardNetworks'
mkPaymentMethodCardNetworks' =
  PaymentMethodCardNetworks' :: Maybe [Text] -> Maybe Text -> PaymentMethodCardNetworks'
PaymentMethodCardNetworks'
    { paymentMethodCardNetworks'Available :: Maybe [Text]
paymentMethodCardNetworks'Available = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardNetworks'Preferred :: Maybe Text
paymentMethodCardNetworks'Preferred = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.three_d_secure_usage.anyOf@ in the specification.
--
-- Contains details on how this Card maybe be used for 3D Secure authentication.
data PaymentMethodCardThreeDSecureUsage' = PaymentMethodCardThreeDSecureUsage'
  { -- | supported: Whether 3D Secure is supported on this card.
    PaymentMethodCardThreeDSecureUsage' -> Maybe Bool
paymentMethodCardThreeDSecureUsage'Supported :: (GHC.Maybe.Maybe GHC.Types.Bool)
  }
  deriving
    ( Int -> PaymentMethodCardThreeDSecureUsage' -> ShowS
[PaymentMethodCardThreeDSecureUsage'] -> ShowS
PaymentMethodCardThreeDSecureUsage' -> String
(Int -> PaymentMethodCardThreeDSecureUsage' -> ShowS)
-> (PaymentMethodCardThreeDSecureUsage' -> String)
-> ([PaymentMethodCardThreeDSecureUsage'] -> ShowS)
-> Show PaymentMethodCardThreeDSecureUsage'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardThreeDSecureUsage'] -> ShowS
$cshowList :: [PaymentMethodCardThreeDSecureUsage'] -> ShowS
show :: PaymentMethodCardThreeDSecureUsage' -> String
$cshow :: PaymentMethodCardThreeDSecureUsage' -> String
showsPrec :: Int -> PaymentMethodCardThreeDSecureUsage' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardThreeDSecureUsage' -> ShowS
GHC.Show.Show,
      PaymentMethodCardThreeDSecureUsage'
-> PaymentMethodCardThreeDSecureUsage' -> Bool
(PaymentMethodCardThreeDSecureUsage'
 -> PaymentMethodCardThreeDSecureUsage' -> Bool)
-> (PaymentMethodCardThreeDSecureUsage'
    -> PaymentMethodCardThreeDSecureUsage' -> Bool)
-> Eq PaymentMethodCardThreeDSecureUsage'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardThreeDSecureUsage'
-> PaymentMethodCardThreeDSecureUsage' -> Bool
$c/= :: PaymentMethodCardThreeDSecureUsage'
-> PaymentMethodCardThreeDSecureUsage' -> Bool
== :: PaymentMethodCardThreeDSecureUsage'
-> PaymentMethodCardThreeDSecureUsage' -> Bool
$c== :: PaymentMethodCardThreeDSecureUsage'
-> PaymentMethodCardThreeDSecureUsage' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardThreeDSecureUsage' where
  toJSON :: PaymentMethodCardThreeDSecureUsage' -> Value
toJSON PaymentMethodCardThreeDSecureUsage'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"supported" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardThreeDSecureUsage' -> Maybe Bool
paymentMethodCardThreeDSecureUsage'Supported PaymentMethodCardThreeDSecureUsage'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardThreeDSecureUsage' -> Encoding
toEncoding PaymentMethodCardThreeDSecureUsage'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"supported" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardThreeDSecureUsage' -> Maybe Bool
paymentMethodCardThreeDSecureUsage'Supported PaymentMethodCardThreeDSecureUsage'
obj)

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardThreeDSecureUsage' where
  parseJSON :: Value -> Parser PaymentMethodCardThreeDSecureUsage'
parseJSON = String
-> (Object -> Parser PaymentMethodCardThreeDSecureUsage')
-> Value
-> Parser PaymentMethodCardThreeDSecureUsage'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardThreeDSecureUsage'" (\Object
obj -> (Maybe Bool -> PaymentMethodCardThreeDSecureUsage')
-> Parser (Maybe Bool -> PaymentMethodCardThreeDSecureUsage')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool -> PaymentMethodCardThreeDSecureUsage'
PaymentMethodCardThreeDSecureUsage' Parser (Maybe Bool -> PaymentMethodCardThreeDSecureUsage')
-> Parser (Maybe Bool)
-> Parser PaymentMethodCardThreeDSecureUsage'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"supported"))

-- | Create a new 'PaymentMethodCardThreeDSecureUsage'' with all required fields.
mkPaymentMethodCardThreeDSecureUsage' :: PaymentMethodCardThreeDSecureUsage'
mkPaymentMethodCardThreeDSecureUsage' :: PaymentMethodCardThreeDSecureUsage'
mkPaymentMethodCardThreeDSecureUsage' = PaymentMethodCardThreeDSecureUsage' :: Maybe Bool -> PaymentMethodCardThreeDSecureUsage'
PaymentMethodCardThreeDSecureUsage' {paymentMethodCardThreeDSecureUsage'Supported :: Maybe Bool
paymentMethodCardThreeDSecureUsage'Supported = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing}

-- | Defines the object schema located at @components.schemas.payment_method_card.properties.wallet.anyOf@ in the specification.
--
-- If this Card is part of a card wallet, this contains the details of the card wallet.
data PaymentMethodCardWallet' = PaymentMethodCardWallet'
  { -- | amex_express_checkout:
    PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'AmexExpressCheckout :: (GHC.Maybe.Maybe PaymentMethodCardWalletAmexExpressCheckout),
    -- | apple_pay:
    PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'ApplePay :: (GHC.Maybe.Maybe PaymentMethodCardWalletApplePay),
    -- | dynamic_last4: (For tokenized numbers only.) The last four digits of the device account number.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentMethodCardWallet' -> Maybe Text
paymentMethodCardWallet'DynamicLast4 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | google_pay:
    PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'GooglePay :: (GHC.Maybe.Maybe PaymentMethodCardWalletGooglePay),
    -- | masterpass:
    PaymentMethodCardWallet' -> Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWallet'Masterpass :: (GHC.Maybe.Maybe PaymentMethodCardWalletMasterpass),
    -- | samsung_pay:
    PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'SamsungPay :: (GHC.Maybe.Maybe PaymentMethodCardWalletSamsungPay),
    -- | type: The type of the card wallet, one of \`amex_express_checkout\`, \`apple_pay\`, \`google_pay\`, \`masterpass\`, \`samsung_pay\`, or \`visa_checkout\`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type.
    PaymentMethodCardWallet' -> Maybe PaymentMethodCardWallet'Type'
paymentMethodCardWallet'Type :: (GHC.Maybe.Maybe PaymentMethodCardWallet'Type'),
    -- | visa_checkout:
    PaymentMethodCardWallet'
-> Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWallet'VisaCheckout :: (GHC.Maybe.Maybe PaymentMethodCardWalletVisaCheckout)
  }
  deriving
    ( Int -> PaymentMethodCardWallet' -> ShowS
[PaymentMethodCardWallet'] -> ShowS
PaymentMethodCardWallet' -> String
(Int -> PaymentMethodCardWallet' -> ShowS)
-> (PaymentMethodCardWallet' -> String)
-> ([PaymentMethodCardWallet'] -> ShowS)
-> Show PaymentMethodCardWallet'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardWallet'] -> ShowS
$cshowList :: [PaymentMethodCardWallet'] -> ShowS
show :: PaymentMethodCardWallet' -> String
$cshow :: PaymentMethodCardWallet' -> String
showsPrec :: Int -> PaymentMethodCardWallet' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardWallet' -> ShowS
GHC.Show.Show,
      PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool
(PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool)
-> (PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool)
-> Eq PaymentMethodCardWallet'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool
$c/= :: PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool
== :: PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool
$c== :: PaymentMethodCardWallet' -> PaymentMethodCardWallet' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardWallet' where
  toJSON :: PaymentMethodCardWallet' -> Value
toJSON PaymentMethodCardWallet'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amex_express_checkout" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'AmexExpressCheckout PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"apple_pay" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'ApplePay PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"dynamic_last4" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Text
paymentMethodCardWallet'DynamicLast4 PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"google_pay" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'GooglePay PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"masterpass" Text -> Maybe PaymentMethodCardWalletMasterpass -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWallet'Masterpass PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"samsung_pay" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'SamsungPay PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> Maybe PaymentMethodCardWallet'Type' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe PaymentMethodCardWallet'Type'
paymentMethodCardWallet'Type PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"visa_checkout" Text -> Maybe PaymentMethodCardWalletVisaCheckout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet'
-> Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWallet'VisaCheckout PaymentMethodCardWallet'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentMethodCardWallet' -> Encoding
toEncoding PaymentMethodCardWallet'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amex_express_checkout" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'AmexExpressCheckout PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"apple_pay" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'ApplePay PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"dynamic_last4" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Text
paymentMethodCardWallet'DynamicLast4 PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"google_pay" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'GooglePay PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"masterpass" Text -> Maybe PaymentMethodCardWalletMasterpass -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWallet'Masterpass PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"samsung_pay" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe Object
paymentMethodCardWallet'SamsungPay PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> Maybe PaymentMethodCardWallet'Type' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet' -> Maybe PaymentMethodCardWallet'Type'
paymentMethodCardWallet'Type PaymentMethodCardWallet'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"visa_checkout" Text -> Maybe PaymentMethodCardWalletVisaCheckout -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet'
-> Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWallet'VisaCheckout PaymentMethodCardWallet'
obj))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardWallet' where
  parseJSON :: Value -> Parser PaymentMethodCardWallet'
parseJSON = String
-> (Object -> Parser PaymentMethodCardWallet')
-> Value
-> Parser PaymentMethodCardWallet'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodCardWallet'" (\Object
obj -> ((((((((Maybe Object
 -> Maybe Object
 -> Maybe Text
 -> Maybe Object
 -> Maybe PaymentMethodCardWalletMasterpass
 -> Maybe Object
 -> Maybe PaymentMethodCardWallet'Type'
 -> Maybe PaymentMethodCardWalletVisaCheckout
 -> PaymentMethodCardWallet')
-> Parser
     (Maybe Object
      -> Maybe Object
      -> Maybe Text
      -> Maybe Object
      -> Maybe PaymentMethodCardWalletMasterpass
      -> Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Object
-> Maybe Object
-> Maybe Text
-> Maybe Object
-> Maybe PaymentMethodCardWalletMasterpass
-> Maybe Object
-> Maybe PaymentMethodCardWallet'Type'
-> Maybe PaymentMethodCardWalletVisaCheckout
-> PaymentMethodCardWallet'
PaymentMethodCardWallet' Parser
  (Maybe Object
   -> Maybe Object
   -> Maybe Text
   -> Maybe Object
   -> Maybe PaymentMethodCardWalletMasterpass
   -> Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe Object)
-> Parser
     (Maybe Object
      -> Maybe Text
      -> Maybe Object
      -> Maybe PaymentMethodCardWalletMasterpass
      -> Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"amex_express_checkout")) Parser
  (Maybe Object
   -> Maybe Text
   -> Maybe Object
   -> Maybe PaymentMethodCardWalletMasterpass
   -> Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe Object)
-> Parser
     (Maybe Text
      -> Maybe Object
      -> Maybe PaymentMethodCardWalletMasterpass
      -> Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"apple_pay")) Parser
  (Maybe Text
   -> Maybe Object
   -> Maybe PaymentMethodCardWalletMasterpass
   -> Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe Text)
-> Parser
     (Maybe Object
      -> Maybe PaymentMethodCardWalletMasterpass
      -> Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"dynamic_last4")) Parser
  (Maybe Object
   -> Maybe PaymentMethodCardWalletMasterpass
   -> Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe Object)
-> Parser
     (Maybe PaymentMethodCardWalletMasterpass
      -> Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"google_pay")) Parser
  (Maybe PaymentMethodCardWalletMasterpass
   -> Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe PaymentMethodCardWalletMasterpass)
-> Parser
     (Maybe Object
      -> Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardWalletMasterpass)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"masterpass")) Parser
  (Maybe Object
   -> Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe Object)
-> Parser
     (Maybe PaymentMethodCardWallet'Type'
      -> Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"samsung_pay")) Parser
  (Maybe PaymentMethodCardWallet'Type'
   -> Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe PaymentMethodCardWallet'Type')
-> Parser
     (Maybe PaymentMethodCardWalletVisaCheckout
      -> PaymentMethodCardWallet')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PaymentMethodCardWallet'Type')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"type")) Parser
  (Maybe PaymentMethodCardWalletVisaCheckout
   -> PaymentMethodCardWallet')
-> Parser (Maybe PaymentMethodCardWalletVisaCheckout)
-> Parser PaymentMethodCardWallet'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PaymentMethodCardWalletVisaCheckout)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"visa_checkout"))

-- | Create a new 'PaymentMethodCardWallet'' with all required fields.
mkPaymentMethodCardWallet' :: PaymentMethodCardWallet'
mkPaymentMethodCardWallet' :: PaymentMethodCardWallet'
mkPaymentMethodCardWallet' =
  PaymentMethodCardWallet' :: Maybe Object
-> Maybe Object
-> Maybe Text
-> Maybe Object
-> Maybe PaymentMethodCardWalletMasterpass
-> Maybe Object
-> Maybe PaymentMethodCardWallet'Type'
-> Maybe PaymentMethodCardWalletVisaCheckout
-> PaymentMethodCardWallet'
PaymentMethodCardWallet'
    { paymentMethodCardWallet'AmexExpressCheckout :: Maybe Object
paymentMethodCardWallet'AmexExpressCheckout = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'ApplePay :: Maybe Object
paymentMethodCardWallet'ApplePay = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'DynamicLast4 :: Maybe Text
paymentMethodCardWallet'DynamicLast4 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'GooglePay :: Maybe Object
paymentMethodCardWallet'GooglePay = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'Masterpass :: Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWallet'Masterpass = Maybe PaymentMethodCardWalletMasterpass
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'SamsungPay :: Maybe Object
paymentMethodCardWallet'SamsungPay = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'Type :: Maybe PaymentMethodCardWallet'Type'
paymentMethodCardWallet'Type = Maybe PaymentMethodCardWallet'Type'
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWallet'VisaCheckout :: Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWallet'VisaCheckout = Maybe PaymentMethodCardWalletVisaCheckout
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.payment_method_card.properties.wallet.anyOf.properties.type@ in the specification.
--
-- The type of the card wallet, one of \`amex_express_checkout\`, \`apple_pay\`, \`google_pay\`, \`masterpass\`, \`samsung_pay\`, or \`visa_checkout\`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type.
data PaymentMethodCardWallet'Type'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PaymentMethodCardWallet'Type'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    PaymentMethodCardWallet'Type'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"amex_express_checkout"@
    PaymentMethodCardWallet'Type'EnumAmexExpressCheckout
  | -- | Represents the JSON value @"apple_pay"@
    PaymentMethodCardWallet'Type'EnumApplePay
  | -- | Represents the JSON value @"google_pay"@
    PaymentMethodCardWallet'Type'EnumGooglePay
  | -- | Represents the JSON value @"masterpass"@
    PaymentMethodCardWallet'Type'EnumMasterpass
  | -- | Represents the JSON value @"samsung_pay"@
    PaymentMethodCardWallet'Type'EnumSamsungPay
  | -- | Represents the JSON value @"visa_checkout"@
    PaymentMethodCardWallet'Type'EnumVisaCheckout
  deriving (Int -> PaymentMethodCardWallet'Type' -> ShowS
[PaymentMethodCardWallet'Type'] -> ShowS
PaymentMethodCardWallet'Type' -> String
(Int -> PaymentMethodCardWallet'Type' -> ShowS)
-> (PaymentMethodCardWallet'Type' -> String)
-> ([PaymentMethodCardWallet'Type'] -> ShowS)
-> Show PaymentMethodCardWallet'Type'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardWallet'Type'] -> ShowS
$cshowList :: [PaymentMethodCardWallet'Type'] -> ShowS
show :: PaymentMethodCardWallet'Type' -> String
$cshow :: PaymentMethodCardWallet'Type' -> String
showsPrec :: Int -> PaymentMethodCardWallet'Type' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardWallet'Type' -> ShowS
GHC.Show.Show, PaymentMethodCardWallet'Type'
-> PaymentMethodCardWallet'Type' -> Bool
(PaymentMethodCardWallet'Type'
 -> PaymentMethodCardWallet'Type' -> Bool)
-> (PaymentMethodCardWallet'Type'
    -> PaymentMethodCardWallet'Type' -> Bool)
-> Eq PaymentMethodCardWallet'Type'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardWallet'Type'
-> PaymentMethodCardWallet'Type' -> Bool
$c/= :: PaymentMethodCardWallet'Type'
-> PaymentMethodCardWallet'Type' -> Bool
== :: PaymentMethodCardWallet'Type'
-> PaymentMethodCardWallet'Type' -> Bool
$c== :: PaymentMethodCardWallet'Type'
-> PaymentMethodCardWallet'Type' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodCardWallet'Type' where
  toJSON :: PaymentMethodCardWallet'Type' -> Value
toJSON (PaymentMethodCardWallet'Type'Other Value
val) = Value
val
  toJSON (PaymentMethodCardWallet'Type'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumAmexExpressCheckout) = Value
"amex_express_checkout"
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumApplePay) = Value
"apple_pay"
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumGooglePay) = Value
"google_pay"
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumMasterpass) = Value
"masterpass"
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumSamsungPay) = Value
"samsung_pay"
  toJSON (PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumVisaCheckout) = Value
"visa_checkout"

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodCardWallet'Type' where
  parseJSON :: Value -> Parser PaymentMethodCardWallet'Type'
parseJSON Value
val =
    PaymentMethodCardWallet'Type'
-> Parser PaymentMethodCardWallet'Type'
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
"amex_express_checkout" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumAmexExpressCheckout
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"apple_pay" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumApplePay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"google_pay" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumGooglePay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"masterpass" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumMasterpass
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"samsung_pay" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumSamsungPay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"visa_checkout" -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'EnumVisaCheckout
            | Bool
GHC.Base.otherwise -> Value -> PaymentMethodCardWallet'Type'
PaymentMethodCardWallet'Type'Other Value
val
      )