Hi, are there any plans to port this to D6?

Comments

onewayticket’s picture

Status: Active » Needs review
StatusFileSize
new28.85 KB

I've managed to use the 'Coder' module to make all of the critical changes to the UC PayPoint module. There are still some minor code cleanups that Coder recommended - 'string concatenation should be formatted with a space separating the operators (dot .)' - but these are mainly associated with the on-screen messages the user gets when payment is being processed. I thought I should leave them in because they seemed to work when the original creator wrote the script.

I haven't tested this live yet - I'm still awaiting my PayPoint account settings! Please let me know your results - that's all I ask for.

If psynaptic can look through the code quickly and test it, that would be a great help. I'm hoping that the 'Implementation of hook_menu()' has been converted correctly. If there are any problems with it, I'm assuming it's the 'if()' statement. This used to be 'if($may_cache)' beforehand, so I removed the '$may_cache' from the line and Coder was happy with it.

Onewayticket

onewayticket’s picture

StatusFileSize
new28.86 KB

Sorry, please use this file not the other one I attached. It seems that '$may_cache' still needs to be present for the script to not botch up your site.

onewayticket’s picture

StatusFileSize
new28.85 KB

This version removes the whole 'if ($may_cache) {' line. I'm hoping this is the best version as it validates in Coder again now.

Here's how that whole block now looks

/**
 * Implementation of hook_menu().
 */
function uc_paypoint_menu() {

  $items['uc_paypoint/complete'] = array(
    'title' => 'PayPoint payment complete',
    'page callback' => 'uc_paypoint_complete',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
  $items['uc_paypoint/cancel'] = array(
    'title' => 'PayPoint payment cancelled',
    'page callback' => 'uc_paypoint_cancel',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
  
  return $items;
}
psynaptic’s picture

Has anyone tested this?

psynaptic’s picture

Thanks for your efforts. I fully intend to make a Drupal 6 port of this module, I just don't have the time right now to get deeply into this. If you good people could test it fully it would give me more confidence to commit it. I can't commit something that's not even been tested.

bloke_zero’s picture

Ah, catch 22, my client went with world pay. Next time I have a paypoint client I'll jump in, but till then I have no account details to test with.

thanks for the conversion.

merch’s picture

Im attempting to use the converted paypoint module but when I try and review my order I get the following message.

"An illegal choice has been detected. Please contact the site administrator."

Note:Im getting this error using the default settings for the module I have yet to get the propper details of the paypoint account from the client.

Fix: theres an issue with the title tag using the variable "$cards"

merch’s picture

Got the module somewhat working details are sent to paypoint.net and transactions are processed im now faced with the issues of returning from paypoint back to my drupal site.

Template : http://testsite/uc_paypoint/complete?valid=true&trans_id=11&code=A&auth_code=9999&amount=9.10&ip=84.12.119.153&cv2avs=ALL+MATCH&test_status=true&backcallback=http://testsite/uc_paypoint/cancel&uid=1&cart_id=1&hash=cc0c1955601eb1dd04e77d47ad7b0a47 not found!

java.net.UnknownHostException: testsite

Please contact merchant cardtest@secpay.com and ask them to correct their callback.
This transaction succeeded and the reference was '11' regardless of the failure to contact the merchant your order was successful 

This is what paypoint returns when I "pay" im currently running off a local host so im assuming this may be the problem. Tommorow I will attempt to get my site online and test out the payment module once again

onewayticket’s picture

'merch' I'm also getting this problem with the original script running on Drupal 5. When I try to use the link specified, my drupal site brings up just an un-themed page with the following text:

"We were unable to process your payment. Please verify your details and try again. If the problem persists, please contact us. Many thanks."

Have you managed to work out what the problem is? If so, please let me know your work-around. Thanks.

onewayticket’s picture

Actually I'm getting a 401 message now from the PayPoint / Secpay server. That must mean that we're denied access. Could this be something to do with the user_access part of the UC_PayPoint script? I'm running a membership site if anyone can help?

merch’s picture

StatusFileSize
new7.75 KB

Hi onewayticket,

Just to let you know where im coming from. I'm new to drupal, ubercart and pritty much php.

I spent a few days tinkering aroud with the module code (I am led to belive that people aren't ment to change module code)
However In doing so im please to announce I was able to get the module working! I've changed a small amount of code with help from one of the core payment modules (2checkout i think). My site which im developing for a client is up online and im currently using the test account provided by secpay and entered these account details on the module set up.

PayPoint merchant ID: secpay
Remote password: secpay
Digest key: secpay

Changes ive made - sorry if my terminolgy is incorrect. (all changes were made in notepad - yes I know thats not ideal guess im just used to using it for html)

Ive added a finalize "page" to the hook_menu

$items['cart/paypoint/finalize'] = array(
    'title' => 'Order complete',
    'page callback' => 'uc_paypoint_finalize',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,

  );

I added a google analytics hook

function uc_paypoint_ucga_display() {
  // Tell UC Google Analytics to display the e-commerce JS on the custom
  // order completion page for this module.
  if (arg(0) == 'cart' && arg(1) == 'paypoint' && arg(2) == 'finalize') {
    return TRUE;
  }
}

I changed the 'title' to "paypoint" using the variable $cards was causing the "An illegal choice has been detected. Please contact the site administrator." message i was expericence in message 7 above.

In the function "uc_paypoint_complete i have commented out the last 2 lines of the case 'A' in the switch statment

case 'A': // Transaction authorised.
      $comment = t('Order successfully processed by PayPoint for order #!order.', array('!order' => $order->order_id));
      uc_payment_enter($order->order_id, 'paypoint', $parameters['amount'], 0, NULL, $comment);
      uc_order_comment_save($order->order_id, 0, t('Order created through website.'), 'admin');
      // TODO: uc_cart_complete_sale() doesn't seem to be able to detect whether the user is logged in from the callback page.
      //$output .= uc_cart_complete_sale($order);
      //uc_cart_empty($parameters['cart_id']);
      break;

and at the bottom of this function i have replaced the last 4 lines

  print uc_paypoint_debug($parameters, $order);
  print $output;
  //drupal_set_message($output);
  //drupal_goto('<front>');

with the following

$url = 'cart/paypoint/finalize/'. $order->order_id;
$redirect = '<script type="text/javascript">window.location = "'. url($url, array('absolute' => TRUE)) .'";</script>';
print $redirect;
exit();

and at the bottom of the module i have added the uc_paypoint_finalize function

function uc_paypoint_finalize() {
  $order = uc_order_load(arg(3));

  // Add a comment to let sales team know this came in through the site.
  uc_order_comment_save($order->order_id, 0, t('Order created through website.'), 'admin');

  $output = uc_cart_complete_sale($order, variable_get('uc_new_customer_login', FALSE));

  $page = variable_get('uc_cart_checkout_complete_page', '');

  if (!empty($page)) {
    drupal_goto($page);
  }

  return $output;
}

Thats about it Ill keep checking here see if i can be of any more help.

onewayticket’s picture

Thanks for the information merch. Is this for Drupal 5 or 6? I've actually just managed to work out why in Drupal 5 I was getting the 401 error - my own fault, I'd password protected my site! Once that was removed the process worked. I too am using an active SecPay / PayPoint account but only processing orders in TEST mode.

I noticed in your code that you've added a 'finalize' page. Is this to load a template matching your site for the completed order page? If so that's great, as it looks terrible just having black text on a white background, which is what I'm getting at the moment.

Like the look of the Google Analytics code too. Would be very handy. I hope this works for both Drupal 5 & 6, as I've had to go back to 5 due to the lack of upgraded modules for 6. psynaptic's original D5 version was claiming to be working so I thought I'd better stick with that.

merch’s picture

Ive been working on drupal 6. the finalize page Is a themed page to display the output text of the completed order. (stopping that awful black text on white background) Ive yet to test the google code for my site so not sure if its working yet.
If you do change to Drupal 6 let me know and ill help anyway I can. If not goodluck with getting the module working on 5 :D

onewayticket’s picture

Yes, I'm struggling with the horrible confirmation black text on white background. I can't get your changes to work though in D5 and I'm unsure that this finalise page will work with creating roles once the user has paid. Isn't there a way that we can just call the main site template into the confirmation page, so that it still integrates fully with Ubercart? Could anyone suggest a way of doing this?

I've looked at the protx direct gateway module (D5) and there is a piece of code at the top of the module which calls a CSS file to style the pages. Maybe changing that code could theme the confirmation? Here's the code:

  // add css
  if (!$may_cache) {
    drupal_add_css(drupal_get_path('module', 'uc_protx_vsp_direct') .'/uc_protx_vsp_direct.css', 'module', 'all', FALSE);
  }
bloke_zero’s picture

You might want to look at this: http://drupal.org/node/369096
Where a themed page is returned for the final page in a worldpay transaction - might solve your problems viz black and white unthemed page

chrispeat’s picture

Hi,

I am pretty new to Drupal, although not to PHP and payment gateways and have used Secpay in the past. I am just testing out the interface as-is at present and have a few Q's:

1. What is the remote password?
(It says "Enter the remote password that you entered into your account on the PayPoint site" which would leave me to believe its the main password for Secpay... but this surely isnt correct as the interface would have no requirement for it?)

2. Is the module any further down the track, are there any areas anyone would like me to look through as I need to get this module working?

Any and all hints and tips are very gratefully recieved!

Many thanks

Chris

marc.groth’s picture

Hi there,

Firstly I'd like to thank you so much for all the work you've put into this module. It's really great and I've almost got it working 100%!!

@merch: You mentioned something about getting the "Template not Found" error being because the site wasn't live. Can you confirm that that was in fact the case? I am getting the same error and am currently working on my localhost. I'm unable to put it live just yet to test, though have noticed that if I put in any live URL (i.e. http://www.bbc.co.uk) for the callback it seems to redirect successfully. Is this because I'm working on localhost then?

@chrispeat
1) The remote password is the one you entered when you log into the SecPay website. Once logged in if you click on "Account" (top nav) and then "Remote Passwords" (left nav) you should be able to enter it in there (selecting "Remote" from the drop down)... I'm not 100% sure, but if you haven't followed these steps before then I doubt you have one already and will need to set one up. Try entering a new one anyway and then linking that on Drupal. It should work :) Remember (I fell short here for some time and it took me a while to figure out) that the password you enter into Drupal is case sensitive!!!
2) I'd like to know this too... It seems like this module could be used widely and I am very willing to be a tester (and even help with code where I can)...

Hoping to hear back from someone soon!! :)

chrispeat’s picture

Hi Marc Groth,

Thanks for the heads up, I'll have a poke around on Monday and hopefully get somewhere more meaningful. I also managed to get the module up and running and it seems to work, the last part to test is the callback and full testing that its handing over all the data... as these sorts of things should.

It does look pretty good and I'll be trying hard in the next few days to get it working so I'm happy to share anything back into the community.

Let me know how you get on and I look forward to getting this going.

Cheers everyone!

Chris

merch’s picture

Not checked here for any progress for some time.

@marc.groth I think moving the site onto a proper webserver helped with the issue you mentioned was a long while back.

I can however say that The site I was working on is just about to go live (long time developing being my first big drupal site).
Yesterday while checking things we tried a live paypoint transaction with a debit card, this was a 100% success paypoint happily took my money and then i was able to refund it (using the paypoint site) :)

I dont think my module has changed since I posted it (post 11) i will check tho and get back to you when i can.

The module will post the sale to paypoint and port back to your site on a page with the checkout complete messages.

thanks to psynaptic for the orignal module and onewayticket for his D6 conversion

merch’s picture

StatusFileSize
new7.78 KB

I checked my version with the one i posted a while back. only changes ive made since then was to output the credit card images.

psynaptic’s picture

Status: Needs review » Needs work

If you want to get your work committed you need to create a patch.

Make sure your code follows the Drupal coding standards too.

marc.groth’s picture

@merch thanks so much for your response!! Better late than never! ;)

I still haven't had a chance to test it on live, but from what you've said it should definitely work so I'm not too worried... However I will let you know if I run into any problems!

And definitely a big thanks to EVERYONE who has contributed to this module... Not having it would have been a show stopper for me so I am very thankful it exists! :)

psynaptic’s picture

Code looks good. Just needs a patch.

Pete B’s picture

StatusFileSize
new8.04 KB

Tested and code reviewed patch.

psynaptic’s picture

Status: Needs work » Needs review

@Pete B & @merch: Patch looks good. Only thing I can question is the use of:

$redirect = '<script type="text/javascript">window.location = "'. url($url, array('absolute' => TRUE)) .'";</script>';

Why didn't you use drupal_goto for this? Any specific reason?

http://drupalcontrib.org/api/function/drupal_goto/6

Pete B’s picture

I did question that myself when I rolled the patch. I tried replacing it with a drupal_goto, but it did not function correctly.

I believe this is to do with how paypoint handles the callback url, which is requested from the drupal site from within a paypoint url. I think this probably causes a "headers already sent" error on the paypoint site.

The original drupal 5 module contains a commented out drupal_goto in this portion of the code, so I think you possibly experienced similar problems when you wrote the original code?

Thanks,
Pete

merch’s picture

@psynaptic no particular reason apart from the fact that I was unaware of such functionality of drupal, being totaly new to the system as mentioned in post 11. I know now that this is not the drupal way. Any suggestions on how to fix it to be correct?

on a side note my client site is now live with this code and the first sale for over £470 was made successfully. however the order does have a admin comment saying:

"Authentication of hash failed for this transaction."

psynaptic’s picture

The "Authentication of hash failed for this transaction." notices are quite common. It just means the md5 security check didn't match. It clearly needs some work to get rid of these false positives.

I really wish I had the time to get down and dirty with a project involving this module but alas I am busy working on other things.

Does anyone here have a CVS account who would be willing to be co-maintainer of this module with me?

marc.groth’s picture

Hi psynaptic,

I would be very interested to help you out however I have a few problems preventing/limiting me:

a) I have no CVS account as of yet :(
b) I work full time (and have other projects I am currently working on)

However this module doesn't seem to be very complicated (like Views for instance ;)) so if that is fine for you... I'd be willing to help you co-maintain this module and iron any of the bugs out...

Do you know if it's possible to apply for a CVS account if only co-maintaining (for the moment)?

Anyway, I am interested. What do you reckon? :)

psynaptic’s picture

a) I think you should be able to get a CVS account if you link to this issue in your application. I am happy to have you onboard.

b) Co-maintaining this module wouldn't take too much time, my own sites that use this module are still on D5 and I don't have time to test this in the new UC.

So please do go ahead and apply for a CVS account. We'll see what they say :)

marc.groth’s picture

Hi psynaptic,

Thanks very much for that! I have applied for a CVS account. My application can be found here: http://drupal.org/node/641490

Can you (and anyone else who is interested in this module getting a stable 6 release, further improvements etc.) please visit the above link and comment?

Any and all help much appreciated.

Looking forward to (hopefully) becoming a co-maintainer! :)

avpaderno’s picture

I have approved marc.groth's application, and granted him access to this project CVS.

marc.groth’s picture

Thank you very much KiamLaLuno :)

psynaptic’s picture

Excellent. Welcome aboard.

Mostly stuff should be discussed in the issue queue before committing but I won't mind if you slip stuff in without declaring it as I know how much it slows down the process. Just make sure we have nice commit history so we can use the cvs-release-notes.php script.

marc.groth’s picture

Great thanks psynaptic!

I'm very excited! I've gotten an email explaining everything about CVS so will give that a read and make sure I'm up to scratch with how it all works.

I guess the first job would be to create a 6 branch for the module? At least that way we can branch it out separately rather than having everyone who wants to use it have to patch it...

Does that sound about right?

avpaderno’s picture

Does that sound about right?

Yes, it does.
Basing on what reported in Drupal.org handbooks, branches are always created from HEAD, to avoid revision numbers like 1.2.3.4.5.6.7.8. That means you first update the HEAD code, and then you create the branch from it.

chrispeat’s picture

Hi Everyone,

I was just looking over my posts and remembered that I would report our progress.

We have succesfully joined the original code with the chnages from m.groth to create a fully functioning D6.14 / UC 2.0 paypoint module and have been using it for over a month now.

We haven't had any problems with it yet and are really thankful to everyone for their hardwork. Reporting back on everyone else's success seemed the least we could do.

Thanks

Chris

marc.groth’s picture

Status: Needs review » Fixed

Hi all,

Sorry it's taken me a while but there is now a development snapshot for Drupal 6 which can be downloaded on the main page. I'm changing the status of this to "Fixed", but if there is anything specific to this thread that still isn't quite right then please feel free to re-open.

From this point forward, any bugs/fixes for the 6 release should be created in a new issue so we have a differentiation between the different versions.

Thanks again to everyone who made this porting possible.

psynaptic’s picture

Excellent work. Thanks for helping out and congrats on your first commits :D

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.