AnalyticsServiceInstance.TransactionFailed.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using UnityEngine;
  3. namespace Unity.Services.Analytics
  4. {
  5. partial class AnalyticsServiceInstance
  6. {
  7. public void TransactionFailed(TransactionFailedParameters parameters)
  8. {
  9. if (!ServiceEnabled)
  10. {
  11. return;
  12. }
  13. if (string.IsNullOrEmpty(parameters.TransactionName))
  14. {
  15. Debug.LogError("Required to have a value for transactionName");
  16. }
  17. if (parameters.TransactionType.Equals(TransactionType.INVALID))
  18. {
  19. Debug.LogError("Required to have a value for transactionType");
  20. }
  21. if (string.IsNullOrEmpty(parameters.FailureReason))
  22. {
  23. Debug.LogError("Required to have a failure reason in transactionFailed event");
  24. }
  25. if (string.IsNullOrEmpty(parameters.PaymentCountry))
  26. {
  27. parameters.PaymentCountry = Internal.Platform.UserCountry.Name();
  28. }
  29. dataGenerator.TransactionFailed(ref dataBuffer, DateTime.Now, m_CommonParams, "com.unity.services.analytics.events.TransactionFailed", parameters);
  30. }
  31. }
  32. }