@@ -17,7 +17,7 @@ func RCTMakeAndLogError(_ error: String, _ something: String?, _ anotherSomethin
17
17
18
18
@objc ( StripePlugin)
19
19
class StripePlugin : StripeSdkImpl , FlutterPlugin , ViewManagerDelegate {
20
-
20
+
21
21
22
22
private var channel : FlutterMethodChannel
23
23
@@ -26,6 +26,7 @@ class StripePlugin: StripeSdkImpl, FlutterPlugin, ViewManagerDelegate {
26
26
let channel = FlutterMethodChannel ( name: " flutter.stripe/payments " , binaryMessenger: registrar. messenger ( ) , codec: FlutterJSONMethodCodec ( ) )
27
27
28
28
let instance = StripePlugin ( channel: channel)
29
+ instance. emitter = instance
29
30
registrar. addMethodCallDelegate ( instance, channel: channel)
30
31
registrar. addApplicationDelegate ( instance)
31
32
@@ -238,10 +239,9 @@ class StripePlugin: StripeSdkImpl, FlutterPlugin, ViewManagerDelegate {
238
239
}
239
240
}
240
241
241
- /*override
242
242
func sendEvent( withName name: String , body: [ String : Any ] ) {
243
243
channel. invokeMethod ( name, arguments: body)
244
- }*/
244
+ }
245
245
246
246
func application( _ application: UIApplication , open url: URL , options: [ UIApplication . OpenURLOptionsKey : Any ] = [ : ] ) -> Bool {
247
247
return StripeAPI . handleURLCallback ( with: url)
@@ -258,6 +258,70 @@ class StripePlugin: StripeSdkImpl, FlutterPlugin, ViewManagerDelegate {
258
258
}
259
259
}
260
260
261
+ extension StripePlugin : StripeSdkEmitter {
262
+
263
+ func emitOnConfirmHandlerCallback( _ value: [ String : Any ] ) {
264
+ self . sendEvent ( withName: " onConfirmHandlerCallback " , body: value)
265
+ }
266
+
267
+ func emitOnFinancialConnectionsEvent( _ value: [ String : Any ] ) {
268
+ self . sendEvent ( withName: " onFinancialConnectionsEvent " , body: value)
269
+ }
270
+
271
+ func emitOnOrderTrackingCallback( ) {
272
+ self . sendEvent ( withName: " onOrderTrackingCallback " , body: [ : ] )
273
+ }
274
+
275
+ func emitOnCustomerAdapterFetchPaymentMethodsCallback( ) {
276
+ self . sendEvent ( withName: " onCustomerAdapterFetchPaymentMethodsCallback " , body: [ : ] )
277
+ }
278
+
279
+ func emitOnCustomerAdapterAttachPaymentMethodCallback( _ value: [ String : Any ] ) {
280
+ self . sendEvent ( withName: " onCustomerAdapterAttachPaymentMethodCallback " , body: value)
281
+ }
282
+
283
+ func emitOnCustomerAdapterDetachPaymentMethodCallback( _ value: [ String : Any ] ) {
284
+ self . sendEvent ( withName: " onCustomerAdapterDetachPaymentMethodCallback " , body: value)
285
+ }
286
+
287
+ func emitOnCustomerAdapterSetSelectedPaymentOptionCallback( _ value: [ String : Any ] ) {
288
+ self . sendEvent ( withName: " onCustomerAdapterSetSelectedPaymentOptionCallback " , body: value)
289
+ }
290
+
291
+ func emitOnCustomerAdapterFetchSelectedPaymentOptionCallback( ) {
292
+ self . sendEvent ( withName: " onCustomerAdapterFetchSelectedPaymentOptionCallback " , body: [ : ] )
293
+ }
294
+
295
+ func emitOnCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback( ) {
296
+ self . sendEvent ( withName: " onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback " , body: [ : ] )
297
+ }
298
+
299
+ func emitEmbeddedPaymentElementDidUpdateHeight( _ value: [ String : Any ] ) {
300
+ self . sendEvent ( withName: " embeddedPaymentElementDidUpdateHeight " , body: value)
301
+ }
302
+
303
+ func emitEmbeddedPaymentElementWillPresent( ) {
304
+ self . sendEvent ( withName: " embeddedPaymentElementWillPresent " , body: [ : ] )
305
+ }
306
+
307
+ func emitEmbeddedPaymentElementDidUpdatePaymentOption( _ value: [ String : Any ] ) {
308
+ self . sendEvent ( withName: " embeddedPaymentElementDidUpdatePaymentOption " , body: value)
309
+ }
310
+
311
+ func emitEmbeddedPaymentElementFormSheetConfirmComplete( _ value: [ String : Any ] ) {
312
+ self . sendEvent ( withName: " embeddedPaymentElementFormSheetConfirmComplete " , body: value)
313
+ }
314
+
315
+ func emitEmbeddedPaymentElementRowSelectionImmediateAction( ) {
316
+ self . sendEvent ( withName: " embeddedPaymentElementRowSelectionImmediateAction " , body: [ : ] )
317
+ }
318
+
319
+ func emitEmbeddedPaymentElementLoadingFailed( _ value: [ String : Any ] ) {
320
+ self . sendEvent ( withName: " embeddedPaymentElementLoadingFailed " , body: value)
321
+ }
322
+
323
+ }
324
+
261
325
262
326
// Mark: MethodChannel handlers
263
327
extension StripePlugin {
0 commit comments