Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

GooglePlayReceipt.cs 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. namespace UnityEngine.Purchasing.Security
  3. {
  4. // See Google's reference docs.
  5. // http://developer.android.com/google/play/billing/billing_reference.html
  6. /// <summary>
  7. /// The state of the GooglePlay purchase.
  8. /// </summary>
  9. public enum GooglePurchaseState
  10. {
  11. /// <summary>
  12. /// The purchase was completed.
  13. /// </summary>
  14. Purchased = 0,
  15. /// <summary>
  16. /// The purchase was cancelled.
  17. /// </summary>
  18. Cancelled = 1,
  19. /// <summary>
  20. /// The purchase was refunded.
  21. /// </summary>
  22. Refunded = 2,
  23. /// <summary>
  24. /// The purchase was deferred.
  25. /// </summary>
  26. Deferred = 4
  27. }
  28. /// <summary>
  29. /// A GooglePlay purchase receipt
  30. /// </summary>
  31. public class GooglePlayReceipt : IPurchaseReceipt
  32. {
  33. /// <summary>
  34. /// The item's product identifier.
  35. /// </summary>
  36. public string productID { get; private set; }
  37. /// <summary>
  38. /// A unique order identifier for the transaction. This identifier corresponds to the Google payments order ID.
  39. /// </summary>
  40. public string orderID { get; private set; }
  41. /// <summary>
  42. /// The ID of the transaction.
  43. /// </summary>
  44. public string transactionID => orderID;
  45. /// <summary>
  46. /// The package name of the app.
  47. /// </summary>
  48. public string packageName { get; private set; }
  49. /// <summary>
  50. /// A token that uniquely identifies a purchase for a given item and user pair.
  51. /// </summary>
  52. public string purchaseToken { get; private set; }
  53. /// <summary>
  54. /// The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
  55. /// </summary>
  56. public DateTime purchaseDate { get; private set; }
  57. /// <summary>
  58. /// The purchase state of the order.
  59. /// </summary>
  60. public GooglePurchaseState purchaseState { get; private set; }
  61. /// <summary>
  62. /// Constructor that initializes the members from the input parameters.
  63. /// </summary>
  64. /// <param name="productID"> The item's product identifier. </param>
  65. /// <param name="orderID"> The unique order identifier for the transaction. </param>
  66. /// <param name="packageName"> The package name of the app. </param>
  67. /// <param name="purchaseToken"> The token that uniquely identifies a purchase for a given item and user pair. </param>
  68. /// <param name="purchaseTime"> The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970). </param>
  69. /// <param name="purchaseState"> The purchase state of the order. </param>
  70. public GooglePlayReceipt(string productID, string orderID, string packageName,
  71. string purchaseToken, DateTime purchaseTime, GooglePurchaseState purchaseState)
  72. {
  73. this.productID = productID;
  74. this.orderID = orderID;
  75. this.packageName = packageName;
  76. this.purchaseToken = purchaseToken;
  77. this.purchaseDate = purchaseTime;
  78. this.purchaseState = purchaseState;
  79. }
  80. }
  81. }