Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
*
  • Loading branch information
cornwe19 committed Dec 18, 2023
1 parent eed2bb5 commit 3ca5f02
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
3 changes: 2 additions & 1 deletion packages/stripe/lib/src/widgets/platform_pay_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PaymentResponse {
@JS()
abstract class _JS {
external JsPaymentRequest paymentRequest(
PaymentRequestCreateOptions options,
PaymentRequestCreateOptions options,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Future<Map<String, dynamic>> _parsePromise(Promise<dynamic> promise) async {
}

@internal
Map<String,dynamic> jsToJsonMap(dynamic jsObject) {
Map<String, dynamic> jsToJsonMap(dynamic jsObject) {
final value = dartify(jsObject) as Map<dynamic, dynamic>;
return value.cast();
}
Expand Down
30 changes: 12 additions & 18 deletions packages/stripe_platform_interface/lib/src/models/platform_pay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -444,44 +445,38 @@ 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<PlatformPayWebPaymentItem> displayItems,
@Default([]) List<PlatformPayWebPaymentItem> 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.
///
/// 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<PlatformPayWebShippingOption> shippingOptions,
@Default([]) List<PlatformPayWebShippingOption> 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<PlatformPayWebWalletType> disableWallets,
@Default([]) List<PlatformPayWebWalletType> disableWallets,
}) = _PaymentRequestCreateOptions;

factory PlatformPayWebPaymentRequestCreateOptions.fromJson(Map<String, dynamic> json) =>
factory PlatformPayWebPaymentRequestCreateOptions.fromJson(
Map<String, dynamic> json) =>
_$PlatformPayWebPaymentRequestCreateOptionsFromJson(json);

static const defaultOptions = PlatformPayWebPaymentRequestCreateOptions(
Expand Down Expand Up @@ -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<String, dynamic> json) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/stripe_web/lib/src/parser/payment_request.dart
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/stripe_web/lib/src/web_stripe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<PaymentMethod> completer = Completer();
Expand Down

0 comments on commit 3ca5f02

Please sign in to comment.