Skip to content

Commit 6e26f1c

Browse files
jonasbarkremonh87
andauthored
Sync (#835)
* sync Android with React Native 0.15.0 * sync iOS with React Native 0.15.0 * try to fix integration test * try to fix integration test * adjust integration tests * integration tests on iOS, do adjustments * update tests, cleanup * update tests, cleanup * add new google pay and apple pay payment params to paymentsheet * add new apple pay payment method items needed for iOS 15 support * add support for affirm payment * chore(release): publish packages - [email protected] * chore(release): publish packages - [email protected] * chore(release): publish packages - [email protected] * chore(release): publish packages - [email protected] * chore(release): publish packages - [email protected] * chore provide correct readmes Co-authored-by: Remon Helmond <[email protected]>
1 parent 93a291f commit 6e26f1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+9629
-797
lines changed

.github/workflows/all_plugins.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v2
23-
- uses: subosito/flutter-action@v1
23+
- uses: subosito/flutter-action@v2
2424
with:
2525
channel: 'stable'
2626

@@ -51,7 +51,7 @@ jobs:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- uses: actions/checkout@v2
54-
- uses: subosito/flutter-action@v1
54+
- uses: subosito/flutter-action@v2
5555
with:
5656
channel: 'stable'
5757

@@ -85,7 +85,7 @@ jobs:
8585
with:
8686
java-version: '11'
8787

88-
- uses: subosito/flutter-action@v1
88+
- uses: subosito/flutter-action@v2
8989
with:
9090
channel: 'stable'
9191

@@ -124,3 +124,11 @@ jobs:
124124
sleep 15;
125125
flutter drive --driver test_driver/integration_test.dart --target=integration_test/run_all_tests.dart;
126126
cd android && ./gradlew :app:connectedDebugAndroidTest;
127+
128+
- name: "Start iOS Simulator"
129+
run: |
130+
xcrun simctl boot "iPhone 13 mini"
131+
132+
- name: "Run Flutter Driver tests on iOS"
133+
working-directory: example
134+
run: "flutter drive --driver test_driver/integration_test.dart --target=integration_test/run_all_tests.dart"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
flutter pub global activate melos
3+
flutter pub global activate melos

example/integration_test/app_test.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ void main() {
2424
// 2. initialize the payment sheet
2525
await Stripe.instance.initPaymentSheet(
2626
paymentSheetParameters: SetupPaymentSheetParameters(
27-
applePay: true,
28-
googlePay: true,
27+
applePay: PaymentSheetApplePay(merchantCountryCode: 'DE'),
28+
googlePay: PaymentSheetGooglePay(
29+
merchantCountryCode: 'DE',
30+
testEnv: true,
31+
),
2932
style: ThemeMode.dark,
30-
testEnv: true,
31-
merchantCountryCode: 'DE',
3233
merchantDisplayName: 'Flutter Stripe Store Demo',
3334
customerId: _paymentSheetData['customer'],
3435
paymentIntentClientSecret: _paymentSheetData['paymentIntent'],
@@ -77,7 +78,8 @@ void main() {
7778
);
7879

7980
// 3. create intent on the server
80-
final paymentIntentResult = await _createNoWebhookPayEndpointMethod(paymentMethod.id);
81+
final paymentIntentResult =
82+
await _createNoWebhookPayEndpointMethod(paymentMethod.id);
8183
expect(paymentIntentResult['status'], 'succeeded');
8284
});
8385
});
@@ -100,7 +102,8 @@ Future<Map<String, dynamic>> _createTestPaymentSheet() async {
100102
return json.decode(response.body);
101103
}
102104

103-
Future<Map<String, dynamic>> _createNoWebhookPayEndpointMethod(String paymentMethodId) async {
105+
Future<Map<String, dynamic>> _createNoWebhookPayEndpointMethod(
106+
String paymentMethodId) async {
104107
final ipAddress = kApiUrl.split('\n').last.trim();
105108
final url = Uri.parse('http://$ipAddress:4242/pay-without-webhooks');
106109
final response = await http.post(

example/integration_test/payment_method_test.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:io';
2+
13
import 'package:flutter_stripe/flutter_stripe.dart';
24
import 'package:flutter_test/flutter_test.dart';
35
import 'package:integration_test/integration_test.dart';
@@ -123,7 +125,12 @@ void main() {
123125
expect(paymentMethod.id, startsWith('pm_'));
124126
expect(paymentMethod.ideal, isNotNull);
125127
expect(paymentMethod.ideal.bank, isNull);
126-
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
128+
// TODO instead create tickets for react native
129+
if (Platform.isIOS) {
130+
expect(paymentMethod.ideal.bankIdentifierCode, '');
131+
} else {
132+
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
133+
}
127134
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
128135
});
129136

@@ -134,7 +141,7 @@ void main() {
134141
expect(paymentMethod.id, startsWith('pm_'));
135142
expect(paymentMethod.ideal, isNotNull);
136143
expect(paymentMethod.ideal.bank, isNull);
137-
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
144+
expect(paymentMethod.ideal.bankIdentifierCode, 'REVOLT21');
138145
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
139146
});
140147
});
@@ -145,8 +152,13 @@ void main() {
145152
);
146153
expect(paymentMethod.id, startsWith('pm_'));
147154
expect(paymentMethod.fpx, isNotNull);
148-
expect(paymentMethod.fpx.bank, isNull);
149-
expect(paymentMethod.fpx.accountHolderType, isNull);
155+
expect(paymentMethod.fpx.bank, 'affin_bank');
156+
// TODO instead create tickets for react native
157+
if (Platform.isIOS) {
158+
expect(paymentMethod.fpx.accountHolderType, isNull);
159+
} else {
160+
expect(paymentMethod.fpx.accountHolderType, 'individual');
161+
}
150162
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
151163
});
152164
});

example/lib/screens/payment_sheet/payment_sheet_screen.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreen> {
9494
customerId: data['customer'],
9595
customerEphemeralKeySecret: data['ephemeralKey'],
9696
// Extra params
97-
applePay: true,
98-
googlePay: true,
97+
applePay: PaymentSheetApplePay(
98+
merchantCountryCode: 'DE',
99+
),
100+
googlePay: PaymentSheetGooglePay(
101+
merchantCountryCode: 'DE',
102+
testEnv: true,
103+
),
99104
style: ThemeMode.dark,
100105
appearance: PaymentSheetAppearance(
101106
colors: PaymentSheetAppearanceColors(
@@ -119,8 +124,6 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreen> {
119124
),
120125
),
121126
billingDetails: billingDetails,
122-
testEnv: true,
123-
merchantCountryCode: 'DE',
124127
),
125128
);
126129
setState(() {

example/lib/screens/payment_sheet/payment_sheet_screen_custom_flow.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreenWithCustomFlow> {
7070
customerEphemeralKeySecret: data['ephemeralKey'],
7171
customerId: data['customer'],
7272
// Extra options
73-
testEnv: true,
74-
applePay: true,
75-
googlePay: true,
73+
applePay: PaymentSheetApplePay(
74+
merchantCountryCode: 'DE',
75+
),
76+
googlePay: PaymentSheetGooglePay(merchantCountryCode: 'DE'),
7677
style: ThemeMode.dark,
77-
merchantCountryCode: 'DE',
7878
),
7979
);
8080
setState(() {

example/lib/screens/wallets/apple_pay_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _ApplePayScreenState extends State<ApplePayScreen> {
5252
await Stripe.instance.presentApplePay(
5353
ApplePayPresentParams(
5454
cartItems: [
55-
ApplePayCartSummaryItem(
55+
ApplePayCartSummaryItem.immediate(
5656
label: 'Product Test',
5757
amount: '0.01',
5858
),

example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
flutter_stripe: ^3.2.0
14-
flutter_stripe_web: ^1.1.0
13+
flutter_stripe: ^4.0.0
14+
flutter_stripe_web: ^1.2.0
1515
stripe_checkout: ^1.0.0
1616
pay: ^1.0.10
1717
http: ^0.13.1

0 commit comments

Comments
 (0)