com.ibm.commerce.edp.commands

Class ChangePaymentCurrencyTaskCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, AEDPPaymentTaskCmd, AEDPTaskCmd, ChangePaymentCurrencyTaskCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class ChangePaymentCurrencyTaskCmdImpl
    extends AEDPPaymentTaskCmdImpl
    implements ChangePaymentCurrencyTaskCmd
    This is the default implementation of the ChangePaymentCurrencyTaskCmd task command.

    Behaviour:

    • When a shopper changes his/her preferred currency. Order component will change the currency for all his/her shopping carts. As the order object inside payment rules engine subcomponent is created during the shopping cart is created. Some payment instructions may be added against the shopping cart at the same time. The currency of the order and the payment instructions inside payment component should be changed too. This command is called by OrderProcessingHelper when the currency of order has been changed.

    Input parameters:

    commandContext The command context.
    orderId A Long that specifies current order id..

    Output parameters:

    None.

    Task commands called:

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • ChangePaymentCurrencyTaskCmdImpl

        public ChangePaymentCurrencyTaskCmdImpl()
    • Method Detail

      • setMonetaryAmount

        public void setMonetaryAmount(MonetaryAmount aMonetaryAmount)
        This method sets the current monetary amount object, which contains the value and the currency.
        Parameters:
        aMonetaryAmount - A MonetaryAmount that represents the current monetary amount object.
      • getMonetaryAmount

        public MonetaryAmount getMonetaryAmount()
        This method returns the current monetary amount object, which contains the value and the currency.
        Returns:
        The current monetary amount object.
      • setOrderTotalAmount

        public void setOrderTotalAmount(java.math.BigDecimal newAmount)
        This method sets the total amount of current order, since here the currency has been changed, the total amount is based on the new currency.
        Specified by:
        setOrderTotalAmount in interface ChangePaymentCurrencyTaskCmd
        Parameters:
        newAmount - A BigDecimal that specifies the new total amount of the order based on the new currency.
      • getOrderTotalAmount

        public java.math.BigDecimal getOrderTotalAmount()
        This method returns the total amount of current order, since here the currency has been changed, the total amount is based on the new currency.
        Returns:
        The new total amount of the order based on the new currency.
      • getOrderNewCurrency

        public java.lang.String getOrderNewCurrency()
        This method returns the new currency of the order.
        Returns:
        The new currency of the order.
      • setOrderNewCurrency

        public void setOrderNewCurrency(java.lang.String newCurrency)
        This method sets the new currency to the Order.
        Specified by:
        setOrderNewCurrency in interface ChangePaymentCurrencyTaskCmd
        Parameters:
        newCurrency - A String that specifies the new currency of the order.
      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the business logic of this command implementation.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - This exception is thrown when any kind of EDPExceptions catched.
      • isBgJobInWorking

        public boolean isBgJobInWorking()
                                 throws InternalException,
                                        J2EEException,
                                        InputException
        This method returns the current pending status of the order. This actually checks the background Job Status.
        Overrides:
        isBgJobInWorking in class AEDPPaymentTaskCmdImpl
        Returns:
        A boolean that represents if the order is in pending status, from a BG task perspective.
        Throws:
        InternalException - This exception is thrown when an internal logic error is detected.
        J2EEException - This exception is thrown when EJBs cannot be accessed.
        InputException - This exception is thrown when an invalid order id / store id combination is provided in the request.
      • ifAtomicPaymentsExist

        public boolean ifAtomicPaymentsExist(java.lang.Long piId)
                                      throws J2EEException,
                                             InputException
        This method judges if any atomic payments of a payment instruction exists. It is called by performExecute().
        Parameters:
        piId - A Long that represents the current payment instruction id.
        Returns:
        A boolean that represents if any atomic payments of a payment instruction exists.
        Throws:
        J2EEException - This exception is thrown when EJBs cannot be accessed.
        InputException - This exception is thrown when an invalid order id / store id combination is provided in the request.
      • setBgJobStatusInDb

        public void setBgJobStatusInDb(java.lang.Integer bgJobStatus)
                                throws J2EEException,
                                       InputException
        This method sets the BG status on the current EDPOrder .
        Overrides:
        setBgJobStatusInDb in class AEDPPaymentTaskCmdImpl
        Parameters:
        bgJobStatus - An Integer that specifies the new backend job status of current EDPOrder .
        Throws:
        J2EEException - This exception is thrown if EJBs cannot be accessed.
        InputException - This exception is thrown if an invalid status or invalid order is selected.
      • 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 com.ibm.websphere.command.Command
        Overrides:
        reset in class AEDPPaymentTaskCmdImpl