diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs index 5674e13..e30c6cd 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs @@ -1,5 +1,7 @@ +using System; + namespace Guru { using System.Text; @@ -49,24 +51,31 @@ namespace Guru protected override void RequestSuccessCallBack(string response) { - ResponseData responseData = JsonUtility.FromJson>(response); - if (responseData != null && responseData.data != null) + try { - double usdPrice = responseData.data.usdPrice; - Analytics.Tch001IAPRev(usdPrice); - Analytics.Tch02IAPRev(usdPrice); - if (orderType == 0) + ResponseData responseData = JsonUtility.FromJson>(response); + if (responseData != null && responseData.data != null) { - AdjustService.TrackIAPPurchase(usdPrice, productId); - Analytics.IAPPurchase(usdPrice, productId); + double usdPrice = responseData.data.usdPrice; + Analytics.Tch001IAPRev(usdPrice); + Analytics.Tch02IAPRev(usdPrice); + if (orderType == 0) + { + AdjustService.TrackIAPPurchase(usdPrice, productId); + Analytics.IAPPurchase(usdPrice, productId); + } + else if (orderType == 1) + { + AdjustService.TrackSubPurchase(usdPrice, productId); + Analytics.SubPurchase(usdPrice, productId); + } } - else if (orderType == 1) - { - AdjustService.TrackSubPurchase(usdPrice, productId); - Analytics.SubPurchase(usdPrice, productId); - } - } + catch (Exception ex) + { + Analytics.LogCrashlytics(ex); + } + } } } \ No newline at end of file diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs index 0833c66..9b48d43 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs @@ -1,3 +1,4 @@ +using System; using System.Text; using Guru.LitJson; using UnityEngine; @@ -48,31 +49,37 @@ namespace Guru protected override void RequestSuccessCallBack(string response) { - ResponseData responseData = JsonUtility.FromJson>(response); - if (responseData != null && responseData.data != null) + try { - // Analytics.Tch001IAPRev(responseData.data.usdPrice); - double usdPrice = responseData.data.usdPrice; - Analytics.Tch001IAPRev(usdPrice); - Analytics.Tch02IAPRev(usdPrice); + ResponseData responseData = JsonUtility.FromJson>(response); + if (responseData != null && responseData.data != null) + { + // Analytics.Tch001IAPRev(responseData.data.usdPrice); + double usdPrice = responseData.data.usdPrice; + Analytics.Tch001IAPRev(usdPrice); + Analytics.Tch02IAPRev(usdPrice); - string pid = ""; + string pid = ""; - if (!string.IsNullOrEmpty(productId)) - { - pid = productId; - AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件 - Analytics.IAPPurchase(usdPrice, pid); - } + if (!string.IsNullOrEmpty(productId)) + { + pid = productId; + AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件 + Analytics.IAPPurchase(usdPrice, pid); + } - if (!string.IsNullOrEmpty(subscriptionId)) - { - pid = subscriptionId; - AdjustService.TrackSubPurchase(usdPrice, productId); // 上报 订阅 支付事件 - Analytics.SubPurchase(usdPrice, productId); + if (!string.IsNullOrEmpty(subscriptionId)) + { + pid = subscriptionId; + AdjustService.TrackSubPurchase(usdPrice, productId); // 上报 订阅 支付事件 + Analytics.SubPurchase(usdPrice, productId); + } } } - + catch (Exception ex) + { + Analytics.LogCrashlytics(ex); + } }