com.ibm.commerce.negotiation.commands
Class BidSubmitCmdImpl

com.ibm.commerce.negotiation.commands.BidSubmitCmdImpl
All Implemented Interfaces:
AccCommand, BidSubmitCmd, ControllerCommand, ECCommand, Protectable
Direct Known Subclasses:
AutoBidSubmitCmdImpl

public class BidSubmitCmdImpl
implements BidSubmitCmd

Bid Submit Implementation


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String EC_BID_SUBMIT_ERROR_VIEW_CMD
           
 
Fields inherited from interface com.ibm.commerce.negotiation.commands.BidSubmitCmd
defaultCommandClassName, NAME
 
Constructor Summary
BidSubmitCmdImpl()
          BidSubmitImpl default constructor.
 
Method Summary
protected  void checkBidControlRules(AuctionAccessBean auction, java.math.BigDecimal value)
          Verifies that the current bid/autobid value complies with the associated bid rules.
protected  void deductBidDeposit(java.math.BigDecimal auctionDeposit, BidAccessBean bid)
          Creates/Updates a bid payment deposit entry.
protected  java.lang.String encryptPaymentInfo()
          Encrypts the user's device number.
protected  java.lang.Long getAuctionReferenceNumber()
          Returns the auction reference number for which a bid is being submitted.
protected  java.math.BigDecimal getBestBidBigDeciaml()
          Get the current auction best bid value.
protected  java.lang.String getBestBidValue()
          Get the current auction best bid value.
protected  java.lang.String getBidActionType()
          Returns the current bid action type.
protected  java.lang.String getBidActionValue()
          Returns the current bid action value
protected  java.lang.String getBidCreateTime()
          Returns the time this bid was created.
protected  java.lang.Double getBidQuantity()
          Returns the quantity being bid for.
protected  java.lang.String getBidReferenceKey()
          Returns the reference key for the bid being submitted.
protected  java.lang.String getBidType()
          Returns the current bid type.
protected  java.math.BigDecimal getBidValue()
          Returns the value of the bid being submitted.
protected  java.lang.Long getBillAddrReferenceNumber()
          Returns the bidder's billing address Id.
 int getDeviceExpirationPeriod()
          Get the Device (credit card) maximum expiration period.
protected  java.lang.String getDeviceNumber()
          Returns the Payment Device Number.
protected  java.lang.String getEncryptedPaymentInfo()
          Returns the Payment Encrypted Device Number.
 java.lang.String getFormattedMonetaryAmountValue(java.math.BigDecimal amt)
          Foramtting amount of currency.
protected  java.lang.String getLocalErrorTaskName()
          Returns this command's error task name.
protected  java.util.Hashtable getNVPairs()
          Returns a hash table of name-value pairs.
protected  java.lang.String getPartialDeviceNumber(java.lang.String aNum)
          This method will replace all numbers with 'X' except the last 4 digits for a payment device longer than 4 digits to avoid exposing the whole number when transmitted through the Internet.
 java.lang.String getPaymentInfoString()
          Returns the payment information.
 java.lang.String getPaymentSelectionIndex()
          Returns the payment selection index.
protected  java.lang.String getRedirectUrl()
          Returns url that will be called when the bid is successfully submitted.
protected  TypedProperty getRequestProp()
          Returns current request properties.
 AccessVector getResources()
          This method returns the resources resources accessed by this command It will return null if no resource if being accessed by this command.
protected  java.lang.Long getShipAddrReferenceNumber()
          Returns the shipping address reference number
protected  java.lang.Integer getShipModeReferenceNumber()
          Returns the shipping mode reference number
protected  void handleException(java.lang.Exception e)
          Formats an ECException based on the input exception value.
protected  void initBidData(BidAccessBean bid)
          Initializes bid fields.
protected  boolean isBidderQualified()
          Checks if current Bidder (user) is qualified to Bid on the current auction.
protected  boolean isDeductionAuthorized()
          Returns whether the bidder allowed for money to be deducted.
protected  boolean isPartialQuantityAccepted()
          Returns whether the bidder will accept a partial quantiy.
 boolean isReadyToCallExecute()
          Verifies that the this command is ready to be executed.
protected  boolean isValidAddress(java.lang.Long addressRefNum)
          Sets the Billing Address reference key for which a bid is being submitted.
protected  boolean isValidShippingMode()
          Determines if the specified merchant shipping mode is valid.
 void performExecute()
          Executes a bid submit task.
protected  void saveRequestProp(TypedProperty reqProp)
          Saves current request properties
protected  void setAuctionReferenceNumber(java.lang.String auctionReferenceKey)
          Sets the auction reference number for which a bid is being submitted.
protected  void setBestBidValue(java.math.BigDecimal bestBidVal)
          Set the current auction best bid value
protected  void setBidActionType(java.lang.String type)
          Sets the current bid action type
protected  void setBidActionValue(java.lang.String value)
          Sets the current action to be performed on the bid.
protected  void setBidCreateTime(java.lang.String bidCreateTime)
          Sets the bid create time.
protected  void setBidQuantity(java.lang.String bidQuantity)
          Sets the quantity being bid for.
protected  void setBidReferenceKey(java.lang.String bidReferenceKey)
          Sets the reference key for the bid being submitted.
protected  void setBidType(java.lang.String bidType)
          Sets the type of the bid being submitted.
protected  void setBidValue(java.math.BigDecimal bidValue)
          Sets a new value for the bid.
protected  void setBidValue(java.lang.String bidValue)
          Sets the value of the bid being submitted.
protected  void setBillAddrReferenceKey(java.lang.String billAddrRefKey)
          Determines if the bidder's shipping/billing address is valid.
protected  void setDeductionAuthorized(java.lang.String flag)
          Set the bidder's deduction authorization flag.
protected  void setEncryptedPaymentInfo(java.lang.String encryptedDeviceNumber)
          Sets the bidder payment encrypted device number.
protected  void setLocalErrorTaskName(java.lang.String errorTaskName)
          Sets this command's error task name
 void setNVPairs(java.util.Hashtable newNVPairs)
          Stores the incoming hashtable of name-value pairs.
protected  void setPartialQuantityAccepted(java.lang.String flag)
          Set the bidder's partial quantity flag (optional).
 void setPaymentInfoString(java.lang.String newPaymentInfoString)
          Set payment info string.
 void setPaymentSelectionIndex(java.lang.String newPaymentSelectionIndex)
          Stores the incoming value of the payment selection index.
protected  void setRedirectUrl(java.lang.String url)
          Sets the value for redirect url called upon successful bid submit.
 void setRequestProperties(TypedProperty requestParam)
          Saves the Mandatory and optional command parameter values.
protected  void setShipAddrReferenceKey(java.lang.String shipAddrRefKey)
          Sets the Shipping Address reference key for which a bid is being submitted.
protected  void setShipModeReferenceKey(java.lang.String shipModeRefKey)
          Sets the Shipping Mode reference key for which a bid is being submitted.
protected  void updateAuctionGallery()
          Adds the auction being bid on to the auction gallery, if not already there.
protected  void validateBidReferenceNumber()
          Validate that the current bid reference number is valid.
protected  void validateCreditCard()
          Validates the user's Credit Card number and expiration date.
protected  boolean validBidderStatus()
          Checks that the bidder status is valid for the current auction.
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT

EC_BID_SUBMIT_ERROR_VIEW_CMD

public static final java.lang.String EC_BID_SUBMIT_ERROR_VIEW_CMD
Constructor Detail

BidSubmitCmdImpl

public BidSubmitCmdImpl()
BidSubmitImpl default constructor.
Method Detail

checkBidControlRules

protected void checkBidControlRules(AuctionAccessBean auction,
                                    java.math.BigDecimal value)
                             throws java.lang.Exception
Verifies that the current bid/autobid value complies with the associated bid rules.
Parameters:
auction - AuctionAccessBean - Current auction bean
value - BigDecimal - Bid/Autobid value to be checked.
Throws:
ECException - - thorws an exception if an error occurred while executing the CheckBidControlCmd or the bid does not meet the bid control rule conditions.

deductBidDeposit

protected void deductBidDeposit(java.math.BigDecimal auctionDeposit,
                                BidAccessBean bid)
                         throws java.lang.Exception
Creates/Updates a bid payment deposit entry.
Parameters:
auctionDeposit - BigDecimal
bid - BidAccesBean
Throws:
java.lang.Exception - The exception description.

encryptPaymentInfo

protected java.lang.String encryptPaymentInfo()
                                       throws ECException
Encrypts the user's device number.
Returns:
String - The device number encrypted value.
Throws:
ECException - - throws an exception if encountered during DataCryptCmd command execution.

getAuctionReferenceNumber

protected java.lang.Long getAuctionReferenceNumber()
Returns the auction reference number for which a bid is being submitted.
Returns:
Long - Auction reference number

getBestBidBigDeciaml

protected java.math.BigDecimal getBestBidBigDeciaml()
Get the current auction best bid value.
Returns:
BigDecimal - Auction's Best Bid Value. A null value is returned for auctions with null best bid ids.

getBestBidValue

protected java.lang.String getBestBidValue()
Get the current auction best bid value.
Returns:
String - Auction's Best Bid Value. A null value is returned for auctions with null best bid ids.

getBidActionType

protected java.lang.String getBidActionType()
Returns the current bid action type.
Returns:
String - Bid action type

getBidActionValue

protected java.lang.String getBidActionValue()
Returns the current bid action value
Returns:
String - Bid action value

getBidCreateTime

protected java.lang.String getBidCreateTime()
Returns the time this bid was created.
Returns:
String - Time of bid creation represented in format of (yyyy-mm-dd hh:mm:ss.fffffffff)

getBidQuantity

protected java.lang.Double getBidQuantity()
Returns the quantity being bid for.
Returns:
Double - Bid quantity

getBidReferenceKey

protected java.lang.String getBidReferenceKey()
Returns the reference key for the bid being submitted.
Returns:
String - Bid reference key

getBidType

protected java.lang.String getBidType()
Returns the current bid type.
Returns:
String - Bid Type (regular or auto)

getBidValue

protected java.math.BigDecimal getBidValue()
Returns the value of the bid being submitted.
Returns:
BigDecimal - Bid value

getBillAddrReferenceNumber

protected java.lang.Long getBillAddrReferenceNumber()
Returns the bidder's billing address Id.
Returns:
billing address Id.

getDeviceExpirationPeriod

public int getDeviceExpirationPeriod()
Get the Device (credit card) maximum expiration period.
Returns:
int - The maximum number of years a given device can be valid.

getDeviceNumber

protected java.lang.String getDeviceNumber()
Returns the Payment Device Number.
Returns:
String - Payment Device Number.

getEncryptedPaymentInfo

protected java.lang.String getEncryptedPaymentInfo()
Returns the Payment Encrypted Device Number.
Returns:
String - Payment Encrypted Device Number.

getFormattedMonetaryAmountValue

public java.lang.String getFormattedMonetaryAmountValue(java.math.BigDecimal amt)
                                                 throws ECException,
                                                        ECApplicationException,
                                                        ECSystemException
Foramtting amount of currency.
Parameters:
amt - java.math.BigDecimal
Returns:
java.lang.String
Throws:
ECApplicationException - The exception description.

getLocalErrorTaskName

protected java.lang.String getLocalErrorTaskName()
Returns this command's error task name.
Returns:
tring - Error task name

getNVPairs

protected java.util.Hashtable getNVPairs()
Returns a hash table of name-value pairs.
Returns:
java.util.Hashtable

getPartialDeviceNumber

protected java.lang.String getPartialDeviceNumber(java.lang.String aNum)
This method will replace all numbers with 'X' except the last 4 digits for a payment device longer than 4 digits to avoid exposing the whole number when transmitted through the Internet. For example, 5457 0045 0377 3680 will become xxxx xxxx xxxx 3680.
Parameters:
aNum - java.lang.String
Returns:
java.lang.String

getPaymentInfoString

public java.lang.String getPaymentInfoString()
Returns the payment information.
Returns:
java.lang.String

getPaymentSelectionIndex

public java.lang.String getPaymentSelectionIndex()
Returns the payment selection index.
Returns:
int

getRedirectUrl

protected java.lang.String getRedirectUrl()
Returns url that will be called when the bid is successfully submitted.
Returns:
String - Redirect url

getRequestProp

protected TypedProperty getRequestProp()
Returns current request properties.
Returns:
com.ibm.commerce.datatype.TypedProperty

getResources

public AccessVector getResources()
                          throws ECException
This method returns the resources resources accessed by this command It will return null if no resource if being accessed by this command.
Specified by:
getResources in interface ECCommand
Returns:
Object[] - an array of protectable resources

getShipAddrReferenceNumber

protected java.lang.Long getShipAddrReferenceNumber()
Returns the shipping address reference number
Returns:
Long - Shipping address reference number

getShipModeReferenceNumber

protected java.lang.Integer getShipModeReferenceNumber()
Returns the shipping mode reference number
Returns:
Integer - Shipping mode reference number

handleException

protected void handleException(java.lang.Exception e)
                        throws ECException
Formats an ECException based on the input exception value.
Parameters:
e - Exception - The exception instance to be formatted.
Throws:
ECException - - could be one of many diffrenet exceptions: ECApplicationException. RemoteException, CreateException, FinderException, or NamingException.

initBidData

protected void initBidData(BidAccessBean bid)
                    throws ECException
Initializes bid fields.
Parameters:
bid - BidAccessBean - Referes to the bid bean to be initialized.
Throws:
ECException - - Invalid data was used to set the bean fields.

isBidderQualified

protected boolean isBidderQualified()
                             throws ECException
Checks if current Bidder (user) is qualified to Bid on the current auction.
Returns:
boolean = true if user is qualified, otherwise false
Throws:
ECException - - thorws an exception if an error occurred while executing the bidder qualification task.

isDeductionAuthorized

protected boolean isDeductionAuthorized()
Returns whether the bidder allowed for money to be deducted.
Returns:
boolean = true if money deduction is authorized, otherwise = false.

isPartialQuantityAccepted

protected boolean isPartialQuantityAccepted()
Returns whether the bidder will accept a partial quantiy.
Returns:
boolean = true if partial quantity will be accepted, otherwise = false.

isReadyToCallExecute

public boolean isReadyToCallExecute()
Verifies that the this command is ready to be executed.
Returns:
boolean =true if command is ready, otherwise false.

isValidAddress

protected boolean isValidAddress(java.lang.Long addressRefNum)
                          throws ECException
Sets the Billing Address reference key for which a bid is being submitted.
Parameters:
billAddrRefKey - String - String representation for billing address reference key
Throws:
InvalidParameterValueException - - Throws an exception if the billing address reference number is not numeric.

isValidShippingMode

protected boolean isValidShippingMode()
                               throws ECException
Determines if the specified merchant shipping mode is valid.
Returns:
boolean - true if the shipping mode is valid, otherwise false.
Throws:
ECException - - Encountered a data base error during shipping mode entry lookup.

performExecute

public void performExecute()
                    throws ECException
Executes a bid submit task.
Specified by:
performExecute in interface ECCommand
Throws:
ECException - is thrown if anything goes wrong.

saveRequestProp

protected void saveRequestProp(TypedProperty reqProp)
Saves current request properties
Parameters:
reqProp - com.ibm.commerce.datatype.TypedProperty

setAuctionReferenceNumber

protected void setAuctionReferenceNumber(java.lang.String auctionReferenceKey)
                                  throws InvalidParameterValueException
Sets the auction reference number for which a bid is being submitted.
Parameters:
auctionReferenceKey - String - String representation for auction reference number
Throws:
InvalidParameterValueException - - Throws an exception if the auction reference number is not numeric.

setBestBidValue

protected void setBestBidValue(java.math.BigDecimal bestBidVal)
Set the current auction best bid value
Parameters:
bestBidVal - BigDecimal - Best Bid Value

setBidActionType

protected void setBidActionType(java.lang.String type)
Sets the current bid action type
Parameters:
type - String - Bid Action Type

setBidActionValue

protected void setBidActionValue(java.lang.String value)
Sets the current action to be performed on the bid.
Parameters:
value - String - Bid Action value

setBidCreateTime

protected void setBidCreateTime(java.lang.String bidCreateTime)
Sets the bid create time.
Parameters:
bidCreateTime - String - String representation for bid creation time in JDBC timestamp escape format (yyyy-mm-dd hh:mm:ss.fffffffff)

setBidQuantity

protected void setBidQuantity(java.lang.String bidQuantity)
                       throws InvalidParameterValueException
Sets the quantity being bid for.
Parameters:
bidQuantity - String - String representation for bid quantity
Throws:
InvalidParameterValueException - - Throws an exception if the bid quantity is empty, has all blank characters, or not positive

setBidReferenceKey

protected void setBidReferenceKey(java.lang.String bidReferenceKey)
                           throws InvalidParameterValueException
Sets the reference key for the bid being submitted.
Parameters:
bidReferenceKey - String - String representation for bid reference key
Throws:
InvalidParameterValueException - - Throws an exception if the bid reference key is empty or has all blank characters.

setBidType

protected void setBidType(java.lang.String bidType)
Sets the type of the bid being submitted.
Parameters:
bidType - java.lang.String - Regular or Auto bid type.

setBidValue

protected void setBidValue(java.math.BigDecimal bidValue)
Sets a new value for the bid.
Parameters:
bidValue - BigDecimal

setBidValue

protected void setBidValue(java.lang.String bidValue)
                    throws InvalidParameterValueException
Sets the value of the bid being submitted.
Parameters:
bidValue - String - String representation for bid value
Throws:
InvalidParameterValueException - - Throws an exception if the bid value is empty, has all blank characters, or negative.

setBillAddrReferenceKey

protected void setBillAddrReferenceKey(java.lang.String billAddrRefKey)
                                throws InvalidParameterValueException
Determines if the bidder's shipping/billing address is valid.
Parameters:
Long - addressRefNum - Shipping/Billing address reference number.
Returns:
boolean - true if the shipping/billing address is valid, otherwise false.
Throws:
ECException - - Encountered a data base error during shipping/billing address entry lookup.

setDeductionAuthorized

protected void setDeductionAuthorized(java.lang.String flag)
                               throws InvalidParameterValueException
Set the bidder's deduction authorization flag.
Parameters:
flag - String
Throws:
InvalidParameterValueException - - throws an exception if the deduction authorization flag is not enabled, or has an invalid value.

setEncryptedPaymentInfo

protected void setEncryptedPaymentInfo(java.lang.String encryptedDeviceNumber)
Sets the bidder payment encrypted device number.
Parameters:
encryptedDeviceNumber - String - String representation for payment encrypted device number

setLocalErrorTaskName

protected void setLocalErrorTaskName(java.lang.String errorTaskName)
Sets this command's error task name
Parameters:
errorTaskName - java.lang.String

setNVPairs

public void setNVPairs(java.util.Hashtable newNVPairs)
Stores the incoming hashtable of name-value pairs.
Parameters:
newNVPairs - java.util.Hashtable

setPartialQuantityAccepted

protected void setPartialQuantityAccepted(java.lang.String flag)
Set the bidder's partial quantity flag (optional).
Parameters:
flag - String - Partial quantity flag value

setPaymentInfoString

public void setPaymentInfoString(java.lang.String newPaymentInfoString)
                          throws InvalidParameterValueException
Set payment info string. This is a string contains name/value pairs delimited by semicolon.
Parameters:
newPaymentInfoString - java.lang.String

setPaymentSelectionIndex

public void setPaymentSelectionIndex(java.lang.String newPaymentSelectionIndex)
Stores the incoming value of the payment selection index.
Parameters:
newPaymentSelectionIndex - int

setRedirectUrl

protected void setRedirectUrl(java.lang.String url)
                       throws InvalidParameterValueException
Sets the value for redirect url called upon successful bid submit.
Parameters:
url - String - url string
Throws:
InvalidParameterValueException - - Throws an exception if the url string contains only blank characters.

setRequestProperties

public void setRequestProperties(TypedProperty requestParam)
                          throws ECApplicationException
Saves the Mandatory and optional command parameter values.
Specified by:
setRequestProperties in interface ControllerCommand
Parameters:
TypedPropery - requestParam - Request properties
Throws:
ECApplicationException: - An exception is returned if any of the mandatory parameters are missing, or invalid

setShipAddrReferenceKey

protected void setShipAddrReferenceKey(java.lang.String shipAddrRefKey)
                                throws InvalidParameterValueException
Sets the Shipping Address reference key for which a bid is being submitted.
Parameters:
shipAddrRefKey - String - String representation for shipping address reference key
Throws:
InvalidParameterValueException - - Throws an exception if the shipping address reference number is not numeric.

setShipModeReferenceKey

protected void setShipModeReferenceKey(java.lang.String shipModeRefKey)
                                throws InvalidParameterValueException
Sets the Shipping Mode reference key for which a bid is being submitted.
Parameters:
shipModeRefNum - String - String representation for shipping mode reference key
Throws:
InvalidParameterValueException - - Throws an exception if the shipping mode reference key is not numeric.

updateAuctionGallery

protected void updateAuctionGallery()
                             throws ECException
Adds the auction being bid on to the auction gallery, if not already there.
Throws:
ECException - - On error looking up the auction in the member-auction-relation table, creating a new entry in the same table

validateBidReferenceNumber

protected void validateBidReferenceNumber()
                                   throws ECException
Validate that the current bid reference number is valid.
Throws:
ECException - - thorws an exception if an error occurred while executing the check bid reference number task, when bid reference number is invalid.

validateCreditCard

protected void validateCreditCard()
                           throws ECException
Validates the user's Credit Card number and expiration date. Luhn standard check will be used if the credit card number was not found in the CCCHECK table.
Throws:
ECException - - throws an exception if encountered during CheckCCNumberCmd command execution.

validBidderStatus

protected boolean validBidderStatus()
                             throws ECException
Checks that the bidder status is valid for the current auction.
Returns:
boolean - true if bidder status is valid, otherwise false.
Throws:
ECException - - An exception is thrown if encountered an while showing the bidder the auction rules.