|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.claimable.ClaimableManager
public class ClaimableManager
This class is intended to encapsulate all of the business logic needed to interact with the claimable repository. For example, this knows how to create, initialize and delete items that exist in the repository. Right now, the two types of claimable items that it can deal with are:
This class uses the ClaimableTools package to interact with the claimable repository on a lower level.
ClaimableTools
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
protected static java.lang.String |
INVALID_GIFTCERT_ID_PARAMETER
|
protected static java.lang.String |
INVALID_INITIAL_GIFTCERTIFICATE_PARAMETER
|
protected static java.lang.String |
INVALID_INITIAL_PROMOTION_PARAMETER
|
protected static java.lang.String |
INVALID_STORECREDIT_ID_PARAMETER
|
protected static java.lang.String |
MSG_INSUFFICIENT_AUTH
|
protected static java.lang.String |
MSG_INSUFFICIENT_AUTH_FOR_DEBIT
|
protected static java.lang.String |
MSG_INSUFFICIENT_CRED
|
protected static java.lang.String |
MSG_INSUFFICIENT_EXP_AMT
|
protected static java.lang.String |
MSG_INSUFFICIENT_FUNDS
|
protected static java.lang.String |
MSG_INSUFFICIENT_SC_AUTH
|
protected static java.lang.String |
MSG_INSUFFICIENT_SC_AUTH_FOR_DEBIT
|
protected static java.lang.String |
MSG_INSUFFICIENT_SC_CRED
|
protected static java.lang.String |
MSG_INSUFFICIENT_SC_EXP_AMT
|
protected static java.lang.String |
MSG_INSUFFICIENT_SC_FUNDS
|
protected static java.lang.String |
MSG_UNABLE_TO_CLAIM
|
protected static java.util.ResourceBundle |
sPromotionResourceBundle
Promotion Resource Bundle Used in claimCoupon for backwards compatibility |
protected static java.util.ResourceBundle |
sResourceBundle
Resource Bundle |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
ClaimableManager()
Empty Constructor |
Method Summary | |
---|---|
void |
authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
double pAmount)
This method will authorize a gift certificate for the amount identified by the parameter pAmount. |
void |
authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
java.lang.Double pAmount)
Deprecated. use authorizeClaimableGiftCertificate(String, double) instead |
void |
authorizeClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
double pAmount)
This method will authorize a store credit for the amount identified by the parameter pAmount. |
boolean |
checkExpireDate(RepositoryItem pClaimableItem)
Check whether the ClaimableItem is expired or not |
boolean |
checkPromotionType(RepositoryItem pPromotion)
Checks to see if the type of the promotion is valid. |
void |
claimCoupon(java.lang.String pProfileId,
java.lang.String pCouponClaimCode)
This method will attempt to claim the given coupon for the given user. |
RepositoryItem |
claimItem(java.lang.String pId)
This method will claim an item from the repository. |
RepositoryItem[] |
claimItems(java.lang.String[] pIds)
Same as the claimItem method except can take an array argument. |
RepositoryItem |
createClaimableGiftCertificate()
Will create a gift certificate in the claimable repository. |
RepositoryItem |
createClaimablePromotion()
Will create a coupon in the claimable repository. |
RepositoryItem |
createClaimableStoreCredit()
Will create a store credit in the claimable repository. |
RepositoryItem |
createTransientClaimableStoreCredit()
This method will create a transient store credit in the claimable repository. |
void |
creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
double pAmount)
This method will credit a gift certificate for the amount identified by the parameter pAmount. |
void |
creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
java.lang.Double pAmount)
Deprecated. use creditClaimableGiftCertificate(String, double) instead |
void |
creditClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
double pAmount)
This method will credit a store credit for the amount identified by the parameter pAmount. |
void |
debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
double pAmount)
This method will debit a gift certificate for the amount identified by the parameter pAmount. |
void |
debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
java.lang.Double pAmount)
Deprecated. use debitClaimableGiftCertificate(String, double) instead |
void |
debitClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
double pAmount)
This method will debit a store credit for the amount identified by the parameter pAmount. |
void |
decreaseAuthorizationForClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
double pAmount)
Decreases the authorized amount for the gift certificate by the given amount |
void |
decreaseAuthorizationForClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
double pAmount)
Decreases the authorized amount for the store credit by the given amount |
void |
expireGiftCertificateAuthorization(java.lang.String pClaimableGiftCertificateId,
double pAmount)
This method will expire a gift certificate authorization for the amount identified by the parameter pAmount. |
void |
expireStoreCreditAuthorization(java.lang.String pClaimableStoreCreditId,
double pAmount)
This method will expire a store credit authorization for the amount identified by the parameter pAmount. |
RepositoryItem |
findAndClaimCoupon(java.lang.String pCouponClaimCode)
Claims a coupon and returns it. |
ClaimableTools |
getClaimableTools()
Return the claimableTools property. |
java.util.List |
getGiftCertificatesForProfile(java.lang.String pProfileId)
Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId. |
java.util.List |
getGiftCertificatesForProfile(java.lang.String pProfileId,
boolean pReturnAll)
Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId. |
PricingTools |
getPricingTools()
The PricingTools class is used to round intermediate values |
PromotionTools |
getPromotionTools()
Return the PromotionTools property. |
java.util.List |
getStoreCreditsForProfile(java.lang.String pProfileId)
Returns a List of store credit repository items which belong to the user with the profile id in pProfileId. |
java.util.List |
getStoreCreditsForProfile(java.lang.String pProfileId,
boolean pReturnAll)
Returns a List of store credit repository items which belong to the user with the profile id in pProfileId. |
javax.transaction.TransactionManager |
getTransactionManager()
The TransactionManager |
java.lang.String[] |
getValidCouponItemTypes()
The list of acceptable item types for promotions when claiming a coupon. |
void |
initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate,
double pAmount,
double pAmountRemaining,
java.lang.String pPurchaserId,
java.util.Date pPurchaseDate)
This will initialize a gift certificates values to be the parameters passed in. |
void |
initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate,
java.lang.Double pAmount,
java.lang.Double pAmountRemaining,
java.lang.String pPurchaserId,
java.util.Date pPurchaseDate)
Deprecated. use initializeClaimableGiftCertificate(RepositoryItem, double, double, String, Date) instead |
void |
initializeClaimablePromotion(RepositoryItem pClaimablePromotion,
RepositoryItem pPromotion)
This will initialize a claimable promotion (coupon) by setting the promotion property of the coupon to be the parameter pPromotion. |
void |
initializeClaimableStoreCredit(RepositoryItem pClaimableStoreCredit,
double pAmount,
double pAmountRemaining,
java.lang.String pOwnerId,
java.util.Date pExpirationDate)
This will initialize store credit values to be the parameters passed in. |
void |
persistTransientClaimableItem(RepositoryItem pClaimableItem)
This method calls the claimable tools component to persist the claimable item into the repository. |
void |
setClaimableTools(ClaimableTools pClaimableTools)
Set the claimableTools property. |
void |
setPricingTools(PricingTools pPricingTools)
|
void |
setPromotionTools(PromotionTools pPromotionTools)
Set the PromotionTools property. |
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set the TransactionManager property. |
void |
setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes)
|
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
protected static java.util.ResourceBundle sResourceBundle
protected static java.util.ResourceBundle sPromotionResourceBundle
claimCoupon
for backwards compatibility
protected static final java.lang.String INVALID_GIFTCERT_ID_PARAMETER
protected static final java.lang.String INVALID_STORECREDIT_ID_PARAMETER
protected static final java.lang.String INVALID_INITIAL_PROMOTION_PARAMETER
protected static final java.lang.String INVALID_INITIAL_GIFTCERTIFICATE_PARAMETER
protected static final java.lang.String MSG_UNABLE_TO_CLAIM
protected static final java.lang.String MSG_INSUFFICIENT_FUNDS
protected static final java.lang.String MSG_INSUFFICIENT_AUTH
protected static final java.lang.String MSG_INSUFFICIENT_CRED
protected static final java.lang.String MSG_INSUFFICIENT_EXP_AMT
protected static final java.lang.String MSG_INSUFFICIENT_AUTH_FOR_DEBIT
protected static final java.lang.String MSG_INSUFFICIENT_SC_FUNDS
protected static final java.lang.String MSG_INSUFFICIENT_SC_AUTH
protected static final java.lang.String MSG_INSUFFICIENT_SC_CRED
protected static final java.lang.String MSG_INSUFFICIENT_SC_EXP_AMT
protected static final java.lang.String MSG_INSUFFICIENT_SC_AUTH_FOR_DEBIT
Constructor Detail |
---|
public ClaimableManager()
Method Detail |
---|
public void setClaimableTools(ClaimableTools pClaimableTools)
public ClaimableTools getClaimableTools()
public void setPricingTools(PricingTools pPricingTools)
public PricingTools getPricingTools()
public void setPromotionTools(PromotionTools pPromotionTools)
public PromotionTools getPromotionTools()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes)
public java.lang.String[] getValidCouponItemTypes()
handleClaimCoupon
public RepositoryItem claimItem(java.lang.String pId) throws ClaimableException
To claim the item and adjust the status, the methods provided by the ClaimableTools package will be used.
pId
- the repository id of the item to be claimed.
ClaimableException
- if an error occurspublic RepositoryItem[] claimItems(java.lang.String[] pIds) throws ClaimableException
pIds
- a value of type 'String[]'
ClaimableException
- if an error occurspublic RepositoryItem createClaimableGiftCertificate() throws ClaimableException
ClaimableException
- if an error occurspublic RepositoryItem createClaimablePromotion() throws ClaimableException
ClaimableException
- if an error occurspublic RepositoryItem createClaimableStoreCredit() throws ClaimableException
ClaimableException
- if an error occurspublic RepositoryItem createTransientClaimableStoreCredit() throws ClaimableException
ClaimableException
- if an error occurspublic void initializeClaimablePromotion(RepositoryItem pClaimablePromotion, RepositoryItem pPromotion) throws CommerceException
The promotion property of the ClaimablePromotion is identified by by the getPromotionPropertyName method of ClaimableTools.
pClaimablePromotion
- the coupon to be updatedpPromotion
- the promotion that will be associated witht he coupon
CommerceException
- if an error occurspublic void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate, java.lang.Double pAmount, java.lang.Double pAmountRemaining, java.lang.String pPurchaserId, java.util.Date pPurchaseDate) throws CommerceException
pClaimableGiftCertificate
- the giftCertificate whose properties will be updatedpAmount
- the amount that the gift certificate will be set topAmountRemaining
- the amount remaining on the gift certificatepPurchaserId
- id of the person purchasing the gift certificatepPurchaseDate
- the date that the gift certificate was purchased on
CommerceException
- if an error occurspublic void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate, double pAmount, double pAmountRemaining, java.lang.String pPurchaserId, java.util.Date pPurchaseDate) throws CommerceException
pClaimableGiftCertificate
- the giftCertificate whose properties will be updatedpAmount
- the amount that the gift certificate will be set topAmountRemaining
- the amount remaining on the gift certificatepPurchaserId
- id of the person purchasing the gift certificatepPurchaseDate
- the date that the gift certificate was purchased on
CommerceException
- if an error occurspublic void initializeClaimableStoreCredit(RepositoryItem pClaimableStoreCredit, double pAmount, double pAmountRemaining, java.lang.String pOwnerId, java.util.Date pExpirationDate) throws CommerceException
pClaimableStoreCredit
- the store credit whose properties will be updatedpAmount
- the amount that the store credit will be set topAmountRemaining
- the amount remaining on the store creditpOwnerId
- id of the person the store credit belongs topExpirationDate
- the expiration date of the store credit, can be null which means the
credit never expires
CommerceException
- if an error occurspublic java.util.List getStoreCreditsForProfile(java.lang.String pProfileId) throws CommerceException
pProfileId
- the profile id of the user to retrieve the StoreCredits for
if
- an exception occurs while executing the query
CommerceException
public java.util.List getStoreCreditsForProfile(java.lang.String pProfileId, boolean pReturnAll) throws CommerceException
pProfileId
- the profile id of the user to retrieve the StoreCredits forpReturnAll
- return all store credits vs the store credits which still have
money left on them
if
- an exception occurs while executing the query
CommerceException
public java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId) throws CommerceException
pProfileId
- the profile id of the user to retrieve the GiftCertificates for
if
- an exception occurs while executing the query
CommerceException
public java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId, boolean pReturnAll) throws CommerceException
pProfileId
- the profile id of the user to retrieve the GiftCertificates forpReturnAll
- return all gift certificates vs the gift certificates which still have
money left on them
if
- an exception occurs while executing the query
CommerceException
public void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount) throws InvalidParameterException, ClaimableException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to credit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurspublic void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount) throws InvalidParameterException, ClaimableException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to authorize to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurspublic void decreaseAuthorizationForClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount) throws InvalidParameterException, ClaimableException, RepositoryException
pClaimableGiftCertificateId
- pAmount
-
InvalidParameterException
ClaimableException
RepositoryException
public void decreaseAuthorizationForClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount) throws InvalidParameterException, ClaimableException, RepositoryException
pClaimableGiftCertificateId
- pAmount
-
InvalidParameterException
ClaimableException
RepositoryException
public void authorizeClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount) throws InvalidParameterException, ClaimableException, RepositoryException
If the store credit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableStoreCreditId
- the id of the store credit to adjustpAmount
- the amount to authorize to the store credit
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurspublic void expireGiftCertificateAuthorization(java.lang.String pClaimableGiftCertificateId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to debit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
- if the amount remaing is less then the pAmount.public void expireStoreCreditAuthorization(java.lang.String pClaimableStoreCreditId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableStoreCreditId
- the id of the store credit to adjustpAmount
- the amount to expire from the store credit authorization
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
- if the amount remaining is less then the pAmount.public void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to credit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
public void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to credit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
public void creditClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableStoreCreditId
- the id of the store credit to adjustpAmount
- the amount to credit to the store credit
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
public void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to debit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
- if the amount remaing is less then the pAmount.public void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableGiftCertificateId
- the id of the gift certificate to adjustpAmount
- the amount to debit to the gift certificate
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
- if the amount remaing is less then the pAmount.public void debitClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount) throws InvalidParameterException, ClaimableException, InsufficientFundsException, RepositoryException
If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.
pClaimableStoreCreditId
- the id of the store credit to adjustpAmount
- the amount to debit to the store credit
InvalidParameterException
- if an error occurs
ClaimableException
- if an error occurs
RepositoryException
- if an error occurs
InsufficientFundsException
- if the amount remaing is less then the pAmount.public boolean checkExpireDate(RepositoryItem pClaimableItem)
pClaimableItem
-
public boolean checkPromotionType(RepositoryItem pPromotion)
validCouponItemTypes
pPromotion
-
validCouponItemTypes
list.public void claimCoupon(java.lang.String pProfileId, java.lang.String pCouponClaimCode) throws ClaimableException
findAndClaimCoupon
, then,
if necessary, updates the given profile's active promotions and initializes
the pricing model holder.
pProfileId
- The profile making the claimpCouponClaimCode
- The claim code of the coupon
ClaimableException
- Thrown on any problemsfindAndClaimCoupon(String)
,
PromotionTools.addPromotion(MutableRepositoryItem, RepositoryItem, String)
,
PromotionTools.initializePricingModels()
public RepositoryItem findAndClaimCoupon(java.lang.String pCouponClaimCode) throws ClaimableException
If the coupon has expired, an ClaimableException is thrown
pCouponClaimCode
-
ClaimableException
claimItem(String)
,
checkExpireDate(RepositoryItem)
public void persistTransientClaimableItem(RepositoryItem pClaimableItem) throws ClaimableException
pClaimableItem
-
ClaimableException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |