Posts

Showing posts with the label ControllerCommand

IBM WebSphere Commerce - Payment related debugging - AEDPPIEditCtrlCmdImpl getOrderIdByEDPPIID

Here I am going to share my recent experience in debugging a payment related issue. This issue started occurring all of a sudden without any recent changes to the code. All the orders were failing after entering the payment information. Error log for the issue was as below. [9/27/17 0:31:23:137 EST] 0000002e CommerceSrvr A AEDPPIEditCtrlCmdImpl getOrderIdByEDPPIID Object of type payment instruction with primary key 79,172 could not be found in the database. [9/27/17 0:31:23:139 EST] 0000002e ExtendedInfo I CWXFR9010I: Extended information : [URL=http://localhost/webapp/wcs/stores/servlet/webapp/wcs/stores/servlet/XPaymentProcessCmd] [parameters=signature=+Yuun7p7fwRo6hgHvdf4CBz2lNvrKUN/BtKbQZgFsue= encryptedparameters=2SDSwUkztXgotmmLbKuB+P2ZoiX1Rd65ai3932yezsdHLI2wb1deUvHoNKzaP9KvXsedZd0SgLBWjv+COHyZXTLyFEDXBcfCcYBFzkgTc2JdTl3XAjKai4KbGp0sJ8haesjbeZKIavF6AK7LjdsF05guWvsEkQ6ymn7OvK9UvLrIQDTT1/UNW4i9G/qXJ3WIYp3H8E1BCHS+HfFj/1wS/ORpartRTNxwYCloHwT4qjPVr/toH2LWtzNTICMEdgJ4We+SzSS...

IBM WebSphere Commerce - PriceRule related debugging - ResolveOrderItemPriceCmdImpl handleNullPriceException

Image
Couple of months back in my work I was assigned with an issue of Add to cart not working in our toolkit environment. The error logs was like below. [8/1/17 16:43:34:296 CEST] 0000015c CommerceSrvr A com.ibm.commerce.orderitems.commands.ResolveOrderItemPriceCmdImpl handleNullPriceException CMN1011E: Unable to retrieve the price for catEntry 420472, quantity: 1.0, unit of measure: C62, and currency: null. [8/1/17 16:43:34:297 CEST] 0000015c ExtendedInfo I CWXFR9010I: Extended information : [URL=http://localhost/webapp/wcs/stores/servlet/AjaxOrderChangeServiceItemAdd] [parameters=calculationUsage=-1,-2,-3,-4,-5,-6,-7 orderId=. quantity=1 catalogId=15451 langId=-1 catEntryId=420472 storeId=11352 ] [userId=-1002] [8/1/17 16:43:34:298 CEST] 0000015c MessageMappin C com.ibm.commerce.foundation.server.command.soi.MessageMappingCmdImpl createBusinessObjectDocumentResponse(CommandProperty, ControllerCommand) No customized message mapping error or response cmd found for errorCommand: ...

Adding new cookie from controller command - IBM WebSphere Commerce

In a previous post we have seen how to fetch a cookie value in controller command . Here in this post we will see how to add a new cookie from a controller command. For fetching the cookie value in controller command we first obtained the http servlet request object from the command context. But in order to add a new cookie we need to get the http servlet response object. Below is sample code to get the http servlet response object from command context, create a new cookie and to add the cookie to the response. RuntimeHttpServletResponseWrapper httpServletRes = (RuntimeHttpServletResponseWrapper) ((CacheProxyResponse) (((ViewCommandContext) getCommandContext()).getResponse())) .getResponse(); Cookie cookie = new Cookie("MyCookie", "MyCookieValue"); //optionally you may use these methods to set other parameters as required //cookie.setDomain() //cookie.setMaxAge() //cookie.setPath() httpServletRes.addCookie(cookie); Hope t...

Enabling the shipment notification e-mail - IBM WebSphere Commerce

In WebSphere Commerce you need to make following configuration change for enabling shipment notification e-mail. The default command registry entry is mapped to ReleaseShipNotifyDummyImpl which does nothing. If you change the mapping to ReleaseShipNotifyCmdImpl it will enable the application to send notification message when the order release is shipped. Procedure Update the CMDREG mapping for ReleaseShipNotifyCmd: update cmdreg set classname='com.ibm.commerce.messaging.commands.ReleaseShipNotifyCmdImpl' where interfacename='com.ibm.commerce.messaging.commands.ReleaseShipNotifyCmd' By default, the Release_WCS_ShipmentNotify message is disabled by using ReleaseShipNotifyDummyImpl as the CLASSNAME in the CMDREG database table. The ReleaseShipNotifyDummyImpl is a dummy implementation which does nothing. The default JSP, ReleaseShipNotify.jsp, for the XML message is located in the following directory: WC_eardir/Stores.war Deploy updates to this file using...

Fetching PIs (Payment Instructions) for an order - IBM WebSphere Commerce

Payment instructions of an order is stored in PPCPAYINST database table. This post is about the usage of QueryPIsCmd task command which can be used to fetch all the payment instructions for an order. The default implementation of this command is QueryPIsCmdImpl. Below is a sample code snippet to fetch already added PIs for an order. QueryPIsCmd queryPICmd = (QueryPIsCmd) CommandFactory.createCommand("com.ibm.commerce.edp.commands.QueryPIsCmd", storeId); queryPICmd.setCommandContext(commandContext); queryPICmd.setOrderId(new Long(orderId)); queryPICmd.execute(); ArrayList pis = queryPICmd.getPIs(); Hope this help someone. Feel free to share this page with your friends and colleagues. Thanks..!

Applied promotions of an order - IBM WebSphere Commerce

In this post we will see how we can get the name and other details of promotions already applied to an order from a controller command. These details are stored in the PX_PROMOARG table in XML format. So for this task we need to fetch the PromotionArgument object for the order from the PX_PROMOARG table. This is achieved using PromotionArgumentSessionBeanPersistenceManager, this class provides a load() method which accepts OrderKey using which we can load the PromotionArgument for the order. From the PromotionArgument we can get the list of PromotionExecutionRecords. Below is sample code to get all the promotions applied to an order and print the name and description of the promotions. OrderKey ordKey = new OrderKey(new Long(orderId)); PromotionArgumentSessionBeanPersistenceManager promoManager = new PromotionArgumentSessionBeanPersistenceManager(); PromotionArgument promArg = promoManager.load(ordKey); Iterator prmoExeRecds = promArg.getPromotionExecutionRecords(); ...

Fetching cookie value in controller command - IBM WebSphere Commerce

As WebSphere Commerce developers we may sometimes work on scenarios where we need to read a particular cookie value in controller command. Usually lot of developers use cookies as a simple technique to store some value only for a session and when not required to be saved in the database for future use. Recently, I have came across a business requirement where I have to add a cookie from the front-end (using Javascript) and write some logic in the back-end using the cookie value. Below is the code I have used to iterate over the list of cookies and fetch the value of the required one in a controller command. String cookieName = "MyCookieName"; HttpServletRequest httpServletReq = ((HttpControllerRequestObject) (((ViewCommandContext) getCommandContext()).getRequest())) .getHttpRequest(); Cookie[] cookies = httpServletReq.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookieName.equals(cookie.ge...