using System;
namespace UnityEngine.Purchasing.Security
{
// See Google's reference docs.
// http://developer.android.com/google/play/billing/billing_reference.html
///
/// The state of the GooglePlay purchase.
///
public enum GooglePurchaseState
{
///
/// The purchase was completed.
///
Purchased = 0,
///
/// The purchase was cancelled.
///
Cancelled = 1,
///
/// The purchase was refunded.
///
Refunded = 2,
///
/// The purchase was deferred.
///
Deferred = 4
}
///
/// A GooglePlay purchase receipt
///
public class GooglePlayReceipt : IPurchaseReceipt
{
///
/// The item's product identifier.
///
public string productID { get; private set; }
///
/// A unique order identifier for the transaction. This identifier corresponds to the Google payments order ID.
///
public string orderID { get; private set; }
///
/// The ID of the transaction.
///
public string transactionID => orderID;
///
/// The package name of the app.
///
public string packageName { get; private set; }
///
/// A token that uniquely identifies a purchase for a given item and user pair.
///
public string purchaseToken { get; private set; }
///
/// The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
///
public DateTime purchaseDate { get; private set; }
///
/// The purchase state of the order.
///
public GooglePurchaseState purchaseState { get; private set; }
///
/// Constructor that initializes the members from the input parameters.
///
/// The item's product identifier.
/// The unique order identifier for the transaction.
/// The package name of the app.
/// The token that uniquely identifies a purchase for a given item and user pair.
/// The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
/// The purchase state of the order.
public GooglePlayReceipt(string productID, string orderID, string packageName,
string purchaseToken, DateTime purchaseTime, GooglePurchaseState purchaseState)
{
this.productID = productID;
this.orderID = orderID;
this.packageName = packageName;
this.purchaseToken = purchaseToken;
this.purchaseDate = purchaseTime;
this.purchaseState = purchaseState;
}
}
}