{-# 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 SourceMandateNotification module StripeAPI.Types.SourceMandateNotification 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.Source import {-# SOURCE #-} StripeAPI.Types.SourceMandateNotificationAcssDebitData import {-# SOURCE #-} StripeAPI.Types.SourceMandateNotificationBacsDebitData import {-# SOURCE #-} StripeAPI.Types.SourceMandateNotificationSepaDebitData import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.source_mandate_notification@ in the specification. -- -- Source mandate notifications should be created when a notification related to -- a source mandate must be sent to the payer. They will trigger a webhook or -- deliver an email to the customer. data SourceMandateNotification = SourceMandateNotification { -- | acss_debit: sourceMandateNotificationAcssDebit :: (GHC.Maybe.Maybe SourceMandateNotificationAcssDebitData), -- | amount: A positive integer in the smallest currency unit (that is, 100 cents for \$1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount associated with the mandate notification. The amount is expressed in the currency of the underlying source. Required if the notification type is \`debit_initiated\`. sourceMandateNotificationAmount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | bacs_debit: sourceMandateNotificationBacsDebit :: (GHC.Maybe.Maybe SourceMandateNotificationBacsDebitData), -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. sourceMandateNotificationCreated :: GHC.Types.Int, -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 sourceMandateNotificationId :: Data.Text.Internal.Text, -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode. sourceMandateNotificationLivemode :: GHC.Types.Bool, -- | reason: The reason of the mandate notification. Valid reasons are \`mandate_confirmed\` or \`debit_initiated\`. -- -- Constraints: -- -- * Maximum length of 5000 sourceMandateNotificationReason :: Data.Text.Internal.Text, -- | sepa_debit: sourceMandateNotificationSepaDebit :: (GHC.Maybe.Maybe SourceMandateNotificationSepaDebitData), -- | source: \`Source\` objects allow you to accept a variety of payment methods. They -- represent a customer\'s payment instrument, and can be used with the Stripe API -- just like a \`Card\` object: once chargeable, they can be charged, or can be -- attached to customers. -- -- Related guides: [Sources API](https:\/\/stripe.com\/docs\/sources) and [Sources & Customers](https:\/\/stripe.com\/docs\/sources\/customers). sourceMandateNotificationSource :: Source, -- | status: The status of the mandate notification. Valid statuses are \`pending\` or \`submitted\`. -- -- Constraints: -- -- * Maximum length of 5000 sourceMandateNotificationStatus :: Data.Text.Internal.Text, -- | type: The type of source this mandate notification is attached to. Should be the source type identifier code for the payment method, such as \`three_d_secure\`. -- -- Constraints: -- -- * Maximum length of 5000 sourceMandateNotificationType :: Data.Text.Internal.Text } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON SourceMandateNotification where toJSON obj = Data.Aeson.Types.Internal.object ("acss_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationAcssDebit obj : "amount" Data.Aeson.Types.ToJSON..= sourceMandateNotificationAmount obj : "bacs_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationBacsDebit obj : "created" Data.Aeson.Types.ToJSON..= sourceMandateNotificationCreated obj : "id" Data.Aeson.Types.ToJSON..= sourceMandateNotificationId obj : "livemode" Data.Aeson.Types.ToJSON..= sourceMandateNotificationLivemode obj : "reason" Data.Aeson.Types.ToJSON..= sourceMandateNotificationReason obj : "sepa_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationSepaDebit obj : "source" Data.Aeson.Types.ToJSON..= sourceMandateNotificationSource obj : "status" Data.Aeson.Types.ToJSON..= sourceMandateNotificationStatus obj : "type" Data.Aeson.Types.ToJSON..= sourceMandateNotificationType obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "source_mandate_notification" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("acss_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationAcssDebit obj) GHC.Base.<> (("amount" Data.Aeson.Types.ToJSON..= sourceMandateNotificationAmount obj) GHC.Base.<> (("bacs_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationBacsDebit obj) GHC.Base.<> (("created" Data.Aeson.Types.ToJSON..= sourceMandateNotificationCreated obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= sourceMandateNotificationId obj) GHC.Base.<> (("livemode" Data.Aeson.Types.ToJSON..= sourceMandateNotificationLivemode obj) GHC.Base.<> (("reason" Data.Aeson.Types.ToJSON..= sourceMandateNotificationReason obj) GHC.Base.<> (("sepa_debit" Data.Aeson.Types.ToJSON..= sourceMandateNotificationSepaDebit obj) GHC.Base.<> (("source" Data.Aeson.Types.ToJSON..= sourceMandateNotificationSource obj) GHC.Base.<> (("status" Data.Aeson.Types.ToJSON..= sourceMandateNotificationStatus obj) GHC.Base.<> (("type" Data.Aeson.Types.ToJSON..= sourceMandateNotificationType obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "source_mandate_notification")))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON SourceMandateNotification where parseJSON = Data.Aeson.Types.FromJSON.withObject "SourceMandateNotification" (\obj -> ((((((((((GHC.Base.pure SourceMandateNotification GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "acss_debit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "bacs_debit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "created")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "livemode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "reason")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "sepa_debit")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "source")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "status")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) -- | Create a new 'SourceMandateNotification' with all required fields. mkSourceMandateNotification :: -- | 'sourceMandateNotificationCreated' GHC.Types.Int -> -- | 'sourceMandateNotificationId' Data.Text.Internal.Text -> -- | 'sourceMandateNotificationLivemode' GHC.Types.Bool -> -- | 'sourceMandateNotificationReason' Data.Text.Internal.Text -> -- | 'sourceMandateNotificationSource' Source -> -- | 'sourceMandateNotificationStatus' Data.Text.Internal.Text -> -- | 'sourceMandateNotificationType' Data.Text.Internal.Text -> SourceMandateNotification mkSourceMandateNotification sourceMandateNotificationCreated sourceMandateNotificationId sourceMandateNotificationLivemode sourceMandateNotificationReason sourceMandateNotificationSource sourceMandateNotificationStatus sourceMandateNotificationType = SourceMandateNotification { sourceMandateNotificationAcssDebit = GHC.Maybe.Nothing, sourceMandateNotificationAmount = GHC.Maybe.Nothing, sourceMandateNotificationBacsDebit = GHC.Maybe.Nothing, sourceMandateNotificationCreated = sourceMandateNotificationCreated, sourceMandateNotificationId = sourceMandateNotificationId, sourceMandateNotificationLivemode = sourceMandateNotificationLivemode, sourceMandateNotificationReason = sourceMandateNotificationReason, sourceMandateNotificationSepaDebit = GHC.Maybe.Nothing, sourceMandateNotificationSource = sourceMandateNotificationSource, sourceMandateNotificationStatus = sourceMandateNotificationStatus, sourceMandateNotificationType = sourceMandateNotificationType }