Class PIAddCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, AEDPCtrlCmd, PIAddCmd, Protectable,,,,,,

    public class PIAddCmdImpl
    extends AEDPPIEditCtrlCmdImpl
    implements PIAddCmd

    This is the default implementation of the PIAddCmd controller command.

    Input parameters:

    Name Description
    orderId The identifier of the order to which the payment method is to be added. Mandatory.
    unbound The flag that indicates if the payment instruction to be added is an unbound one or not.
    URL The URL to be redirected when the command completes successfully. Mandatory.
    piAmount The amount in the order currency to be used for this payment method. The format of this number must fit the rules for a java.math.BigDecimal object. The number must use a period for a decimal place. Mandatory
    policyId The payment policy identifier. It is the primary key of the payment business policy table. (Table POLICY with column policytype_id = 'Payment'). If this parameter is missing, then payMethodId should be mandatory, and this command tries to get the policy identifier from business policy table via the policy name as payMethodId.
    payMethodId The payment method name. It is the policy name of the payment business policy table. (Table POLICY with column policytype_id = 'Payment'). If policyId is passed in, this parameter is not required since this command always sets it as the policy name from business policy table via the policyId.
    protocolData Additional name-value pairs that will be passed to the payment plug-in or payment processor as additional data required by that payment protocol. For example, for a credit card, cc_brand=AMEX.
    purchaseorder_id The purchase order number specified to the order. This parameter is optional. If it is set, the value of the purchase order number will send back to the response properties to be displayed in the page.
    errorViewName The view name which is redirected to when the execution fails. If this parameter is provided, the default error view name is PaymentInstructionErrorView.
    billing_address_id The billing address identifier in WebSphere Commerce instance.
    paymentTCId The payment Term & Condition identifier for this payment instruction. This parameter is used by the business customer.
    valueFromPaymentTC The flag to indicate: Whether the payment protocol data should be extracted from the payment Term&Condition identified by paymentTCId parameter. And whether ignore any protocol data passed in the request properties. The value includes "true" and "false", the default value is "false".
    valueFromProfileOrder The flag to indicate: whether the payment protocol data should be extracted from the user's quick checkout profile. And whether ignore any protocol data passed in the request properties. The value includes "Y" and "N", the default value is "N".

    Output parameters:



    If the parameter of "unbound" is true, this command will invoke the AddUnboundPITaskCmd to add one unbound/dummy payment instruction for the given payment method will be created. This payment instruction does not have any other information. Else if the unbound is not passed, or it is false, then it does the normal logic blow. Adds a payment instruction to an existing order. Calls the EditCmd task command to add the payment instruction to the order.
    • Validates that the required parameters are passed: orderId, policyId or paymentMethodId, piAmount, and URL. If policyId is not passed in, use paymentMethodId to find out the policy identifier.
    • Check if the order is locked by other CSR, throw exception if it is locked. If the order is not locked and this request is called by CSR, lock the order object.
    • Creates an EDPPaymentInstruction with the payment policy ID, the amount, and any payment protocol data supplied (protocol data specified as name-value pairs).
    • Adds the EDPPaymentInstruction to an empty list.
    • Calls the EditCmdtask command with the list of payment methods, the total order amount and the orderId. The total order amount is calculated from total product price, total tax, total shipping, total shipping tax, total adjustment.
    • Examines the results of the task command for an error and redirects to an error page. Otherwise, it redirects to the URL that was passed as a parameter.

    Task commands called:

    See Also:
    EditCmd, AddUnboundPITaskCmd, Serialized Form
    • Field Detail


        public static final java.lang.String COPYRIGHT
        The IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PIAddCmdImpl

        public PIAddCmdImpl()
        The default constructor.
    • Method Detail

      • setAddedPaymentInstructionId

        public void setAddedPaymentInstructionId(java.lang.Long paymentInstructionId)
        This method sets the payment instruction Id
        paymentInstructionId -
      • getAddedPaymentInstructionId

        public java.lang.Long getAddedPaymentInstructionId()
        This method returns the Id of the added payment instruction
        Specified by:
        getAddedPaymentInstructionId in interface PIAddCmd
        a long that specify the id of the new payment instruction
      • fetchAddedPaymentInstructionId

        public void fetchAddedPaymentInstructionId(EDPEditResults edpEditResults)
        This method fetchs the Id of the newly added payment instruction according to the returned edpEditResults
        edpEditResults - a result object returned from payment rules task commands.
      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the actual business logic of the command, which adds a new payment instruction in payment rules subcomponent.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface
        performExecute in class AbstractECTargetableCommand
        ECException - if something fails
      • reset

        public void reset()

        This method resets the command fields.

        After this method is invoked, and proper attributes are set, the command can be executed again.

        Specified by:
        reset in interface
        reset in class AEDPPIEditCtrlCmdImpl