[checkout] create a new payment type and add address form

anonimlt

Joined: 2010-02-11
Posts: 26
Posted: Thu, 2010-02-11 21:29

I am trying to integrate a new payment gateway for checkout plugin. As a base I have taken checkoutpaypal module. (almost) Everything works, but I would like to have have the possibility to show a form where a non-logged in user must fill-in its details (email, name etc), otherwise I will have no idea who paid for the order. In case of Paypal the user name is returned from the Paypal account, but in my case I need to fill in transaction details (name and email) before redirecting to the payment gateway (payment gateway does not require buyer's name and address in contrast to Paypal). I tried to do in a similar way as in checkoutemail, the form is shown, but when I click the submit button I get redirected to the checkout complete instead of to the payment gateway. Maybe someone could tell me how to do that:
1.where and how should I place redirect correctly to the buyer details fill-in form in case the user is not logged in user?
2. how to redirect from the fill-in form to the payment gateway passing the correct parameters from payment gateway settings?
I cannot figure out the 2nd issue, I think I have .
Thank you in advance

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2010-02-12 01:00
Quote:
(almost) Everything works,

Quote:
I would like to have have the possibility to show a form where...

There's a big disparity between these two things - what you're saying is that almost everything works, except the difficult bit that's actually most of the work. Getting the execution flow right is difficult, and requires a thorough and solid understanding of the G2 framework, with respect to controllers, views (and the underlying model). This I cannot teach you. You also need a thorough understanding of the checkout API, which I *can* help you with.

Which payment gateway are you attempting to integrate?

EDIT: also take a look at the checkoutnochex module which does (I think) work the way you want.

 
anonimlt

Joined: 2010-02-11
Posts: 26
Posted: Fri, 2010-02-12 15:39

I have looked at the nochex, but it does not work as a payment mode. I don't know why. It installed with no errors. Well I have managed to collect customer's details and I'm stuck at the same place- I don't know how to send collected data to the payment gateway.
there are 3 urls to pass to the gw:
1. postback - confirmation on successful receipt of payment is sent to this url from the gw
2. Accepturl - on success
3. cancel - on fail
I can see how to post to the gw from this

Quote:
$results['redirect']['view'] = 'checkoutnochex.SendData';

but in my case nothing happens. It seems there is no redirect to the SendData. I will investigate this

 
anonimlt

Joined: 2010-02-11
Posts: 26
Posted: Sat, 2010-02-13 18:35

Is there a working version of checkoutnochex module? It installs correctly, but nochex does not appear as a payment option.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2010-02-13 20:45

Let me try installing it here so I can check. I thought it was working, but I haven't used it for a while so I'm not 100% sure it's up to date with the latest changes to the checkout core.

Which is the new payment gateway you're trying to implement?

 
anonimlt

Joined: 2010-02-11
Posts: 26
Posted: Sun, 2010-02-14 21:56

I have fixed something in the nochex code, so it now appears as an available payment option and it posts to the nochex website, but I don't have an account with them, so I cannot tell is everything OK with it.
I have almost implemented a webtopay.com payment gateway. One of the issues not clear is how the gateway response is processed. e.g. I can see the following link for the accepturl in the webpage source

Quote:
main.php?g2_controller=checkout.Complete&g2_transactionId=126&g2_verify1=1266183758&g2_verify2=201954b786e4eaac5a9.06442909&g2_authToken=93d13bd8e430

but if I try to paste this link into the browser, I get an error.
I can see that nochex uses controller=checkout.OrderComplete instead of controller=checkout.Complete. What is the correct way having in mind all those controller/view classes?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2010-02-14 22:32
Quote:
but if I try to paste this link into the browser, I get an error.

Unescape the & back to & - and you might have a problem because the authtoken is expired.

Quote:
I can see that nochex uses controller=checkout.OrderComplete instead of controller=checkout.Complete.

Should be checkout.Complete

What did you have to change in checkoutnochex? I'm actually wondering if the latest version is in the repository, or if I have something more recent locally that never got uploaded. (There was never any enthusiasm for NoChex - I don't think anyone is using that module.)

 
anonimlt

Joined: 2010-02-11
Posts: 26
Posted: Tue, 2010-02-16 12:38

I have changed

Quote:
$transactionId = unserialize($session->get('checkoutemail.transactionId'));

to

Quote:
$transactionId = $session->get('checkout.transactionId');

unserialize did not work for me in other module too. I simply used $session->get(..)and it worked. also there were syntax errors in files, single colon (":") used instead of double one, e.g.

Quote:
GalleryCheckoutApi::getCurrentTransactionForPayment();

I have attached a zip file.
I have gallery 2.3.1 installed.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2010-02-16 12:54
Quote:
$transactionId = $session->get('checkout.transactionId');

Actually that's deprecated. You should use GalleryCheckoutAPI::getCurrentTransactionForPayment(). In future the transaction will not be stored in the session.