From de8887593d7e5067dd25ba8c9348022c238ac5ea Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 11 Dec 2023 18:04:32 +0000 Subject: [PATCH 01/16] doc: fix #1532 broken link in readme --- README.md | 2 +- packages/stripe/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 07e1dc3d8..7f7634c54 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ dart pub add flutter_stripe This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps: 1. Use Android 5.0 (API level 21) and above -2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/.gradle#L2) +2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle) 3. Requires Android Gradle plugin 8 and higher 4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16) 5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6) diff --git a/packages/stripe/README.md b/packages/stripe/README.md index 07e1dc3d8..7f7634c54 100644 --- a/packages/stripe/README.md +++ b/packages/stripe/README.md @@ -47,7 +47,7 @@ dart pub add flutter_stripe This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps: 1. Use Android 5.0 (API level 21) and above -2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/.gradle#L2) +2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle) 3. Requires Android Gradle plugin 8 and higher 4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16) 5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6) From 0993288c0304988d835cceeb32988fecb83af3d4 Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 11 Dec 2023 18:12:21 +0000 Subject: [PATCH 02/16] chore(release): publish packages - stripe_js@3.3.0 --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ packages/stripe_js/CHANGELOG.md | 4 ++++ packages/stripe_js/pubspec.yaml | 2 +- packages/stripe_web/pubspec.yaml | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfb54d08c..01a8ed198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-11 + +### Changes + +--- + +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`stripe_js` - `v3.3.0`](#stripe_js---v330) + - [`flutter_stripe_web` - `v4.6.1`](#flutter_stripe_web---v461) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `flutter_stripe_web` - `v4.6.1` + +--- + +#### `stripe_js` - `v3.3.0` + + - aaa + + - **FIX**: invalid argument `requires_capture` on web (#1431). + + ## 2023-11-29 ### Changes diff --git a/packages/stripe_js/CHANGELOG.md b/packages/stripe_js/CHANGELOG.md index 1b5a5ac31..743031d35 100644 --- a/packages/stripe_js/CHANGELOG.md +++ b/packages/stripe_js/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.3.0 +**FIXES** + - Invalid argument `requires_capture` on web (#1431). + ## 3.2.0 **FIXES** - PaymentConfirmationRedirect enum value (#1221). diff --git a/packages/stripe_js/pubspec.yaml b/packages/stripe_js/pubspec.yaml index bd25014da..9b9953716 100644 --- a/packages/stripe_js/pubspec.yaml +++ b/packages/stripe_js/pubspec.yaml @@ -1,6 +1,6 @@ name: stripe_js description: Stripe.js bindings for dart. This package is used by Stripe web so that the Stripe js sdk can be invoked directly. -version: 3.2.0 +version: 3.3.0 homepage: https://github.com/flutter-stripe/flutter_stripe environment: diff --git a/packages/stripe_web/pubspec.yaml b/packages/stripe_web/pubspec.yaml index 42b9171f4..aceab139c 100644 --- a/packages/stripe_web/pubspec.yaml +++ b/packages/stripe_web/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: freezed_annotation: ^2.0.3 stripe_platform_interface: ^9.6.0 js: ^0.6.3 - stripe_js: ^3.2.0 + stripe_js: ^3.3.0 dev_dependencies: flutter_test: From 8eac4d8f1f37ae7b2fdc7cf482a6e47141218c57 Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 11 Dec 2023 18:29:00 +0000 Subject: [PATCH 03/16] fix: #1512 add latest charge field to payment intent (Web only) --- .../lib/src/models/payment_intents.dart | 5 ++ .../src/models/payment_intents.freezed.dart | 48 ++++++++++++++++--- .../lib/src/models/payment_intents.g.dart | 2 + .../lib/src/parser/payment_intent.dart | 1 + 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/packages/stripe_platform_interface/lib/src/models/payment_intents.dart b/packages/stripe_platform_interface/lib/src/models/payment_intents.dart index cfa09faea..0bd8d9e06 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_intents.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_intents.dart @@ -66,6 +66,11 @@ class PaymentIntent with _$PaymentIntent { /// Mandata data for this paymentintent. MandateData? mandateData, + + /// The latest charge created by this payment intent. + /// + /// This field is only available on stripe web. + String? latestCharge, }) = _PaymentIntent; factory PaymentIntent.fromJson(Map json) => diff --git a/packages/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart b/packages/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart index 25e2b3125..bf2012278 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_intents.freezed.dart @@ -70,6 +70,11 @@ mixin _$PaymentIntent { /// Mandata data for this paymentintent. MandateData? get mandateData => throw _privateConstructorUsedError; + /// The latest charge created by this payment intent. + /// + /// This field is only available on stripe web. + String? get latestCharge => throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $PaymentIntentCopyWith get copyWith => @@ -98,7 +103,8 @@ abstract class $PaymentIntentCopyWith<$Res> { String? canceledAt, NextAction? nextAction, ShippingDetails? shipping, - MandateData? mandateData}); + MandateData? mandateData, + String? latestCharge}); $NextActionCopyWith<$Res>? get nextAction; $ShippingDetailsCopyWith<$Res>? get shipping; @@ -134,6 +140,7 @@ class _$PaymentIntentCopyWithImpl<$Res, $Val extends PaymentIntent> Object? nextAction = freezed, Object? shipping = freezed, Object? mandateData = freezed, + Object? latestCharge = freezed, }) { return _then(_value.copyWith( id: null == id @@ -200,6 +207,10 @@ class _$PaymentIntentCopyWithImpl<$Res, $Val extends PaymentIntent> ? _value.mandateData : mandateData // ignore: cast_nullable_to_non_nullable as MandateData?, + latestCharge: freezed == latestCharge + ? _value.latestCharge + : latestCharge // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } @@ -264,7 +275,8 @@ abstract class _$$PaymentIntentImplCopyWith<$Res> String? canceledAt, NextAction? nextAction, ShippingDetails? shipping, - MandateData? mandateData}); + MandateData? mandateData, + String? latestCharge}); @override $NextActionCopyWith<$Res>? get nextAction; @@ -301,6 +313,7 @@ class __$$PaymentIntentImplCopyWithImpl<$Res> Object? nextAction = freezed, Object? shipping = freezed, Object? mandateData = freezed, + Object? latestCharge = freezed, }) { return _then(_$PaymentIntentImpl( id: null == id @@ -367,6 +380,10 @@ class __$$PaymentIntentImplCopyWithImpl<$Res> ? _value.mandateData : mandateData // ignore: cast_nullable_to_non_nullable as MandateData?, + latestCharge: freezed == latestCharge + ? _value.latestCharge + : latestCharge // ignore: cast_nullable_to_non_nullable + as String?, )); } } @@ -391,7 +408,8 @@ class _$PaymentIntentImpl implements _PaymentIntent { this.canceledAt, this.nextAction, this.shipping, - this.mandateData}); + this.mandateData, + this.latestCharge}); factory _$PaymentIntentImpl.fromJson(Map json) => _$$PaymentIntentImplFromJson(json); @@ -461,9 +479,15 @@ class _$PaymentIntentImpl implements _PaymentIntent { @override final MandateData? mandateData; + /// The latest charge created by this payment intent. + /// + /// This field is only available on stripe web. + @override + final String? latestCharge; + @override String toString() { - return 'PaymentIntent(id: $id, amount: $amount, created: $created, currency: $currency, status: $status, clientSecret: $clientSecret, livemode: $livemode, captureMethod: $captureMethod, confirmationMethod: $confirmationMethod, paymentMethodId: $paymentMethodId, description: $description, receiptEmail: $receiptEmail, canceledAt: $canceledAt, nextAction: $nextAction, shipping: $shipping, mandateData: $mandateData)'; + return 'PaymentIntent(id: $id, amount: $amount, created: $created, currency: $currency, status: $status, clientSecret: $clientSecret, livemode: $livemode, captureMethod: $captureMethod, confirmationMethod: $confirmationMethod, paymentMethodId: $paymentMethodId, description: $description, receiptEmail: $receiptEmail, canceledAt: $canceledAt, nextAction: $nextAction, shipping: $shipping, mandateData: $mandateData, latestCharge: $latestCharge)'; } @override @@ -498,7 +522,9 @@ class _$PaymentIntentImpl implements _PaymentIntent { (identical(other.shipping, shipping) || other.shipping == shipping) && (identical(other.mandateData, mandateData) || - other.mandateData == mandateData)); + other.mandateData == mandateData) && + (identical(other.latestCharge, latestCharge) || + other.latestCharge == latestCharge)); } @JsonKey(ignore: true) @@ -520,7 +546,8 @@ class _$PaymentIntentImpl implements _PaymentIntent { canceledAt, nextAction, shipping, - mandateData); + mandateData, + latestCharge); @JsonKey(ignore: true) @override @@ -553,7 +580,8 @@ abstract class _PaymentIntent implements PaymentIntent { final String? canceledAt, final NextAction? nextAction, final ShippingDetails? shipping, - final MandateData? mandateData}) = _$PaymentIntentImpl; + final MandateData? mandateData, + final String? latestCharge}) = _$PaymentIntentImpl; factory _PaymentIntent.fromJson(Map json) = _$PaymentIntentImpl.fromJson; @@ -624,6 +652,12 @@ abstract class _PaymentIntent implements PaymentIntent { /// Mandata data for this paymentintent. MandateData? get mandateData; @override + + /// The latest charge created by this payment intent. + /// + /// This field is only available on stripe web. + String? get latestCharge; + @override @JsonKey(ignore: true) _$$PaymentIntentImplCopyWith<_$PaymentIntentImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/packages/stripe_platform_interface/lib/src/models/payment_intents.g.dart b/packages/stripe_platform_interface/lib/src/models/payment_intents.g.dart index 1c55b26ee..b19796e2a 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_intents.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_intents.g.dart @@ -31,6 +31,7 @@ _$PaymentIntentImpl _$$PaymentIntentImplFromJson(Map json) => mandateData: json['mandateData'] == null ? null : MandateData.fromJson(json['mandateData'] as Map), + latestCharge: json['latestCharge'] as String?, ); Map _$$PaymentIntentImplToJson(_$PaymentIntentImpl instance) => @@ -52,6 +53,7 @@ Map _$$PaymentIntentImplToJson(_$PaymentIntentImpl instance) => 'nextAction': instance.nextAction?.toJson(), 'shipping': instance.shipping?.toJson(), 'mandateData': instance.mandateData?.toJson(), + 'latestCharge': instance.latestCharge, }; const _$PaymentIntentsStatusEnumMap = { diff --git a/packages/stripe_web/lib/src/parser/payment_intent.dart b/packages/stripe_web/lib/src/parser/payment_intent.dart index 5ab59f7c6..0df15a414 100644 --- a/packages/stripe_web/lib/src/parser/payment_intent.dart +++ b/packages/stripe_web/lib/src/parser/payment_intent.dart @@ -11,6 +11,7 @@ extension PaymentIntentExtension on js.PaymentIntent { status: PaymentIntentsStatusExtension.parse(status.name), clientSecret: clientSecret, livemode: livemode, + latestCharge: latestCharge, //paymentMethodId: payment_method, captureMethod: CaptureMethodExtension.parse(captureMethod.name), confirmationMethod: From c2e41f39ac08252e84f2118d8f91c0b6beb1c6cd Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 11 Dec 2023 19:01:49 +0000 Subject: [PATCH 04/16] doc: fix #1488 add nscamerausagedescription to readme --- README.md | 10 ++++++++++ packages/stripe/README.md | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 7f7634c54..2b079573c 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,16 @@ You will also need to update in your Podfile: `platform :ios, '13.0'` +For card scanning add the following to your Info.plist: + +```xml +NSCameraUsageDescription +Scan your card to add it automatically +NSCameraUsageDescription +<string>To scan cards</string> +To scan cards +``` + #### Web (Experimental) Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented. Namely: diff --git a/packages/stripe/README.md b/packages/stripe/README.md index 7f7634c54..2b079573c 100644 --- a/packages/stripe/README.md +++ b/packages/stripe/README.md @@ -68,6 +68,16 @@ You will also need to update in your Podfile: `platform :ios, '13.0'` +For card scanning add the following to your Info.plist: + +```xml +NSCameraUsageDescription +Scan your card to add it automatically +NSCameraUsageDescription +<string>To scan cards</string> +To scan cards +``` + #### Web (Experimental) Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented. Namely: From ab2088cb88912dc9fe196da8b0e324238511ed7d Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 11 Dec 2023 19:48:00 +0000 Subject: [PATCH 05/16] BREAKING: rename ApplePayShippingContact to Platformpayshipping contact --- .../apple_pay_create_payment_method.dart | 12 +- packages/stripe/lib/src/stripe.dart | 2 +- .../lib/src/widgets/apple_pay_button.dart | 6 +- .../lib/src/method_channel_stripe.dart | 10 +- .../lib/src/models/apple_pay.dart | 24 +- .../lib/src/models/apple_pay.freezed.dart | 257 ---------- .../lib/src/models/apple_pay.g.dart | 19 - .../lib/src/models/payment_methods.dart | 1 + .../lib/src/models/platform_pay.dart | 40 ++ .../lib/src/models/platform_pay.freezed.dart | 469 ++++++++++++++++++ .../lib/src/models/platform_pay.g.dart | 37 ++ .../lib/src/stripe_platform_interface.dart | 2 +- packages/stripe_web/lib/src/web_stripe.dart | 2 +- 13 files changed, 572 insertions(+), 309 deletions(-) diff --git a/example/lib/screens/wallets/apple_pay_create_payment_method.dart b/example/lib/screens/wallets/apple_pay_create_payment_method.dart index aa82d8afb..e160ce99a 100644 --- a/example/lib/screens/wallets/apple_pay_create_payment_method.dart +++ b/example/lib/screens/wallets/apple_pay_create_payment_method.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_stripe/flutter_stripe.dart'; import 'package:stripe_example/widgets/example_scaffold.dart'; +import 'package:stripe_example/widgets/response_card.dart'; class ApplePayCreatePaymentMethodScreen extends StatefulWidget { @override @@ -8,6 +9,7 @@ class ApplePayCreatePaymentMethodScreen extends StatefulWidget { } class _ApplePayScreenState extends State { + PlatformPayPaymentMethod? response; @override void initState() { Stripe.instance.isPlatformPaySupportedListenable.addListener(update); @@ -37,6 +39,10 @@ class _ApplePayScreenState extends State { ) else Text('Apple Pay is not available in this device'), + SizedBox( + height: 50, + ), + ResponseCard(response: response?.toString() ?? ''), ], ); } @@ -76,8 +82,12 @@ class _ApplePayScreenState extends State { ), ); + setState(() { + response = paymentMethod; + }); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( - 'Success!: The payment method with id: ${paymentMethod.id} was created successfully,'))); + 'Success!: The payment method with id: ${paymentMethod.paymentMethod.id} was created successfully,'))); } } diff --git a/packages/stripe/lib/src/stripe.dart b/packages/stripe/lib/src/stripe.dart index b608132f7..2d149799d 100644 --- a/packages/stripe/lib/src/stripe.dart +++ b/packages/stripe/lib/src/stripe.dart @@ -144,7 +144,7 @@ class Stripe { /// Creating payment method does not return a token by default. Use `usesDeprecatedTokenFlow` instead. /// /// throws [StripeError] in case creating payment method is failing. - Future createPlatformPayPaymentMethod({ + Future createPlatformPayPaymentMethod({ required PlatformPayPaymentMethodParams params, bool usesDeprecatedTokenFlow = false, }) async { diff --git a/packages/stripe/lib/src/widgets/apple_pay_button.dart b/packages/stripe/lib/src/widgets/apple_pay_button.dart index af1a1c681..338987603 100644 --- a/packages/stripe/lib/src/widgets/apple_pay_button.dart +++ b/packages/stripe/lib/src/widgets/apple_pay_button.dart @@ -17,7 +17,7 @@ class ApplePayButton extends StatelessWidget { Key? key, this.style = PlatformButtonStyle.automatic, this.type = PlatformButtonType.plain, - this.cornerRadius=4, + this.cornerRadius = 4, this.onPressed, double? width, double? height = _kApplePayButtonDefaultHeight, @@ -242,8 +242,8 @@ class _UiKitApplePayButtonState extends State<_UiKitApplePayButton> { } // For some reason json serializable cannot be cast -ApplePayShippingContact _convertShippingContact(dynamic json) => - ApplePayShippingContact( +PlatformPayShippingContact _convertShippingContact(dynamic json) => + PlatformPayShippingContact( phoneNumber: json['phoneNumber'], name: ApplePayContactName( familyName: json['name']['familyName'], diff --git a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart index 417c1052b..636e0dd18 100644 --- a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart +++ b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart @@ -568,7 +568,7 @@ class MethodChannelStripe extends StripePlatform { } @override - Future platformPayCreatePaymentMethod({ + Future platformPayCreatePaymentMethod({ required PlatformPayPaymentMethodParams params, bool usesDeprecatedTokenFlow = false, }) async { @@ -596,9 +596,11 @@ class MethodChannelStripe extends StripePlatform { 'usesDeprecatedTokenFlow': usesDeprecatedTokenFlow, }); - return ResultParser( - parseJson: (json) => PaymentMethod.fromJson(json)) - .parse(result: result!, successResultKey: 'paymentMethod'); + if (result!.containsKey('error')) { + throw ResultParser(parseJson: (json) => {}).parseError(result); + } + + return PlatformPayPaymentMethod.fromJson(result); } @override diff --git a/packages/stripe_platform_interface/lib/src/models/apple_pay.dart b/packages/stripe_platform_interface/lib/src/models/apple_pay.dart index e58854678..9d1f8c9ec 100644 --- a/packages/stripe_platform_interface/lib/src/models/apple_pay.dart +++ b/packages/stripe_platform_interface/lib/src/models/apple_pay.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:stripe_platform_interface/src/models/platform_pay.dart'; part 'apple_pay.freezed.dart'; part 'apple_pay.g.dart'; @@ -202,28 +203,7 @@ class ApplePayErrorAddressField with _$ApplePayErrorAddressField { _$ApplePayErrorAddressFieldFromJson(json); } -@freezed - -/// Entered Shipping contact data -class ApplePayShippingContact with _$ApplePayShippingContact { - @JsonSerializable(explicitToJson: true) - const factory ApplePayShippingContact({ - /// Email address of the shipping contact - String? emailAddress, - - /// Name of shipping contact - required ApplePayContactName name, - /// Postal address of shipping contact - required ApplePayPostalAddress postalAddress, - - ///Phone Number of the shipping contact - String? phoneNumber, - }) = _ApplePayShippingContact; - - factory ApplePayShippingContact.fromJson(Map json) => - _$ApplePayShippingContactFromJson(json); -} @freezed @@ -264,7 +244,7 @@ class ApplePayPostalAddress with _$ApplePayPostalAddress { } typedef OnDidSetShippingContact = FutureOr Function( - ApplePayShippingContact contact); + PlatformPayShippingContact contact); typedef OnDidSetShippingMethod = FutureOr Function( ApplePayShippingMethod method); typedef OnCouponCodeEntered = FutureOr Function(String couponCode); diff --git a/packages/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart b/packages/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart index 9ad156d73..a7ae99aab 100644 --- a/packages/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/apple_pay.freezed.dart @@ -1773,263 +1773,6 @@ abstract class _ApplePayErrorAddressField implements ApplePayErrorAddressField { get copyWith => throw _privateConstructorUsedError; } -ApplePayShippingContact _$ApplePayShippingContactFromJson( - Map json) { - return _ApplePayShippingContact.fromJson(json); -} - -/// @nodoc -mixin _$ApplePayShippingContact { - /// Email address of the shipping contact - String? get emailAddress => throw _privateConstructorUsedError; - - /// Name of shipping contact - ApplePayContactName get name => throw _privateConstructorUsedError; - - /// Postal address of shipping contact - ApplePayPostalAddress get postalAddress => throw _privateConstructorUsedError; - - ///Phone Number of the shipping contact - String? get phoneNumber => throw _privateConstructorUsedError; - - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $ApplePayShippingContactCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ApplePayShippingContactCopyWith<$Res> { - factory $ApplePayShippingContactCopyWith(ApplePayShippingContact value, - $Res Function(ApplePayShippingContact) then) = - _$ApplePayShippingContactCopyWithImpl<$Res, ApplePayShippingContact>; - @useResult - $Res call( - {String? emailAddress, - ApplePayContactName name, - ApplePayPostalAddress postalAddress, - String? phoneNumber}); - - $ApplePayContactNameCopyWith<$Res> get name; - $ApplePayPostalAddressCopyWith<$Res> get postalAddress; -} - -/// @nodoc -class _$ApplePayShippingContactCopyWithImpl<$Res, - $Val extends ApplePayShippingContact> - implements $ApplePayShippingContactCopyWith<$Res> { - _$ApplePayShippingContactCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? emailAddress = freezed, - Object? name = null, - Object? postalAddress = null, - Object? phoneNumber = freezed, - }) { - return _then(_value.copyWith( - emailAddress: freezed == emailAddress - ? _value.emailAddress - : emailAddress // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as ApplePayContactName, - postalAddress: null == postalAddress - ? _value.postalAddress - : postalAddress // ignore: cast_nullable_to_non_nullable - as ApplePayPostalAddress, - phoneNumber: freezed == phoneNumber - ? _value.phoneNumber - : phoneNumber // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } - - @override - @pragma('vm:prefer-inline') - $ApplePayContactNameCopyWith<$Res> get name { - return $ApplePayContactNameCopyWith<$Res>(_value.name, (value) { - return _then(_value.copyWith(name: value) as $Val); - }); - } - - @override - @pragma('vm:prefer-inline') - $ApplePayPostalAddressCopyWith<$Res> get postalAddress { - return $ApplePayPostalAddressCopyWith<$Res>(_value.postalAddress, (value) { - return _then(_value.copyWith(postalAddress: value) as $Val); - }); - } -} - -/// @nodoc -abstract class _$$ApplePayShippingContactImplCopyWith<$Res> - implements $ApplePayShippingContactCopyWith<$Res> { - factory _$$ApplePayShippingContactImplCopyWith( - _$ApplePayShippingContactImpl value, - $Res Function(_$ApplePayShippingContactImpl) then) = - __$$ApplePayShippingContactImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? emailAddress, - ApplePayContactName name, - ApplePayPostalAddress postalAddress, - String? phoneNumber}); - - @override - $ApplePayContactNameCopyWith<$Res> get name; - @override - $ApplePayPostalAddressCopyWith<$Res> get postalAddress; -} - -/// @nodoc -class __$$ApplePayShippingContactImplCopyWithImpl<$Res> - extends _$ApplePayShippingContactCopyWithImpl<$Res, - _$ApplePayShippingContactImpl> - implements _$$ApplePayShippingContactImplCopyWith<$Res> { - __$$ApplePayShippingContactImplCopyWithImpl( - _$ApplePayShippingContactImpl _value, - $Res Function(_$ApplePayShippingContactImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? emailAddress = freezed, - Object? name = null, - Object? postalAddress = null, - Object? phoneNumber = freezed, - }) { - return _then(_$ApplePayShippingContactImpl( - emailAddress: freezed == emailAddress - ? _value.emailAddress - : emailAddress // ignore: cast_nullable_to_non_nullable - as String?, - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as ApplePayContactName, - postalAddress: null == postalAddress - ? _value.postalAddress - : postalAddress // ignore: cast_nullable_to_non_nullable - as ApplePayPostalAddress, - phoneNumber: freezed == phoneNumber - ? _value.phoneNumber - : phoneNumber // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc - -@JsonSerializable(explicitToJson: true) -class _$ApplePayShippingContactImpl implements _ApplePayShippingContact { - const _$ApplePayShippingContactImpl( - {this.emailAddress, - required this.name, - required this.postalAddress, - this.phoneNumber}); - - factory _$ApplePayShippingContactImpl.fromJson(Map json) => - _$$ApplePayShippingContactImplFromJson(json); - - /// Email address of the shipping contact - @override - final String? emailAddress; - - /// Name of shipping contact - @override - final ApplePayContactName name; - - /// Postal address of shipping contact - @override - final ApplePayPostalAddress postalAddress; - - ///Phone Number of the shipping contact - @override - final String? phoneNumber; - - @override - String toString() { - return 'ApplePayShippingContact(emailAddress: $emailAddress, name: $name, postalAddress: $postalAddress, phoneNumber: $phoneNumber)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ApplePayShippingContactImpl && - (identical(other.emailAddress, emailAddress) || - other.emailAddress == emailAddress) && - (identical(other.name, name) || other.name == name) && - (identical(other.postalAddress, postalAddress) || - other.postalAddress == postalAddress) && - (identical(other.phoneNumber, phoneNumber) || - other.phoneNumber == phoneNumber)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => - Object.hash(runtimeType, emailAddress, name, postalAddress, phoneNumber); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ApplePayShippingContactImplCopyWith<_$ApplePayShippingContactImpl> - get copyWith => __$$ApplePayShippingContactImplCopyWithImpl< - _$ApplePayShippingContactImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ApplePayShippingContactImplToJson( - this, - ); - } -} - -abstract class _ApplePayShippingContact implements ApplePayShippingContact { - const factory _ApplePayShippingContact( - {final String? emailAddress, - required final ApplePayContactName name, - required final ApplePayPostalAddress postalAddress, - final String? phoneNumber}) = _$ApplePayShippingContactImpl; - - factory _ApplePayShippingContact.fromJson(Map json) = - _$ApplePayShippingContactImpl.fromJson; - - @override - - /// Email address of the shipping contact - String? get emailAddress; - @override - - /// Name of shipping contact - ApplePayContactName get name; - @override - - /// Postal address of shipping contact - ApplePayPostalAddress get postalAddress; - @override - - ///Phone Number of the shipping contact - String? get phoneNumber; - @override - @JsonKey(ignore: true) - _$$ApplePayShippingContactImplCopyWith<_$ApplePayShippingContactImpl> - get copyWith => throw _privateConstructorUsedError; -} - ApplePayContactName _$ApplePayContactNameFromJson(Map json) { return _ApplePayContactName.fromJson(json); } diff --git a/packages/stripe_platform_interface/lib/src/models/apple_pay.g.dart b/packages/stripe_platform_interface/lib/src/models/apple_pay.g.dart index 3aeb803c0..bbd148abc 100644 --- a/packages/stripe_platform_interface/lib/src/models/apple_pay.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/apple_pay.g.dart @@ -162,25 +162,6 @@ Map _$$ApplePayErrorAddressFieldImplToJson( 'message': instance.message, }; -_$ApplePayShippingContactImpl _$$ApplePayShippingContactImplFromJson( - Map json) => - _$ApplePayShippingContactImpl( - emailAddress: json['emailAddress'] as String?, - name: ApplePayContactName.fromJson(json['name'] as Map), - postalAddress: ApplePayPostalAddress.fromJson( - json['postalAddress'] as Map), - phoneNumber: json['phoneNumber'] as String?, - ); - -Map _$$ApplePayShippingContactImplToJson( - _$ApplePayShippingContactImpl instance) => - { - 'emailAddress': instance.emailAddress, - 'name': instance.name.toJson(), - 'postalAddress': instance.postalAddress.toJson(), - 'phoneNumber': instance.phoneNumber, - }; - _$ApplePayContactNameImpl _$$ApplePayContactNameImplFromJson( Map json) => _$ApplePayContactNameImpl( diff --git a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart index 1d2964382..3bf335426 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_methods.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_methods.dart @@ -60,6 +60,7 @@ class PaymentMethod with _$PaymentMethod { /// Id related to the customer to which this paymentmethod has been saved. String? customerId, + }) = _PaymentMethod; factory PaymentMethod.fromJson(Map json) => 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 1fe7a589d..0e45ee0cb 100644 --- a/packages/stripe_platform_interface/lib/src/models/platform_pay.dart +++ b/packages/stripe_platform_interface/lib/src/models/platform_pay.dart @@ -4,12 +4,30 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'apple_pay.dart'; import 'google_pay.dart'; +import 'payment_methods.dart'; part 'platform_pay.freezed.dart'; part 'platform_pay.g.dart'; @freezed +/// Result object when creating a payment method through apple pay or google pay. +class PlatformPayPaymentMethod with _$PlatformPayPaymentMethod { + @JsonSerializable(explicitToJson: true) + const factory PlatformPayPaymentMethod({ + /// The payment method + required PaymentMethod paymentMethod, + + /// shipping contact of the user + PlatformPayShippingContact? shippingContact, + }) = _PlatformPayPaymentMethod; + + factory PlatformPayPaymentMethod.fromJson(Map json) => + _$PlatformPayPaymentMethodFromJson(json); +} + +@freezed + ///Parameters related to updating the platform pay sheet /// /// At this moment only Apple pay is supported @@ -115,6 +133,28 @@ class PlatformPayConfirmParams with _$PlatformPayConfirmParams { _$PlatformPayConfirmParamsFromJson(json); } +@freezed +/// Entered Shipping contact data +class PlatformPayShippingContact with _$PlatformPayShippingContact { + @JsonSerializable(explicitToJson: true) + const factory PlatformPayShippingContact({ + /// Email address of the shipping contact + String? emailAddress, + + /// Name of shipping contact + required ApplePayContactName name, + + /// Postal address of shipping contact + required ApplePayPostalAddress postalAddress, + + ///Phone Number of the shipping contact + String? phoneNumber, + }) = _PlatformPayShippingContact; + + factory PlatformPayShippingContact.fromJson(Map json) => + _$PlatformPayShippingContactFromJson(json); +} + @freezed class ApplePayParams with _$ApplePayParams { @JsonSerializable(explicitToJson: true) diff --git a/packages/stripe_platform_interface/lib/src/models/platform_pay.freezed.dart b/packages/stripe_platform_interface/lib/src/models/platform_pay.freezed.dart index 3dc58476a..729f364ac 100644 --- a/packages/stripe_platform_interface/lib/src/models/platform_pay.freezed.dart +++ b/packages/stripe_platform_interface/lib/src/models/platform_pay.freezed.dart @@ -14,6 +14,215 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); +PlatformPayPaymentMethod _$PlatformPayPaymentMethodFromJson( + Map json) { + return _PlatformPayPaymentMethod.fromJson(json); +} + +/// @nodoc +mixin _$PlatformPayPaymentMethod { + /// The payment method + PaymentMethod get paymentMethod => throw _privateConstructorUsedError; + + /// shipping contact of the user + PlatformPayShippingContact? get shippingContact => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PlatformPayPaymentMethodCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PlatformPayPaymentMethodCopyWith<$Res> { + factory $PlatformPayPaymentMethodCopyWith(PlatformPayPaymentMethod value, + $Res Function(PlatformPayPaymentMethod) then) = + _$PlatformPayPaymentMethodCopyWithImpl<$Res, PlatformPayPaymentMethod>; + @useResult + $Res call( + {PaymentMethod paymentMethod, + PlatformPayShippingContact? shippingContact}); + + $PaymentMethodCopyWith<$Res> get paymentMethod; + $PlatformPayShippingContactCopyWith<$Res>? get shippingContact; +} + +/// @nodoc +class _$PlatformPayPaymentMethodCopyWithImpl<$Res, + $Val extends PlatformPayPaymentMethod> + implements $PlatformPayPaymentMethodCopyWith<$Res> { + _$PlatformPayPaymentMethodCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentMethod = null, + Object? shippingContact = freezed, + }) { + return _then(_value.copyWith( + paymentMethod: null == paymentMethod + ? _value.paymentMethod + : paymentMethod // ignore: cast_nullable_to_non_nullable + as PaymentMethod, + shippingContact: freezed == shippingContact + ? _value.shippingContact + : shippingContact // ignore: cast_nullable_to_non_nullable + as PlatformPayShippingContact?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $PaymentMethodCopyWith<$Res> get paymentMethod { + return $PaymentMethodCopyWith<$Res>(_value.paymentMethod, (value) { + return _then(_value.copyWith(paymentMethod: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $PlatformPayShippingContactCopyWith<$Res>? get shippingContact { + if (_value.shippingContact == null) { + return null; + } + + return $PlatformPayShippingContactCopyWith<$Res>(_value.shippingContact!, + (value) { + return _then(_value.copyWith(shippingContact: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PlatformPayPaymentMethodImplCopyWith<$Res> + implements $PlatformPayPaymentMethodCopyWith<$Res> { + factory _$$PlatformPayPaymentMethodImplCopyWith( + _$PlatformPayPaymentMethodImpl value, + $Res Function(_$PlatformPayPaymentMethodImpl) then) = + __$$PlatformPayPaymentMethodImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {PaymentMethod paymentMethod, + PlatformPayShippingContact? shippingContact}); + + @override + $PaymentMethodCopyWith<$Res> get paymentMethod; + @override + $PlatformPayShippingContactCopyWith<$Res>? get shippingContact; +} + +/// @nodoc +class __$$PlatformPayPaymentMethodImplCopyWithImpl<$Res> + extends _$PlatformPayPaymentMethodCopyWithImpl<$Res, + _$PlatformPayPaymentMethodImpl> + implements _$$PlatformPayPaymentMethodImplCopyWith<$Res> { + __$$PlatformPayPaymentMethodImplCopyWithImpl( + _$PlatformPayPaymentMethodImpl _value, + $Res Function(_$PlatformPayPaymentMethodImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? paymentMethod = null, + Object? shippingContact = freezed, + }) { + return _then(_$PlatformPayPaymentMethodImpl( + paymentMethod: null == paymentMethod + ? _value.paymentMethod + : paymentMethod // ignore: cast_nullable_to_non_nullable + as PaymentMethod, + shippingContact: freezed == shippingContact + ? _value.shippingContact + : shippingContact // ignore: cast_nullable_to_non_nullable + as PlatformPayShippingContact?, + )); + } +} + +/// @nodoc + +@JsonSerializable(explicitToJson: true) +class _$PlatformPayPaymentMethodImpl implements _PlatformPayPaymentMethod { + const _$PlatformPayPaymentMethodImpl( + {required this.paymentMethod, this.shippingContact}); + + factory _$PlatformPayPaymentMethodImpl.fromJson(Map json) => + _$$PlatformPayPaymentMethodImplFromJson(json); + + /// The payment method + @override + final PaymentMethod paymentMethod; + + /// shipping contact of the user + @override + final PlatformPayShippingContact? shippingContact; + + @override + String toString() { + return 'PlatformPayPaymentMethod(paymentMethod: $paymentMethod, shippingContact: $shippingContact)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PlatformPayPaymentMethodImpl && + (identical(other.paymentMethod, paymentMethod) || + other.paymentMethod == paymentMethod) && + (identical(other.shippingContact, shippingContact) || + other.shippingContact == shippingContact)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, paymentMethod, shippingContact); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PlatformPayPaymentMethodImplCopyWith<_$PlatformPayPaymentMethodImpl> + get copyWith => __$$PlatformPayPaymentMethodImplCopyWithImpl< + _$PlatformPayPaymentMethodImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PlatformPayPaymentMethodImplToJson( + this, + ); + } +} + +abstract class _PlatformPayPaymentMethod implements PlatformPayPaymentMethod { + const factory _PlatformPayPaymentMethod( + {required final PaymentMethod paymentMethod, + final PlatformPayShippingContact? shippingContact}) = + _$PlatformPayPaymentMethodImpl; + + factory _PlatformPayPaymentMethod.fromJson(Map json) = + _$PlatformPayPaymentMethodImpl.fromJson; + + @override + + /// The payment method + PaymentMethod get paymentMethod; + @override + + /// shipping contact of the user + PlatformPayShippingContact? get shippingContact; + @override + @JsonKey(ignore: true) + _$$PlatformPayPaymentMethodImplCopyWith<_$PlatformPayPaymentMethodImpl> + get copyWith => throw _privateConstructorUsedError; +} + PlatformPaySheetUpdateParams _$PlatformPaySheetUpdateParamsFromJson( Map json) { return _PlatformPaySheetUpdateParams.fromJson(json); @@ -2153,6 +2362,266 @@ abstract class PlatformPayConfirmParamsApplePay get copyWith => throw _privateConstructorUsedError; } +PlatformPayShippingContact _$PlatformPayShippingContactFromJson( + Map json) { + return _PlatformPayShippingContact.fromJson(json); +} + +/// @nodoc +mixin _$PlatformPayShippingContact { + /// Email address of the shipping contact + String? get emailAddress => throw _privateConstructorUsedError; + + /// Name of shipping contact + ApplePayContactName get name => throw _privateConstructorUsedError; + + /// Postal address of shipping contact + ApplePayPostalAddress get postalAddress => throw _privateConstructorUsedError; + + ///Phone Number of the shipping contact + String? get phoneNumber => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PlatformPayShippingContactCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PlatformPayShippingContactCopyWith<$Res> { + factory $PlatformPayShippingContactCopyWith(PlatformPayShippingContact value, + $Res Function(PlatformPayShippingContact) then) = + _$PlatformPayShippingContactCopyWithImpl<$Res, + PlatformPayShippingContact>; + @useResult + $Res call( + {String? emailAddress, + ApplePayContactName name, + ApplePayPostalAddress postalAddress, + String? phoneNumber}); + + $ApplePayContactNameCopyWith<$Res> get name; + $ApplePayPostalAddressCopyWith<$Res> get postalAddress; +} + +/// @nodoc +class _$PlatformPayShippingContactCopyWithImpl<$Res, + $Val extends PlatformPayShippingContact> + implements $PlatformPayShippingContactCopyWith<$Res> { + _$PlatformPayShippingContactCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? emailAddress = freezed, + Object? name = null, + Object? postalAddress = null, + Object? phoneNumber = freezed, + }) { + return _then(_value.copyWith( + emailAddress: freezed == emailAddress + ? _value.emailAddress + : emailAddress // ignore: cast_nullable_to_non_nullable + as String?, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as ApplePayContactName, + postalAddress: null == postalAddress + ? _value.postalAddress + : postalAddress // ignore: cast_nullable_to_non_nullable + as ApplePayPostalAddress, + phoneNumber: freezed == phoneNumber + ? _value.phoneNumber + : phoneNumber // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $ApplePayContactNameCopyWith<$Res> get name { + return $ApplePayContactNameCopyWith<$Res>(_value.name, (value) { + return _then(_value.copyWith(name: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $ApplePayPostalAddressCopyWith<$Res> get postalAddress { + return $ApplePayPostalAddressCopyWith<$Res>(_value.postalAddress, (value) { + return _then(_value.copyWith(postalAddress: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$PlatformPayShippingContactImplCopyWith<$Res> + implements $PlatformPayShippingContactCopyWith<$Res> { + factory _$$PlatformPayShippingContactImplCopyWith( + _$PlatformPayShippingContactImpl value, + $Res Function(_$PlatformPayShippingContactImpl) then) = + __$$PlatformPayShippingContactImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String? emailAddress, + ApplePayContactName name, + ApplePayPostalAddress postalAddress, + String? phoneNumber}); + + @override + $ApplePayContactNameCopyWith<$Res> get name; + @override + $ApplePayPostalAddressCopyWith<$Res> get postalAddress; +} + +/// @nodoc +class __$$PlatformPayShippingContactImplCopyWithImpl<$Res> + extends _$PlatformPayShippingContactCopyWithImpl<$Res, + _$PlatformPayShippingContactImpl> + implements _$$PlatformPayShippingContactImplCopyWith<$Res> { + __$$PlatformPayShippingContactImplCopyWithImpl( + _$PlatformPayShippingContactImpl _value, + $Res Function(_$PlatformPayShippingContactImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? emailAddress = freezed, + Object? name = null, + Object? postalAddress = null, + Object? phoneNumber = freezed, + }) { + return _then(_$PlatformPayShippingContactImpl( + emailAddress: freezed == emailAddress + ? _value.emailAddress + : emailAddress // ignore: cast_nullable_to_non_nullable + as String?, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as ApplePayContactName, + postalAddress: null == postalAddress + ? _value.postalAddress + : postalAddress // ignore: cast_nullable_to_non_nullable + as ApplePayPostalAddress, + phoneNumber: freezed == phoneNumber + ? _value.phoneNumber + : phoneNumber // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +@JsonSerializable(explicitToJson: true) +class _$PlatformPayShippingContactImpl implements _PlatformPayShippingContact { + const _$PlatformPayShippingContactImpl( + {this.emailAddress, + required this.name, + required this.postalAddress, + this.phoneNumber}); + + factory _$PlatformPayShippingContactImpl.fromJson( + Map json) => + _$$PlatformPayShippingContactImplFromJson(json); + + /// Email address of the shipping contact + @override + final String? emailAddress; + + /// Name of shipping contact + @override + final ApplePayContactName name; + + /// Postal address of shipping contact + @override + final ApplePayPostalAddress postalAddress; + + ///Phone Number of the shipping contact + @override + final String? phoneNumber; + + @override + String toString() { + return 'PlatformPayShippingContact(emailAddress: $emailAddress, name: $name, postalAddress: $postalAddress, phoneNumber: $phoneNumber)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PlatformPayShippingContactImpl && + (identical(other.emailAddress, emailAddress) || + other.emailAddress == emailAddress) && + (identical(other.name, name) || other.name == name) && + (identical(other.postalAddress, postalAddress) || + other.postalAddress == postalAddress) && + (identical(other.phoneNumber, phoneNumber) || + other.phoneNumber == phoneNumber)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, emailAddress, name, postalAddress, phoneNumber); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PlatformPayShippingContactImplCopyWith<_$PlatformPayShippingContactImpl> + get copyWith => __$$PlatformPayShippingContactImplCopyWithImpl< + _$PlatformPayShippingContactImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PlatformPayShippingContactImplToJson( + this, + ); + } +} + +abstract class _PlatformPayShippingContact + implements PlatformPayShippingContact { + const factory _PlatformPayShippingContact( + {final String? emailAddress, + required final ApplePayContactName name, + required final ApplePayPostalAddress postalAddress, + final String? phoneNumber}) = _$PlatformPayShippingContactImpl; + + factory _PlatformPayShippingContact.fromJson(Map json) = + _$PlatformPayShippingContactImpl.fromJson; + + @override + + /// Email address of the shipping contact + String? get emailAddress; + @override + + /// Name of shipping contact + ApplePayContactName get name; + @override + + /// Postal address of shipping contact + ApplePayPostalAddress get postalAddress; + @override + + ///Phone Number of the shipping contact + String? get phoneNumber; + @override + @JsonKey(ignore: true) + _$$PlatformPayShippingContactImplCopyWith<_$PlatformPayShippingContactImpl> + get copyWith => throw _privateConstructorUsedError; +} + ApplePayParams _$ApplePayParamsFromJson(Map json) { return _ApplePayParams.fromJson(json); } diff --git a/packages/stripe_platform_interface/lib/src/models/platform_pay.g.dart b/packages/stripe_platform_interface/lib/src/models/platform_pay.g.dart index 7b56a9cd1..c37533ae0 100644 --- a/packages/stripe_platform_interface/lib/src/models/platform_pay.g.dart +++ b/packages/stripe_platform_interface/lib/src/models/platform_pay.g.dart @@ -6,6 +6,24 @@ part of 'platform_pay.dart'; // JsonSerializableGenerator // ************************************************************************** +_$PlatformPayPaymentMethodImpl _$$PlatformPayPaymentMethodImplFromJson( + Map json) => + _$PlatformPayPaymentMethodImpl( + paymentMethod: + PaymentMethod.fromJson(json['paymentMethod'] as Map), + shippingContact: json['shippingContact'] == null + ? null + : PlatformPayShippingContact.fromJson( + json['shippingContact'] as Map), + ); + +Map _$$PlatformPayPaymentMethodImplToJson( + _$PlatformPayPaymentMethodImpl instance) => + { + 'paymentMethod': instance.paymentMethod.toJson(), + 'shippingContact': instance.shippingContact?.toJson(), + }; + _$PlatformPaySheetUpdateParamsImpl _$$PlatformPaySheetUpdateParamsImplFromJson( Map json) => _$PlatformPaySheetUpdateParamsImpl( @@ -168,6 +186,25 @@ Map _$$PlatformPayConfirmParamsApplePayImplToJson( 'runtimeType': instance.$type, }; +_$PlatformPayShippingContactImpl _$$PlatformPayShippingContactImplFromJson( + Map json) => + _$PlatformPayShippingContactImpl( + emailAddress: json['emailAddress'] as String?, + name: ApplePayContactName.fromJson(json['name'] as Map), + postalAddress: ApplePayPostalAddress.fromJson( + json['postalAddress'] as Map), + phoneNumber: json['phoneNumber'] as String?, + ); + +Map _$$PlatformPayShippingContactImplToJson( + _$PlatformPayShippingContactImpl instance) => + { + 'emailAddress': instance.emailAddress, + 'name': instance.name.toJson(), + 'postalAddress': instance.postalAddress.toJson(), + 'phoneNumber': instance.phoneNumber, + }; + _$ApplePayParamsImpl _$$ApplePayParamsImplFromJson(Map json) => _$ApplePayParamsImpl( merchantCountryCode: json['merchantCountryCode'] as String, 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 1e3ffbf91..819ded57a 100644 --- a/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart +++ b/packages/stripe_platform_interface/lib/src/stripe_platform_interface.dart @@ -114,7 +114,7 @@ abstract class StripePlatform extends PlatformInterface { }); /// Use native payment sheet to create payment method - Future platformPayCreatePaymentMethod({ + Future platformPayCreatePaymentMethod({ required PlatformPayPaymentMethodParams params, bool usesDeprecatedTokenFlow = false, }); diff --git a/packages/stripe_web/lib/src/web_stripe.dart b/packages/stripe_web/lib/src/web_stripe.dart index f1b4c4d87..53d4739f0 100644 --- a/packages/stripe_web/lib/src/web_stripe.dart +++ b/packages/stripe_web/lib/src/web_stripe.dart @@ -492,7 +492,7 @@ class WebStripe extends StripePlatform { } @override - Future platformPayCreatePaymentMethod({ + Future platformPayCreatePaymentMethod({ required PlatformPayPaymentMethodParams params, bool usesDeprecatedTokenFlow = false, }) { From fb10f16462e77ffeb534f9b515a4872f415e829b Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 18 Dec 2023 19:25:23 +0000 Subject: [PATCH 06/16] doc: #1546 add proguard rules for push provisioning --- README.md | 12 ++++++++++-- docs/troubleshooting.mdx | 26 +++++++++++++++++++++++--- example/android/app/build.gradle | 5 ++++- example/android/app/proguard-rules.pro | 5 +++++ packages/stripe/README.md | 12 ++++++++++-- 5 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 example/android/app/proguard-rules.pro diff --git a/README.md b/README.md index 2b079573c..cc33c0554 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,19 @@ This plugin requires several changes to be able to work on Android devices. Plea 4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16) 5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6) 6. Using `FlutterFragmentActivity` instead of `FlutterActivity` in `MainActivity.kt`: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/app/src/main/kotlin/com/flutter/stripe/example/MainActivity.kt#L6) -7. Rebuild the app, as the above changes don't update with hot reload +7. Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro) +```proguard +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider +``` +8. Rebuild the app, as the above changes don't update with hot reload These changes are needed because the Android Stripe SDK requires the use of the AppCompat theme for their UI components and the Support Fragment Manager for the Payment Sheets -If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support +If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support. #### iOS diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx index f7f4fd3b4..3fcc46224 100644 --- a/docs/troubleshooting.mdx +++ b/docs/troubleshooting.mdx @@ -119,7 +119,7 @@ You can check if your backend is communicating with the live environment at the "livemode": true, "next_action": null, "status": "succeeded", - ... +} ``` #### Client side @@ -157,16 +157,19 @@ The payment intent should be linked to a customer and for the customer an epheme ```json - +{ "id": "pi_12345", "object": "payment_intent", - .... "charges": { "object": "list", "data": [ { "id": "ch_1234", "customer": "cus_12345", + } + ] + }, + } ``` #### Client-side @@ -184,4 +187,21 @@ The payment intent should be linked to a customer and for the customer an epheme customerEphemeralKeySecret: data['ephemeralKey'], // Extra params ``` +#### Android compile issue app bundle +When you get this issue when building android app bundle. + +```bash +Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider)) +Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error (referenced from: void com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy$createActivityEventListener$listener$1.onActivityResult(android.app.Activity, int, int, android.content.Intent)) +Missing class com.stripe.android.pushProvisioning.PushProvisioningActivityStarter (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider)) +Missing class com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider (referenced from: void com.reactnativestripesdk.pushprovisioning.DefaultPushProvisioningProxy.beginPushProvisioning(android.app.Activity, java.lang.String, com.reactnativestripesdk.pushprovisioning.EphemeralKeyProvider) and 1 other context) +``` +Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro) +```proguard +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider +``` diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 7522525ea..305a150cb 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace 'com.flutter.stripe.example' - compileSdk 33 + compileSdk 34 compileOptions { sourceCompatibility JavaVersion.VERSION_17 @@ -53,6 +53,9 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug + + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } } } diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro new file mode 100644 index 000000000..e6d1506c4 --- /dev/null +++ b/example/android/app/proguard-rules.pro @@ -0,0 +1,5 @@ +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider \ No newline at end of file diff --git a/packages/stripe/README.md b/packages/stripe/README.md index 2b079573c..cc33c0554 100644 --- a/packages/stripe/README.md +++ b/packages/stripe/README.md @@ -52,11 +52,19 @@ This plugin requires several changes to be able to work on Android devices. Plea 4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16) 5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6) 6. Using `FlutterFragmentActivity` instead of `FlutterActivity` in `MainActivity.kt`: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/app/src/main/kotlin/com/flutter/stripe/example/MainActivity.kt#L6) -7. Rebuild the app, as the above changes don't update with hot reload +7. Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro) +```proguard +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider +``` +8. Rebuild the app, as the above changes don't update with hot reload These changes are needed because the Android Stripe SDK requires the use of the AppCompat theme for their UI components and the Support Fragment Manager for the Payment Sheets -If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support +If you are having troubles to make this package to work on Android, join [this discussion](https://github.com/flutter-stripe/flutter_stripe/discussions/538) to get some support. #### iOS From f06e51ac810464cbd51bac7cee6b60b9b3f11620 Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 18 Dec 2023 19:45:35 +0000 Subject: [PATCH 07/16] fix: #1465 unknow result --- .../lib/src/method_channel_stripe.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart index 636e0dd18..9b78a7ae6 100644 --- a/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart +++ b/packages/stripe_platform_interface/lib/src/method_channel_stripe.dart @@ -322,7 +322,9 @@ class MethodChannelStripe extends StripePlatform { PaymentSheetPaymentOption? _parsePaymentSheetResult( Map? result) { if (result != null) { - if (result.isEmpty) { + ///iOS sometimes returns empty paymentoption so add workaround for it. + if (result.isEmpty || + (result['paymentOption'] == null && result['error'] == null)) { return null; } else if (result['paymentOption'] != null) { return PaymentSheetPaymentOption.fromJson(result['paymentOption']); From 2b4b3f898cd25850715ad54bda27a81038140874 Mon Sep 17 00:00:00 2001 From: Remon Date: Mon, 18 Dec 2023 20:12:08 +0000 Subject: [PATCH 08/16] doc: add klarna as return url for paymentsheet --- example/lib/screens/payment_sheet/payment_sheet_screen.dart | 1 + example/server/src/index.ts | 3 ++- .../lib/src/models/payment_sheet.dart | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/example/lib/screens/payment_sheet/payment_sheet_screen.dart b/example/lib/screens/payment_sheet/payment_sheet_screen.dart index 82833a914..b82e6ffc5 100644 --- a/example/lib/screens/payment_sheet/payment_sheet_screen.dart +++ b/example/lib/screens/payment_sheet/payment_sheet_screen.dart @@ -93,6 +93,7 @@ class _PaymentSheetScreenState extends State { // Customer params customerId: data['customer'], customerEphemeralKeySecret: data['ephemeralKey'], + returnURL: 'flutterstripe://redirect', // Extra params primaryButtonLabel: 'Pay now', diff --git a/example/server/src/index.ts b/example/server/src/index.ts index fa6f3e24e..c7a6e5816 100644 --- a/example/server/src/index.ts +++ b/example/server/src/index.ts @@ -554,6 +554,7 @@ app.post('/payment-sheet', async (_, res) => { // Edit the following to support different payment methods in your PaymentSheet // Note: some payment methods have different requirements: https://stripe.com/docs/payments/payment-methods/integration-options payment_method_types: [ + 'card', // 'ideal', // 'sepa_debit', // 'sofort', @@ -562,7 +563,7 @@ app.post('/payment-sheet', async (_, res) => { // 'giropay', // 'eps', // 'afterpay_clearpay', - 'klarna', + // 'klarna', // 'us_bank_account', ], }); diff --git a/packages/stripe_platform_interface/lib/src/models/payment_sheet.dart b/packages/stripe_platform_interface/lib/src/models/payment_sheet.dart index 2b8b09f9e..8c52ad87d 100644 --- a/packages/stripe_platform_interface/lib/src/models/payment_sheet.dart +++ b/packages/stripe_platform_interface/lib/src/models/payment_sheet.dart @@ -81,7 +81,7 @@ class SetupPaymentSheetParameters with _$SetupPaymentSheetParameters { /// paymentIntent since the customer can change those. @JsonKey(name: 'defaultBillingDetails') BillingDetails? billingDetails, - /// Return URL is required for IDEAL and few other payment methods + /// Return URL is required for IDEAL, Klarna and few other payment methods String? returnURL, /// Configuration for how billing details are collected during checkout. From c930116b67fd7d22246f46543124f0b90a91ad09 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Tue, 19 Dec 2023 10:43:17 +0100 Subject: [PATCH 09/16] fix #1560 --- example/lib/main.dart | 1 + packages/stripe_android/android/build.gradle | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 302d245a3..7622dbdce 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -61,5 +61,6 @@ final exampleAppTheme = ThemeData( secondary: Color(0xff6058F7), ), primaryColor: Colors.white, + useMaterial3: false, appBarTheme: AppBarTheme(elevation: 1), ); diff --git a/packages/stripe_android/android/build.gradle b/packages/stripe_android/android/build.gradle index 590c89ed8..9d9cd4456 100644 --- a/packages/stripe_android/android/build.gradle +++ b/packages/stripe_android/android/build.gradle @@ -52,12 +52,8 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.12.0' implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1" - implementation("com.stripe:stripe-android:$stripe_version") { - exclude group: 'androidx.emoji2', module: 'emoji2' - } - implementation ("com.stripe:financial-connections:$stripe_version") { - exclude group: 'androidx.emoji2', module: 'emoji2' - } + implementation "com.stripe:stripe-android:$stripe_version" + implementation "com.stripe:financial-connections:$stripe_version" implementation 'com.google.android.material:material:1.6.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' From 7e89e8f10b2e79dfa3ee00d1cb3606aba083d9ce Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Tue, 19 Dec 2023 11:25:38 +0100 Subject: [PATCH 10/16] adjust github android workflow --- .github/workflows/all_plugins.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/all_plugins.yaml b/.github/workflows/all_plugins.yaml index d09e4132d..5ca42c5bc 100644 --- a/.github/workflows/all_plugins.yaml +++ b/.github/workflows/all_plugins.yaml @@ -145,7 +145,7 @@ jobs: - name: Set up Java version uses: actions/setup-java@v1 with: - java-version: '11' + java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 @@ -176,9 +176,9 @@ jobs: - name: "Run integration test Android" uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 29 + api-level: 34 working-directory: example script: | sleep 15; flutter drive --driver test_driver/integration_test.dart --target=integration_test/run_all_tests.dart; - cd android && ./gradlew :app:connectedDebugAndroidTest; \ No newline at end of file + cd android && ./gradlew :app:connectedDebugAndroidTest; From 924fa28da9050e669cb4420becc91dec14f4a988 Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:09:41 +0000 Subject: [PATCH 11/16] chore(release): publish packages - stripe_platform_interface@10.0.0 --- CHANGELOG.md | 32 +++++++++++++++++++ packages/stripe/pubspec.yaml | 2 +- .../stripe_platform_interface/CHANGELOG.md | 9 ++++++ .../stripe_platform_interface/pubspec.yaml | 2 +- packages/stripe_web/pubspec.yaml | 2 +- 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a8ed198..830f62f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-19 + +### Changes + +--- + +Packages with breaking changes: + + - [`stripe_platform_interface` - `v10.0.0`](#stripe_platform_interface---v1000) + +Packages with other changes: + + - [`flutter_stripe_web` - `v4.6.1`](#flutter_stripe_web---v461) + - [`flutter_stripe` - `v9.6.1`](#flutter_stripe---v961) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `flutter_stripe_web` - `v4.6.1` + - `flutter_stripe` - `v9.6.1` + +--- + +#### `stripe_platform_interface` - `v10.0.0` + + - **FIX**: #1465 unknow result. + - **FIX**: #1512 add latest charge field to payment intent (Web only). + - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + + ## 2023-12-11 ### Changes diff --git a/packages/stripe/pubspec.yaml b/packages/stripe/pubspec.yaml index 52aacd15a..4270ac7ba 100644 --- a/packages/stripe/pubspec.yaml +++ b/packages/stripe/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: meta: ^1.8.0 stripe_android: ^9.6.0+1 stripe_ios: ^9.6.0 - stripe_platform_interface: ^9.6.0 + stripe_platform_interface: ^10.0.0 dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/stripe_platform_interface/CHANGELOG.md b/packages/stripe_platform_interface/CHANGELOG.md index cd46dfd9c..212701f30 100644 --- a/packages/stripe_platform_interface/CHANGELOG.md +++ b/packages/stripe_platform_interface/CHANGELOG.md @@ -1,3 +1,12 @@ +## 10.0.0 + +> Note: This release has breaking changes. + + - **FIX**: #1465 unknow result. + - **FIX**: #1512 add latest charge field to payment intent (Web only). + - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + ## 9.6.0 Sync with Stripe React Native v0.34 and v0.35: diff --git a/packages/stripe_platform_interface/pubspec.yaml b/packages/stripe_platform_interface/pubspec.yaml index 546cc3a65..d792ff975 100644 --- a/packages/stripe_platform_interface/pubspec.yaml +++ b/packages/stripe_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: stripe_platform_interface description: Platform interface for stripe sdk -version: 9.6.0 +version: 10.0.0 repository: https://github.com/flutter-stripe/flutter_stripe homepage: https://pub.dev/packages/flutter_stripe diff --git a/packages/stripe_web/pubspec.yaml b/packages/stripe_web/pubspec.yaml index aceab139c..201a496f3 100644 --- a/packages/stripe_web/pubspec.yaml +++ b/packages/stripe_web/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: flutter_web_plugins: sdk: flutter freezed_annotation: ^2.0.3 - stripe_platform_interface: ^9.6.0 + stripe_platform_interface: ^10.0.0 js: ^0.6.3 stripe_js: ^3.3.0 From fc735fbce86c7dd1d48587ae96cc824e57b3851b Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:15:42 +0000 Subject: [PATCH 12/16] chore(release): publish packages - stripe_android@10.0.0 --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ packages/stripe/pubspec.yaml | 2 +- packages/stripe_android/CHANGELOG.md | 4 ++++ packages/stripe_android/pubspec.yaml | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 830f62f01..7451a8956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-19 + +### Changes + +--- + +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`stripe_android` - `v10.0.0`](#stripe_android---v1000) + - [`flutter_stripe` - `v9.6.1`](#flutter_stripe---v961) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `flutter_stripe` - `v9.6.1` + +--- + +#### `stripe_android` - `v10.0.0` + + - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). + + ## 2023-12-19 ### Changes diff --git a/packages/stripe/pubspec.yaml b/packages/stripe/pubspec.yaml index 4270ac7ba..86deb7a1d 100644 --- a/packages/stripe/pubspec.yaml +++ b/packages/stripe/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: flutter: sdk: flutter meta: ^1.8.0 - stripe_android: ^9.6.0+1 + stripe_android: ^10.0.0 stripe_ios: ^9.6.0 stripe_platform_interface: ^10.0.0 dev_dependencies: diff --git a/packages/stripe_android/CHANGELOG.md b/packages/stripe_android/CHANGELOG.md index 130cb64af..8b21e4ca6 100644 --- a/packages/stripe_android/CHANGELOG.md +++ b/packages/stripe_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 10.0.0 + + - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). + ## 9.6.0+1 - fix: compile sdk to 33 diff --git a/packages/stripe_android/pubspec.yaml b/packages/stripe_android/pubspec.yaml index 7bfaa7000..248fc6a76 100644 --- a/packages/stripe_android/pubspec.yaml +++ b/packages/stripe_android/pubspec.yaml @@ -1,6 +1,6 @@ name: stripe_android description: Stripe platform implementation for Android -version: 9.6.0+1 +version: 10.0.0 repository: https://github.com/flutter-stripe/flutter_stripe homepage: https://pub.dev/packages/flutter_stripe From 22e83c9916bfab3e902e5a5274fbbb626514dd62 Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:17:48 +0000 Subject: [PATCH 13/16] chore(release): publish packages - stripe_ios@10.0.0 --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ packages/stripe/pubspec.yaml | 2 +- packages/stripe_ios/CHANGELOG.md | 2 ++ packages/stripe_ios/pubspec.yaml | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7451a8956..664531ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,32 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-19 + +### Changes + +--- + +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`stripe_ios` - `v10.0.0`](#stripe_ios---v1000) + - [`flutter_stripe` - `v9.6.1`](#flutter_stripe---v961) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `flutter_stripe` - `v9.6.1` + +--- + +#### `stripe_ios` - `v10.0.0` + + ## 2023-12-19 ### Changes diff --git a/packages/stripe/pubspec.yaml b/packages/stripe/pubspec.yaml index 86deb7a1d..1c964a21e 100644 --- a/packages/stripe/pubspec.yaml +++ b/packages/stripe/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: sdk: flutter meta: ^1.8.0 stripe_android: ^10.0.0 - stripe_ios: ^9.6.0 + stripe_ios: ^10.0.0 stripe_platform_interface: ^10.0.0 dev_dependencies: flutter_test: diff --git a/packages/stripe_ios/CHANGELOG.md b/packages/stripe_ios/CHANGELOG.md index a23e55d47..b6c2e6855 100644 --- a/packages/stripe_ios/CHANGELOG.md +++ b/packages/stripe_ios/CHANGELOG.md @@ -1,3 +1,5 @@ +## 10.0.0 + ## 9.6.0 Sync with Stripe React Native v0.34 and v0.35: diff --git a/packages/stripe_ios/pubspec.yaml b/packages/stripe_ios/pubspec.yaml index 82c305261..f20f02c5a 100644 --- a/packages/stripe_ios/pubspec.yaml +++ b/packages/stripe_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: stripe_ios description: Stripe platform implementation for iOS -version: 9.6.0 +version: 10.0.0 repository: https://github.com/flutter-stripe/flutter_stripe homepage: https://pub.dev/packages/flutter_stripe From 3c7e476a304602a75050f4cb0c19752201847cdb Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:19:27 +0000 Subject: [PATCH 14/16] chore(release): publish packages - flutter_stripe_web@5.0.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ packages/stripe_web/CHANGELOG.md | 7 +++++++ packages/stripe_web/pubspec.yaml | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 664531ea6..1994f98e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-19 + +### Changes + +--- + +Packages with breaking changes: + + - [`flutter_stripe_web` - `v5.0.0`](#flutter_stripe_web---v500) + +Packages with other changes: + + - There are no other changes in this release. + +--- + +#### `flutter_stripe_web` - `v5.0.0` + + - **FIX**: #1512 add latest charge field to payment intent (Web only). + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + + ## 2023-12-19 ### Changes diff --git a/packages/stripe_web/CHANGELOG.md b/packages/stripe_web/CHANGELOG.md index a2f1369c1..dcb082874 100644 --- a/packages/stripe_web/CHANGELOG.md +++ b/packages/stripe_web/CHANGELOG.md @@ -1,3 +1,10 @@ +## 5.0.0 + +> Note: This release has breaking changes. + + - **FIX**: #1512 add latest charge field to payment intent (Web only). + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + ## 4.6.0 - Support Flutter 3.16 - Fix invalid argument `requires_capture` on web (#1431). diff --git a/packages/stripe_web/pubspec.yaml b/packages/stripe_web/pubspec.yaml index 201a496f3..c5c6b6e7e 100644 --- a/packages/stripe_web/pubspec.yaml +++ b/packages/stripe_web/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_stripe_web description: Stripe sdk bindings for the Flutter web platform. This package contains the implementation of the platform interface for web. -version: 4.6.0 +version: 5.0.0 homepage: https://github.com/flutter-stripe/flutter_stripe environment: From dbbef0cdee951a7afb46c74eb44f16ef60092364 Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:21:56 +0000 Subject: [PATCH 15/16] chore(release): publish packages - flutter_stripe@10.0.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ packages/stripe/CHANGELOG.md | 6 ++++++ packages/stripe/pubspec.yaml | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1994f98e2..66557a54e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-12-19 + +### Changes + +--- + +Packages with breaking changes: + + - [`flutter_stripe` - `v10.0.0`](#flutter_stripe---v1000) + +Packages with other changes: + + - There are no other changes in this release. + +--- + +#### `flutter_stripe` - `v10.0.0` + + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + + ## 2023-12-19 ### Changes diff --git a/packages/stripe/CHANGELOG.md b/packages/stripe/CHANGELOG.md index 991554a89..01f72378f 100644 --- a/packages/stripe/CHANGELOG.md +++ b/packages/stripe/CHANGELOG.md @@ -1,3 +1,9 @@ +## 10.0.0 + +> Note: This release has breaking changes. + + - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. + ## 9.6.0+1 - add requirement for Android gradle plugin to readme diff --git a/packages/stripe/pubspec.yaml b/packages/stripe/pubspec.yaml index 1c964a21e..ba3f660ec 100644 --- a/packages/stripe/pubspec.yaml +++ b/packages/stripe/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_stripe description: Flutter library for Stripe. Supports PaymentSheets, Apple & Google Pay, SCA, PSD2 and much more. -version: 9.6.0+1 +version: 10.0.0 homepage: https://github.com/flutter-stripe/flutter_stripe repository: https://github.com/flutter-stripe/flutter_stripe From 355451f99cfd228f32c8d9912c453dd10565a362 Mon Sep 17 00:00:00 2001 From: Remon Date: Tue, 19 Dec 2023 20:23:31 +0000 Subject: [PATCH 16/16] chore: update changelogs --- packages/stripe/CHANGELOG.md | 9 +++++++-- packages/stripe_android/CHANGELOG.md | 8 +++++++- packages/stripe_ios/CHANGELOG.md | 8 ++++++++ packages/stripe_platform_interface/CHANGELOG.md | 12 +++++++----- packages/stripe_web/CHANGELOG.md | 9 ++++++--- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/packages/stripe/CHANGELOG.md b/packages/stripe/CHANGELOG.md index 01f72378f..e77494d15 100644 --- a/packages/stripe/CHANGELOG.md +++ b/packages/stripe/CHANGELOG.md @@ -1,8 +1,13 @@ ## 10.0.0 -> Note: This release has breaking changes. +**Breaking changes** +Rename `ApplePayShippingContact` to `PlatformpayshippingContact`. - - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. +**Fixes** +- #1465 Handle nullable result coming from Stripe sdk. +- #1512 add latest charge field to payment intent (Web only). +- #1522 add bankidentifiercode to ideal paymentdata. +- #1560 fix payment sheet crash when pressing back button. ## 9.6.0+1 - add requirement for Android gradle plugin to readme diff --git a/packages/stripe_android/CHANGELOG.md b/packages/stripe_android/CHANGELOG.md index 8b21e4ca6..d2cb99f99 100644 --- a/packages/stripe_android/CHANGELOG.md +++ b/packages/stripe_android/CHANGELOG.md @@ -1,6 +1,12 @@ ## 10.0.0 - - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). +**Breaking changes** +Rename `ApplePayShippingContact` to `PlatformpayshippingContact`. + +**Fixes** +- #1465 Handle nullable result coming from Stripe sdk. +- #1522 add bankidentifiercode to ideal paymentdata. +- #1560 fix payment sheet crash when pressing back button. ## 9.6.0+1 diff --git a/packages/stripe_ios/CHANGELOG.md b/packages/stripe_ios/CHANGELOG.md index b6c2e6855..c02cd0f8f 100644 --- a/packages/stripe_ios/CHANGELOG.md +++ b/packages/stripe_ios/CHANGELOG.md @@ -1,5 +1,13 @@ ## 10.0.0 +**Breaking changes** +Rename `ApplePayShippingContact` to `PlatformpayshippingContact`. + +**Fixes** +- #1465 Handle nullable result coming from Stripe sdk. +- #1522 add bankidentifiercode to ideal paymentdata. +- #1560 fix payment sheet crash when pressing back button. + ## 9.6.0 Sync with Stripe React Native v0.34 and v0.35: diff --git a/packages/stripe_platform_interface/CHANGELOG.md b/packages/stripe_platform_interface/CHANGELOG.md index 212701f30..c23432ef3 100644 --- a/packages/stripe_platform_interface/CHANGELOG.md +++ b/packages/stripe_platform_interface/CHANGELOG.md @@ -1,11 +1,13 @@ ## 10.0.0 -> Note: This release has breaking changes. +**Breaking changes** +Rename `ApplePayShippingContact` to `PlatformpayshippingContact`. - - **FIX**: #1465 unknow result. - - **FIX**: #1512 add latest charge field to payment intent (Web only). - - **FIX**: add bankidentifiercode to ideal paymentdata (#1522). - - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. +**Fixes** +- #1465 Handle nullable result coming from Stripe sdk. +- #1512 add latest charge field to payment intent (Web only). +- #1522 add bankidentifiercode to ideal paymentdata (). +- #1560 fix payment sheet crash when pressing back button. ## 9.6.0 Sync with Stripe React Native v0.34 and v0.35: diff --git a/packages/stripe_web/CHANGELOG.md b/packages/stripe_web/CHANGELOG.md index dcb082874..f685b44d1 100644 --- a/packages/stripe_web/CHANGELOG.md +++ b/packages/stripe_web/CHANGELOG.md @@ -1,9 +1,12 @@ ## 5.0.0 -> Note: This release has breaking changes. +**Breaking changes** +Rename `ApplePayShippingContact` to `PlatformpayshippingContact`. - - **FIX**: #1512 add latest charge field to payment intent (Web only). - - **BREAKING** **BREAKING**: rename ApplePayShippingContact to Platformpayshipping contact. +**Fixes** +- #1465 Handle nullable result coming from Stripe sdk. +- #1512 add latest charge field to payment intent (Web only). +- #1522 add bankidentifiercode to ideal paymentdata. ## 4.6.0 - Support Flutter 3.16