public class PaymentHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
PaymentHelper()
PaymentHelper default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkAccountAndCreditLineAreActive_AB(AccountAccessBean abAccount,
CreditLineAccessBean abCreditLine)
Checks if both the specified Account and CreditLine are active.
|
boolean |
checkAccountAndCreditLineAreActive(java.lang.String sAccountId,
java.lang.String sCreditLineId)
Checks if both the specified Account and CreditLine are active.
|
void |
checkCardExpiryYearAndMonth(TypedProperty requestProperties,
java.lang.String errorViewName,
CommandContext cmdCtx)
Checks the cardExpiryMonth and cardExpiryYear parameters if present.
|
void |
checkCardNumberAndBrand(TypedProperty requestProperties,
java.lang.String errorViewName,
CommandContext cmdCtx)
Checks the cardNumber and cardBrand parameters if present.
|
java.lang.Long |
checkFromOrdPayMthdIfAllCreditLineAreActive(java.lang.Long nOrderId)
Checks if the Account & Creditline associated with the OrdPayMthd entries
of the specified order are both active.
|
void |
checkPaymentInfoForDelayedProcess(TypedProperty requestProperties,
OrderAccessBean abOrder,
java.lang.String errorViewName,
CommandContext cmdCtx)
Checks several payment related parameters before scheduling an Order or holding the Order for
Approval by the Buyer Approver.
|
boolean |
checkPaymentPolicyAccess(OrderAccessBean abOrder,
java.lang.Long nPolicyId)
Deprecated.
- This method is obsolete. It always returns true.
|
boolean |
checkPaymentPolicyAccess(OrderAccessBean abOrder,
OrderItemAccessBean[] abOrderItemArray,
java.lang.Long nPolicyId)
Deprecated.
- This method is obsolete. It always returns true.
|
java.lang.Long[] |
findTAsWithCompatiblePaymentTC(java.lang.Long[] nTAIds,
OrderAccessBean abOrder,
CommandContext cmdCtx)
From the array of input TradingIds find all the Trading Agreements that have compatible PaymentTC.
|
java.lang.Long[] |
findTAsWithCompatiblePaymentTC(java.lang.Long[] nTAIds,
java.util.Set setOfExistingTAIds,
CommandContext cmdCtx)
Deprecated.
|
java.util.Set |
findTAsWithCompatiblePaymentTC(java.lang.Long nMemberId,
java.util.List lstTAIds,
CommandContext cmdCtx)
Find the biggest set of Trading Agreement IDs from the List of Trading Agreement IDs that have compatible
Payment Terms and Conditions.
|
java.lang.Long[] |
findTAsWithCompatiblePaymentTC(java.lang.Long nMemberId,
java.lang.Long[] nTAIds,
java.util.Set setOfExistingTAIds,
CommandContext cmdCtx)
From the array of input TradingIds find all the Trading Agreements that have compatible PaymentTC
that the specified customer is entiyled to.
|
java.lang.Long |
getBillToAddressIdFromTC(TypedProperty requestProperties)
Checks if a tcId parameter is specified in the input TypedProperty object.
|
static PaymentHelper |
getInstance()
Returns the PaymentHelper instance that can be used to invoke the instance helper methods.
|
boolean |
isCardExpiryDateValid(int expiryMonth,
int expiryYear)
Checks if the specified expiry date (expiryMonth and expiryYear) is valid.
|
boolean |
isPaymentPolicyValid(OrderAccessBean abOrder,
java.lang.String strPolicyId,
java.lang.String strTCId,
CommandContext commandContext)
This one basically initialized the TermConditionAccessBean from the given strTCId
And all the other isPaymentPolicyValid that takes TermConditionAccessBean.
|
boolean |
isPaymentPolicyValid(OrderAccessBean abOrder,
java.lang.String strPolicyId,
TermConditionAccessBean abPayTC,
CommandContext commandContext)
Checks if the Payment Policy ID specified is valid for the Order.
|
java.lang.String |
removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
Returns a new string that is free of any spaces and hyphenated characters.
|
public static final java.lang.String COPYRIGHT
public boolean checkAccountAndCreditLineAreActive(java.lang.String sAccountId, java.lang.String sCreditLineId)
sAccountId
- the internal ID of the AccountsCreditLineId
- the internal ID of the CreditLinepublic boolean checkAccountAndCreditLineAreActive_AB(AccountAccessBean abAccount, CreditLineAccessBean abCreditLine)
abAccount
- the AcountAccessBean representing the AccountabCreditLine
- the CreditLineAccessBean representing the CreditLinepublic void checkCardExpiryYearAndMonth(TypedProperty requestProperties, java.lang.String errorViewName, CommandContext cmdCtx) throws ECException
requestProperties
- the TypedProperty object that may contain the cardExpiryMonth and cardExpiryYear parameters.errorViewName
- the name of the ErrorView.cmdCtx
- the CommandContext.ECException
- this helper method throws ECApplicationException if the cardExpiryYear or cardExpiryMonth
is specified and is invalid. Note that if one of the parameters is specified, the other must be specified as well.
It is considered an error if only one of the two is specified.public void checkCardNumberAndBrand(TypedProperty requestProperties, java.lang.String errorViewName, CommandContext cmdCtx) throws ECException
This helper method calls the CheckCCNumber
Task Command to do the actual checking.
requestProperties
- the TypedProperty object that may contain the cardNumber and cardBrand parameters.errorViewName
- the name of the ErrorView.cmdCtx
- the CommandContext.ECException
- this helper method throws ECApplicationException if the cardNumber
is specified and is invalid. Note that if one of the parameters is specified, the other must be specified as well.
It is considered an error if only one of the two parameters is present.public java.lang.Long checkFromOrdPayMthdIfAllCreditLineAreActive(java.lang.Long nOrderId)
nOrderId
- the ID of the orderpublic void checkPaymentInfoForDelayedProcess(TypedProperty requestProperties, OrderAccessBean abOrder, java.lang.String errorViewName, CommandContext cmdCtx) throws ECException
This method may call other Task Commands to do the actual checking of the parameters. The
CheckCCNumber
and DoLuhnCheck
.
requestProperties
- the TypedProperty object containing the name-value pairs from the URL.abOrder
- the OrderAccessBean.errorViewName
- the name of the ErrorView. If null, use "DoPaymentErrorView".cmdCtx
- the CommandContext.ECException
- throws ECApplicationException for user correctable errors and ECSystemException
for system type errors related to the site or the JSP or the configuration of the Store that the user
has no direct control.public boolean checkPaymentPolicyAccess(OrderAccessBean abOrder, OrderItemAccessBean[] abOrderItemArray, java.lang.Long nPolicyId)
abOrder
- the OrderAccessBean for the orderabOrderItemArray
- the OrderItemAccessBeans for the order items in the ordernPolicyId
- the ID of the Payment Business Policy to checkpublic boolean checkPaymentPolicyAccess(OrderAccessBean abOrder, java.lang.Long nPolicyId)
abOrder
- the OrderAccessBean for the ordernPolicyId
- the ID of the Payment Business Policy to checkpublic java.lang.Long[] findTAsWithCompatiblePaymentTC(java.lang.Long[] nTAIds, OrderAccessBean abOrder, CommandContext cmdCtx) throws ECException
nTAIds
- an input array containing the TradingIds to check.abOrder
- the OrderAccessBeancmdCtx
- the CommandContext.ECException
public java.lang.Long[] findTAsWithCompatiblePaymentTC(java.lang.Long[] nTAIds, java.util.Set setOfExistingTAIds, CommandContext cmdCtx) throws ECException
findTAsWithCompatiblePaymentTC(Long, Long[], Set, CommandContext)
nTAIds
- the array of Trading Agreement IDssetOfExistingTAIds
- the set of IDs of existing Trading AgreementscmdCtx
- the CommandContextECException
public java.lang.Long[] findTAsWithCompatiblePaymentTC(java.lang.Long nMemberId, java.lang.Long[] nTAIds, java.util.Set setOfExistingTAIds, CommandContext cmdCtx) throws ECException
nMemberId
- the Member ID that identifies the customernTAIds
- the array of Trading Agreement IDssetOfExistingTAIds
- the Set of IDs of existing Trading AgreementscmdCtx
- the CommandContextECException
public java.util.Set findTAsWithCompatiblePaymentTC(java.lang.Long nMemberId, java.util.List lstTAIds, CommandContext cmdCtx) throws ECException
nMemberId
- the member ID that identifies the customer.lstTAIds
- list of Trading Agreement IDs to check.cmdCtx
- the CommandContextECException
public java.lang.Long getBillToAddressIdFromTC(TypedProperty requestProperties) throws ECException
requestProperties
- the TypedProperty object containing the name-value pairs from the URL.ECException
public static PaymentHelper getInstance()
public boolean isCardExpiryDateValid(int expiryMonth, int expiryYear)
expiryMonth
- the calender month of the expiry date (1 for January, 2 for February, and so on.)expiryYear
- the calender year of the expiry datepublic boolean isPaymentPolicyValid(OrderAccessBean abOrder, java.lang.String strPolicyId, TermConditionAccessBean abPayTC, CommandContext commandContext) throws ECException
abOrder
- the OrderAccessBean representing the Order.strPolicyId
- the String representing the Payment Policy ID.abPayTC
- the TermConditionAccessBean representing the Payment Terms and Conditions to use for the purchase. It can be null.commandContext
- the CommandContextECException
public boolean isPaymentPolicyValid(OrderAccessBean abOrder, java.lang.String strPolicyId, java.lang.String strTCId, CommandContext commandContext) throws ECException
abOrder
- the OrderAccessBean representing the Order.strPolicyId
- the String representing the Payment Policy ID.strTCId
- the String representing the ID of the Payment Terms and Conditions to use for the purchase.
This String could be an empty String but cannot be null.commandContext
- the CommandContextECException
public java.lang.String removeSpaceAndHyphenFromString(java.lang.String aCardNumber)
aCardNumber
- the card number to be examined and stripped