Skip to content

Commit

Permalink
Sync (#835)
Browse files Browse the repository at this point in the history
* 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

 - stripe_platform_interface@4.0.0

* chore(release): publish packages

 - flutter_stripe_web@1.2.0

* chore(release): publish packages

 - stripe_ios@4.0.0

* chore(release): publish packages

 - stripe_android@4.0.0

* chore(release): publish packages

 - flutter_stripe@4.0.0

* chore provide correct readmes

Co-authored-by: Remon Helmond <remonhelmond@gmail.com>
  • Loading branch information
jonasbark and remonh87 authored Jul 20, 2022
1 parent 93a291f commit 6e26f1c
Show file tree
Hide file tree
Showing 50 changed files with 9,629 additions and 797 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'

Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
with:
java-version: '11'

- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'

Expand Down Expand Up @@ -124,3 +124,11 @@ jobs:
sleep 15;
flutter drive --driver test_driver/integration_test.dart --target=integration_test/run_all_tests.dart;
cd android && ./gradlew :app:connectedDebugAndroidTest;
- name: "Start iOS Simulator"
run: |
xcrun simctl boot "iPhone 13 mini"
- name: "Run Flutter Driver tests on iOS"
working-directory: example
run: "flutter drive --driver test_driver/integration_test.dart --target=integration_test/run_all_tests.dart"
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install-tools.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

flutter pub global activate melos
flutter pub global activate melos
15 changes: 9 additions & 6 deletions example/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ void main() {
// 2. initialize the payment sheet
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
applePay: true,
googlePay: true,
applePay: PaymentSheetApplePay(merchantCountryCode: 'DE'),
googlePay: PaymentSheetGooglePay(
merchantCountryCode: 'DE',
testEnv: true,
),
style: ThemeMode.dark,
testEnv: true,
merchantCountryCode: 'DE',
merchantDisplayName: 'Flutter Stripe Store Demo',
customerId: _paymentSheetData['customer'],
paymentIntentClientSecret: _paymentSheetData['paymentIntent'],
Expand Down Expand Up @@ -77,7 +78,8 @@ void main() {
);

// 3. create intent on the server
final paymentIntentResult = await _createNoWebhookPayEndpointMethod(paymentMethod.id);
final paymentIntentResult =
await _createNoWebhookPayEndpointMethod(paymentMethod.id);
expect(paymentIntentResult['status'], 'succeeded');
});
});
Expand All @@ -100,7 +102,8 @@ Future<Map<String, dynamic>> _createTestPaymentSheet() async {
return json.decode(response.body);
}

Future<Map<String, dynamic>> _createNoWebhookPayEndpointMethod(String paymentMethodId) async {
Future<Map<String, dynamic>> _createNoWebhookPayEndpointMethod(
String paymentMethodId) async {
final ipAddress = kApiUrl.split('\n').last.trim();
final url = Uri.parse('http://$ipAddress:4242/pay-without-webhooks');
final response = await http.post(
Expand Down
20 changes: 16 additions & 4 deletions example/integration_test/payment_method_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
Expand Down Expand Up @@ -123,7 +125,12 @@ void main() {
expect(paymentMethod.id, startsWith('pm_'));
expect(paymentMethod.ideal, isNotNull);
expect(paymentMethod.ideal.bank, isNull);
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
// TODO instead create tickets for react native
if (Platform.isIOS) {
expect(paymentMethod.ideal.bankIdentifierCode, '');
} else {
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
}
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
});

Expand All @@ -134,7 +141,7 @@ void main() {
expect(paymentMethod.id, startsWith('pm_'));
expect(paymentMethod.ideal, isNotNull);
expect(paymentMethod.ideal.bank, isNull);
expect(paymentMethod.ideal.bankIdentifierCode, isNull);
expect(paymentMethod.ideal.bankIdentifierCode, 'REVOLT21');
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
});
});
Expand All @@ -145,8 +152,13 @@ void main() {
);
expect(paymentMethod.id, startsWith('pm_'));
expect(paymentMethod.fpx, isNotNull);
expect(paymentMethod.fpx.bank, isNull);
expect(paymentMethod.fpx.accountHolderType, isNull);
expect(paymentMethod.fpx.bank, 'affin_bank');
// TODO instead create tickets for react native
if (Platform.isIOS) {
expect(paymentMethod.fpx.accountHolderType, isNull);
} else {
expect(paymentMethod.fpx.accountHolderType, 'individual');
}
// expect(paymentMethod.billingDetails.isEmpty, isTrue);
});
});
Expand Down
11 changes: 7 additions & 4 deletions example/lib/screens/payment_sheet/payment_sheet_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreen> {
customerId: data['customer'],
customerEphemeralKeySecret: data['ephemeralKey'],
// Extra params
applePay: true,
googlePay: true,
applePay: PaymentSheetApplePay(
merchantCountryCode: 'DE',
),
googlePay: PaymentSheetGooglePay(
merchantCountryCode: 'DE',
testEnv: true,
),
style: ThemeMode.dark,
appearance: PaymentSheetAppearance(
colors: PaymentSheetAppearanceColors(
Expand All @@ -119,8 +124,6 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreen> {
),
),
billingDetails: billingDetails,
testEnv: true,
merchantCountryCode: 'DE',
),
);
setState(() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class _PaymentSheetScreenState extends State<PaymentSheetScreenWithCustomFlow> {
customerEphemeralKeySecret: data['ephemeralKey'],
customerId: data['customer'],
// Extra options
testEnv: true,
applePay: true,
googlePay: true,
applePay: PaymentSheetApplePay(
merchantCountryCode: 'DE',
),
googlePay: PaymentSheetGooglePay(merchantCountryCode: 'DE'),
style: ThemeMode.dark,
merchantCountryCode: 'DE',
),
);
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screens/wallets/apple_pay_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _ApplePayScreenState extends State<ApplePayScreen> {
await Stripe.instance.presentApplePay(
ApplePayPresentParams(
cartItems: [
ApplePayCartSummaryItem(
ApplePayCartSummaryItem.immediate(
label: 'Product Test',
amount: '0.01',
),
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_stripe: ^3.2.0
flutter_stripe_web: ^1.1.0
flutter_stripe: ^4.0.0
flutter_stripe_web: ^1.2.0
stripe_checkout: ^1.0.0
pay: ^1.0.10
http: ^0.13.1
Expand Down
Loading

0 comments on commit 6e26f1c

Please sign in to comment.