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

-- | Defines the object schema located at @components.schemas.payment_intent_next_action_verify_with_microdeposits@ in the specification.
data PaymentIntentNextActionVerifyWithMicrodeposits = PaymentIntentNextActionVerifyWithMicrodeposits
  { -- | arrival_date: The timestamp when the microdeposits are expected to land.
    PaymentIntentNextActionVerifyWithMicrodeposits -> Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate :: GHC.Types.Int,
    -- | hosted_verification_url: The URL for the hosted verification page, which allows customers to verify their bank account.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentIntentNextActionVerifyWithMicrodeposits -> Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> PaymentIntentNextActionVerifyWithMicrodeposits -> ShowS
[PaymentIntentNextActionVerifyWithMicrodeposits] -> ShowS
PaymentIntentNextActionVerifyWithMicrodeposits -> String
(Int -> PaymentIntentNextActionVerifyWithMicrodeposits -> ShowS)
-> (PaymentIntentNextActionVerifyWithMicrodeposits -> String)
-> ([PaymentIntentNextActionVerifyWithMicrodeposits] -> ShowS)
-> Show PaymentIntentNextActionVerifyWithMicrodeposits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentIntentNextActionVerifyWithMicrodeposits] -> ShowS
$cshowList :: [PaymentIntentNextActionVerifyWithMicrodeposits] -> ShowS
show :: PaymentIntentNextActionVerifyWithMicrodeposits -> String
$cshow :: PaymentIntentNextActionVerifyWithMicrodeposits -> String
showsPrec :: Int -> PaymentIntentNextActionVerifyWithMicrodeposits -> ShowS
$cshowsPrec :: Int -> PaymentIntentNextActionVerifyWithMicrodeposits -> ShowS
GHC.Show.Show,
      PaymentIntentNextActionVerifyWithMicrodeposits
-> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool
(PaymentIntentNextActionVerifyWithMicrodeposits
 -> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool)
-> (PaymentIntentNextActionVerifyWithMicrodeposits
    -> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool)
-> Eq PaymentIntentNextActionVerifyWithMicrodeposits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentIntentNextActionVerifyWithMicrodeposits
-> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool
$c/= :: PaymentIntentNextActionVerifyWithMicrodeposits
-> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool
== :: PaymentIntentNextActionVerifyWithMicrodeposits
-> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool
$c== :: PaymentIntentNextActionVerifyWithMicrodeposits
-> PaymentIntentNextActionVerifyWithMicrodeposits -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentIntentNextActionVerifyWithMicrodeposits where
  toJSON :: PaymentIntentNextActionVerifyWithMicrodeposits -> Value
toJSON PaymentIntentNextActionVerifyWithMicrodeposits
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"arrival_date" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionVerifyWithMicrodeposits -> Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate PaymentIntentNextActionVerifyWithMicrodeposits
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"hosted_verification_url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionVerifyWithMicrodeposits -> Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl PaymentIntentNextActionVerifyWithMicrodeposits
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentIntentNextActionVerifyWithMicrodeposits -> Encoding
toEncoding PaymentIntentNextActionVerifyWithMicrodeposits
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"arrival_date" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionVerifyWithMicrodeposits -> Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate PaymentIntentNextActionVerifyWithMicrodeposits
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"hosted_verification_url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionVerifyWithMicrodeposits -> Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl PaymentIntentNextActionVerifyWithMicrodeposits
obj))

instance Data.Aeson.Types.FromJSON.FromJSON PaymentIntentNextActionVerifyWithMicrodeposits where
  parseJSON :: Value -> Parser PaymentIntentNextActionVerifyWithMicrodeposits
parseJSON = String
-> (Object
    -> Parser PaymentIntentNextActionVerifyWithMicrodeposits)
-> Value
-> Parser PaymentIntentNextActionVerifyWithMicrodeposits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentIntentNextActionVerifyWithMicrodeposits" (\Object
obj -> ((Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits)
-> Parser
     (Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits
PaymentIntentNextActionVerifyWithMicrodeposits Parser
  (Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits)
-> Parser Int
-> Parser (Text -> PaymentIntentNextActionVerifyWithMicrodeposits)
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
"arrival_date")) Parser (Text -> PaymentIntentNextActionVerifyWithMicrodeposits)
-> Parser Text
-> Parser PaymentIntentNextActionVerifyWithMicrodeposits
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
"hosted_verification_url"))

-- | Create a new 'PaymentIntentNextActionVerifyWithMicrodeposits' with all required fields.
mkPaymentIntentNextActionVerifyWithMicrodeposits ::
  -- | 'paymentIntentNextActionVerifyWithMicrodepositsArrivalDate'
  GHC.Types.Int ->
  -- | 'paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl'
  Data.Text.Internal.Text ->
  PaymentIntentNextActionVerifyWithMicrodeposits
mkPaymentIntentNextActionVerifyWithMicrodeposits :: Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits
mkPaymentIntentNextActionVerifyWithMicrodeposits Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl =
  PaymentIntentNextActionVerifyWithMicrodeposits :: Int -> Text -> PaymentIntentNextActionVerifyWithMicrodeposits
PaymentIntentNextActionVerifyWithMicrodeposits
    { paymentIntentNextActionVerifyWithMicrodepositsArrivalDate :: Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate = Int
paymentIntentNextActionVerifyWithMicrodepositsArrivalDate,
      paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl :: Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl = Text
paymentIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl
    }