Skip to content

Commit

Permalink
Fix a couple issues that arose in platform pay on web after the packa…
Browse files Browse the repository at this point in the history
…ge:web upgrade (#1917)

* Restore call to preventDefaul on payment request button

*

* Fix marshaling of paymentRequest complete function args

*
  • Loading branch information
cornwe19 authored Sep 25, 2024
1 parent 645edf8 commit 1c75fe4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension type JsPaymentResponse._(JSObject o) {
@JS('complete')
external JSFunction get _complete;
void Function(String) get complete {
return (String val) => _complete.callAsFunction(val.toJS);
return _complete.dartify() as void Function(String);

Check warning on line 65 in packages/stripe_js/lib/src/js/payment_requests/payment_request.dart

View workflow job for this annotation

GitHub Actions / Typo CI

dartify

"dartify" is a typo. Did you mean "fortify"?
}
}

Expand Down
6 changes: 2 additions & 4 deletions packages/stripe_web/lib/src/widgets/platform_pay_button.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'dart:js_interop';

import 'package:web/web.dart' as web;
import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:flutter_stripe_web/flutter_stripe_web.dart';
import 'package:flutter_stripe_web/src/parser/payment_request.dart';

import 'package:stripe_js/stripe_js.dart';
import 'package:web/web.dart' as web;

const kPlatformPayButtonDefaultHeight = 40.0;

Expand Down Expand Up @@ -76,7 +74,7 @@ class _WebPlatformPayButtonState extends State<WebPlatformPayButton> {
height: '${constraints.maxHeight}px',
))))
..on('click', (event) {
//callMethod(event, 'preventDefault', []);
event.toDart['preventDefault']();
widget.onPressed();
})
..mount('#platform-pay-button'.toJS);
Expand Down

0 comments on commit 1c75fe4

Please sign in to comment.