Skip to content

Commit

Permalink
Update customer invoice settings
Browse files Browse the repository at this point in the history
  • Loading branch information
emhoracek committed Jul 18, 2024
1 parent f0a1379 commit 5e6d532
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions stripe-core/src/Web/Stripe/Customer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ instance StripeHasParam UpdateCustomer TokenId
instance StripeHasParam UpdateCustomer NewCard
instance StripeHasParam UpdateCustomer CouponId
instance StripeHasParam UpdateCustomer DefaultCard
instance StripeHasParam UpdateCustomer InvoiceSettings
instance StripeHasParam UpdateCustomer Description
instance StripeHasParam UpdateCustomer Email
instance StripeHasParam UpdateCustomer MetaData
Expand Down
8 changes: 7 additions & 1 deletion stripe-core/src/Web/Stripe/StripeRequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import Web.Stripe.Types (AccountBalance(..), AccountNumber(..),
ExpYear(..), Forgiven(..), Interval(..),
IntervalCount(..),
InvoiceId(..), InvoiceItemId(..),
InvoiceLineItemId(..),
InvoiceLineItemId(..), InvoiceSettings(..),
IsVerified(..), MetaData(..), PaymentIntentId(..), PaymentIntentUsage(..), PaymentMethodId(..), PaymentMethodTypes(..), PaymentMethodType(..), PlanId(..),
PlanName(..), Prorate(..), Limit(..),
MaxRedemptions(..), Name(..),
Expand Down Expand Up @@ -291,6 +291,12 @@ instance ToStripeParam InvoiceLineItemId where
toStripeParam (InvoiceLineItemId txt) =
(("line_item", Text.encodeUtf8 txt) :)

instance ToStripeParam InvoiceSettings where
toStripeParam (InvoiceSettings (Just (PaymentMethodId pid))) =
(("default_payment_method", Text.encodeUtf8 pid) :)
toStripeParam (InvoiceSettings Nothing) =
(("default_payment_method", "null") :)

instance ToStripeParam IsVerified where
toStripeParam (IsVerified b) =
(("verified", if b then "true" else "false") :)
Expand Down
2 changes: 1 addition & 1 deletion stripe-core/src/Web/Stripe/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ newtype CardId = CardId Text
------------------------------------------------------------------------------
-- | InvoiceSettings for a `Customer`
data InvoiceSettings = InvoiceSettings {
invoiceSettingsDefaultPaymentMethod :: Maybe (Expandable PaymentMethodId)
invoiceSettingsDefaultPaymentMethod :: Maybe PaymentMethodId
} deriving (Read, Show, Eq, Ord, Data, Typeable)

instance FromJSON InvoiceSettings where
Expand Down

0 comments on commit 5e6d532

Please sign in to comment.