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

How to invoke paymet gateway from WS API

Started by shadders, May 17, 2011, 08:23:37 am

Previous topic - Next topic

shadders

I'm building a wicket front end for konakart and I've got to the part where I want to test building orders and confirming payment.

I've been through the com.konakart.apiexamples.InsertOrder example but it just kind of skips over the payment part and assumes it's happened.

I've run the example and can see the orders in the admin interface but they show nothing for the payment info.  I came across this post: http://www.konakart.com/forum/index.php/topic,719.msg3240/topicseen.html#msg3240 That talks about the BaseGatewayAction class.  I'm actually using Eway_au gateway module.  This is what I've got so far


PaymentDetailsIf[] pGateways = eng.getPaymentGateways(order, DEFAULT_LANGUAGE);
            if (pGateways != null && pGateways.length > 0)
            {
            for (PaymentDetailsIf gw: pGateways) {
            System.out.println(gw.getRequestUrl());
            System.out.println(gw.getDescription());
            System.out.println(gw.getPostOrGet());
            System.out.println(gw.getPaymentType());
            System.out.println(gw.getCode());
            System.out.println(gw.getTitle());
            System.out.println("--------");
           
            }
                order.setPaymentDetails(pGateways[0]);
                order.setPaymentModuleCode(pGateways[0].getCode());
                order.setPaymentMethod(pGateways[0].getCode());
            }
Eway_auAction eway = new Eway_auAction();
System.out.println(eway.postData(order.getPaymentDetails(), new ArrayList()));
           


Which results in java.net.MalformedURLException

It seems that System.out.println(gw.getRequestUrl()); outputs null but in the admin interface it's set to https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp

If I set the URL manually I get

java.lang.NullPointerException
   at com.konakart.actions.gateways.BaseGatewayAction.hashParameters(Unknown Source)
   at com.konakart.actions.gateways.Eway_auAction.getGatewayRequest(Unknown Source)
   at com.konakart.actions.gateways.BaseGatewayAction.postData(Unknown Source)
   at com.konakart.apiexamples.InsertOrder.main(InsertOrder.java:214)

Could someone post a working example of a call to a payment gateway?


trevor

QuoteI'm building a wicket front end for konakart


Great. As far as I'm aware http://www.savvyshop.nl/home is also a KK / Wicket store.

You have the source code for BaseGatewayAction, so what I suggest is that you copy the postData() method from that class into your framework and just debug it through.

shadders

Happy to debug it but can I confirm that postData(PaymentDetailsIf, List<NameValueIf>) is the correct entry method to invoke the payment?

Am I supposed to passing anything in the NameValueIf list?

trevor

Take a look at Eway_auAction.java which calls the postData() method. The list contains the parameters that get sent to the payment gateway. These are created bythe Eway payment module on the server.