Class CustomerInfo
What the Codename One Commerce service knows about one customer: the entitlements held, the subscriptions that are active and the attributes the application attached.
Instances are immutable. CommerceManager.getCustomerInfo() returns the
last one the service answered with, and an empty one before any answer.
-
Method Summary
Modifier and TypeMethodDescriptionThe entitlements the service reported as active.The store product ids of the subscriptions that are active.The id the service knows this customer by, or null for the empty customer.The attributes attached to this customer.The customer's virtual currency balances, by currency code.longgetCurrencyBalance(String code) The customer's balance of a virtual currency.getEntitlement(String entitlementId) The entitlement with this id, active or not.Every entitlement the service reported, active or not, by id.The page where the customer manages the subscription with the store, or null when there is none.The first id this customer was known by, when a later one replaced it (an anonymous id that became an account), or null.The rewards the service granted this customer for referrals: an entitlement or an amount of a virtual currency each, as configured in the console.longThe service's clock when it answered, in milliseconds since the epoch, or 0 for the empty customer.booleanisEntitled(String entitlementId) Whether the service reported this entitlement as active.toMap()This customer as the JSON object it was built from, for storage.toString()Returns a string representation of the object.
-
Method Details
-
getAppUserId
The id the service knows this customer by, or null for the empty customer. -
getOriginalAppUserId
The first id this customer was known by, when a later one replaced it (an anonymous id that became an account), or null. -
getManagementUrl
The page where the customer manages the subscription with the store, or null when there is none. -
getServerTime
public long getServerTime()The service's clock when it answered, in milliseconds since the epoch, or 0 for the empty customer. -
getEntitlement
The entitlement with this id, active or not.
Returns
the entitlement, or null when the service reported none by that id
-
isEntitled
Whether the service reported this entitlement as active. -
getEntitlements
Every entitlement the service reported, active or not, by id.
Returns
a new map, which the caller may change
-
getActiveEntitlements
The entitlements the service reported as active.
Returns
a new list, which the caller may change
-
getActiveSubscriptions
-
getAttributes
-
getCurrencyBalance
The customer's balance of a virtual currency.
Parameters
code: the code of the currency, as defined in the console
Returns
the balance, or 0 when the customer holds none of that currency
-
getCurrencies
-
getReferralRewards
The rewards the service granted this customer for referrals: an entitlement or an amount of a virtual currency each, as configured in the console. A reward that is an entitlement is also among
getEntitlements(), and a currency reward is already part ofgetCurrencyBalance(String); this list says where they came from.Returns
a new list, which the caller may change; empty when the service reported no reward
-
toMap
-
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-