namespace UnityEngine.Purchasing.Extension
{
///
/// A common format for store subsystems to use to
/// describe available In App Purchases to UnityPurchasing,
/// including purchase state via Receipt and Transaction
/// Identifiers.
///
public class ProductDescription
{
///
/// Parametrized Constructor.
/// With transaction data.
///
/// The id of the product.
/// The metadata of the product.
/// The receipt of the purchase of the product.
/// The transaction id of the purchase of the product.
public ProductDescription(string id, ProductMetadata metadata,
string receipt, string transactionId)
{
storeSpecificId = id;
this.metadata = metadata;
this.receipt = receipt;
this.transactionId = transactionId;
}
///
/// Parametrized Constructor.
/// With the transaction data and type.
///
/// The id of the product.
/// The metadata of the product.
/// The receipt of the purchase of the product.
/// The transaction id of the purchase of the product.
/// The type of the product.
public ProductDescription(string id, ProductMetadata metadata,
string receipt, string transactionId, ProductType type)
: this(id, metadata, receipt, transactionId)
{
this.type = type;
}
///
/// Parametrized Constructor.
/// Without transaction data.
///
/// The id of the product.
/// The metadata of the product.
public ProductDescription(string id, ProductMetadata metadata) : this(id, metadata, null, null)
{
}
///
/// The store-specific id of this product.
///
public string storeSpecificId { get; private set; }
///
/// The type of the product, with respect to the store.
///
/// If this ProductDescription was explicitly queried by Unity IAP
/// then it is not necessary to specify a type since it is already
/// known from the product definition.
///
/// Otherwise, if this ProductDescription is unknown, type must
/// be correctly so the product can be handled correctly.
///
public ProductType type;
///
/// The Metadate of the product. Contains store interface information.
///
public ProductMetadata metadata { get; private set; }
///
/// The receipt provided on product purchase.
///
public string receipt { get; private set; }
///
/// The transaction id of the purchase of this product.
///
public string transactionId { get; set; }
}
}