Class CommercePackage
java.lang.Object
com.codename1.payment.CommercePackage
One thing a customer can buy from an Offering: a store product together
with the role it plays in the offering (the monthly plan, the annual plan,
a lifetime unlock).
Everything the Codename One Commerce service said about the package is
fixed when the instance is made. The store's own Product, which carries
the localized price, is attached later, once the store has been asked.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA subscription billed once a year.static final StringA package that is none of the standard ones.static final StringA one time purchase that never expires.static final StringA subscription billed once a month.static final StringA subscription billed every six months.static final StringA subscription billed every three months.static final StringA subscription billed every two months.static final StringA subscription billed once a week. -
Method Summary
Modifier and TypeMethodDescriptiongetId()The id of the package inside its offering.How long the introductory price lasts, as an ISO-8601 duration, or null when the package has none.The introductory price as text, or null when the package has none.The id of the offering this package was listed in, or null for a package that came from no offering.The billing period as an ISO-8601 duration such asP1M, or null for a package that is not billed periodically.The store's product for this package, which carries the localized price and name.The store product id (SKU) this package sells.The free trial as an ISO-8601 duration such asP7D, or null when the package has none.getType()The role of the package, one of theTYPE_constants.booleanWhether this customer may still take the free trial or introductory price of the package, as far as the service knows.booleanWhether buying the package starts a subscription.booleanWhether the package is of the given type.toString()Returns a string representation of the object.
-
Field Details
-
TYPE_LIFETIME
-
TYPE_ANNUAL
-
TYPE_SIX_MONTH
-
TYPE_THREE_MONTH
-
TYPE_TWO_MONTH
-
TYPE_MONTHLY
-
TYPE_WEEKLY
-
TYPE_CUSTOM
-
-
Method Details
-
getOfferingId
The id of the offering this package was listed in, or null for a package that came from no offering. A web checkout names the package by both ids. -
getId
The id of the package inside its offering. -
getType
The role of the package, one of theTYPE_constants. A package the service gave no type isTYPE_CUSTOM. -
isType
Whether the package is of the given type. Types are compared without regard to case.
Parameters
packageType: one of theTYPE_constants
-
getProductId
The store product id (SKU) this package sells. -
getPeriod
The billing period as an ISO-8601 duration such asP1M, or null for a package that is not billed periodically. -
getTrialPeriod
The free trial as an ISO-8601 duration such asP7D, or null when the package has none. -
getIntroPrice
The introductory price as text, or null when the package has none. -
getIntroPeriod
How long the introductory price lasts, as an ISO-8601 duration, or null when the package has none. -
isEligibleForIntro
public boolean isEligibleForIntro()Whether this customer may still take the free trial or introductory price of the package, as far as the service knows. -
isSubscription
public boolean isSubscription()Whether buying the package starts a subscription. Everything is a subscription except aTYPE_LIFETIMEpackage and aTYPE_CUSTOMone with no billing period. -
getProduct
The store's product for this package, which carries the localized price and name.
Returns
the product, or null while the store has not been asked or does not list products on this platform
-
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())
-