Class Receipt
- All Implemented Interfaces:
Externalizable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAllows us to store an object state, this method must be implemented in order to save the state of an objectCancellation date of the receipt, if it has been cancelled.The expiry date of the receipt, in case this is a subscription receipt.An internal ID that may be optionally used to link the receipt to an internal order ID.The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.The order data that may be used to verify the receipt with the appropriate REST service.Date of purchase.intQuantity.getSku()Returns
The store code from which this receipt originated.The store-specific transaction ID.intReturns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisionsvoidinternalize(int version, DataInputStream in) Loads the object from the input stream and allows deserializationvoidsetCancellationDate(Date cancellationDate) Parameters
voidsetExpiryDate(Date expiryDate) Parameters
voidsetInternalId(String internalId) Parameters
voidsetOrderData(String orderData) Parameters
voidsetPurchaseDate(Date originalPurchaseDate) Parameters
voidsetQuantity(int quantity) Parameters
voidParameters
voidsetStoreCode(String storeCode) Parameters
voidsetTransactionId(String transactionId) Parameters
toString()
-
Field Details
-
STORE_CODE_ITUNES
- See Also:
-
STORE_CODE_PLAY
- See Also:
-
STORE_CODE_WINDOWS
- See Also:
-
STORE_CODE_SIMULATOR
- See Also:
-
-
Constructor Details
-
Receipt
public Receipt() -
Receipt
-
-
Method Details
-
getSku
Returns
the sku
-
setSku
Parameters
sku: the sku to set
See also
- #getSku()
-
getExpiryDate
The expiry date of the receipt, in case this is a subscription receipt.
NOTE: The expiry date will NOT be set automatically when the receipt is generated by the platform. It should be set by the
ReceiptStorein thecom.codename1.util.SuccessCallback)step, and usually on the server-side (in cases where a server is being used to track subscriptions), then the expiry date will be made available when the receipt is loaded usingReceiptStore#fetchReceipts(com.codename1.util.SuccessCallback).Returns
the expiryDate Will be null for non-subscriptions.
-
setExpiryDate
Parameters
expiryDate: the expiryDate to set
See also
- #getExpiryDate()
-
getVersion
public int getVersion()Returns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisions
Returns
version number for the persistant code
- Specified by:
getVersionin interfaceExternalizable
-
externalize
Allows us to store an object state, this method must be implemented in order to save the state of an object
Parameters
out: the stream into which the object must be serialized
Throws
java.io.IOException: the method may throw an exception
- Specified by:
externalizein interfaceExternalizable- Throws:
IOException
-
internalize
Loads the object from the input stream and allows deserialization
Parameters
-
version: the version the class returned during the externalization processs -
in: the input stream used to load the class
Throws
java.io.IOException: the method may throw an exception
- Specified by:
internalizein interfaceExternalizable- Throws:
IOException
-
-
getObjectId
The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.
Returns
a unique id
- Specified by:
getObjectIdin interfaceExternalizable
-
getCancellationDate
Cancellation date of the receipt, if it has been cancelled. A cancelled receipt should be treated as if the purchase had never been made in the first place.
Returns
the cancellationDate
-
setCancellationDate
Parameters
cancellationDate: the cancellationDate to set
See also
- #getCancellationDate()
-
getPurchaseDate
Date of purchase.
Returns
the purchaseDate
-
setPurchaseDate
Parameters
originalPurchaseDate: the purchaseDate to set
See also
- #getPurchaseDate()
-
getQuantity
public int getQuantity()Quantity. Currently this will always be 1, but potentially could be used internally to denote other quantities.
Returns
the quantity
-
setQuantity
public void setQuantity(int quantity) Parameters
quantity: the quantity to set
See also
- #getQuantity()
-
getTransactionId
The store-specific transaction ID. This will match exactly the transaction id of the store the issued the receipt. Use the
storeCodeto differentiate between transactions of different stores, which may potentially have the same transaction Ids.Returns
the transactionId
-
setTransactionId
Parameters
transactionId: the transactionId to set
See also
- #getTransactionId()
-
getOrderData
The order data that may be used to verify the receipt with the appropriate REST service. This data will be in different formats for different stores.
iTunes has a base64 encoded string, Play has a JSON structure, Windows has an XML string, etc...
This will be filled in at the time that the receipt is generated by the platform's implementation, so developers should never have to explicitly set this.
Returns
the orderData
-
setOrderData
Parameters
orderData: the orderData to set
See also
- #getOrderData()
-
getStoreCode
The store code from which this receipt originated. Will usually be one of
#STORE_CODE_ITUNES,#STORE_CODE_PLAY,#STORE_CODE_WINDOWS, or#STORE_CODE_SIMULATOR, but developers could also use custom codes if they use a different store, or no store at all. This code can be used for validating the receipt.Returns
the storeCode
-
setStoreCode
Parameters
storeCode: the storeCode to set
See also
- #getStoreCode()
-
getInternalId
An internal ID that may be optionally used to link the receipt to an internal order ID.
Returns
the internalId
-
setInternalId
Parameters
internalId: the internalId to set
See also
- #getInternalId()
-
toString
-