Skip to content

Commit

Permalink
Merge branch 'main' into create-correct-result-object-for-present-pay…
Browse files Browse the repository at this point in the history
…ment-sheet
  • Loading branch information
remonh87 authored Jun 29, 2023
2 parents 06eab1c + e14c117 commit 9e4fbe7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,13 @@ If you continue to have trouble, follow this discussion to get some support http
}

private inline fun <reified T> MethodCall.optionalArgument(key: String): T? {
val value = argument<T>(key)
if (value == JSONObject.NULL)
return null
if (T::class.java == ReadableMap::class.java) {
return ReadableMap(argument<JSONObject>(key) ?: JSONObject()) as T
}
return argument<T>(key)
return value
}

private inline fun <reified T> MethodCall.requiredArgument(key: String): T {
Expand Down
6 changes: 3 additions & 3 deletions packages/stripe_ios/ios/Classes/StripePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ extension StripePlugin {

func confirmPayment(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let arguments = call.arguments as? FlutterMap,
let paymentIntentClientSecret = arguments["paymentIntentClientSecret"] as? String,
let params = arguments["params"] as? NSDictionary,
let options = arguments["options"] as? NSDictionary else {
let paymentIntentClientSecret = arguments["paymentIntentClientSecret"] as? String,
let options = arguments["options"] as? NSDictionary else {
result(FlutterError.invalidParams)
return
}
let params = arguments["params"] as? NSDictionary
confirmPayment(
paymentIntentClientSecret: paymentIntentClientSecret,
params: params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class MethodChannelStripe extends StripePlatform {
final result = await _methodChannel
.invokeMapMethod<String, dynamic>('confirmPayment', {
'paymentIntentClientSecret': paymentIntentClientSecret,
'params': params?.toJson() ?? {},
'params': params?.toJson(),
'options': options?.toJson() ?? {},
});

Expand Down

0 comments on commit 9e4fbe7

Please sign in to comment.