Skip to content

Commit

Permalink
fix deferred configuration, implement missing methods on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbark committed Aug 29, 2023
1 parent c054a6a commit 2fd9183
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _PaymentSheetScreenState extends State<PaymentSheetDefferedScreen> {
merchantDisplayName: 'Flutter Stripe Store Demo',
intentConfiguration: IntentConfiguration(
mode: IntentMode(
currencyCode: 'EUR',
currencyCode: 'USD',
amount: 1500,
),
confirmHandler: (method, saveFuture) {
Expand Down
25 changes: 25 additions & 0 deletions packages/stripe_ios/ios/Classes/StripePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ class StripePlugin: StripeSdk, FlutterPlugin, ViewManagerDelegate {
return confirmPlatformPay(call, result: result)
case "configureOrderTracking":
return configureOrderTracking(call, result: result)
case "addListener":
return addListener(call, result: result)
case "removeListener":
return removeListener(call, result: result)
case "intentCreationCallback":
return intentCreationCallback(call, result: result)
default:
result(FlutterMethodNotImplemented)
}
Expand Down Expand Up @@ -526,6 +532,25 @@ extension StripePlugin {
)
}

func addListener(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
startObserving()
}

func removeListener(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
stopObserving()
}

func intentCreationCallback(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let arguments = call.arguments as? FlutterMap,
let params = arguments["params"] as? NSDictionary
else {
result(FlutterError.invalidParams)
return
}

intentCreationCallback(result: params, resolver: resolver(for: result), rejecter: rejecter(for: result))
}

func dangerouslyUpdateCardDetails(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let arguments = call.arguments as? FlutterMap,
let params = arguments["params"] as? NSDictionary else {
Expand Down

0 comments on commit 2fd9183

Please sign in to comment.