Package com.stripe.model
Class PromotionCode
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- com.stripe.model.PromotionCode
-
- All Implemented Interfaces:
HasId
,MetadataStore<PromotionCode>
,StripeObjectInterface
public class PromotionCode extends ApiResource implements HasId, MetadataStore<PromotionCode>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PromotionCode.Restrictions
-
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
-
Field Summary
-
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON
-
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
-
Constructor Summary
Constructors Constructor Description PromotionCode()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(java.lang.Object other)
static PromotionCode
create(PromotionCodeCreateParams params)
A promotion code points to a coupon.static PromotionCode
create(PromotionCodeCreateParams params, RequestOptions options)
A promotion code points to a coupon.static PromotionCode
create(java.util.Map<java.lang.String,java.lang.Object> params)
A promotion code points to a coupon.static PromotionCode
create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
A promotion code points to a coupon.boolean
equals(java.lang.Object o)
java.lang.Boolean
getActive()
Whether the promotion code is currently active.java.lang.String
getCode()
The customer-facing code.Coupon
getCoupon()
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.java.lang.Long
getCreated()
Time at which the object was created.java.lang.String
getCustomer()
Get ID of expandablecustomer
object.Customer
getCustomerObject()
Get expandedcustomer
.java.lang.Long
getExpiresAt()
Date at which the promotion code can no longer be redeemed.java.lang.String
getId()
Unique identifier for the object.java.lang.Boolean
getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.java.lang.Long
getMaxRedemptions()
Maximum number of times this promotion code can be redeemed.java.util.Map<java.lang.String,java.lang.String>
getMetadata()
Set of key-value pairs that you can attach to an object.java.lang.String
getObject()
String representing the object's type.PromotionCode.Restrictions
getRestrictions()
java.lang.Long
getTimesRedeemed()
Number of times this promotion code has been used.int
hashCode()
static PromotionCodeCollection
list(PromotionCodeListParams params)
Returns a list of your promotion codes.static PromotionCodeCollection
list(PromotionCodeListParams params, RequestOptions options)
Returns a list of your promotion codes.static PromotionCodeCollection
list(java.util.Map<java.lang.String,java.lang.Object> params)
Returns a list of your promotion codes.static PromotionCodeCollection
list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Returns a list of your promotion codes.static PromotionCode
retrieve(java.lang.String promotionCode)
Retrieves the promotion code with the given ID.static PromotionCode
retrieve(java.lang.String promotionCode, RequestOptions options)
Retrieves the promotion code with the given ID.static PromotionCode
retrieve(java.lang.String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options)
Retrieves the promotion code with the given ID.static PromotionCode
retrieve(java.lang.String promotionCode, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Retrieves the promotion code with the given ID.void
setActive(java.lang.Boolean active)
Whether the promotion code is currently active.void
setCode(java.lang.String code)
The customer-facing code.void
setCoupon(Coupon coupon)
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.void
setCreated(java.lang.Long created)
Time at which the object was created.void
setCustomer(java.lang.String id)
void
setCustomerObject(Customer expandableObject)
void
setExpiresAt(java.lang.Long expiresAt)
Date at which the promotion code can no longer be redeemed.void
setId(java.lang.String id)
Unique identifier for the object.void
setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setMaxRedemptions(java.lang.Long maxRedemptions)
Maximum number of times this promotion code can be redeemed.void
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object.void
setObject(java.lang.String object)
String representing the object's type.void
setRestrictions(PromotionCode.Restrictions restrictions)
void
setTimesRedeemed(java.lang.Long timesRedeemed)
Number of times this promotion code has been used.PromotionCode
update(PromotionCodeUpdateParams params)
Updates the specified promotion code by setting the values of the parameters passed.PromotionCode
update(PromotionCodeUpdateParams params, RequestOptions options)
Updates the specified promotion code by setting the values of the parameters passed.PromotionCode
update(java.util.Map<java.lang.String,java.lang.Object> params)
Updates the specified promotion code by setting the values of the parameters passed.PromotionCode
update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Updates the specified promotion code by setting the values of the parameters passed.-
Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
-
Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
-
-
-
Method Detail
-
getCustomer
public java.lang.String getCustomer()
Get ID of expandablecustomer
object.
-
setCustomer
public void setCustomer(java.lang.String id)
-
getCustomerObject
public Customer getCustomerObject()
Get expandedcustomer
.
-
setCustomerObject
public void setCustomerObject(Customer expandableObject)
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
retrieve
public static PromotionCode retrieve(java.lang.String promotionCode, PromotionCodeRetrieveParams params, RequestOptions options) throws StripeException
Retrieves the promotion code with the given ID.- Throws:
StripeException
-
create
public static PromotionCode create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(PromotionCodeCreateParams params) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
create
public static PromotionCode create(PromotionCodeCreateParams params, RequestOptions options) throws StripeException
A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.- Throws:
StripeException
-
update
public PromotionCode update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Specified by:
update
in interfaceMetadataStore<PromotionCode>
- Throws:
StripeException
-
update
public PromotionCode update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Specified by:
update
in interfaceMetadataStore<PromotionCode>
- Throws:
StripeException
-
update
public PromotionCode update(PromotionCodeUpdateParams params) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Throws:
StripeException
-
update
public PromotionCode update(PromotionCodeUpdateParams params, RequestOptions options) throws StripeException
Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(PromotionCodeListParams params) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
list
public static PromotionCodeCollection list(PromotionCodeListParams params, RequestOptions options) throws StripeException
Returns a list of your promotion codes.- Throws:
StripeException
-
getActive
public java.lang.Boolean getActive()
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
-
getCode
public java.lang.String getCode()
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
-
getCoupon
public Coupon getCoupon()
-
getCreated
public java.lang.Long getCreated()
Time at which the object was created. Measured in seconds since the Unix epoch.
-
getExpiresAt
public java.lang.Long getExpiresAt()
Date at which the promotion code can no longer be redeemed.
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
getMaxRedemptions
public java.lang.Long getMaxRedemptions()
Maximum number of times this promotion code can be redeemed.
-
getObject
public java.lang.String getObject()
String representing the object's type. Objects of the same type share the same value.Equal to
promotion_code
.
-
getRestrictions
public PromotionCode.Restrictions getRestrictions()
-
getTimesRedeemed
public java.lang.Long getTimesRedeemed()
Number of times this promotion code has been used.
-
setActive
public void setActive(java.lang.Boolean active)
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
-
setCode
public void setCode(java.lang.String code)
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
-
setCoupon
public void setCoupon(Coupon coupon)
-
setCreated
public void setCreated(java.lang.Long created)
Time at which the object was created. Measured in seconds since the Unix epoch.
-
setExpiresAt
public void setExpiresAt(java.lang.Long expiresAt)
Date at which the promotion code can no longer be redeemed.
-
setId
public void setId(java.lang.String id)
Unique identifier for the object.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
setMaxRedemptions
public void setMaxRedemptions(java.lang.Long maxRedemptions)
Maximum number of times this promotion code can be redeemed.
-
setMetadata
public void setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
-
setObject
public void setObject(java.lang.String object)
String representing the object's type. Objects of the same type share the same value.Equal to
promotion_code
.
-
setRestrictions
public void setRestrictions(PromotionCode.Restrictions restrictions)
-
setTimesRedeemed
public void setTimesRedeemed(java.lang.Long timesRedeemed)
Number of times this promotion code has been used.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getId
public java.lang.String getId()
Unique identifier for the object.
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.- Specified by:
getMetadata
in interfaceMetadataStore<PromotionCode>
-
-