-
-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: stripe js library * test: add tests for api and endpoints * fix: path workflow * fix: publish stripe_js * ci: fix workflow * fix: add stripe_js docs * fix: change license * fix: update examples * fix: analyze warnings
- Loading branch information
1 parent
43635ec
commit f4e03de
Showing
214 changed files
with
39,485 additions
and
4,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: stripe_js | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths-ignore: | ||
- "docs/**" | ||
- "website/**" | ||
- "**.md" | ||
pull_request: | ||
branches: ['**'] | ||
paths-ignore: | ||
- "docs/**" | ||
- "website/**" | ||
- "**.md" | ||
|
||
jobs: | ||
build: | ||
defaults: | ||
run: | ||
working-directory: packages/stripe_js | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🎯 Setup Dart | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: 📦 Install Dependencies | ||
run: dart pub get | ||
|
||
- name: "Set env keys" | ||
env: | ||
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | ||
run: | | ||
cd ../../ | ||
./.github/workflows/scripts/env-files.sh | ||
- name: ✨ Check Formatting | ||
run: dart format --set-exit-if-changed . | ||
|
||
- name: 🕵️ Analyze | ||
run: dart analyze --fatal-infos --fatal-warnings lib test | ||
|
||
- name: 🧪 Run Tests | ||
run: | | ||
dart pub global activate coverage | ||
dart test -j 4 --coverage=coverage --platform=chrome && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib | ||
- name: 📊 Check Code Coverage | ||
uses: VeryGoodOpenSource/very_good_coverage@v2 | ||
with: | ||
path: packages/stripe_js/coverage/lcov.info | ||
exclude: "lib/**/*.g.dart lib/**/*.freezed.dart" | ||
min_coverage: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
example/lib/screens/payment_sheet/payment_element/platforms/payment_element.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
Future<void> pay() async { | ||
throw UnimplementedError(); | ||
} | ||
|
||
class PlatformPaymentElement extends StatelessWidget { | ||
const PlatformPaymentElement(this.clientSecret); | ||
|
||
final String? clientSecret; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
example/lib/screens/payment_sheet/payment_element/platforms/payment_element_web.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_stripe_web/flutter_stripe_web.dart'; | ||
|
||
import '../../../checkout/platforms/stripe_checkout_web.dart'; | ||
|
||
Future<void> pay() async { | ||
await WebStripe().confirmPaymentElement( | ||
ConfirmPaymentElementOptions( | ||
confirmParams: ConfirmPaymentParams(return_url: getReturnUrl()), | ||
), | ||
); | ||
} | ||
|
||
class PlatformPaymentElement extends StatelessWidget { | ||
const PlatformPaymentElement(this.clientSecret); | ||
|
||
final String? clientSecret; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PaymentElement( | ||
autofocus: true, | ||
enablePostalCode: true, | ||
onCardChanged: (_) {}, | ||
clientSecret: clientSecret ?? '', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.