{-# 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 IssuingAuthorizationRequest
module StripeAPI.Types.IssuingAuthorizationRequest 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.IssuingAuthorizationAmountDetails
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.issuing_authorization_request@ in the specification.
data IssuingAuthorizationRequest = IssuingAuthorizationRequest
  { -- | amount: The \`pending_request.amount\` at the time of the request, presented in your card\'s currency and in the [smallest currency unit](https:\/\/stripe.com\/docs\/currencies\#zero-decimal). Stripe held this amount from your account to fund the authorization if the request was approved.
    IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestAmount :: GHC.Types.Int,
    -- | amount_details: Detailed breakdown of amount components. These amounts are denominated in \`currency\` and in the [smallest currency unit](https:\/\/stripe.com\/docs\/currencies\#zero-decimal).
    IssuingAuthorizationRequest
-> Maybe IssuingAuthorizationRequestAmountDetails'
issuingAuthorizationRequestAmountDetails :: (GHC.Maybe.Maybe IssuingAuthorizationRequestAmountDetails'),
    -- | approved: Whether this request was approved.
    IssuingAuthorizationRequest -> Bool
issuingAuthorizationRequestApproved :: GHC.Types.Bool,
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestCreated :: GHC.Types.Int,
    -- | currency: Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestCurrency :: Data.Text.Internal.Text,
    -- | merchant_amount: The \`pending_request.merchant_amount\` at the time of the request, presented in the \`merchant_currency\` and in the [smallest currency unit](https:\/\/stripe.com\/docs\/currencies\#zero-decimal).
    IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestMerchantAmount :: GHC.Types.Int,
    -- | merchant_currency: The currency that was collected by the merchant and presented to the cardholder for the authorization. Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestMerchantCurrency :: Data.Text.Internal.Text,
    -- | reason: The reason for the approval or decline.
    IssuingAuthorizationRequest -> IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason :: IssuingAuthorizationRequestReason'
  }
  deriving
    ( Int -> IssuingAuthorizationRequest -> ShowS
[IssuingAuthorizationRequest] -> ShowS
IssuingAuthorizationRequest -> String
(Int -> IssuingAuthorizationRequest -> ShowS)
-> (IssuingAuthorizationRequest -> String)
-> ([IssuingAuthorizationRequest] -> ShowS)
-> Show IssuingAuthorizationRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IssuingAuthorizationRequest] -> ShowS
$cshowList :: [IssuingAuthorizationRequest] -> ShowS
show :: IssuingAuthorizationRequest -> String
$cshow :: IssuingAuthorizationRequest -> String
showsPrec :: Int -> IssuingAuthorizationRequest -> ShowS
$cshowsPrec :: Int -> IssuingAuthorizationRequest -> ShowS
GHC.Show.Show,
      IssuingAuthorizationRequest -> IssuingAuthorizationRequest -> Bool
(IssuingAuthorizationRequest
 -> IssuingAuthorizationRequest -> Bool)
-> (IssuingAuthorizationRequest
    -> IssuingAuthorizationRequest -> Bool)
-> Eq IssuingAuthorizationRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IssuingAuthorizationRequest -> IssuingAuthorizationRequest -> Bool
$c/= :: IssuingAuthorizationRequest -> IssuingAuthorizationRequest -> Bool
== :: IssuingAuthorizationRequest -> IssuingAuthorizationRequest -> Bool
$c== :: IssuingAuthorizationRequest -> IssuingAuthorizationRequest -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON IssuingAuthorizationRequest where
  toJSON :: IssuingAuthorizationRequest -> Value
toJSON IssuingAuthorizationRequest
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestAmount IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"amount_details" Text -> Maybe IssuingAuthorizationRequestAmountDetails' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest
-> Maybe IssuingAuthorizationRequestAmountDetails'
issuingAuthorizationRequestAmountDetails IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"approved" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Bool
issuingAuthorizationRequestApproved IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestCreated IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestCurrency IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"merchant_amount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestMerchantAmount IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"merchant_currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestMerchantCurrency IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"reason" Text -> IssuingAuthorizationRequestReason' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason IssuingAuthorizationRequest
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: IssuingAuthorizationRequest -> Encoding
toEncoding IssuingAuthorizationRequest
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestAmount IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"amount_details" Text -> Maybe IssuingAuthorizationRequestAmountDetails' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest
-> Maybe IssuingAuthorizationRequestAmountDetails'
issuingAuthorizationRequestAmountDetails IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"approved" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Bool
issuingAuthorizationRequestApproved IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestCreated IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestCurrency IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"merchant_amount" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Int
issuingAuthorizationRequestMerchantAmount IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"merchant_currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> Text
issuingAuthorizationRequestMerchantCurrency IssuingAuthorizationRequest
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"reason" Text -> IssuingAuthorizationRequestReason' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequest -> IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason IssuingAuthorizationRequest
obj))))))))

instance Data.Aeson.Types.FromJSON.FromJSON IssuingAuthorizationRequest where
  parseJSON :: Value -> Parser IssuingAuthorizationRequest
parseJSON = String
-> (Object -> Parser IssuingAuthorizationRequest)
-> Value
-> Parser IssuingAuthorizationRequest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"IssuingAuthorizationRequest" (\Object
obj -> ((((((((Int
 -> Maybe IssuingAuthorizationRequestAmountDetails'
 -> Bool
 -> Int
 -> Text
 -> Int
 -> Text
 -> IssuingAuthorizationRequestReason'
 -> IssuingAuthorizationRequest)
-> Parser
     (Int
      -> Maybe IssuingAuthorizationRequestAmountDetails'
      -> Bool
      -> Int
      -> Text
      -> Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Maybe IssuingAuthorizationRequestAmountDetails'
-> Bool
-> Int
-> Text
-> Int
-> Text
-> IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequest
IssuingAuthorizationRequest Parser
  (Int
   -> Maybe IssuingAuthorizationRequestAmountDetails'
   -> Bool
   -> Int
   -> Text
   -> Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Int
-> Parser
     (Maybe IssuingAuthorizationRequestAmountDetails'
      -> Bool
      -> Int
      -> Text
      -> Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
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
"amount")) Parser
  (Maybe IssuingAuthorizationRequestAmountDetails'
   -> Bool
   -> Int
   -> Text
   -> Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser (Maybe IssuingAuthorizationRequestAmountDetails')
-> Parser
     (Bool
      -> Int
      -> Text
      -> Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe IssuingAuthorizationRequestAmountDetails')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"amount_details")) Parser
  (Bool
   -> Int
   -> Text
   -> Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Bool
-> Parser
     (Int
      -> Text
      -> Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"approved")) Parser
  (Int
   -> Text
   -> Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Int
-> Parser
     (Text
      -> Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
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
"created")) Parser
  (Text
   -> Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Text
-> Parser
     (Int
      -> Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
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
"currency")) Parser
  (Int
   -> Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Int
-> Parser
     (Text
      -> IssuingAuthorizationRequestReason'
      -> IssuingAuthorizationRequest)
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
"merchant_amount")) Parser
  (Text
   -> IssuingAuthorizationRequestReason'
   -> IssuingAuthorizationRequest)
-> Parser Text
-> Parser
     (IssuingAuthorizationRequestReason' -> IssuingAuthorizationRequest)
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
"merchant_currency")) Parser
  (IssuingAuthorizationRequestReason' -> IssuingAuthorizationRequest)
-> Parser IssuingAuthorizationRequestReason'
-> Parser IssuingAuthorizationRequest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser IssuingAuthorizationRequestReason'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"reason"))

-- | Create a new 'IssuingAuthorizationRequest' with all required fields.
mkIssuingAuthorizationRequest ::
  -- | 'issuingAuthorizationRequestAmount'
  GHC.Types.Int ->
  -- | 'issuingAuthorizationRequestApproved'
  GHC.Types.Bool ->
  -- | 'issuingAuthorizationRequestCreated'
  GHC.Types.Int ->
  -- | 'issuingAuthorizationRequestCurrency'
  Data.Text.Internal.Text ->
  -- | 'issuingAuthorizationRequestMerchantAmount'
  GHC.Types.Int ->
  -- | 'issuingAuthorizationRequestMerchantCurrency'
  Data.Text.Internal.Text ->
  -- | 'issuingAuthorizationRequestReason'
  IssuingAuthorizationRequestReason' ->
  IssuingAuthorizationRequest
mkIssuingAuthorizationRequest :: Int
-> Bool
-> Int
-> Text
-> Int
-> Text
-> IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequest
mkIssuingAuthorizationRequest Int
issuingAuthorizationRequestAmount Bool
issuingAuthorizationRequestApproved Int
issuingAuthorizationRequestCreated Text
issuingAuthorizationRequestCurrency Int
issuingAuthorizationRequestMerchantAmount Text
issuingAuthorizationRequestMerchantCurrency IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason =
  IssuingAuthorizationRequest :: Int
-> Maybe IssuingAuthorizationRequestAmountDetails'
-> Bool
-> Int
-> Text
-> Int
-> Text
-> IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequest
IssuingAuthorizationRequest
    { issuingAuthorizationRequestAmount :: Int
issuingAuthorizationRequestAmount = Int
issuingAuthorizationRequestAmount,
      issuingAuthorizationRequestAmountDetails :: Maybe IssuingAuthorizationRequestAmountDetails'
issuingAuthorizationRequestAmountDetails = Maybe IssuingAuthorizationRequestAmountDetails'
forall a. Maybe a
GHC.Maybe.Nothing,
      issuingAuthorizationRequestApproved :: Bool
issuingAuthorizationRequestApproved = Bool
issuingAuthorizationRequestApproved,
      issuingAuthorizationRequestCreated :: Int
issuingAuthorizationRequestCreated = Int
issuingAuthorizationRequestCreated,
      issuingAuthorizationRequestCurrency :: Text
issuingAuthorizationRequestCurrency = Text
issuingAuthorizationRequestCurrency,
      issuingAuthorizationRequestMerchantAmount :: Int
issuingAuthorizationRequestMerchantAmount = Int
issuingAuthorizationRequestMerchantAmount,
      issuingAuthorizationRequestMerchantCurrency :: Text
issuingAuthorizationRequestMerchantCurrency = Text
issuingAuthorizationRequestMerchantCurrency,
      issuingAuthorizationRequestReason :: IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason = IssuingAuthorizationRequestReason'
issuingAuthorizationRequestReason
    }

-- | Defines the object schema located at @components.schemas.issuing_authorization_request.properties.amount_details.anyOf@ in the specification.
--
-- Detailed breakdown of amount components. These amounts are denominated in \\\`currency\\\` and in the [smallest currency unit](https:\\\/\\\/stripe.com\\\/docs\\\/currencies\\\#zero-decimal).
data IssuingAuthorizationRequestAmountDetails' = IssuingAuthorizationRequestAmountDetails'
  { -- | atm_fee: The fee charged by the ATM for the cash withdrawal.
    IssuingAuthorizationRequestAmountDetails' -> Maybe Int
issuingAuthorizationRequestAmountDetails'AtmFee :: (GHC.Maybe.Maybe GHC.Types.Int)
  }
  deriving
    ( Int -> IssuingAuthorizationRequestAmountDetails' -> ShowS
[IssuingAuthorizationRequestAmountDetails'] -> ShowS
IssuingAuthorizationRequestAmountDetails' -> String
(Int -> IssuingAuthorizationRequestAmountDetails' -> ShowS)
-> (IssuingAuthorizationRequestAmountDetails' -> String)
-> ([IssuingAuthorizationRequestAmountDetails'] -> ShowS)
-> Show IssuingAuthorizationRequestAmountDetails'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IssuingAuthorizationRequestAmountDetails'] -> ShowS
$cshowList :: [IssuingAuthorizationRequestAmountDetails'] -> ShowS
show :: IssuingAuthorizationRequestAmountDetails' -> String
$cshow :: IssuingAuthorizationRequestAmountDetails' -> String
showsPrec :: Int -> IssuingAuthorizationRequestAmountDetails' -> ShowS
$cshowsPrec :: Int -> IssuingAuthorizationRequestAmountDetails' -> ShowS
GHC.Show.Show,
      IssuingAuthorizationRequestAmountDetails'
-> IssuingAuthorizationRequestAmountDetails' -> Bool
(IssuingAuthorizationRequestAmountDetails'
 -> IssuingAuthorizationRequestAmountDetails' -> Bool)
-> (IssuingAuthorizationRequestAmountDetails'
    -> IssuingAuthorizationRequestAmountDetails' -> Bool)
-> Eq IssuingAuthorizationRequestAmountDetails'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IssuingAuthorizationRequestAmountDetails'
-> IssuingAuthorizationRequestAmountDetails' -> Bool
$c/= :: IssuingAuthorizationRequestAmountDetails'
-> IssuingAuthorizationRequestAmountDetails' -> Bool
== :: IssuingAuthorizationRequestAmountDetails'
-> IssuingAuthorizationRequestAmountDetails' -> Bool
$c== :: IssuingAuthorizationRequestAmountDetails'
-> IssuingAuthorizationRequestAmountDetails' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON IssuingAuthorizationRequestAmountDetails' where
  toJSON :: IssuingAuthorizationRequestAmountDetails' -> Value
toJSON IssuingAuthorizationRequestAmountDetails'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"atm_fee" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequestAmountDetails' -> Maybe Int
issuingAuthorizationRequestAmountDetails'AtmFee IssuingAuthorizationRequestAmountDetails'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: IssuingAuthorizationRequestAmountDetails' -> Encoding
toEncoding IssuingAuthorizationRequestAmountDetails'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"atm_fee" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= IssuingAuthorizationRequestAmountDetails' -> Maybe Int
issuingAuthorizationRequestAmountDetails'AtmFee IssuingAuthorizationRequestAmountDetails'
obj)

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

-- | Create a new 'IssuingAuthorizationRequestAmountDetails'' with all required fields.
mkIssuingAuthorizationRequestAmountDetails' :: IssuingAuthorizationRequestAmountDetails'
mkIssuingAuthorizationRequestAmountDetails' :: IssuingAuthorizationRequestAmountDetails'
mkIssuingAuthorizationRequestAmountDetails' = IssuingAuthorizationRequestAmountDetails' :: Maybe Int -> IssuingAuthorizationRequestAmountDetails'
IssuingAuthorizationRequestAmountDetails' {issuingAuthorizationRequestAmountDetails'AtmFee :: Maybe Int
issuingAuthorizationRequestAmountDetails'AtmFee = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing}

-- | Defines the enum schema located at @components.schemas.issuing_authorization_request.properties.reason@ in the specification.
--
-- The reason for the approval or decline.
data IssuingAuthorizationRequestReason'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    IssuingAuthorizationRequestReason'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.
    IssuingAuthorizationRequestReason'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"account_disabled"@
    IssuingAuthorizationRequestReason'EnumAccountDisabled
  | -- | Represents the JSON value @"card_active"@
    IssuingAuthorizationRequestReason'EnumCardActive
  | -- | Represents the JSON value @"card_inactive"@
    IssuingAuthorizationRequestReason'EnumCardInactive
  | -- | Represents the JSON value @"cardholder_inactive"@
    IssuingAuthorizationRequestReason'EnumCardholderInactive
  | -- | Represents the JSON value @"cardholder_verification_required"@
    IssuingAuthorizationRequestReason'EnumCardholderVerificationRequired
  | -- | Represents the JSON value @"insufficient_funds"@
    IssuingAuthorizationRequestReason'EnumInsufficientFunds
  | -- | Represents the JSON value @"not_allowed"@
    IssuingAuthorizationRequestReason'EnumNotAllowed
  | -- | Represents the JSON value @"spending_controls"@
    IssuingAuthorizationRequestReason'EnumSpendingControls
  | -- | Represents the JSON value @"suspected_fraud"@
    IssuingAuthorizationRequestReason'EnumSuspectedFraud
  | -- | Represents the JSON value @"verification_failed"@
    IssuingAuthorizationRequestReason'EnumVerificationFailed
  | -- | Represents the JSON value @"webhook_approved"@
    IssuingAuthorizationRequestReason'EnumWebhookApproved
  | -- | Represents the JSON value @"webhook_declined"@
    IssuingAuthorizationRequestReason'EnumWebhookDeclined
  | -- | Represents the JSON value @"webhook_timeout"@
    IssuingAuthorizationRequestReason'EnumWebhookTimeout
  deriving (Int -> IssuingAuthorizationRequestReason' -> ShowS
[IssuingAuthorizationRequestReason'] -> ShowS
IssuingAuthorizationRequestReason' -> String
(Int -> IssuingAuthorizationRequestReason' -> ShowS)
-> (IssuingAuthorizationRequestReason' -> String)
-> ([IssuingAuthorizationRequestReason'] -> ShowS)
-> Show IssuingAuthorizationRequestReason'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IssuingAuthorizationRequestReason'] -> ShowS
$cshowList :: [IssuingAuthorizationRequestReason'] -> ShowS
show :: IssuingAuthorizationRequestReason' -> String
$cshow :: IssuingAuthorizationRequestReason' -> String
showsPrec :: Int -> IssuingAuthorizationRequestReason' -> ShowS
$cshowsPrec :: Int -> IssuingAuthorizationRequestReason' -> ShowS
GHC.Show.Show, IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequestReason' -> Bool
(IssuingAuthorizationRequestReason'
 -> IssuingAuthorizationRequestReason' -> Bool)
-> (IssuingAuthorizationRequestReason'
    -> IssuingAuthorizationRequestReason' -> Bool)
-> Eq IssuingAuthorizationRequestReason'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequestReason' -> Bool
$c/= :: IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequestReason' -> Bool
== :: IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequestReason' -> Bool
$c== :: IssuingAuthorizationRequestReason'
-> IssuingAuthorizationRequestReason' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON IssuingAuthorizationRequestReason' where
  toJSON :: IssuingAuthorizationRequestReason' -> Value
toJSON (IssuingAuthorizationRequestReason'Other Value
val) = Value
val
  toJSON (IssuingAuthorizationRequestReason'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumAccountDisabled) = Value
"account_disabled"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardActive) = Value
"card_active"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardInactive) = Value
"card_inactive"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardholderInactive) = Value
"cardholder_inactive"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardholderVerificationRequired) = Value
"cardholder_verification_required"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumInsufficientFunds) = Value
"insufficient_funds"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumNotAllowed) = Value
"not_allowed"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumSpendingControls) = Value
"spending_controls"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumSuspectedFraud) = Value
"suspected_fraud"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumVerificationFailed) = Value
"verification_failed"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookApproved) = Value
"webhook_approved"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookDeclined) = Value
"webhook_declined"
  toJSON (IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookTimeout) = Value
"webhook_timeout"

instance Data.Aeson.Types.FromJSON.FromJSON IssuingAuthorizationRequestReason' where
  parseJSON :: Value -> Parser IssuingAuthorizationRequestReason'
parseJSON Value
val =
    IssuingAuthorizationRequestReason'
-> Parser IssuingAuthorizationRequestReason'
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
"account_disabled" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumAccountDisabled
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"card_active" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardActive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"card_inactive" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardInactive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"cardholder_inactive" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardholderInactive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"cardholder_verification_required" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumCardholderVerificationRequired
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"insufficient_funds" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumInsufficientFunds
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"not_allowed" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumNotAllowed
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"spending_controls" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumSpendingControls
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"suspected_fraud" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumSuspectedFraud
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"verification_failed" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumVerificationFailed
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"webhook_approved" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookApproved
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"webhook_declined" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookDeclined
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"webhook_timeout" -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'EnumWebhookTimeout
            | Bool
GHC.Base.otherwise -> Value -> IssuingAuthorizationRequestReason'
IssuingAuthorizationRequestReason'Other Value
val
      )