Handle exceptions nicely - some of these should redirect to an error
page for the user.

Add in tests for invalid responses from pxpay gateway

Add in tests for unsuccessful transactions

There are a few of dependencies on plone

1) the tests - which depend on PloneGetPaid test harness
2) PloneGetPaid product - which depends on plone
3) grabbing a portal url in the PXPayPaymentAdapter

There is an issue with getting context in one of the tests where line
items do not provide it. The following patch for getpaid.core.payment
helps out here. Need to investigate this more. This error won't happen
in an normal shop, and we could avoid it by making the test order
contain a line item that gives context, but it would be nice to fix
the root of the problem itself in the core.

Index: src/getpaid.core/src/getpaid/core/payment.py
===================================================================
--- src/getpaid.core/src/getpaid/core/payment.py        (revision 1576)
+++ src/getpaid.core/src/getpaid/core/payment.py        (working copy)
@@ -29,6 +29,7 @@

 from getpaid.core import interfaces, options
 from zope import component, interface
+from zope.app import zapi

 class Address( options.PersistentBag ): pass
 Address.initclass( interfaces.IAddress  )
@@ -82,7 +83,6 @@
     def __call__( self, event ):
         if event.destination != interfaces.workflow_states.order.finance.CHARGING:
             return
-
         # on orders without any cost, forgo invoking the payment processor
         price = self.order.getTotalPrice()
         if not price > 0:
@@ -91,8 +91,11 @@
         # ick.. get a hold of the store
         # this is a little gross, we need some access to context, so we fetch line items
         # till we find something that resolves to an object, and try to get the store from that
-        #
-        context = component.queryUtility( interfaces.IStore )
+        #
+        sm = zapi.getSiteManager()
+        from Products.CMFCore.utils import getToolByName
+        context = getToolByName( sm, 'portal_url').getPortalObject()
+
         if context is None:
             from Products.CMFCore.utils import getToolByName
             ob = None
