Skip to content

Commit

Permalink
fix: reverse format matching flutter 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesblasco committed Jun 29, 2023
1 parent 9e3622c commit 676b6ba
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ class PaymentElementFields with _$PaymentElementFields {
@freezed
class BillingDetailsFields with _$BillingDetailsFields {
const factory BillingDetailsFields({
@Default(PaymentElementFieldRequired.auto) PaymentElementFieldRequired name,
@Default(PaymentElementFieldRequired.auto)
PaymentElementFieldRequired name,
@Default(PaymentElementFieldRequired.auto)
PaymentElementFieldRequired email,
@Default(PaymentElementFieldRequired.auto)
Expand All @@ -196,7 +197,8 @@ class PaymentElementAddressFields with _$PaymentElementAddressFields {
PaymentElementFieldRequired line1,
@Default(PaymentElementFieldRequired.auto)
PaymentElementFieldRequired line2,
@Default(PaymentElementFieldRequired.auto) PaymentElementFieldRequired city,
@Default(PaymentElementFieldRequired.auto)
PaymentElementFieldRequired city,
@Default(PaymentElementFieldRequired.auto)
PaymentElementFieldRequired state,
@Default(PaymentElementFieldRequired.auto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ class ConfirmCardPaymentData with _$ConfirmCardPaymentData {
/// Either the id of an existing PaymentMethod, or an object containing
/// data to create a PaymentMethod with.
/// See the use case sections below for details.
@paymentMethodDetailJsonKey CardPaymentMethodDetails? paymentMethod,
@paymentMethodDetailJsonKey
CardPaymentMethodDetails? paymentMethod,

/// The shipping details for the payment, if collected.
ShippingDetails? shipping,

/// If you are handling next actions yourself, pass in a return_url.
/// If the subsequent action is redirect_to_url,
/// this URL will be used on the return path for the redirect.
@JsonKey(name: "return_url") String? returnUrl,
@JsonKey(name: "return_url")
String? returnUrl,

/// Email address that the receipt for the resulting payment will be sent to.
@JsonKey(name: "receipt_email") String? receiptEmail,
@JsonKey(name: "receipt_email")
String? receiptEmail,

/// Indicates that you intend to make future payments with this
/// PaymentIntent's payment method.
Expand All @@ -42,7 +45,8 @@ class ConfirmCardPaymentData with _$ConfirmCardPaymentData {

/// An object containing payment-method-specific configuration to
/// confirm the PaymentIntent with.
@JsonKey(name: "payment_method_options") dynamic paymentMethodOptions,
@JsonKey(name: "payment_method_options")
dynamic paymentMethodOptions,
}) = _ConfirmCardPaymentData;

factory ConfirmCardPaymentData.fromJson(Map<String, dynamic> json) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ class ConfirmIdealPaymentData with _$ConfirmIdealPaymentData {
/// Either the id of an existing PaymentMethod, or an object containing
/// data to create a PaymentMethod with.
/// See the use case sections below for details.
@paymentMethodDetailJsonKey IdealPaymentMethodDetails? paymentMethod,
@paymentMethodDetailJsonKey
IdealPaymentMethodDetails? paymentMethod,

/// The url your customer will be directed to after they complete authentication.
@JsonKey(name: "return_url") String? returnUrl,
@JsonKey(name: "return_url")
String? returnUrl,

/// To set up a SEPA Direct Debit payment method using the bank details
/// from this iDEAL payment, set this parameter to off_session.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class ConfirmSepaDebitPaymentData with _$ConfirmSepaDebitPaymentData {
/// Either the id of an existing PaymentMethod, or an object containing
/// data to create a PaymentMethod with.
/// See the use case sections below for details.
@paymentMethodDetailJsonKey SepaDebitPaymentMethodDetails? paymentMethod,
@paymentMethodDetailJsonKey
SepaDebitPaymentMethodDetails? paymentMethod,

/// To set up the SEPA Direct Debit account for reuse, set this parameter
/// to off_session. SEPA Direct Debit only accepts an off_session value
Expand Down
48 changes: 32 additions & 16 deletions packages/stripe_js/lib/src/api/payment_intents/payment_intent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class PaymentIntent with _$PaymentIntent {
/// String representing the object’s type.
/// Objects of the same type share the same value.
/// Value is "payment_intent".
@Default("payment_intent") String object,
@Default("payment_intent")
String object,

/// Amount intended to be collected by this PaymentIntent.
/// A positive integer representing how much to charge in the
Expand All @@ -89,15 +90,17 @@ class PaymentIntent with _$PaymentIntent {
required int amount,

/// The amount that can be captured with from this PaymentIntent (in cents).
@JsonKey(name: "amount_capturable") int? amountCapturable,
@JsonKey(name: "amount_capturable")
int? amountCapturable,

/// Details about items included in the amount
@Default(PaymentIntentAmountDetails())
@JsonKey(name: "amount_details")
PaymentIntentAmountDetails? amountDetails,

/// The amount that was collected from this PaymentIntent (in cents).
@JsonKey(name: "amount_received") int? amountReceived,
@JsonKey(name: "amount_received")
int? amountReceived,

/// CONNECT ONLY
/// ID of the Connect application that created the PaymentIntent.
Expand All @@ -110,7 +113,8 @@ class PaymentIntent with _$PaymentIntent {
/// capped at the total payment amount.
/// For more information, see the PaymentIntents use
/// case for connected accounts..
@JsonKey(name: "application_fee_amount") int? applicationFeeAmount,
@JsonKey(name: "application_fee_amount")
int? applicationFeeAmount,

/// Settings to configure compatible payment methods from the
/// Stripe Dashboard
Expand All @@ -119,7 +123,8 @@ class PaymentIntent with _$PaymentIntent {

/// Populated when status is canceled, this is the time at which the
/// PaymentIntent was canceled. Measured in seconds since the Unix epoch.
@JsonKey(name: "canceled_at") int? canceledAt,
@JsonKey(name: "canceled_at")
int? canceledAt,

/// Reason for cancellation of this PaymentIntent,
/// either user-provided
Expand All @@ -138,7 +143,8 @@ class PaymentIntent with _$PaymentIntent {
///
/// Refer to our docs to accept a payment and learn about how `client_secret`
/// should be handled.
@JsonKey(name: "client_secret") required String clientSecret,
@JsonKey(name: "client_secret")
required String clientSecret,

/// Controls when the funds will be captured from the customer’s account.
@JsonKey(name: "capture_method")
Expand Down Expand Up @@ -175,10 +181,12 @@ class PaymentIntent with _$PaymentIntent {

/// The payment error encountered in the previous PaymentIntent confirmation.
/// It will be cleared if the PaymentIntent is later updated for any reason.
@JsonKey(name: "last_payment_error") StripeError? lastPaymentError,
@JsonKey(name: "last_payment_error")
StripeError? lastPaymentError,

/// The latest charge created by this payment intent.
@JsonKey(name: "latest_charge") String? latestCharge,
@JsonKey(name: "latest_charge")
String? latestCharge,

/// Has the value true if the object exists in live mode or the
/// value false if the object exists in test mode.
Expand All @@ -187,21 +195,25 @@ class PaymentIntent with _$PaymentIntent {
/// Set of key-value pairs that you can attach to an object.
/// This can be useful for storing additional information about the
/// object in a structured format.
@Default({}) Map<String, dynamic> metadata,
@Default({})
Map<String, dynamic> metadata,

/// If present, this property tells you what actions you need to
/// take in order for your customer to fulfill a payment using the
/// provided source.
@JsonKey(name: "next_action") dynamic nextAction,
@JsonKey(name: "next_action")
dynamic nextAction,

/// CONNECT ONLY
/// The account (if any) for which the funds of the PaymentIntent are
/// intended. See the PaymentIntents use case for connected accounts
/// for details.
@JsonKey(name: "on_behalf_of") String? onBehalfOf,
@JsonKey(name: "on_behalf_of")
String? onBehalfOf,

/// ID of the payment method used in this PaymentIntent.
@JsonKey(name: "payment_method") String? paymentMethod,
@JsonKey(name: "payment_method")
String? paymentMethod,

/// Payment-method-specific configuration for this PaymentIntent.
@Default({})
Expand All @@ -220,7 +232,8 @@ class PaymentIntent with _$PaymentIntent {
/// Email address that the receipt for the resulting payment will be sent to.
/// If receipt_email is specified for a payment in live mode, a receipt
/// will be sent regardless of your email settings.
@JsonKey(name: "receipt_email") String? receiptEmail,
@JsonKey(name: "receipt_email")
String? receiptEmail,

// ID of the review associated with this PaymentIntent, if any.
String? review,
Expand All @@ -244,7 +257,8 @@ class PaymentIntent with _$PaymentIntent {
/// For non-card charges, you can use this value as the complete
/// description that appears on your customers’ statements.
/// Must contain at least one letter, maximum 22 characters.
@JsonKey(name: "statement_descriptor") String? statementDescriptor,
@JsonKey(name: "statement_descriptor")
String? statementDescriptor,

/// Provides information about a card payment that customers see on
/// their statements.
Expand All @@ -263,12 +277,14 @@ class PaymentIntent with _$PaymentIntent {
/// The data with which to automatically create a Transfer when the payment
/// is finalized. See the PaymentIntents use case for connected
/// accounts for details.
@JsonKey(name: "transfer_data") dynamic transferData,
@JsonKey(name: "transfer_data")
dynamic transferData,

/// CONNECT ONLY
/// A string that identifies the resulting payment as part of a group.
/// See the PaymentIntents use case for connected accounts for details.
@JsonKey(name: "transfer_group") dynamic transferGroup,
@JsonKey(name: "transfer_group")
dynamic transferGroup,
}) = _PaymentIntent;

factory PaymentIntent.fromJson(Map<String, dynamic> json) =>
Expand Down
39 changes: 26 additions & 13 deletions packages/stripe_js/lib/src/api/setup_intents/setup_intent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class SetupIntent with _$SetupIntent {
/// String representing the object’s type.
/// Objects of the same type share the same value.
/// Value is "setup_intent".
@Default("setup_intent") String object,
@Default("setup_intent")
String object,

/// CONNECT ONLY
/// ID of the Connect application that created the SetupIntent.
Expand All @@ -86,7 +87,8 @@ class SetupIntent with _$SetupIntent {
/// flows like InboundTransfer and OutboundTransfers.
/// It cannot be set to true when setting up a PaymentMethod for a Customer,
/// and defaults to false when attaching a PaymentMethod to a Customer.
@JsonKey(name: "attach_to_self") String? attachToSelf,
@JsonKey(name: "attach_to_self")
String? attachToSelf,

/// Reason for cancellation of this SetupIntent,
/// one of abandoned, requested_by_customer, or duplicate.
Expand All @@ -99,7 +101,8 @@ class SetupIntent with _$SetupIntent {
/// It should not be stored, logged, or exposed to anyone other than the
/// customer. Make sure that you have TLS enabled on any page that includes
/// the client secret.
@JsonKey(name: "client_secret") required String clientSecret,
@JsonKey(name: "client_secret")
required String clientSecret,

/// Time at which the object was created. Measured in seconds since the
/// Unix epoch.
Expand All @@ -124,36 +127,44 @@ class SetupIntent with _$SetupIntent {
List<SetupIntentFlowDirections>? flowDirections,

/// The error encountered in the previous SetupIntent confirmation.
@JsonKey(name: "last_setup_error") dynamic lastSetupError,
@JsonKey(name: "last_setup_error")
dynamic lastSetupError,

/// The most recent SetupAttempt for this SetupIntent.
@JsonKey(name: "latest_attempt") String? latestAttempt,
@JsonKey(name: "latest_attempt")
String? latestAttempt,

/// Has the value true if the object exists in live mode or the
/// value false if the object exists in test mode.
@Default(true) bool livemode,
@Default(true)
bool livemode,

/// ID of the multi use Mandate generated by the SetupIntent.
String? mandate,

/// Set of key-value pairs that you can attach to an object.
/// This can be useful for storing additional information about the
/// object in a structured format.
@Default({}) Map<String, dynamic> metadata,
@Default({})
Map<String, dynamic> metadata,

/// If present, this property tells you what actions you need to
/// take in order for your customer to continue payment setup.
@JsonKey(name: "next_action") dynamic nextAction,
@JsonKey(name: "next_action")
dynamic nextAction,

/// CONNECT ONLY
/// The account (if any) for which the setup is intended.
@JsonKey(name: "on_behalf_of") String? onBehalfOf,
@JsonKey(name: "on_behalf_of")
String? onBehalfOf,

/// ID of the payment method used in this SetupIntent.
@JsonKey(name: "payment_method") String? paymentMethod,
@JsonKey(name: "payment_method")
String? paymentMethod,

/// Payment-method-specific configuration for this SetupIntent.
@JsonKey(name: "payment_method_options") dynamic paymentMethodOptions,
@JsonKey(name: "payment_method_options")
dynamic paymentMethodOptions,

/// The list of payment method types (e.g. card) that this SetupIntent
/// is allowed to set up.
Expand All @@ -162,7 +173,8 @@ class SetupIntent with _$SetupIntent {
List<PaymentMethodType> paymentMethodTypes,

/// ID of the single_use Mandate generated by the SetupIntent.
@JsonKey(name: "single_use_mandate") String? singleUseMandate,
@JsonKey(name: "single_use_mandate")
String? singleUseMandate,

/// Status of this SetupIntent, one of requires_payment_method,
/// requires_confirmation, requires_action, processing, canceled, or
Expand All @@ -174,7 +186,8 @@ class SetupIntent with _$SetupIntent {
/// the customer is in your checkout flow.
/// Use off_session if your customer may or may not be in your checkout flow.
/// If not provided, this value defaults to off_session.
@Default(SetupIntentUsage.offSession) SetupIntentUsage usage,
@Default(SetupIntentUsage.offSession)
SetupIntentUsage usage,
}) = _SetupIntent;

factory SetupIntent.fromJson(Map<String, dynamic> json) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ class CreateTokenBankAccountData with _$CreateTokenBankAccountData {

/// Three character currency code (e.g., usd).
required String currency,
@JsonKey(name: "routing_number") String? routingNumber,
@JsonKey(name: "account_number") required String accountNumber,
@JsonKey(name: "account_holder_name") String? accountHolderName,
@JsonKey(name: "routing_number")
String? routingNumber,
@JsonKey(name: "account_number")
required String accountNumber,
@JsonKey(name: "account_holder_name")
String? accountHolderName,
@JsonKey(name: "account_holder_type")
BankAccountHolderType? accountHolderType,
@JsonKey(name: "account_type") String? accountType,
@JsonKey(name: "account_type")
String? accountType,
}) = _CreateTokenBankAccountData;

factory CreateTokenBankAccountData.fromJson(Map<String, dynamic> json) =>
Expand Down
Loading

0 comments on commit 676b6ba

Please sign in to comment.