OrderCreateXML message does not contain OrderItem and payment related information Technote
(troubleshooting)Problem(Abstract) You notice the XML Message (OrderCreateXML) does not contain OrderItem and payment related information. The JSP file refers to a deprecated payment table in version 5.6.x that is empty when using the payment plug-in. Cause The OrderCreateXML.jsp file refers to the payment architecture that was used in version 5.6.x. Resolving the problem
Sample OrderCreateXML.jsp Sample code to retrieve version 6.0 payment information from the OrderCreateXML.jsp file
Sample OrderCreateXML.jsp
The following code sample provides an example of an OrderCreateXML.jsp file that uses the payment plug-in and organizes information in the following format:
<PaymentInstruction>
<PaymentMethod>VISA</PaymentMethod>
<MonetaryAmount currency="USD">10.00000</MonetaryAmount>
<CardType>VISA</CardType>
<CardNumber>4111111111111111</CardNumber>
<CVV>123</CVV>
<ExpirationMonth>03</ExpirationMonth>
<ExpirationYear>2008</ExpirationYear>
<BillingAddress>11301</BillingAddress>
</PaymentInstruction>
<PaymentInstruction>
<PaymentMethod>Master Card</PaymentMethod>
<MonetaryAmount currency="USD">20.00000</MonetaryAmount>
<CardType>MasterCard</CardType>
<CardNumber>4111111111111111</CardNumber>
<ExpirationMonth>03</ExpirationMonth>
<ExpirationYear>2008</ExpirationYear>
<BillingAddress>11301</BillingAddress>
</PaymentInstruction>
<PaymentInstruction>
<PaymentMethod>COD</PaymentMethod>
<MonetaryAmount currency="USD">30.00000</MonetaryAmount>
<BillingAddress>11301</BillingAddress>
</PaymentInstruction>
<PaymentInstruction>
<PaymentMethod>BillMeLater</PaymentMethod>
<MonetaryAmount currency="USD">19.99000</MonetaryAmount>
<BillingAddress>11301</BillingAddress>
</PaymentInstruction>
This payment XML data should contain the information that is entered during the checkout shopping sequence. If include an additional field in the XML, use the following code sample to retrieve the version 6.0 payment information from the OrderCreateXML.jsp file.
Sample code to retrieve version 6.0 payment information from the OrderCreateXML.jsp file
//EDPInfo
com.ibm.commerce.command.CommandContext commandContext =
(com.ibm.commerce.command.CommandContext) request.getAttribute(ECConstants.EC_COMMANDCONTEXT);
java.util.ArrayList paymentInstructions = (java.util.ArrayList) com.ibm.commerce.payment.rules.EDPServices.getQueryHandler().getPaymentInstructionsInOrder(commandContext.getStoreId(),commandContext.getLocale(),odb.getOrderChannelTypeId(),commandContext,new Long(orderId),false);
for (int i = 0; i <paymentInstructions.size(); i++) {
com.ibm.commerce.edp.api.EDPPaymentInstruction pi = (com.ibm.commerce.edp.api.EDPPaymentInstruction)paymentInstructions.get(i);
if (pi.getPaymentMethod() != null)
{
out.println("<PaymentInstruction>");
if(!pi.getPaymentMethod().equals("")){
out.println("<PaymentMethod>"+ pi.getPaymentMethod()+"</PaymentMethod>");
}
if (pi.getAmount() != null)
{
if (currString != null){
out.println("<MonetaryAmount currency=\""+currString+"\">"+pi.getAmount()+"</MonetaryAmount>");
}
else{
out.println("<MonetaryAmount>"+pi.getAmount()+"</MonetaryAmount>");
}
}
if (pi.getProtocolData().get("cc_brand") != null){
out.println("<CardType>"+(String) pi.getProtocolData().get("cc_brand")+"</CardType>");
}
if(pi.getProtocolData().get("account") != null){
out.println("<CardNumber>"+(String) pi.getProtocolData().get("account")+"</CardNumber>");
}
if(pi.getProtocolData().get("cc_cvc") != null){
out.println("<CVV>"+(String) pi.getProtocolData().get("cc_cvc")+"</CVV>");
}
if (pi.getProtocolData().get("expire_month") != null ) {
out.println("<ExpirationMonth>"+(String)pi.getProtocolData().get("expire_month") +"</ExpirationMonth>");
}
if (pi.getProtocolData().get("expire_year") != null ) {
out.println("<ExpirationYear>"+(String)pi.getProtocolData().get("expire_year") +"</ExpirationYear>");
}
if (pi.getProtocolData().get("billing_address_id") != null ) {
out.println("<BillingAddress>"+(String)pi.getProtocolData().get("billing_address_id") +"</BillingAddress>");
}
out.println("</PaymentInstruction>");
}
}
The sample code contained in this document is meant to serve as a starting point for customization. IBM is not responsible for this sample code.
Document Information Current web document: http://www.ibm.com/support/docview.wss?uid=swg21299350