Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

PaymatePayment_Handler Paid function - issues accessing response data


Go to End
Reply


9 Posts   1609 Views

Avatar
mschiefmaker

Community Member, 187 Posts

22 November 2009 at 5:29pm

Edited: 23/11/2009 8:02am

Hi

I have got the as far as sending the order information to Paymate, completing the order and then returning to the website. I get stuck when I try to retreive the information that Paymate has reutrned.

I have the code class PaymatePayment_Handler extends Controller {
   /**
    * Get the Order object to modify, check security that it's the object you want to modify based
    * off Paymate confirmation, update the Order object to show complete and Payment object to show
    * that it was received. Finally, send a receipt to the buyer to show these details.
    */      
   function paid() {
      global $project;
         $orderID = $_POST['ref'];
         $order = $order = DataObject::get_by_id("Order", $orderID);
         if($order) ....

but it appears I am not successfully retreiving ref which is the Paymate name for the Silverstripe OrderID. When I do an isDev it is the $orderID = $_POST['ref']; line that is highlighted with the errors

* PaymatePayment_Handler->paid(HTTPRequest)
Line 162 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 107 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(/PaymatePayment_Handler/paid/72/)
Line 115 of main.php

So am I right in understanding that this means I am not accessing the Paymate info? Any suggestion on what I am doing wrong (any other work I have seen on accessing a Pamate response uses this)?

Thanks

MM

Avatar
mschiefmaker

Community Member, 187 Posts

24 November 2009 at 4:00am

Found the issue. Te returned value was being prefix with Order #.

function paid() {
      global $project;
         $orderID = $_POST[ref];
         $orderID = str_replace("Order #","",$orderID);
         $order = DataObject::get_by_id("Order",$orderID );
Fixed this.

Very happy :-)

Catherine

Avatar
lanks

Community Member, 61 Posts

24 November 2009 at 2:00pm

Hey would you be able to post the working code for Paymate. Really keen to use it with my site.

Thanks
Liam

Avatar
mschiefmaker

Community Member, 187 Posts

24 November 2009 at 5:19pm

Hi Liam

Will do, but it'll be the weekend before I post. Am travelling and don't have access to the code, sorry

C

Avatar
lanks

Community Member, 61 Posts

24 November 2009 at 5:57pm

Ok that's cool. Thanks.

Avatar
mschiefmaker

Community Member, 187 Posts

29 November 2009 at 9:54pm

Hey Liam

Attached as promised. There are a couple of issues still to iron out see [url]http://www.silverstripe.org/e-commerce-module-forum/show/274386#post274386#post274386[/url] for details

Send me any feedback/improvements

Catherine

Avatar
lanks

Community Member, 61 Posts

2 December 2009 at 9:31am

Thanks for this, havent been able to get to work so far but will keep trying.

Avatar
mschiefmaker

Community Member, 187 Posts

6 December 2009 at 9:49am

Hey Liam

Where is it failing?

Cheers

Catherine

Go to Top