public class

Purchase

extends Object
implements Parcelable JSONSerializable Cloneable
java.lang.Object
   ↳ com.ad4screen.sdk.analytics.Purchase

Class Overview

Purchase Object to use for analytics event

Summary

Constants
String KEY_CURRENCY
String KEY_ID
String KEY_ITEMS
String KEY_TOTAL_PRICE
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Purchase> CREATOR
Public Constructors
Purchase(String id, String currency, double totalPrice)
Constructor of Purchase object without Items
Purchase(String id, String currency, double totalPrice, Item[] items)
Constructor of Purchase object with Items
Public Methods
Object clone()
int describeContents()
String getCurrency()
Get the currency of this Purchase
String getId()
Return the id of this Purchase
Item[] getItems()
Get the array of Item belonging to this Purchase
double getTotalPrice()
Return the total price of this purchase
void setCurrency(String currency)
Set the currency of this purchase
void setId(String mId)
Set the id of this Purchase
void setItems(Item[] mItems)
Set a array of Item for this purchase
void setTotalPrice(double mTotalPrice)
Set the total Price of this Purchase
JSONObject toJSON()
Serialize an object into a JSONObject
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable
From interface com.ad4screen.sdk.common.persistence.JSONSerializable

Constants

public static final String KEY_CURRENCY

Constant Value: "currency"

public static final String KEY_ID

Constant Value: "purchaseId"

public static final String KEY_ITEMS

Constant Value: "items"

public static final String KEY_TOTAL_PRICE

Constant Value: "total"

Fields

public static final Creator<Purchase> CREATOR

Public Constructors

public Purchase (String id, String currency, double totalPrice)

Constructor of Purchase object without Items

Parameters
id Purchase ID
currency Currency of this purchase in ISO4217 format
totalPrice Total Price of this purchase in the purchase currency
Throws
IllegalArgumentException if currency is invalid

public Purchase (String id, String currency, double totalPrice, Item[] items)

Constructor of Purchase object with Items

Parameters
id Purchase ID
currency Currency of this purchase in ISO4217 format
totalPrice Total Price of this purchase
items Array of Item Objects belonging to this purchase

Public Methods

public Object clone ()

Throws
CloneNotSupportedException

public int describeContents ()

public String getCurrency ()

Get the currency of this Purchase

Returns
  • Purchase Currency in ISO4217 format

public String getId ()

Return the id of this Purchase

Returns
  • Purchase ID

public Item[] getItems ()

Get the array of Item belonging to this Purchase

Returns
  • Array of Item

public double getTotalPrice ()

Return the total price of this purchase

Returns
  • Purchase total price

public void setCurrency (String currency)

Set the currency of this purchase

Parameters
currency the currency to set in ISO4217 format
Throws
IllegalArgumentException if currency is invalid

public void setId (String mId)

Set the id of this Purchase

public void setItems (Item[] mItems)

Set a array of Item for this purchase

public void setTotalPrice (double mTotalPrice)

Set the total Price of this Purchase

Parameters
mTotalPrice Total Price to set for this purchase

public JSONObject toJSON ()

Serialize an object into a JSONObject

Returns
  • JSONObject of the serialized class
Throws
JSONException

public void writeToParcel (Parcel dest, int flags)