{-# 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 PaymentMethodCardWallet
module StripeAPI.Types.PaymentMethodCardWallet 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.PaymentMethodCardWalletMasterpass
import {-# SOURCE #-} StripeAPI.Types.PaymentMethodCardWalletVisaCheckout
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.payment_method_card_wallet@ in the specification.
data PaymentMethodCardWallet = PaymentMethodCardWallet
  { -- | amex_express_checkout:
    PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletAmexExpressCheckout :: (GHC.Maybe.Maybe PaymentMethodCardWalletAmexExpressCheckout),
    -- | apple_pay:
    PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletApplePay :: (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
paymentMethodCardWalletDynamicLast4 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | google_pay:
    PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletGooglePay :: (GHC.Maybe.Maybe PaymentMethodCardWalletGooglePay),
    -- | masterpass:
    PaymentMethodCardWallet -> Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWalletMasterpass :: (GHC.Maybe.Maybe PaymentMethodCardWalletMasterpass),
    -- | samsung_pay:
    PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletSamsungPay :: (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 -> PaymentMethodCardWalletType'
paymentMethodCardWalletType :: PaymentMethodCardWalletType',
    -- | visa_checkout:
    PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWalletVisaCheckout :: (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 PaymentMethodCardWalletAmexExpressCheckout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletAmexExpressCheckout PaymentMethodCardWallet
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"apple_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletApplePay 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
paymentMethodCardWalletDynamicLast4 PaymentMethodCardWallet
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"google_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletGooglePay 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
paymentMethodCardWalletMasterpass PaymentMethodCardWallet
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"samsung_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletSamsungPay PaymentMethodCardWallet
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> PaymentMethodCardWalletType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet -> PaymentMethodCardWalletType'
paymentMethodCardWalletType 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
paymentMethodCardWalletVisaCheckout 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 PaymentMethodCardWalletAmexExpressCheckout -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletAmexExpressCheckout PaymentMethodCardWallet
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"apple_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletApplePay 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
paymentMethodCardWalletDynamicLast4 PaymentMethodCardWallet
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"google_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletGooglePay 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
paymentMethodCardWalletMasterpass PaymentMethodCardWallet
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"samsung_pay" Text -> Maybe PaymentMethodCardWalletAmexExpressCheckout -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletSamsungPay PaymentMethodCardWallet
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> PaymentMethodCardWalletType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentMethodCardWallet -> PaymentMethodCardWalletType'
paymentMethodCardWalletType 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
paymentMethodCardWalletVisaCheckout PaymentMethodCardWallet
obj))))))))

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

-- | Create a new 'PaymentMethodCardWallet' with all required fields.
mkPaymentMethodCardWallet ::
  -- | 'paymentMethodCardWalletType'
  PaymentMethodCardWalletType' ->
  PaymentMethodCardWallet
mkPaymentMethodCardWallet :: PaymentMethodCardWalletType' -> PaymentMethodCardWallet
mkPaymentMethodCardWallet PaymentMethodCardWalletType'
paymentMethodCardWalletType =
  PaymentMethodCardWallet :: Maybe PaymentMethodCardWalletAmexExpressCheckout
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
-> Maybe Text
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
-> Maybe PaymentMethodCardWalletMasterpass
-> Maybe PaymentMethodCardWalletAmexExpressCheckout
-> PaymentMethodCardWalletType'
-> Maybe PaymentMethodCardWalletVisaCheckout
-> PaymentMethodCardWallet
PaymentMethodCardWallet
    { paymentMethodCardWalletAmexExpressCheckout :: Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletAmexExpressCheckout = Maybe PaymentMethodCardWalletAmexExpressCheckout
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletApplePay :: Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletApplePay = Maybe PaymentMethodCardWalletAmexExpressCheckout
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletDynamicLast4 :: Maybe Text
paymentMethodCardWalletDynamicLast4 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletGooglePay :: Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletGooglePay = Maybe PaymentMethodCardWalletAmexExpressCheckout
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletMasterpass :: Maybe PaymentMethodCardWalletMasterpass
paymentMethodCardWalletMasterpass = Maybe PaymentMethodCardWalletMasterpass
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletSamsungPay :: Maybe PaymentMethodCardWalletAmexExpressCheckout
paymentMethodCardWalletSamsungPay = Maybe PaymentMethodCardWalletAmexExpressCheckout
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentMethodCardWalletType :: PaymentMethodCardWalletType'
paymentMethodCardWalletType = PaymentMethodCardWalletType'
paymentMethodCardWalletType,
      paymentMethodCardWalletVisaCheckout :: Maybe PaymentMethodCardWalletVisaCheckout
paymentMethodCardWalletVisaCheckout = Maybe PaymentMethodCardWalletVisaCheckout
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.payment_method_card_wallet.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 PaymentMethodCardWalletType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PaymentMethodCardWalletType'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.
    PaymentMethodCardWalletType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"amex_express_checkout"@
    PaymentMethodCardWalletType'EnumAmexExpressCheckout
  | -- | Represents the JSON value @"apple_pay"@
    PaymentMethodCardWalletType'EnumApplePay
  | -- | Represents the JSON value @"google_pay"@
    PaymentMethodCardWalletType'EnumGooglePay
  | -- | Represents the JSON value @"masterpass"@
    PaymentMethodCardWalletType'EnumMasterpass
  | -- | Represents the JSON value @"samsung_pay"@
    PaymentMethodCardWalletType'EnumSamsungPay
  | -- | Represents the JSON value @"visa_checkout"@
    PaymentMethodCardWalletType'EnumVisaCheckout
  deriving (Int -> PaymentMethodCardWalletType' -> ShowS
[PaymentMethodCardWalletType'] -> ShowS
PaymentMethodCardWalletType' -> String
(Int -> PaymentMethodCardWalletType' -> ShowS)
-> (PaymentMethodCardWalletType' -> String)
-> ([PaymentMethodCardWalletType'] -> ShowS)
-> Show PaymentMethodCardWalletType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodCardWalletType'] -> ShowS
$cshowList :: [PaymentMethodCardWalletType'] -> ShowS
show :: PaymentMethodCardWalletType' -> String
$cshow :: PaymentMethodCardWalletType' -> String
showsPrec :: Int -> PaymentMethodCardWalletType' -> ShowS
$cshowsPrec :: Int -> PaymentMethodCardWalletType' -> ShowS
GHC.Show.Show, PaymentMethodCardWalletType'
-> PaymentMethodCardWalletType' -> Bool
(PaymentMethodCardWalletType'
 -> PaymentMethodCardWalletType' -> Bool)
-> (PaymentMethodCardWalletType'
    -> PaymentMethodCardWalletType' -> Bool)
-> Eq PaymentMethodCardWalletType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodCardWalletType'
-> PaymentMethodCardWalletType' -> Bool
$c/= :: PaymentMethodCardWalletType'
-> PaymentMethodCardWalletType' -> Bool
== :: PaymentMethodCardWalletType'
-> PaymentMethodCardWalletType' -> Bool
$c== :: PaymentMethodCardWalletType'
-> PaymentMethodCardWalletType' -> Bool
GHC.Classes.Eq)

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

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