Skip to content

Commit

Permalink
Add play checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Nov 17, 2023
1 parent 2526084 commit c73de2c
Show file tree
Hide file tree
Showing 6 changed files with 1,056 additions and 1,010 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class SessionModel(
)

"submitGooglePlayPayment" -> paymentsUtil.submitGooglePlayPayment(
call.argument("email")!!,
call.argument("planID")!!,
result,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class PaymentsUtil(private val activity: Activity) {
}

// Handles Google Play transactions
fun submitGooglePlayPayment(planID: String, methodCallResult: MethodChannel.Result) {
fun submitGooglePlayPayment(email: String, planID: String, methodCallResult: MethodChannel.Result) {
val inAppBilling = LanternApp.getInAppBilling()

if (inAppBilling == null) {
Expand Down Expand Up @@ -179,7 +179,7 @@ class PaymentsUtil(private val activity: Activity) {

sendPurchaseRequest(
planID,
"",
email,
tokens[0],
PaymentProvider.GooglePlay,
methodCallResult,
Expand Down
6 changes: 5 additions & 1 deletion lib/common/session_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,13 @@ class SessionModel extends Model {
}).then((value) => value as String);
}

Future<void> submitGooglePlay(String planID) async {
Future<void> submitPlayPayment(
String planID,
String email,
) async {
return methodChannel
.invokeMethod('submitGooglePlayPayment', <String, dynamic>{
'email': email,
'planID': planID,
}).then((value) => value as String);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/core/router/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ class AppRouter extends $AppRouter {
transitionsBuilder: defaultTransition,
durationInMilliseconds: defaultTransitionMillis,
reverseDurationInMilliseconds: defaultTransitionMillis),
CustomRoute(
page: PlayCheckout.page,
path: '/playcheckout',
transitionsBuilder: defaultTransition,
durationInMilliseconds: defaultTransitionMillis,
reverseDurationInMilliseconds: defaultTransitionMillis),
CustomRoute(
page: Checkout.page,
path: '/checkout',
Expand Down
Loading

0 comments on commit c73de2c

Please sign in to comment.