diff --git a/packages/stripe/lib/src/widgets/platform_pay_button.dart b/packages/stripe/lib/src/widgets/platform_pay_button.dart index e7094498c..159df3091 100644 --- a/packages/stripe/lib/src/widgets/platform_pay_button.dart +++ b/packages/stripe/lib/src/widgets/platform_pay_button.dart @@ -23,7 +23,8 @@ class PlatformPayButton extends StatelessWidget { this.onCouponCodeEntered, this.onShippingMethodSelected, this.onOrderTracking, - this.paymentRequestCreateOptions = PlatformPayWebPaymentRequestCreateOptions.defaultOptions, + this.paymentRequestCreateOptions = + PlatformPayWebPaymentRequestCreateOptions.defaultOptions, }); /// Defines the displayed text on the button. diff --git a/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart b/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart index 7f5bcadc1..3ac331c33 100644 --- a/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart +++ b/packages/stripe_js/lib/src/js/elements/element_payment_request_button.dart @@ -53,6 +53,7 @@ abstract class PaymentRequestButtonElement extends StripeElement {} extension ElementsPaymentRequestExtension on StripeElements { PaymentRequestButtonElement createPaymentRequestButton( JsPaymentRequestButtonElementCreateOptions options) { - return create('paymentRequestButton', options) as PaymentRequestButtonElement; + return create('paymentRequestButton', options) + as PaymentRequestButtonElement; } } diff --git a/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart b/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart index 22c60c89b..e70c77fe3 100644 --- a/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart +++ b/packages/stripe_js/lib/src/js/payment_requests/payment_request.dart @@ -55,7 +55,7 @@ class PaymentResponse { @JS() abstract class _JS { external JsPaymentRequest paymentRequest( - PaymentRequestCreateOptions options, + PaymentRequestCreateOptions options, ); } diff --git a/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart b/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart index 1ee9a462f..bc3a3c494 100644 --- a/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart +++ b/packages/stripe_js/lib/src/js/utils/parse_intent_response.dart @@ -7,7 +7,7 @@ Future> _parsePromise(Promise promise) async { } @internal -Map jsToJsonMap(dynamic jsObject) { +Map jsToJsonMap(dynamic jsObject) { final value = dartify(jsObject) as Map; return value.cast(); } diff --git a/packages/stripe_platform_interface/lib/src/models/platform_pay.dart b/packages/stripe_platform_interface/lib/src/models/platform_pay.dart index be3f5bf8e..e454788d9 100644 --- a/packages/stripe_platform_interface/lib/src/models/platform_pay.dart +++ b/packages/stripe_platform_interface/lib/src/models/platform_pay.dart @@ -430,7 +430,8 @@ enum PlatformPayWebWalletType { } @freezed -class PlatformPayWebPaymentRequestCreateOptions with _$PlatformPayWebPaymentRequestCreateOptions { +class PlatformPayWebPaymentRequestCreateOptions + with _$PlatformPayWebPaymentRequestCreateOptions { @JsonSerializable(explicitToJson: true) const factory PlatformPayWebPaymentRequestCreateOptions({ /// The two-letter country code of your Stripe account (e.g., US). @@ -444,8 +445,7 @@ class PlatformPayWebPaymentRequestCreateOptions with _$PlatformPayWebPaymentRequ /// An array of PaymentItem objects. These objects are shown as line items in the browser’s payment interface. /// Note that the sum of the line item amounts does not need to add up to the total amount above. - @Default([]) - List displayItems, + @Default([]) List displayItems, /// By default, the browser‘s payment interface only asks the customer for actual payment information. A customer /// name can be collected by setting this option to true. This collected name will appears in the PaymentResponse object. @@ -453,35 +453,30 @@ class PlatformPayWebPaymentRequestCreateOptions with _$PlatformPayWebPaymentRequ /// We highly recommend you collect name as this also results in collection of billing address for Apple Pay. /// The billing address can be used to perform address verification and block fraudulent payments. /// For all other payment methods, the billing address is automatically collected when available. - @Default(false) - bool requestPayerName, + @Default(false) bool requestPayerName, /// See the requestPayerName option. - @Default(false) - bool requestPayerEmail, + @Default(false) bool requestPayerEmail, /// See the requestPayerName option. - @Default(false) - bool requestPayerPhone, + @Default(false) bool requestPayerPhone, /// Collect shipping address by setting this option to true. The address appears in the PaymentResponse. /// /// You must also supply a valid [ShippingOptions] to the shippingOptions property. This can be up front at the /// time stripe.paymentRequest is called, or in response to a shippingaddresschange event using the updateWith callback. - @Default(false) - bool requestShipping, + @Default(false) bool requestShipping, /// An array of ShippingOption objects. The first shipping option listed appears in the browser payment interface as the default option. - @Default([]) - List shippingOptions, + @Default([]) List shippingOptions, /// An array of wallet strings. Can be one or more of applePay, googlePay, link, and browserCard. Use this option /// to disable Apple Pay, Google Pay, Link, and/or browser-saved cards. - @Default([]) - List disableWallets, + @Default([]) List disableWallets, }) = _PaymentRequestCreateOptions; - factory PlatformPayWebPaymentRequestCreateOptions.fromJson(Map json) => + factory PlatformPayWebPaymentRequestCreateOptions.fromJson( + Map json) => _$PlatformPayWebPaymentRequestCreateOptionsFromJson(json); static const defaultOptions = PlatformPayWebPaymentRequestCreateOptions( @@ -530,8 +525,7 @@ class PlatformPayWebPaymentItem with _$PlatformPayWebPaymentItem { /// If you might change this amount later (for example, after you have calculated shipping costs), set this to true. /// Note that browsers treat this as a hint for how to display things, and not necessarily as something that will /// prevent submission. - @Default(false) - bool pending, + @Default(false) bool pending, }) = _$PaymentItem; factory PlatformPayWebPaymentItem.fromJson(Map json) => diff --git a/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart b/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart index ab86bae7b..2a24071fc 100644 --- a/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart +++ b/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart @@ -192,7 +192,8 @@ abstract class StripePlatform extends PlatformInterface { Widget buildPaymentRequestButton({ Key? key, required VoidCallback onPressed, - required PlatformPayWebPaymentRequestCreateOptions paymentRequestCreateOptions, + required PlatformPayWebPaymentRequestCreateOptions + paymentRequestCreateOptions, BoxConstraints? constraints, PlatformButtonType? type, PlatformButtonStyle? style, diff --git a/packages/stripe_web/lib/src/parser/payment_request.dart b/packages/stripe_web/lib/src/parser/payment_request.dart index e44d1bd4f..dad737d26 100644 --- a/packages/stripe_web/lib/src/parser/payment_request.dart +++ b/packages/stripe_web/lib/src/parser/payment_request.dart @@ -1,7 +1,8 @@ import 'package:flutter_stripe_web/flutter_stripe_web.dart'; import 'package:stripe_js/stripe_js.dart' as js; -extension PaymentRequestCreateOptionsExtension on PlatformPayWebPaymentRequestCreateOptions { +extension PaymentRequestCreateOptionsExtension + on PlatformPayWebPaymentRequestCreateOptions { js.PaymentRequestCreateOptions toJS() { return js.PaymentRequestCreateOptions( country: country, diff --git a/packages/stripe_web/lib/src/web_stripe.dart b/packages/stripe_web/lib/src/web_stripe.dart index 7c77d9ed9..be0a7efe2 100644 --- a/packages/stripe_web/lib/src/web_stripe.dart +++ b/packages/stripe_web/lib/src/web_stripe.dart @@ -530,7 +530,8 @@ class WebStripe extends StripePlatform { bool usesDeprecatedTokenFlow = false, }) { if (!(params is PlatformPayPaymentMethodParamsWeb)) { - throw WebUnsupportedError("platformPayCreatePaymentMethod - ${params.runtimeType} is not supported on web"); + throw WebUnsupportedError( + "platformPayCreatePaymentMethod - ${params.runtimeType} is not supported on web"); } Completer completer = Completer();