• Welcome to KonaKart Community Forum. Please login or sign up.
 

Question about PaymentGateway and GetPaymentDetails

Started by ReLLiK75, January 22, 2009, 03:18:00 pm

Previous topic - Next topic

ReLLiK75

I'm trying to understand how the SOAP API is able to work with the KK servlet engine to call the payment gateway.  For example, if I use the following code to create my order:

                   //Create the Order
                    Order order = kkServerApi.createOrderWithOptions(KKSessionID, basketItems, orderOptions, -1);

                    //Get shipping quotess for all installed shipping modules
                    ShippingQuote[] shippingQuotes = getShippingQuotes(order);

                    //Assign the default shipping method to the order
                    if (shippingQuotes.Length > 0)
                        order.shippingQuote = shippingQuotes[0];

                    order = kkServerApi.getOrderTotals(order, -1);

                    //Get payment details for specified payment gateway
                    order.paymentDetails = kkServerApi.getPaymentDetailsPerOrder(KKSessionID, "usaepay", order, kkServerApi.Url, -1);

                    order.paymentDetails.ccNumber= some_number;
                    order.paymentDetails.ccExpiryYear= year;
                    order.paymentDetails.ccExpiryMonth = month;
                    order.paymentDetails.ccOwner=owner;
                    order.paymentDetails.ccType=type;

                   order.id=kkServerApi.saveOrder(KKSessionID, order, -1);

I would expect that by calling saveOrder with the paymentDetails populated, that KonaKart would automatically invoke the UsaepayAction class (provided it's been enabled in the Admin console).  However, this is not the case.  The gateway never gets called and there are no SOAP APIs to forcefully invoke the gateway or to get the response from the gateway, had it been automatically invoked by KonaKart.

Am I missing something here?

The workaround for me has been to write my own SOAP based payment gateway invoker that calls the payment service directly through my C# backend, and then build up the IPNHistory object with the results I get back from submitting a payment to the sandbox.  My concern with doing it this way is that I'm not capturing something that KK captures automatically.  For example, credit card number.  I've read in previous posts on the forum that the CC number is supposed to be returned by ccNumber field on the order object.  Even if I manually set those values before calling saveOrder, it doesn't appear that the credit card info is being saved with the order because I'm not using the KonaKart servlet engine to send the payment.

Aside from using the custom fields, what am I doing wrong?

Thanks!


trevor

The data posts to the gateways are done in BaseGatewayAction.java. They aren't done in the KK server engine since this may not have such access to the internet for security reasons. In fact the struts code and kk client engine are sometimes deployed in a less secure area and communicate to the kk server engine (which is in a more secure area) through SOAP calls.