diff --git a/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt b/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt index d520477..9c85897 100644 --- a/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt +++ b/android/src/main/kotlin/com/example/trackierfluttersdk/TrackierfluttersdkPlugin.kt @@ -167,8 +167,8 @@ class TrackierfluttersdkPlugin : FlutterPlugin, MethodCallHandler { discount = configMap.get("discount") as Double trackierEvent.discount = discount.toFloat() } - if (configMap.containsKey("c_code")) { - couponCode = configMap.get("c_code") as String + if (configMap.containsKey("couponCode")) { + couponCode = configMap.get("couponCode") as String trackierEvent.couponCode = couponCode } if (configMap.containsKey("param1")) { diff --git a/example/lib/main.dart b/example/lib/main.dart index 680b6b8..afc7eb3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -29,7 +29,7 @@ class _MyAppState extends State { // Platform messages are asynchronous, so we initialize in an async method. Future initPlatformState() async { TrackerSDKConfig trackerSDKConfig = - new TrackerSDKConfig("xxfe3694-1ef5-430d-baa7-01ba36332xxx", "development"); + new TrackerSDKConfig("0455721b-33c5-4c9f-805e-596d818d910a", "development");//xxfe3694-1ef5-430d-baa7-01ba36332xxx Trackierfluttersdk.setUserId("this_is_a_userId"); Trackierfluttersdk.setUserEmail("userEmail@gmail.com"); @@ -102,8 +102,12 @@ class _MyAppState extends State { _trackSimpleEvent() { TrackierEvent trackierEvent = new TrackierEvent("1CFfUn3xEY"); - trackierEvent.revenue = 10.0; + trackierEvent.revenue = 70.0; trackierEvent.discount = 2.0; + trackierEvent.currency = "INR"; + trackierEvent.orderId = "orderID"; + trackierEvent.param1 = "param1"; + trackierEvent.param2 = "param2"; trackierEvent.couponCode = "test1"; Trackierfluttersdk.setUserName("abc"); Trackierfluttersdk.setUserPhone("6562127727"); diff --git a/ios/Classes/SwiftTrackierfluttersdkPlugin.swift b/ios/Classes/SwiftTrackierfluttersdkPlugin.swift index 5575b41..0178f25 100644 --- a/ios/Classes/SwiftTrackierfluttersdkPlugin.swift +++ b/ios/Classes/SwiftTrackierfluttersdkPlugin.swift @@ -73,10 +73,10 @@ public class SwiftTrackierfluttersdkPlugin: NSObject, FlutterPlugin { func trackEvent(dict: Optional>) -> Void { let eventId: String = "\(dict?["eventId"] as? String ?? "")" let currency: String = "\(dict?["currency"] as? String ?? "")" - let revenue: String = "\(dict?["revenue"] as? String ?? "")" + let revenue: Float64 = (dict?["revenue"] as? Float64 ?? 0.0) let orderId: String = "\(dict?["orderId"] as? String ?? "")" - let discount: String = "\(dict?["discount"] as? String ?? "")" - let couponCode: String = "\(dict?["c_code"] as? String ?? "")" + let discount: Float64 = (dict?["discount"] as? Float64 ?? 0.0) + let couponCode: String = "\(dict?["couponCode"] as? String ?? "")" let param1: String = "\(dict?["param1"] as? String ?? "")" let param2: String = "\(dict?["param2"] as? String ?? "")" let param3: String = "\(dict?["param3"] as? String ?? "")" @@ -94,10 +94,10 @@ public class SwiftTrackierfluttersdkPlugin: NSObject, FlutterPlugin { } let event = TrackierEvent(id: eventId) - event.setRevenue(revenue: Float64((revenue as NSString).floatValue), currency: currency) + event.setRevenue(revenue: Float64(revenue), currency: currency) event.orderId = orderId event.setCouponCode(couponCode: couponCode) - event.setDiscount(discount: Float64((discount as NSString).floatValue)) + event.setDiscount(discount: Float64(discount)) event.param1 = param1 event.param2 = param2 event.param3 = param3 diff --git a/lib/trackierevent.dart b/lib/trackierevent.dart index e2c004d..29805e9 100644 --- a/lib/trackierevent.dart +++ b/lib/trackierevent.dart @@ -34,7 +34,7 @@ class TrackierEvent { Map eventMap = { 'eventId': eventId, 'orderId': orderId, - 'c_code' : couponCode, + 'couponCode' : couponCode, 'discount' : discount, 'currency': currency, 'revenue': revenue,