Skip to content

Commit

Permalink
Complete payment feature (#1334)
Browse files Browse the repository at this point in the history
## Description

This PR (nearly) completes the payment feature of the Sharezone Plus
subscription. The following things were added:

* Flag to disable new purchases (#932)
* Analytics for the subscription page (#899)
* Cancel subscription
* Add lifetime option for Sharezone Plus (#1484)
* Move buy section to `sharezone_plus_page_ui` package (will be used for
"Eltern bezahlen lassen" feature)
* Dialogs for payment failure
* Update RevenueCat package to latest version

## Demo



https://github.com/SharezoneApp/sharezone-app/assets/24459435/bf6102f6-c190-44f7-bfb0-da05f5732fd5

(Used Stripe for the Demo, we will use RevenueCat in production for
macOS)

## ToDo

* [ ] Allow to resubscribe when you cancelled subscription
* [ ] Create products in App Store
* [ ] Create products in Play Store
* [ ] Set `isCancelled` when Stripe subscription is cancelled via
customer portal (something for the backend repo)
* [ ] Ensure Stripe invoice is sent for monthly & lifetime subscription
(something for the backend repo)

Closes #932
Closes #872
Closes #1484
Closes #899

---------

Co-authored-by: Jonas Sander <[email protected]>
  • Loading branch information
nilsreichardt and Jonas-Sander authored Apr 22, 2024
1 parent 0e374f5 commit 7334070
Show file tree
Hide file tree
Showing 46 changed files with 1,838 additions and 643 deletions.
2 changes: 1 addition & 1 deletion app/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone/keys.dart';
import 'package:sharezone/main/run_app.dart';
import 'package:sharezone/main/sharezone.dart';
import 'package:sharezone/util/flavor.dart';
import 'package:platform_check/platform_check.dart';

void main() {
const config = PatrolTesterConfig(
Expand Down
16 changes: 8 additions & 8 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,13 @@ PODS:
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- purchases_flutter (6.6.0):
- purchases_flutter (6.27.0):
- Flutter
- PurchasesHybridCommon (= 8.2.1)
- PurchasesHybridCommon (8.2.1):
- RevenueCat (= 4.31.6)
- PurchasesHybridCommon (= 10.4.1)
- PurchasesHybridCommon (10.4.1):
- RevenueCat (= 4.40.1)
- RecaptchaInterop (100.0.0)
- RevenueCat (4.31.6)
- RevenueCat (4.40.1)
- SDWebImage (5.19.0):
- SDWebImage/Core (= 5.19.0)
- SDWebImage/Core (5.19.0)
Expand Down Expand Up @@ -694,10 +694,10 @@ SPEC CHECKSUMS:
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
purchases_flutter: 28b20f31e3186f173d2d24d20e7820e788a833a0
PurchasesHybridCommon: 9adfb3252d99e22142aae9b8456e0069f0cae72d
purchases_flutter: 5a1857a77feec2e518cf0ea84e090ee0a7441c26
PurchasesHybridCommon: 596ac8a54be4e03cc1398b012bd9cdf134111b70
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
RevenueCat: a853fc1d6eb058e8546d91fba9c9c5cd2e041949
RevenueCat: 9f6b84da3f00953b2eeaaa6fc4710c1d280a5710
SDWebImage: 981fd7e860af070920f249fd092420006014c3eb
SDWebImageWebPCoder: c94f09adbca681822edad9e532ac752db713eabf
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
Expand Down
5 changes: 4 additions & 1 deletion app/lib/legal/terms_of_service/terms_of_service_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import 'package:sharezone/legal/privacy_policy/privacy_policy_page.dart';
import 'package:sharezone/legal/privacy_policy/src/privacy_policy_src.dart';

class TermsOfServicePage extends StatelessWidget {
static const tag = "terms-of-service-page";
// When you change the tag, you also need to change the tag in the
// `styled_markdown_text.dart` because the tag is used on the Sharezone Plus
// page.
static const tag = "terms-of-service";

const TermsOfServicePage({super.key});

Expand Down
7 changes: 6 additions & 1 deletion app/lib/main/sharezone_bloc_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ import 'package:sharezone/settings/src/subpages/my_profile/change_type_of_user/c
import 'package:sharezone/settings/src/subpages/my_profile/change_type_of_user/change_type_of_user_service.dart';
import 'package:sharezone/settings/src/subpages/timetable/bloc/timetable_settings_bloc_factory.dart';
import 'package:sharezone/settings/src/subpages/timetable/time_picker_settings_cache.dart';
import 'package:sharezone/sharezone_plus/page/sharezone_plus_page_analytics.dart';
import 'package:sharezone/sharezone_plus/page/sharezone_plus_page_controller.dart';
import 'package:sharezone/sharezone_plus/subscription_service/is_buying_enabled.dart';
import 'package:sharezone/sharezone_plus/subscription_service/revenue_cat_sharezone_plus_service.dart';
import 'package:sharezone/sharezone_plus/subscription_service/subscription_service.dart';
import 'package:sharezone/support/support_page_controller.dart';
Expand Down Expand Up @@ -318,7 +320,7 @@ class _SharezoneBlocProvidersState extends State<SharezoneBlocProviders> {
const clock = Clock();
final subscriptionService = SubscriptionService(
user: api.user.userStream,
clock: clock,
functions: widget.blocDependencies.functions,
);

final feedbackApi = FirebaseFeedbackApi(firestore);
Expand All @@ -343,9 +345,12 @@ class _SharezoneBlocProvidersState extends State<SharezoneBlocProviders> {
),
ChangeNotifierProvider(
create: (context) => SharezonePlusPageController(
buyingFlagApi: BuyingEnabledApi(client: http.Client()),
userId: UserId(api.uID),
purchaseService: RevenueCatPurchaseService(),
subscriptionService: subscriptionService,
crashAnalytics: crashAnalytics,
analytics: SharezonePlusPageAnalytics(analytics),
stripeCheckoutSession: StripeCheckoutSession(
createCheckoutSessionFunctionUrl: widget
.blocDependencies.remoteConfiguration
Expand Down
Loading

0 comments on commit 7334070

Please sign in to comment.