public class SwarmStoreListing
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
SwarmStoreListing.ItemPurchaseCB |
Modifier and Type | Field and Description |
---|---|
int |
id
The unique identification number of this SwarmStoreListing.
|
java.lang.String |
imageUrl
The URL that points to the image associated with this SwarmStoreListing.
|
SwarmStoreItem |
item
The SwarmStoreItem that is contained by this SwarmStoreListing.
|
int |
orderId
Identifies this Listing's position in the Swarm Store list.
|
int |
price
The number of SwarmCoins that it will cost the user to purchase this SwarmStoreListing.
|
static int |
PURCHASE_CANCELED
The value returned by the ItemPurchaseCB if the purchase was intentionally cancelled by the user.
|
static int |
PURCHASE_FAILED_ALREADY_PURCHASED
The value returned by the ItemPurchaseCB callback if the purchase fails because the item has already been purchased (and the StoreItem isn't consumable - can't have multiples).
|
static int |
PURCHASE_FAILED_INVALID_ITEM
The value returned by the ItemPurchaseCB callback if the user attempted to purchase a SwarmStoreListing that
contained an invalid SwarmStoreItem.
|
static int |
PURCHASE_FAILED_INVALID_STORE
The value returned by the ItemPurchaseCB callback if the user attempted to purchase an invalid SwarmStoreListing.
|
static int |
PURCHASE_FAILED_NO_COINS
The value returned by the ItemPurchaseCB callback if the user attempted to purchase a SwarmStoreListing but has
an insufficient number of Swarm Coins.
|
static int |
PURCHASE_FAILED_NO_INTERNET
The value returned by the ItemPurchaseCB callback if the purchase fails because of a loss of internet connectivity.
|
static int |
PURCHASE_FAILED_OTHER
The value returned by the ItemPurchaseCB callback if the purchase fails for an unspecified reason.
|
static int |
PURCHASE_SUCCESS
The value returned by the ItemPurchaseCB if the purchase was successful.
|
int |
quantity
The quantity of SwarmStoreItems associated with this SwarmStoreListing.
|
java.lang.String |
title
The title of this SwarmStoreListing.
|
Constructor and Description |
---|
SwarmStoreListing() |
Modifier and Type | Method and Description |
---|---|
static void |
purchase(Context context,
int listingId)
Call this method to prompt the user to purchase the SwarmStoreListing specified by the listingId.
|
static void |
purchase(Context context,
int listingId,
SwarmStoreListing.ItemPurchaseCB cb)
Call this method to prompt the user to purchase the SwarmStoreListing specified by the listingId.
|
void |
purchase(Context c,
SwarmStoreListing.ItemPurchaseCB cb)
This method is called when the user purchases a SwarmStoreListing.
|
public static final int PURCHASE_FAILED_ALREADY_PURCHASED
public static final int PURCHASE_FAILED_NO_INTERNET
public static final int PURCHASE_FAILED_OTHER
public static final int PURCHASE_FAILED_INVALID_ITEM
public static final int PURCHASE_FAILED_INVALID_STORE
public static final int PURCHASE_FAILED_NO_COINS
public static final int PURCHASE_CANCELED
public static final int PURCHASE_SUCCESS
public int id
public SwarmStoreItem item
public java.lang.String title
public int price
public int quantity
public java.lang.String imageUrl
public int orderId
public void purchase(Context c, SwarmStoreListing.ItemPurchaseCB cb)
c
- The applicable context (i.e. "this").cb
- An ItemPurchaseCB callback that returns from the server after a call to purchase.
The ItemPurchaseCB callback returns in purchaseSuccess() if the SwarmStoreListing was successfully purchased.
the ItemPurchaseCB callback returns in purchaseFailed with an integer reason that contains a failure mode error code. The failure mode
error codes are defined in this SwamStoreListing class.public static void purchase(Context context, int listingId)
context
- The applicable context (i.e. "this").listingId
- The StoreItemListing ID number shown in the Swarm Admin Panel.public static void purchase(Context context, int listingId, SwarmStoreListing.ItemPurchaseCB cb)
context
- The applicable context (i.e. "this").listingId
- The StoreItemListing ID number shown in the Swarm Admin Panel.cb
- An ItemPurchaseCB callback that returns from the server after a call to purchase.
The ItemPurchaseCB callback returns in purchaseSuccess() if the SwarmStoreListing was successfully purchased.
the ItemPurchaseCB callback returns in purchaseFailed with an integer reason that contains a failure mode error code. The failure mode
error codes are defined in this SwamStoreListing class.