{-# LANGUAGE ExplicitForAll #-}
{-# 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 different functions to run the operation postCharges
module StripeAPI.Operations.PostCharges where

import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
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.Either
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 Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | > POST /v1/charges
--
-- \<p>To charge a credit card or other payment source, you create a \<code>Charge\<\/code> object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).\<\/p>
postCharges ::
  forall m.
  StripeAPI.Common.MonadHTTP m =>
  -- | The request body to send
  GHC.Maybe.Maybe PostChargesRequestBody ->
  -- | Monadic computation which returns the result of the operation
  StripeAPI.Common.StripeT m (Network.HTTP.Client.Types.Response PostChargesResponse)
postCharges :: Maybe PostChargesRequestBody
-> StripeT m (Response PostChargesResponse)
postCharges Maybe PostChargesRequestBody
body =
  (Response ByteString -> Response PostChargesResponse)
-> StripeT m (Response ByteString)
-> StripeT m (Response PostChargesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
    ( \Response ByteString
response_0 ->
        (ByteString -> PostChargesResponse)
-> Response ByteString -> Response PostChargesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
          ( (String -> PostChargesResponse)
-> (PostChargesResponse -> PostChargesResponse)
-> Either String PostChargesResponse
-> PostChargesResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostChargesResponse
PostChargesResponseError PostChargesResponse -> PostChargesResponse
forall a. a -> a
GHC.Base.id
              (Either String PostChargesResponse -> PostChargesResponse)
-> (ByteString -> Either String PostChargesResponse)
-> ByteString
-> PostChargesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
                             if
                                 | (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   Charge -> PostChargesResponse
PostChargesResponse200
                                     (Charge -> PostChargesResponse)
-> Either String Charge -> Either String PostChargesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Charge
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            Charge
                                                      )
                                 | Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
                                   Error -> PostChargesResponse
PostChargesResponseDefault
                                     (Error -> PostChargesResponse)
-> Either String Error -> Either String PostChargesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
                                                          Data.Either.Either
                                                            GHC.Base.String
                                                            Error
                                                      )
                                 | Bool
GHC.Base.otherwise -> String -> Either String PostChargesResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
                         )
                Response ByteString
response_0
          )
          Response ByteString
response_0
    )
    (Text
-> Text
-> [QueryParameter]
-> Maybe PostChargesRequestBody
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> StripeT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack String
"/v1/charges") [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostChargesRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema@ in the specification.
data PostChargesRequestBody = PostChargesRequestBody
  { -- | amount: Amount intended to be collected by this payment. A positive integer representing how much to charge in the [smallest currency unit](https:\/\/stripe.com\/docs\/currencies\#zero-decimal) (e.g., 100 cents to charge \$1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is \$0.50 US or [equivalent in charge currency](https:\/\/stripe.com\/docs\/currencies\#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of \$999,999.99).
    PostChargesRequestBody -> Maybe Int
postChargesRequestBodyAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | application_fee
    PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFee :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | application_fee_amount: A fee in %s that will be applied to the charge and transferred to the application owner\'s Stripe account. The request must be made with an OAuth key or the \`Stripe-Account\` header in order to take an application fee. For more information, see the application fees [documentation](https:\/\/stripe.com\/docs\/connect\/direct-charges\#collecting-fees).
    PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFeeAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | capture: Whether to immediately capture the charge. Defaults to \`true\`. When \`false\`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https:\/\/stripe.com\/docs\/api\#capture_charge) later. Uncaptured charges expire in _seven days_. For more information, see the [authorizing charges and settling later](https:\/\/stripe.com\/docs\/charges\/placing-a-hold) documentation.
    PostChargesRequestBody -> Maybe Bool
postChargesRequestBodyCapture :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | card: A token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js).
    PostChargesRequestBody -> Maybe PostChargesRequestBodyCard'Variants
postChargesRequestBodyCard :: (GHC.Maybe.Maybe PostChargesRequestBodyCard'Variants),
    -- | 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).
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCurrency :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | customer: The ID of an existing customer that will be charged in this request.
    --
    -- Constraints:
    --
    -- * Maximum length of 500
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCustomer :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | description: An arbitrary string which you can attach to a \`Charge\` object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the \`description\` of the charge(s) that they are describing.
    --
    -- Constraints:
    --
    -- * Maximum length of 40000
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | destination
    PostChargesRequestBody
-> Maybe PostChargesRequestBodyDestination'Variants
postChargesRequestBodyDestination :: (GHC.Maybe.Maybe PostChargesRequestBodyDestination'Variants),
    -- | expand: Specifies which fields in the response should be expanded.
    PostChargesRequestBody -> Maybe [Text]
postChargesRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
    -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`.
    PostChargesRequestBody
-> Maybe PostChargesRequestBodyMetadata'Variants
postChargesRequestBodyMetadata :: (GHC.Maybe.Maybe PostChargesRequestBodyMetadata'Variants),
    -- | on_behalf_of: The Stripe account ID for which these funds are intended. Automatically set if you use the \`destination\` parameter. For details, see [Creating Separate Charges and Transfers](https:\/\/stripe.com\/docs\/connect\/charges-transfers\#on-behalf-of).
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyOnBehalfOf :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | receipt_email: The email address to which this charge\'s [receipt](https:\/\/stripe.com\/docs\/dashboard\/receipts) will be sent. The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. If this charge is for a [Customer](https:\/\/stripe.com\/docs\/api\/customers\/object), the email address specified here will override the customer\'s email address. If \`receipt_email\` is specified for a charge in live mode, a receipt will be sent regardless of your [email settings](https:\/\/dashboard.stripe.com\/account\/emails).
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyReceiptEmail :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | shipping: Shipping information for the charge. Helps prevent fraud on charges for physical goods.
    PostChargesRequestBody -> Maybe PostChargesRequestBodyShipping'
postChargesRequestBodyShipping :: (GHC.Maybe.Maybe PostChargesRequestBodyShipping'),
    -- | source: A payment source to be charged. This can be the ID of a [card](https:\/\/stripe.com\/docs\/api\#cards) (i.e., credit or debit card), a [bank account](https:\/\/stripe.com\/docs\/api\#bank_accounts), a [source](https:\/\/stripe.com\/docs\/api\#sources), a [token](https:\/\/stripe.com\/docs\/api\#tokens), or a [connected account](https:\/\/stripe.com\/docs\/connect\/account-debits\#charging-a-connected-account). For certain sources---namely, [cards](https:\/\/stripe.com\/docs\/api\#cards), [bank accounts](https:\/\/stripe.com\/docs\/api\#bank_accounts), and attached [sources](https:\/\/stripe.com\/docs\/api\#sources)---you must also pass the ID of the associated customer.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodySource :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | statement_descriptor: For card charges, use \`statement_descriptor_suffix\` instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.
    --
    -- Constraints:
    --
    -- * Maximum length of 22
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | statement_descriptor_suffix: Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
    --
    -- Constraints:
    --
    -- * Maximum length of 22
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptorSuffix :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | transfer_data: An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https:\/\/stripe.com\/docs\/connect\/destination-charges) for details.
    PostChargesRequestBody -> Maybe PostChargesRequestBodyTransferData'
postChargesRequestBodyTransferData :: (GHC.Maybe.Maybe PostChargesRequestBodyTransferData'),
    -- | transfer_group: A string that identifies this transaction as part of a group. For details, see [Grouping transactions](https:\/\/stripe.com\/docs\/connect\/charges-transfers\#transfer-options).
    PostChargesRequestBody -> Maybe Text
postChargesRequestBodyTransferGroup :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PostChargesRequestBody -> ShowS
[PostChargesRequestBody] -> ShowS
PostChargesRequestBody -> String
(Int -> PostChargesRequestBody -> ShowS)
-> (PostChargesRequestBody -> String)
-> ([PostChargesRequestBody] -> ShowS)
-> Show PostChargesRequestBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBody] -> ShowS
$cshowList :: [PostChargesRequestBody] -> ShowS
show :: PostChargesRequestBody -> String
$cshow :: PostChargesRequestBody -> String
showsPrec :: Int -> PostChargesRequestBody -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBody -> ShowS
GHC.Show.Show,
      PostChargesRequestBody -> PostChargesRequestBody -> Bool
(PostChargesRequestBody -> PostChargesRequestBody -> Bool)
-> (PostChargesRequestBody -> PostChargesRequestBody -> Bool)
-> Eq PostChargesRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBody -> PostChargesRequestBody -> Bool
$c/= :: PostChargesRequestBody -> PostChargesRequestBody -> Bool
== :: PostChargesRequestBody -> PostChargesRequestBody -> Bool
$c== :: PostChargesRequestBody -> PostChargesRequestBody -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBody where
  toJSON :: PostChargesRequestBody -> Value
toJSON PostChargesRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyAmount PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"application_fee" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFee PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"application_fee_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFeeAmount PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"capture" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Bool
postChargesRequestBodyCapture PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"card" Text -> Maybe PostChargesRequestBodyCard'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyCard'Variants
postChargesRequestBodyCard PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCurrency PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCustomer PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyDescription PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"destination" Text -> Maybe PostChargesRequestBodyDestination'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody
-> Maybe PostChargesRequestBodyDestination'Variants
postChargesRequestBodyDestination PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe [Text]
postChargesRequestBodyExpand PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe PostChargesRequestBodyMetadata'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody
-> Maybe PostChargesRequestBodyMetadata'Variants
postChargesRequestBodyMetadata PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"on_behalf_of" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyOnBehalfOf PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"receipt_email" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyReceiptEmail PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"shipping" Text -> Maybe PostChargesRequestBodyShipping' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyShipping'
postChargesRequestBodyShipping PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"source" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodySource PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptor PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor_suffix" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptorSuffix PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transfer_data" Text -> Maybe PostChargesRequestBodyTransferData' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyTransferData'
postChargesRequestBodyTransferData PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transfer_group" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyTransferGroup PostChargesRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBody -> Encoding
toEncoding PostChargesRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyAmount PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"application_fee" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFee PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"application_fee_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Int
postChargesRequestBodyApplicationFeeAmount PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"capture" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Bool
postChargesRequestBodyCapture PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"card" Text -> Maybe PostChargesRequestBodyCard'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyCard'Variants
postChargesRequestBodyCard PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCurrency PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyCustomer PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyDescription PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"destination" Text -> Maybe PostChargesRequestBodyDestination'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody
-> Maybe PostChargesRequestBodyDestination'Variants
postChargesRequestBodyDestination PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe [Text]
postChargesRequestBodyExpand PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe PostChargesRequestBodyMetadata'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody
-> Maybe PostChargesRequestBodyMetadata'Variants
postChargesRequestBodyMetadata PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"on_behalf_of" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyOnBehalfOf PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"receipt_email" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyReceiptEmail PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"shipping" Text -> Maybe PostChargesRequestBodyShipping' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyShipping'
postChargesRequestBodyShipping PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"source" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodySource PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptor PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor_suffix" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyStatementDescriptorSuffix PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"transfer_data" Text -> Maybe PostChargesRequestBodyTransferData' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe PostChargesRequestBodyTransferData'
postChargesRequestBodyTransferData PostChargesRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"transfer_group" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBody -> Maybe Text
postChargesRequestBodyTransferGroup PostChargesRequestBody
obj)))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostChargesRequestBody where
  parseJSON :: Value -> Parser PostChargesRequestBody
parseJSON = String
-> (Object -> Parser PostChargesRequestBody)
-> Value
-> Parser PostChargesRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostChargesRequestBody" (\Object
obj -> (((((((((((((((((((Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Bool
 -> Maybe PostChargesRequestBodyCard'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe PostChargesRequestBodyDestination'Variants
 -> Maybe [Text]
 -> Maybe PostChargesRequestBodyMetadata'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe PostChargesRequestBodyShipping'
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe PostChargesRequestBodyTransferData'
 -> Maybe Text
 -> PostChargesRequestBody)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe PostChargesRequestBodyCard'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Bool
-> Maybe PostChargesRequestBodyCard'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyDestination'Variants
-> Maybe [Text]
-> Maybe PostChargesRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyShipping'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyTransferData'
-> Maybe Text
-> PostChargesRequestBody
PostChargesRequestBody Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe PostChargesRequestBodyCard'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe PostChargesRequestBodyCard'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"amount")) Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe PostChargesRequestBodyCard'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe PostChargesRequestBodyCard'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"application_fee")) Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe PostChargesRequestBodyCard'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe PostChargesRequestBodyCard'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"application_fee_amount")) Parser
  (Maybe Bool
   -> Maybe PostChargesRequestBodyCard'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Bool)
-> Parser
     (Maybe PostChargesRequestBodyCard'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"capture")) Parser
  (Maybe PostChargesRequestBodyCard'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe PostChargesRequestBodyCard'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostChargesRequestBodyCard'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"card")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"currency")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"customer")) Parser
  (Maybe Text
   -> Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe PostChargesRequestBodyDestination'Variants
      -> Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"description")) Parser
  (Maybe PostChargesRequestBodyDestination'Variants
   -> Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe PostChargesRequestBodyDestination'Variants)
-> Parser
     (Maybe [Text]
      -> Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe PostChargesRequestBodyDestination'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"destination")) Parser
  (Maybe [Text]
   -> Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe [Text])
-> Parser
     (Maybe PostChargesRequestBodyMetadata'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"expand")) Parser
  (Maybe PostChargesRequestBodyMetadata'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe PostChargesRequestBodyMetadata'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostChargesRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"on_behalf_of")) Parser
  (Maybe Text
   -> Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe PostChargesRequestBodyShipping'
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"receipt_email")) Parser
  (Maybe PostChargesRequestBodyShipping'
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe PostChargesRequestBodyShipping')
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe PostChargesRequestBodyShipping')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"shipping")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"source")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text
      -> PostChargesRequestBody)
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
"statement_descriptor")) Parser
  (Maybe Text
   -> Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text
   -> PostChargesRequestBody)
-> Parser (Maybe Text)
-> Parser
     (Maybe PostChargesRequestBodyTransferData'
      -> Maybe Text -> PostChargesRequestBody)
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
"statement_descriptor_suffix")) Parser
  (Maybe PostChargesRequestBodyTransferData'
   -> Maybe Text -> PostChargesRequestBody)
-> Parser (Maybe PostChargesRequestBodyTransferData')
-> Parser (Maybe Text -> PostChargesRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostChargesRequestBodyTransferData')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"transfer_data")) Parser (Maybe Text -> PostChargesRequestBody)
-> Parser (Maybe Text) -> Parser PostChargesRequestBody
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
"transfer_group"))

-- | Create a new 'PostChargesRequestBody' with all required fields.
mkPostChargesRequestBody :: PostChargesRequestBody
mkPostChargesRequestBody :: PostChargesRequestBody
mkPostChargesRequestBody =
  PostChargesRequestBody :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Bool
-> Maybe PostChargesRequestBodyCard'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyDestination'Variants
-> Maybe [Text]
-> Maybe PostChargesRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyShipping'
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PostChargesRequestBodyTransferData'
-> Maybe Text
-> PostChargesRequestBody
PostChargesRequestBody
    { postChargesRequestBodyAmount :: Maybe Int
postChargesRequestBodyAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyApplicationFee :: Maybe Int
postChargesRequestBodyApplicationFee = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyApplicationFeeAmount :: Maybe Int
postChargesRequestBodyApplicationFeeAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCapture :: Maybe Bool
postChargesRequestBodyCapture = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard :: Maybe PostChargesRequestBodyCard'Variants
postChargesRequestBodyCard = Maybe PostChargesRequestBodyCard'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCurrency :: Maybe Text
postChargesRequestBodyCurrency = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCustomer :: Maybe Text
postChargesRequestBodyCustomer = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyDescription :: Maybe Text
postChargesRequestBodyDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyDestination :: Maybe PostChargesRequestBodyDestination'Variants
postChargesRequestBodyDestination = Maybe PostChargesRequestBodyDestination'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyExpand :: Maybe [Text]
postChargesRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyMetadata :: Maybe PostChargesRequestBodyMetadata'Variants
postChargesRequestBodyMetadata = Maybe PostChargesRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyOnBehalfOf :: Maybe Text
postChargesRequestBodyOnBehalfOf = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyReceiptEmail :: Maybe Text
postChargesRequestBodyReceiptEmail = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping :: Maybe PostChargesRequestBodyShipping'
postChargesRequestBodyShipping = Maybe PostChargesRequestBodyShipping'
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodySource :: Maybe Text
postChargesRequestBodySource = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyStatementDescriptor :: Maybe Text
postChargesRequestBodyStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyStatementDescriptorSuffix :: Maybe Text
postChargesRequestBodyStatementDescriptorSuffix = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyTransferData :: Maybe PostChargesRequestBodyTransferData'
postChargesRequestBodyTransferData = Maybe PostChargesRequestBodyTransferData'
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyTransferGroup :: Maybe Text
postChargesRequestBodyTransferGroup = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.card.anyOf@ in the specification.
data PostChargesRequestBodyCard'OneOf1 = PostChargesRequestBodyCard'OneOf1
  { -- | address_city
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCity :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_country
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line1
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine1 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_line2
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_state
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressState :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | address_zip
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressZip :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | cvc
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Cvc :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | exp_month
    PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpMonth :: GHC.Types.Int,
    -- | exp_year
    PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpYear :: GHC.Types.Int,
    -- | metadata
    PostChargesRequestBodyCard'OneOf1 -> Maybe Object
postChargesRequestBodyCard'OneOf1Metadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | name
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Name :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | number
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyCard'OneOf1 -> Text
postChargesRequestBodyCard'OneOf1Number :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> PostChargesRequestBodyCard'OneOf1 -> ShowS
[PostChargesRequestBodyCard'OneOf1] -> ShowS
PostChargesRequestBodyCard'OneOf1 -> String
(Int -> PostChargesRequestBodyCard'OneOf1 -> ShowS)
-> (PostChargesRequestBodyCard'OneOf1 -> String)
-> ([PostChargesRequestBodyCard'OneOf1] -> ShowS)
-> Show PostChargesRequestBodyCard'OneOf1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyCard'OneOf1] -> ShowS
$cshowList :: [PostChargesRequestBodyCard'OneOf1] -> ShowS
show :: PostChargesRequestBodyCard'OneOf1 -> String
$cshow :: PostChargesRequestBodyCard'OneOf1 -> String
showsPrec :: Int -> PostChargesRequestBodyCard'OneOf1 -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyCard'OneOf1 -> ShowS
GHC.Show.Show,
      PostChargesRequestBodyCard'OneOf1
-> PostChargesRequestBodyCard'OneOf1 -> Bool
(PostChargesRequestBodyCard'OneOf1
 -> PostChargesRequestBodyCard'OneOf1 -> Bool)
-> (PostChargesRequestBodyCard'OneOf1
    -> PostChargesRequestBodyCard'OneOf1 -> Bool)
-> Eq PostChargesRequestBodyCard'OneOf1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyCard'OneOf1
-> PostChargesRequestBodyCard'OneOf1 -> Bool
$c/= :: PostChargesRequestBodyCard'OneOf1
-> PostChargesRequestBodyCard'OneOf1 -> Bool
== :: PostChargesRequestBodyCard'OneOf1
-> PostChargesRequestBodyCard'OneOf1 -> Bool
$c== :: PostChargesRequestBodyCard'OneOf1
-> PostChargesRequestBodyCard'OneOf1 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyCard'OneOf1 where
  toJSON :: PostChargesRequestBodyCard'OneOf1 -> Value
toJSON PostChargesRequestBodyCard'OneOf1
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"address_city" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCity PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCountry PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line1" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine1 PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_line2" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine2 PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_state" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressState PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"address_zip" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressZip PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"cvc" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Cvc PostChargesRequestBodyCard'OneOf1
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..= PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpMonth PostChargesRequestBodyCard'OneOf1
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..= PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpYear PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Object
postChargesRequestBodyCard'OneOf1Metadata PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Name PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"number" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Text
postChargesRequestBodyCard'OneOf1Number PostChargesRequestBodyCard'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"card" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBodyCard'OneOf1 -> Encoding
toEncoding PostChargesRequestBodyCard'OneOf1
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"address_city" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCity PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressCountry PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line1" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine1 PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_line2" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine2 PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_state" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressState PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"address_zip" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1AddressZip PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"cvc" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Cvc PostChargesRequestBodyCard'OneOf1
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..= PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpMonth PostChargesRequestBodyCard'OneOf1
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..= PostChargesRequestBodyCard'OneOf1 -> Int
postChargesRequestBodyCard'OneOf1ExpYear PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Object
postChargesRequestBodyCard'OneOf1Metadata PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Maybe Text
postChargesRequestBodyCard'OneOf1Name PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"number" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyCard'OneOf1 -> Text
postChargesRequestBodyCard'OneOf1Number PostChargesRequestBodyCard'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"card")))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostChargesRequestBodyCard'OneOf1 where
  parseJSON :: Value -> Parser PostChargesRequestBodyCard'OneOf1
parseJSON = String
-> (Object -> Parser PostChargesRequestBodyCard'OneOf1)
-> Value
-> Parser PostChargesRequestBodyCard'OneOf1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostChargesRequestBodyCard'OneOf1" (\Object
obj -> ((((((((((((Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> Int
 -> Maybe Object
 -> Maybe Text
 -> Text
 -> PostChargesRequestBodyCard'OneOf1)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> Int
-> Maybe Object
-> Maybe Text
-> Text
-> PostChargesRequestBodyCard'OneOf1
PostChargesRequestBodyCard'OneOf1 Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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_city")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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_country")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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_line2")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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_state")) Parser
  (Maybe Text
   -> Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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_zip")) Parser
  (Maybe Text
   -> Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser
     (Int
      -> Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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")) Parser
  (Int
   -> Int
   -> Maybe Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser Int
-> Parser
     (Int
      -> Maybe Object
      -> Maybe Text
      -> Text
      -> PostChargesRequestBodyCard'OneOf1)
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 Object
   -> Maybe Text
   -> Text
   -> PostChargesRequestBodyCard'OneOf1)
-> Parser Int
-> Parser
     (Maybe Object
      -> Maybe Text -> Text -> PostChargesRequestBodyCard'OneOf1)
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 Object
   -> Maybe Text -> Text -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Object)
-> Parser (Maybe Text -> Text -> PostChargesRequestBodyCard'OneOf1)
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
"metadata")) Parser (Maybe Text -> Text -> PostChargesRequestBodyCard'OneOf1)
-> Parser (Maybe Text)
-> Parser (Text -> PostChargesRequestBodyCard'OneOf1)
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
"name")) Parser (Text -> PostChargesRequestBodyCard'OneOf1)
-> Parser Text -> Parser PostChargesRequestBodyCard'OneOf1
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
"number"))

-- | Create a new 'PostChargesRequestBodyCard'OneOf1' with all required fields.
mkPostChargesRequestBodyCard'OneOf1 ::
  -- | 'postChargesRequestBodyCard'OneOf1ExpMonth'
  GHC.Types.Int ->
  -- | 'postChargesRequestBodyCard'OneOf1ExpYear'
  GHC.Types.Int ->
  -- | 'postChargesRequestBodyCard'OneOf1Number'
  Data.Text.Internal.Text ->
  PostChargesRequestBodyCard'OneOf1
mkPostChargesRequestBodyCard'OneOf1 :: Int -> Int -> Text -> PostChargesRequestBodyCard'OneOf1
mkPostChargesRequestBodyCard'OneOf1 Int
postChargesRequestBodyCard'OneOf1ExpMonth Int
postChargesRequestBodyCard'OneOf1ExpYear Text
postChargesRequestBodyCard'OneOf1Number =
  PostChargesRequestBodyCard'OneOf1 :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> Int
-> Maybe Object
-> Maybe Text
-> Text
-> PostChargesRequestBodyCard'OneOf1
PostChargesRequestBodyCard'OneOf1
    { postChargesRequestBodyCard'OneOf1AddressCity :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressCity = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1AddressCountry :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1AddressLine1 :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine1 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1AddressLine2 :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressLine2 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1AddressState :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1AddressZip :: Maybe Text
postChargesRequestBodyCard'OneOf1AddressZip = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1Cvc :: Maybe Text
postChargesRequestBodyCard'OneOf1Cvc = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1ExpMonth :: Int
postChargesRequestBodyCard'OneOf1ExpMonth = Int
postChargesRequestBodyCard'OneOf1ExpMonth,
      postChargesRequestBodyCard'OneOf1ExpYear :: Int
postChargesRequestBodyCard'OneOf1ExpYear = Int
postChargesRequestBodyCard'OneOf1ExpYear,
      postChargesRequestBodyCard'OneOf1Metadata :: Maybe Object
postChargesRequestBodyCard'OneOf1Metadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1Name :: Maybe Text
postChargesRequestBodyCard'OneOf1Name = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyCard'OneOf1Number :: Text
postChargesRequestBodyCard'OneOf1Number = Text
postChargesRequestBodyCard'OneOf1Number
    }

-- | Defines the oneOf schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.card.anyOf@ in the specification.
--
-- A token, like the ones returned by [Stripe.js](https:\/\/stripe.com\/docs\/stripe.js).
data PostChargesRequestBodyCard'Variants
  = PostChargesRequestBodyCard'PostChargesRequestBodyCard'OneOf1 PostChargesRequestBodyCard'OneOf1
  | PostChargesRequestBodyCard'Text Data.Text.Internal.Text
  deriving (Int -> PostChargesRequestBodyCard'Variants -> ShowS
[PostChargesRequestBodyCard'Variants] -> ShowS
PostChargesRequestBodyCard'Variants -> String
(Int -> PostChargesRequestBodyCard'Variants -> ShowS)
-> (PostChargesRequestBodyCard'Variants -> String)
-> ([PostChargesRequestBodyCard'Variants] -> ShowS)
-> Show PostChargesRequestBodyCard'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyCard'Variants] -> ShowS
$cshowList :: [PostChargesRequestBodyCard'Variants] -> ShowS
show :: PostChargesRequestBodyCard'Variants -> String
$cshow :: PostChargesRequestBodyCard'Variants -> String
showsPrec :: Int -> PostChargesRequestBodyCard'Variants -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyCard'Variants -> ShowS
GHC.Show.Show, PostChargesRequestBodyCard'Variants
-> PostChargesRequestBodyCard'Variants -> Bool
(PostChargesRequestBodyCard'Variants
 -> PostChargesRequestBodyCard'Variants -> Bool)
-> (PostChargesRequestBodyCard'Variants
    -> PostChargesRequestBodyCard'Variants -> Bool)
-> Eq PostChargesRequestBodyCard'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyCard'Variants
-> PostChargesRequestBodyCard'Variants -> Bool
$c/= :: PostChargesRequestBodyCard'Variants
-> PostChargesRequestBodyCard'Variants -> Bool
== :: PostChargesRequestBodyCard'Variants
-> PostChargesRequestBodyCard'Variants -> Bool
$c== :: PostChargesRequestBodyCard'Variants
-> PostChargesRequestBodyCard'Variants -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.destination.anyOf@ in the specification.
data PostChargesRequestBodyDestination'OneOf1 = PostChargesRequestBodyDestination'OneOf1
  { -- | account
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyDestination'OneOf1 -> Text
postChargesRequestBodyDestination'OneOf1Account :: Data.Text.Internal.Text,
    -- | amount
    PostChargesRequestBodyDestination'OneOf1 -> Maybe Int
postChargesRequestBodyDestination'OneOf1Amount :: (GHC.Maybe.Maybe GHC.Types.Int)
  }
  deriving
    ( Int -> PostChargesRequestBodyDestination'OneOf1 -> ShowS
[PostChargesRequestBodyDestination'OneOf1] -> ShowS
PostChargesRequestBodyDestination'OneOf1 -> String
(Int -> PostChargesRequestBodyDestination'OneOf1 -> ShowS)
-> (PostChargesRequestBodyDestination'OneOf1 -> String)
-> ([PostChargesRequestBodyDestination'OneOf1] -> ShowS)
-> Show PostChargesRequestBodyDestination'OneOf1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyDestination'OneOf1] -> ShowS
$cshowList :: [PostChargesRequestBodyDestination'OneOf1] -> ShowS
show :: PostChargesRequestBodyDestination'OneOf1 -> String
$cshow :: PostChargesRequestBodyDestination'OneOf1 -> String
showsPrec :: Int -> PostChargesRequestBodyDestination'OneOf1 -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyDestination'OneOf1 -> ShowS
GHC.Show.Show,
      PostChargesRequestBodyDestination'OneOf1
-> PostChargesRequestBodyDestination'OneOf1 -> Bool
(PostChargesRequestBodyDestination'OneOf1
 -> PostChargesRequestBodyDestination'OneOf1 -> Bool)
-> (PostChargesRequestBodyDestination'OneOf1
    -> PostChargesRequestBodyDestination'OneOf1 -> Bool)
-> Eq PostChargesRequestBodyDestination'OneOf1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyDestination'OneOf1
-> PostChargesRequestBodyDestination'OneOf1 -> Bool
$c/= :: PostChargesRequestBodyDestination'OneOf1
-> PostChargesRequestBodyDestination'OneOf1 -> Bool
== :: PostChargesRequestBodyDestination'OneOf1
-> PostChargesRequestBodyDestination'OneOf1 -> Bool
$c== :: PostChargesRequestBodyDestination'OneOf1
-> PostChargesRequestBodyDestination'OneOf1 -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyDestination'OneOf1 where
  toJSON :: PostChargesRequestBodyDestination'OneOf1 -> Value
toJSON PostChargesRequestBodyDestination'OneOf1
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"account" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyDestination'OneOf1 -> Text
postChargesRequestBodyDestination'OneOf1Account PostChargesRequestBodyDestination'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyDestination'OneOf1 -> Maybe Int
postChargesRequestBodyDestination'OneOf1Amount PostChargesRequestBodyDestination'OneOf1
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBodyDestination'OneOf1 -> Encoding
toEncoding PostChargesRequestBodyDestination'OneOf1
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"account" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyDestination'OneOf1 -> Text
postChargesRequestBodyDestination'OneOf1Account PostChargesRequestBodyDestination'OneOf1
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyDestination'OneOf1 -> Maybe Int
postChargesRequestBodyDestination'OneOf1Amount PostChargesRequestBodyDestination'OneOf1
obj))

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

-- | Create a new 'PostChargesRequestBodyDestination'OneOf1' with all required fields.
mkPostChargesRequestBodyDestination'OneOf1 ::
  -- | 'postChargesRequestBodyDestination'OneOf1Account'
  Data.Text.Internal.Text ->
  PostChargesRequestBodyDestination'OneOf1
mkPostChargesRequestBodyDestination'OneOf1 :: Text -> PostChargesRequestBodyDestination'OneOf1
mkPostChargesRequestBodyDestination'OneOf1 Text
postChargesRequestBodyDestination'OneOf1Account =
  PostChargesRequestBodyDestination'OneOf1 :: Text -> Maybe Int -> PostChargesRequestBodyDestination'OneOf1
PostChargesRequestBodyDestination'OneOf1
    { postChargesRequestBodyDestination'OneOf1Account :: Text
postChargesRequestBodyDestination'OneOf1Account = Text
postChargesRequestBodyDestination'OneOf1Account,
      postChargesRequestBodyDestination'OneOf1Amount :: Maybe Int
postChargesRequestBodyDestination'OneOf1Amount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.destination.anyOf@ in the specification.
data PostChargesRequestBodyDestination'Variants
  = PostChargesRequestBodyDestination'PostChargesRequestBodyDestination'OneOf1 PostChargesRequestBodyDestination'OneOf1
  | PostChargesRequestBodyDestination'Text Data.Text.Internal.Text
  deriving (Int -> PostChargesRequestBodyDestination'Variants -> ShowS
[PostChargesRequestBodyDestination'Variants] -> ShowS
PostChargesRequestBodyDestination'Variants -> String
(Int -> PostChargesRequestBodyDestination'Variants -> ShowS)
-> (PostChargesRequestBodyDestination'Variants -> String)
-> ([PostChargesRequestBodyDestination'Variants] -> ShowS)
-> Show PostChargesRequestBodyDestination'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyDestination'Variants] -> ShowS
$cshowList :: [PostChargesRequestBodyDestination'Variants] -> ShowS
show :: PostChargesRequestBodyDestination'Variants -> String
$cshow :: PostChargesRequestBodyDestination'Variants -> String
showsPrec :: Int -> PostChargesRequestBodyDestination'Variants -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyDestination'Variants -> ShowS
GHC.Show.Show, PostChargesRequestBodyDestination'Variants
-> PostChargesRequestBodyDestination'Variants -> Bool
(PostChargesRequestBodyDestination'Variants
 -> PostChargesRequestBodyDestination'Variants -> Bool)
-> (PostChargesRequestBodyDestination'Variants
    -> PostChargesRequestBodyDestination'Variants -> Bool)
-> Eq PostChargesRequestBodyDestination'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyDestination'Variants
-> PostChargesRequestBodyDestination'Variants -> Bool
$c/= :: PostChargesRequestBodyDestination'Variants
-> PostChargesRequestBodyDestination'Variants -> Bool
== :: PostChargesRequestBodyDestination'Variants
-> PostChargesRequestBodyDestination'Variants -> Bool
$c== :: PostChargesRequestBodyDestination'Variants
-> PostChargesRequestBodyDestination'Variants -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the oneOf schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.metadata.anyOf@ in the specification.
--
-- Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to \`metadata\`.
data PostChargesRequestBodyMetadata'Variants
  = -- | Represents the JSON value @""@
    PostChargesRequestBodyMetadata'EmptyString
  | PostChargesRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
  deriving (Int -> PostChargesRequestBodyMetadata'Variants -> ShowS
[PostChargesRequestBodyMetadata'Variants] -> ShowS
PostChargesRequestBodyMetadata'Variants -> String
(Int -> PostChargesRequestBodyMetadata'Variants -> ShowS)
-> (PostChargesRequestBodyMetadata'Variants -> String)
-> ([PostChargesRequestBodyMetadata'Variants] -> ShowS)
-> Show PostChargesRequestBodyMetadata'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyMetadata'Variants] -> ShowS
$cshowList :: [PostChargesRequestBodyMetadata'Variants] -> ShowS
show :: PostChargesRequestBodyMetadata'Variants -> String
$cshow :: PostChargesRequestBodyMetadata'Variants -> String
showsPrec :: Int -> PostChargesRequestBodyMetadata'Variants -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyMetadata'Variants -> ShowS
GHC.Show.Show, PostChargesRequestBodyMetadata'Variants
-> PostChargesRequestBodyMetadata'Variants -> Bool
(PostChargesRequestBodyMetadata'Variants
 -> PostChargesRequestBodyMetadata'Variants -> Bool)
-> (PostChargesRequestBodyMetadata'Variants
    -> PostChargesRequestBodyMetadata'Variants -> Bool)
-> Eq PostChargesRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyMetadata'Variants
-> PostChargesRequestBodyMetadata'Variants -> Bool
$c/= :: PostChargesRequestBodyMetadata'Variants
-> PostChargesRequestBodyMetadata'Variants -> Bool
== :: PostChargesRequestBodyMetadata'Variants
-> PostChargesRequestBodyMetadata'Variants -> Bool
$c== :: PostChargesRequestBodyMetadata'Variants
-> PostChargesRequestBodyMetadata'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyMetadata'Variants where
  toJSON :: PostChargesRequestBodyMetadata'Variants -> Value
toJSON (PostChargesRequestBodyMetadata'Object Object
a) = Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Object
a
  toJSON (PostChargesRequestBodyMetadata'Variants
PostChargesRequestBodyMetadata'EmptyString) = Value
""

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

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.shipping@ in the specification.
--
-- Shipping information for the charge. Helps prevent fraud on charges for physical goods.
data PostChargesRequestBodyShipping' = PostChargesRequestBodyShipping'
  { -- | address
    PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address :: PostChargesRequestBodyShipping'Address',
    -- | carrier
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Carrier :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | name
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping' -> Text
postChargesRequestBodyShipping'Name :: Data.Text.Internal.Text,
    -- | phone
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Phone :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | tracking_number
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'TrackingNumber :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PostChargesRequestBodyShipping' -> ShowS
[PostChargesRequestBodyShipping'] -> ShowS
PostChargesRequestBodyShipping' -> String
(Int -> PostChargesRequestBodyShipping' -> ShowS)
-> (PostChargesRequestBodyShipping' -> String)
-> ([PostChargesRequestBodyShipping'] -> ShowS)
-> Show PostChargesRequestBodyShipping'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyShipping'] -> ShowS
$cshowList :: [PostChargesRequestBodyShipping'] -> ShowS
show :: PostChargesRequestBodyShipping' -> String
$cshow :: PostChargesRequestBodyShipping' -> String
showsPrec :: Int -> PostChargesRequestBodyShipping' -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyShipping' -> ShowS
GHC.Show.Show,
      PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping' -> Bool
(PostChargesRequestBodyShipping'
 -> PostChargesRequestBodyShipping' -> Bool)
-> (PostChargesRequestBodyShipping'
    -> PostChargesRequestBodyShipping' -> Bool)
-> Eq PostChargesRequestBodyShipping'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping' -> Bool
$c/= :: PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping' -> Bool
== :: PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping' -> Bool
$c== :: PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyShipping' where
  toJSON :: PostChargesRequestBodyShipping' -> Value
toJSON PostChargesRequestBodyShipping'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"address" Text -> PostChargesRequestBodyShipping'Address' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address PostChargesRequestBodyShipping'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"carrier" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Carrier PostChargesRequestBodyShipping'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Text
postChargesRequestBodyShipping'Name PostChargesRequestBodyShipping'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"phone" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Phone PostChargesRequestBodyShipping'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tracking_number" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'TrackingNumber PostChargesRequestBodyShipping'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBodyShipping' -> Encoding
toEncoding PostChargesRequestBodyShipping'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"address" Text -> PostChargesRequestBodyShipping'Address' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'
-> PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address PostChargesRequestBodyShipping'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"carrier" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Carrier PostChargesRequestBodyShipping'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"name" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Text
postChargesRequestBodyShipping'Name PostChargesRequestBodyShipping'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"phone" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'Phone PostChargesRequestBodyShipping'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"tracking_number" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping' -> Maybe Text
postChargesRequestBodyShipping'TrackingNumber PostChargesRequestBodyShipping'
obj)))))

instance Data.Aeson.Types.FromJSON.FromJSON PostChargesRequestBodyShipping' where
  parseJSON :: Value -> Parser PostChargesRequestBodyShipping'
parseJSON = String
-> (Object -> Parser PostChargesRequestBodyShipping')
-> Value
-> Parser PostChargesRequestBodyShipping'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostChargesRequestBodyShipping'" (\Object
obj -> (((((PostChargesRequestBodyShipping'Address'
 -> Maybe Text
 -> Text
 -> Maybe Text
 -> Maybe Text
 -> PostChargesRequestBodyShipping')
-> Parser
     (PostChargesRequestBodyShipping'Address'
      -> Maybe Text
      -> Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostChargesRequestBodyShipping'Address'
-> Maybe Text
-> Text
-> Maybe Text
-> Maybe Text
-> PostChargesRequestBodyShipping'
PostChargesRequestBodyShipping' Parser
  (PostChargesRequestBodyShipping'Address'
   -> Maybe Text
   -> Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping')
-> Parser PostChargesRequestBodyShipping'Address'
-> Parser
     (Maybe Text
      -> Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser PostChargesRequestBodyShipping'Address'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"address")) Parser
  (Maybe Text
   -> Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping')
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Maybe Text -> Maybe Text -> PostChargesRequestBodyShipping')
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
"carrier")) Parser
  (Text
   -> Maybe Text -> Maybe Text -> PostChargesRequestBodyShipping')
-> Parser Text
-> Parser
     (Maybe Text -> Maybe Text -> PostChargesRequestBodyShipping')
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
"name")) Parser
  (Maybe Text -> Maybe Text -> PostChargesRequestBodyShipping')
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PostChargesRequestBodyShipping')
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
"phone")) Parser (Maybe Text -> PostChargesRequestBodyShipping')
-> Parser (Maybe Text) -> Parser PostChargesRequestBodyShipping'
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
"tracking_number"))

-- | Create a new 'PostChargesRequestBodyShipping'' with all required fields.
mkPostChargesRequestBodyShipping' ::
  -- | 'postChargesRequestBodyShipping'Address'
  PostChargesRequestBodyShipping'Address' ->
  -- | 'postChargesRequestBodyShipping'Name'
  Data.Text.Internal.Text ->
  PostChargesRequestBodyShipping'
mkPostChargesRequestBodyShipping' :: PostChargesRequestBodyShipping'Address'
-> Text -> PostChargesRequestBodyShipping'
mkPostChargesRequestBodyShipping' PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address Text
postChargesRequestBodyShipping'Name =
  PostChargesRequestBodyShipping' :: PostChargesRequestBodyShipping'Address'
-> Maybe Text
-> Text
-> Maybe Text
-> Maybe Text
-> PostChargesRequestBodyShipping'
PostChargesRequestBodyShipping'
    { postChargesRequestBodyShipping'Address :: PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address = PostChargesRequestBodyShipping'Address'
postChargesRequestBodyShipping'Address,
      postChargesRequestBodyShipping'Carrier :: Maybe Text
postChargesRequestBodyShipping'Carrier = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'Name :: Text
postChargesRequestBodyShipping'Name = Text
postChargesRequestBodyShipping'Name,
      postChargesRequestBodyShipping'Phone :: Maybe Text
postChargesRequestBodyShipping'Phone = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'TrackingNumber :: Maybe Text
postChargesRequestBodyShipping'TrackingNumber = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.shipping.properties.address@ in the specification.
data PostChargesRequestBodyShipping'Address' = PostChargesRequestBodyShipping'Address'
  { -- | city
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'City :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | country
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Country :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | line1
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Text
postChargesRequestBodyShipping'Address'Line1 :: Data.Text.Internal.Text,
    -- | line2
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Line2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | postal_code
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'PostalCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | state
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'State :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PostChargesRequestBodyShipping'Address' -> ShowS
[PostChargesRequestBodyShipping'Address'] -> ShowS
PostChargesRequestBodyShipping'Address' -> String
(Int -> PostChargesRequestBodyShipping'Address' -> ShowS)
-> (PostChargesRequestBodyShipping'Address' -> String)
-> ([PostChargesRequestBodyShipping'Address'] -> ShowS)
-> Show PostChargesRequestBodyShipping'Address'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyShipping'Address'] -> ShowS
$cshowList :: [PostChargesRequestBodyShipping'Address'] -> ShowS
show :: PostChargesRequestBodyShipping'Address' -> String
$cshow :: PostChargesRequestBodyShipping'Address' -> String
showsPrec :: Int -> PostChargesRequestBodyShipping'Address' -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyShipping'Address' -> ShowS
GHC.Show.Show,
      PostChargesRequestBodyShipping'Address'
-> PostChargesRequestBodyShipping'Address' -> Bool
(PostChargesRequestBodyShipping'Address'
 -> PostChargesRequestBodyShipping'Address' -> Bool)
-> (PostChargesRequestBodyShipping'Address'
    -> PostChargesRequestBodyShipping'Address' -> Bool)
-> Eq PostChargesRequestBodyShipping'Address'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyShipping'Address'
-> PostChargesRequestBodyShipping'Address' -> Bool
$c/= :: PostChargesRequestBodyShipping'Address'
-> PostChargesRequestBodyShipping'Address' -> Bool
== :: PostChargesRequestBodyShipping'Address'
-> PostChargesRequestBodyShipping'Address' -> Bool
$c== :: PostChargesRequestBodyShipping'Address'
-> PostChargesRequestBodyShipping'Address' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyShipping'Address' where
  toJSON :: PostChargesRequestBodyShipping'Address' -> Value
toJSON PostChargesRequestBodyShipping'Address'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"city" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'City PostChargesRequestBodyShipping'Address'
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..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Country PostChargesRequestBodyShipping'Address'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"line1" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Text
postChargesRequestBodyShipping'Address'Line1 PostChargesRequestBodyShipping'Address'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"line2" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Line2 PostChargesRequestBodyShipping'Address'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"postal_code" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'PostalCode PostChargesRequestBodyShipping'Address'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"state" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'State PostChargesRequestBodyShipping'Address'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBodyShipping'Address' -> Encoding
toEncoding PostChargesRequestBodyShipping'Address'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"city" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'City PostChargesRequestBodyShipping'Address'
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..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Country PostChargesRequestBodyShipping'Address'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"line1" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Text
postChargesRequestBodyShipping'Address'Line1 PostChargesRequestBodyShipping'Address'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"line2" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'Line2 PostChargesRequestBodyShipping'Address'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"postal_code" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'PostalCode PostChargesRequestBodyShipping'Address'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"state" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyShipping'Address' -> Maybe Text
postChargesRequestBodyShipping'Address'State PostChargesRequestBodyShipping'Address'
obj))))))

instance Data.Aeson.Types.FromJSON.FromJSON PostChargesRequestBodyShipping'Address' where
  parseJSON :: Value -> Parser PostChargesRequestBodyShipping'Address'
parseJSON = String
-> (Object -> Parser PostChargesRequestBodyShipping'Address')
-> Value
-> Parser PostChargesRequestBodyShipping'Address'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostChargesRequestBodyShipping'Address'" (\Object
obj -> ((((((Maybe Text
 -> Maybe Text
 -> Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> PostChargesRequestBodyShipping'Address')
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping'Address')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostChargesRequestBodyShipping'Address'
PostChargesRequestBodyShipping'Address' Parser
  (Maybe Text
   -> Maybe Text
   -> Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping'Address')
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping'Address')
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
"city")) Parser
  (Maybe Text
   -> Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping'Address')
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping'Address')
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
  (Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping'Address')
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PostChargesRequestBodyShipping'Address')
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
"line1")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PostChargesRequestBodyShipping'Address')
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> PostChargesRequestBodyShipping'Address')
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
"line2")) Parser
  (Maybe Text
   -> Maybe Text -> PostChargesRequestBodyShipping'Address')
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PostChargesRequestBodyShipping'Address')
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
"postal_code")) Parser (Maybe Text -> PostChargesRequestBodyShipping'Address')
-> Parser (Maybe Text)
-> Parser PostChargesRequestBodyShipping'Address'
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
"state"))

-- | Create a new 'PostChargesRequestBodyShipping'Address'' with all required fields.
mkPostChargesRequestBodyShipping'Address' ::
  -- | 'postChargesRequestBodyShipping'Address'Line1'
  Data.Text.Internal.Text ->
  PostChargesRequestBodyShipping'Address'
mkPostChargesRequestBodyShipping'Address' :: Text -> PostChargesRequestBodyShipping'Address'
mkPostChargesRequestBodyShipping'Address' Text
postChargesRequestBodyShipping'Address'Line1 =
  PostChargesRequestBodyShipping'Address' :: Maybe Text
-> Maybe Text
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PostChargesRequestBodyShipping'Address'
PostChargesRequestBodyShipping'Address'
    { postChargesRequestBodyShipping'Address'City :: Maybe Text
postChargesRequestBodyShipping'Address'City = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'Address'Country :: Maybe Text
postChargesRequestBodyShipping'Address'Country = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'Address'Line1 :: Text
postChargesRequestBodyShipping'Address'Line1 = Text
postChargesRequestBodyShipping'Address'Line1,
      postChargesRequestBodyShipping'Address'Line2 :: Maybe Text
postChargesRequestBodyShipping'Address'Line2 = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'Address'PostalCode :: Maybe Text
postChargesRequestBodyShipping'Address'PostalCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyShipping'Address'State :: Maybe Text
postChargesRequestBodyShipping'Address'State = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @paths.\/v1\/charges.POST.requestBody.content.application\/x-www-form-urlencoded.schema.properties.transfer_data@ in the specification.
--
-- An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https:\/\/stripe.com\/docs\/connect\/destination-charges) for details.
data PostChargesRequestBodyTransferData' = PostChargesRequestBodyTransferData'
  { -- | amount
    PostChargesRequestBodyTransferData' -> Maybe Int
postChargesRequestBodyTransferData'Amount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | destination
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PostChargesRequestBodyTransferData' -> Text
postChargesRequestBodyTransferData'Destination :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> PostChargesRequestBodyTransferData' -> ShowS
[PostChargesRequestBodyTransferData'] -> ShowS
PostChargesRequestBodyTransferData' -> String
(Int -> PostChargesRequestBodyTransferData' -> ShowS)
-> (PostChargesRequestBodyTransferData' -> String)
-> ([PostChargesRequestBodyTransferData'] -> ShowS)
-> Show PostChargesRequestBodyTransferData'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesRequestBodyTransferData'] -> ShowS
$cshowList :: [PostChargesRequestBodyTransferData'] -> ShowS
show :: PostChargesRequestBodyTransferData' -> String
$cshow :: PostChargesRequestBodyTransferData' -> String
showsPrec :: Int -> PostChargesRequestBodyTransferData' -> ShowS
$cshowsPrec :: Int -> PostChargesRequestBodyTransferData' -> ShowS
GHC.Show.Show,
      PostChargesRequestBodyTransferData'
-> PostChargesRequestBodyTransferData' -> Bool
(PostChargesRequestBodyTransferData'
 -> PostChargesRequestBodyTransferData' -> Bool)
-> (PostChargesRequestBodyTransferData'
    -> PostChargesRequestBodyTransferData' -> Bool)
-> Eq PostChargesRequestBodyTransferData'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesRequestBodyTransferData'
-> PostChargesRequestBodyTransferData' -> Bool
$c/= :: PostChargesRequestBodyTransferData'
-> PostChargesRequestBodyTransferData' -> Bool
== :: PostChargesRequestBodyTransferData'
-> PostChargesRequestBodyTransferData' -> Bool
$c== :: PostChargesRequestBodyTransferData'
-> PostChargesRequestBodyTransferData' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PostChargesRequestBodyTransferData' where
  toJSON :: PostChargesRequestBodyTransferData' -> Value
toJSON PostChargesRequestBodyTransferData'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyTransferData' -> Maybe Int
postChargesRequestBodyTransferData'Amount PostChargesRequestBodyTransferData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"destination" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyTransferData' -> Text
postChargesRequestBodyTransferData'Destination PostChargesRequestBodyTransferData'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PostChargesRequestBodyTransferData' -> Encoding
toEncoding PostChargesRequestBodyTransferData'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyTransferData' -> Maybe Int
postChargesRequestBodyTransferData'Amount PostChargesRequestBodyTransferData'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"destination" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostChargesRequestBodyTransferData' -> Text
postChargesRequestBodyTransferData'Destination PostChargesRequestBodyTransferData'
obj))

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

-- | Create a new 'PostChargesRequestBodyTransferData'' with all required fields.
mkPostChargesRequestBodyTransferData' ::
  -- | 'postChargesRequestBodyTransferData'Destination'
  Data.Text.Internal.Text ->
  PostChargesRequestBodyTransferData'
mkPostChargesRequestBodyTransferData' :: Text -> PostChargesRequestBodyTransferData'
mkPostChargesRequestBodyTransferData' Text
postChargesRequestBodyTransferData'Destination =
  PostChargesRequestBodyTransferData' :: Maybe Int -> Text -> PostChargesRequestBodyTransferData'
PostChargesRequestBodyTransferData'
    { postChargesRequestBodyTransferData'Amount :: Maybe Int
postChargesRequestBodyTransferData'Amount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      postChargesRequestBodyTransferData'Destination :: Text
postChargesRequestBodyTransferData'Destination = Text
postChargesRequestBodyTransferData'Destination
    }

-- | Represents a response of the operation 'postCharges'.
--
-- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'PostChargesResponseError' is used.
data PostChargesResponse
  = -- | Means either no matching case available or a parse error
    PostChargesResponseError GHC.Base.String
  | -- | Successful response.
    PostChargesResponse200 Charge
  | -- | Error response.
    PostChargesResponseDefault Error
  deriving (Int -> PostChargesResponse -> ShowS
[PostChargesResponse] -> ShowS
PostChargesResponse -> String
(Int -> PostChargesResponse -> ShowS)
-> (PostChargesResponse -> String)
-> ([PostChargesResponse] -> ShowS)
-> Show PostChargesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostChargesResponse] -> ShowS
$cshowList :: [PostChargesResponse] -> ShowS
show :: PostChargesResponse -> String
$cshow :: PostChargesResponse -> String
showsPrec :: Int -> PostChargesResponse -> ShowS
$cshowsPrec :: Int -> PostChargesResponse -> ShowS
GHC.Show.Show, PostChargesResponse -> PostChargesResponse -> Bool
(PostChargesResponse -> PostChargesResponse -> Bool)
-> (PostChargesResponse -> PostChargesResponse -> Bool)
-> Eq PostChargesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostChargesResponse -> PostChargesResponse -> Bool
$c/= :: PostChargesResponse -> PostChargesResponse -> Bool
== :: PostChargesResponse -> PostChargesResponse -> Bool
$c== :: PostChargesResponse -> PostChargesResponse -> Bool
GHC.Classes.Eq)