Jump to content
Sign in to follow this  
perfectpassion

[Contribution] PayOffline (Pro)

Recommended Posts

http://www.oscommerce.com/community/contributions,5386

 

I have created a new payment module for this innovative new payment solution.

 

PayOffline is supported by Alliance & Leicester and allows customers to pay at their local shop (actually any shop that has a PayZone terminal) instead of online.

 

This gives store owners the ability to give their customers a way of paying by cash or debit card. It's ideal for customers that are too afraid of fraud to use their card online or simply don't own a debit or credit card. It also allows more anonymity and privacy for customers as they won't have any tell-tale transactions on their card statements.

 

There are no monthly fees just a per transaction fee.

 

You probably haven't yet heard about PayOffline as they have only started accepting transactions this month.

 

The module allows customers to select PayOffline as a payment method. After some behind the scenes communication with the PayOffline server it will take them straight to checkout_success and allow them to print off a payslip. This payslip contains the amount, a deadline for payment and importantly a barcode. They take the slip to any PayZone outlet to pay. The payment slip will also be emailed to them and they can reprint it from their account history page.

 

Once payment is made PayOffline makes a callback to the vendor's site which will update the order status in admin.

 

Find out more at the PayOffline site: http://www.payoffline.com/default.aspx?rf=sLU%2f9RRNhhM%3d

PayZone info:http://www.payzone.co.uk/

 

Tom

 

 

Note: The link to the PayOffline site is an affiliate link. By using this link it provides a way of showing your appreciation for the time and effort that has gone into developing this module and for the continuing support that I'll be providing. If you don't wish to do this then simply visit the site without the link (www.payoffline.com).

Share this post


Link to post
Share on other sites

PayOffline v1.0b uploaded:

 

Minor update to code for checkout_sucess.php - under certain (unusual) circumstances a customer not paying by PayOffline could be presented with a PayOffline barcode slip - fixed.

 

Full package - if already installed the only change is in checkout_sucess.php as per the install.html file in the package.

 

Tom

Share this post


Link to post
Share on other sites
PayOffline v1.0b uploaded:

 

Minor update to code for checkout_sucess.php - under certain (unusual) circumstances a customer not paying by PayOffline could be presented with a PayOffline barcode slip - fixed.

 

Full package - if already installed the only change is in checkout_sucess.php as per the install.html file in the package.

 

Tom

 

Hi Tom,

 

I've tried installing the contrib this afternoon and I'm having a couple of problems with it.

 

Firstly, while running tests, the process goes through to the checkout_success.php page however, there is no information on there about printing the barcode. Is that correct, or should it be there? I was a little confused about the instructions given to insert the code BEFORE

 

<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>
         </tr>
       </table></td>
     </tr>

Did that mean the line above, or before the

<h3>

or after the

<?php

? I've tried it in the line above and it shows the code on the screen, but not the values. When I move it to either of the two places, I get nothing at all, only the checkout completed text as usual.

 

Secondly, when I go to the Order Information Screen, I get the following error

Fatal error: Call to undefined function: stripos() in /home/roblett/290761X6/htdocs/heavenlydesires/catalog/account_history_info.php on line 187

 

I've tried going through the installation again, to check if I've missed anything, but it all seems ok to me.

 

Can you help?

 

Cheers,

 

Sean.

Share this post


Link to post
Share on other sites

Ok firstly there's a small mistake in the instructions.

 

In step 6 it should say:

6. Edit checkout_success.php 

Find:
?>
		<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>
	  </tr>
	</table></td>
  </tr>

Immediately BEFORE add:

$order_num_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
$order_num = tep_db_fetch_array($orders_query);
$payofflinepro_query = tep_db_query("SELECT BarcodeURL, oid from payofflinepro WHERE order_id = ".(int)$order_num['orders_id']." LIMIT 1");
if (tep_db_num_rows($payofflinepro_query) == 1 && (int)$order_num['orders_id'] != 0) {  
 $payofflinepro = tep_db_fetch_array($payofflinepro_query);  
 echo '<p align="center"><a href="'.tep_href_link(FILENAME_PAYOFFLINEPRO_PAYSLIP, 'oid='.$payofflinepro['oid'], 'SSL').'" target="_new">'.tep_image($payofflinepro['BarcodeURL'], 'PayOffline Barcode').'</a></p>';  
 echo sprintf(TEXT_PAYOFFLINEPRO, tep_href_link(FILENAME_PAYOFFLINEPRO_PAYSLIP, 'oid='.$payofflinepro['oid'], 'SSL'));
}

 

Note the ?> - the added text must come before it.

 

 

Secondly you are getting that error probably as the stripos function is new in PHP5 - something I only found out recently.

 

In step 5 add the following code INSTEAD of the code in the install instructions but in the same place - it should work on either PHP4 or PHP5

			  <tr>
			<td class="main"><?php if (strpos(strtolower($order->info['payment_method']), 'payoffline') !== false) {
										$payofflinepro_query = tep_db_query("SELECT oid FROM ".TABLE_PAYOFFLINEPRO." WHERE order_id=".(int)$_GET['order_id']);
										$payofflinepro = tep_db_fetch_array($payofflinepro_query);
										echo '<a href="'.tep_href_link(FILENAME_PAYOFFLINEPRO_PAYSLIP, 'oid='.$payofflinepro['oid'], 'SSL', true, false).'" target="_new" style="text-decoration: underline">Reprint PayOffline barcode Payslip</a>'; 
								   } ?></td>
		  </tr>

 

I'll upload some modified install instructions shortly for the benefit of others.

 

Tom

Edited by perfectpassion

Share this post


Link to post
Share on other sites

Thanks for your help, I've added the additional information and the errors have gone, however, I've now got some more problems that I hope you can help with.

 

1. The order information screen appears but the item qty and descriptions are blank, however, it does show the attributes for the items.

2. When in Test Mode the checkout_success screen is still not showing any information about the barcode, it just displays the standard screen, although it is sending an email with the barcode in. Is is correct? Or should it give info on where to get the barcode from?

3. In Live Mode when I try a test purchase, I'm getting the following errors:

 

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/roblett/290761X6/htdocs/heavenlydesires/catalog/includes/classes/nusoap/lib/nusoap.php on line 2161

 

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/roblett/290761X6/htdocs/heavenlydesires/catalog/includes/classes/nusoap/lib/nusoap.php on line 2161

 

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/roblett/290761X6/htdocs/heavenlydesires/catalog/includes/classes/nusoap/lib/nusoap.php on line 2161

 

Warning: Cannot modify header information - headers already sent by (output started at /home/roblett/290761X6/htdocs/heavenlydesires/catalog/includes/classes/nusoap/lib/nusoap.php:2161) in /home/roblett/290761X6/htdocs/heavenlydesires/catalog/includes/functions/general.php on line 33

 

Our server is using MySql V4.1.20 if this helps.

 

I really think this method of payment would be excellent for our site and can't wait to get it up and running. Thanks for you help so far, it is really appreciated.

Share this post


Link to post
Share on other sites

Ok, in the order you asked:

 

1. Do you mean on checkout_confirmation page? The module should have no impact on this, have you installed other mods?

2. Sorry, I found a small typo in the code to add to checkout_success.php. Find

$order_num = tep_db_fetch_array($orders_query);

and change to

$order_num = tep_db_fetch_array($order_num_query);

3. This is generated as your server has safe mode active. It is unlikely that you can get this disabled. However you can edit the includes/classes/nusoap/lib/nusoap.php file (line 2161) as follows: Find

		// follow location headers (re-directs)
	curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);

change to

		// follow location headers (re-directs)
	// curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);

 

Tom

Share this post


Link to post
Share on other sites

I've got loads of contribs installed and your right, it's probably just one of them that's caused it. I'll go back though and see what I can find.

 

The good news is that with these little modifications installed it's all working fine, I'm getting the barcode on the checkout success page and everything is now up and running in Live mode too.

 

Thank you so much for all your help.

 

Sean.

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

First I’d like to thank your for the work you’ve put into creating this script.

 

 

I’ve been looking through the code and noticed in the following section you are using the assignment operator (=) and the not the equal operator (==) to check if $sign matches the other concatenated values, therefore both your if statements will always evaluate to true.

 

 

$pass = false;

if ($mid = MODULE_PAYMENT_PAYOFFLINEPRO_ID) {

if ($sign = md5($mid . $txID . $oid . $amt . $code . MODULE_PAYMENT_PAYOFFLINEPRO_SECRET_KEY)) {

$pass = true;

}

}

 

 

 

 

$mid = MODULE_PAYMENT_PAYOFFLINEPRO_ID

 

After this line of code no matter what $mid was before its now equal to MODULE_PAYMENT_PAYOFFLINEPRO_ID and the same goes for ($sign = md5($mid . $txID . $oid . $amt . $code . MODULE_PAYMENT_PAYOFFLINEPRO_SECRET_KEY)

 

 

 

 

 

I apologize in advance if I’ve totally misunderstood what that section of code should do.

Share this post


Link to post
Share on other sites

you are absolutely correct only the first = is correct - the following 3 should be ==

 

I must have been tired!

 

Thanks for pointing it out - it shouldn't have any adverse affect on the functionality of the module but obviously means that the call from the PayOffline server isn't being properly security checked.

 

I'll update the file and post it shortly.

 

Tom

Share this post


Link to post
Share on other sites

Hi, I have a slight problem.

 

I have installed the module and created a merchant account with PayOffline and all is running fine on the test server except for the Checkout_success.php page.

 

It does not show the bar code, clicking on the link to print still doesn't show it. What have I done wrong or will it work when on the live server?

 

Thanks in advance.

 

Nathan

www.saffron-star-trading.co.uk

Share this post


Link to post
Share on other sites
Hi, I have a slight problem.

 

I have installed the module and created a merchant account with PayOffline and all is running fine on the test server except for the Checkout_success.php page.

 

It does not show the bar code, clicking on the link to print still doesn't show it. What have I done wrong or will it work when on the live server?

 

Thanks in advance.

 

Nathan

www.saffron-star-trading.co.uk

Hi again, answered my own problem. It works on the live server but not on the test server.

 

Nathan

www.saffron-star-trading.co.uk

Share this post


Link to post
Share on other sites

Hi Tom,

 

I have installed this module and run some tests on the test server and all appears fine, I do however have a few questions.

 

1. I presume that when a payment is process through the PayOffline Admin that the callback should then update the order status?? If so does the test environment update the order status or not as my test order was not updated.

 

2. Is it possible to change the order id to display the actual store order id in PayOffline Admin as at the moment all test orders are showing up as a load of horrible characters 'QAoDh6PZd3KQMhN0FNVgwbbPqKtKxLAvNse0ydhOgOAUkB0g'

 

3. The display of the barcode on the checkout_success page and the payofflinepro_payslip causes secure/insecure image warnings with my SSL, any ideas???

 

Thanks

 

Mark


Lifes a bitch, then you marry one, then you die!

Share this post


Link to post
Share on other sites

1. Yes, when you click "Simulate Payment - Run" it should make a call back to your site and change the der status - if this doesn't seem to be happening check your callback settings carefully - the test payoffline admin area should give you a status result of "200" if it successfully contacts your site.

 

2. it is not possible to get an accurate order id before the transaction is actually completed due to the way osC 2.2 works. You can change line 104 of includes/modules/payment/payofflinepro.php

  $txID = tep_create_random_value(48, 'mixed');

to something like

  $txID = substr($order->customer['firstname'].' '.$order->customer['lastname'],0,31).'-'.tep_create_random_value(16, 'mixed');

- this will include the customer name

 

3. It will cause ssl errors one the test server but should be fine on the live payoffline server (but do test)

 

Tom

Share this post


Link to post
Share on other sites
2. it is not possible to get an accurate order id before the transaction is actually completed due to the way osC 2.2 works. You can change line 104 of includes/modules/payment/payofflinepro.php

  $txID = tep_create_random_value(48, 'mixed');

to something like

  $txID = substr($order->customer['firstname'].' '.$order->customer['lastname'],0,31).'-'.tep_create_random_value(16, 'mixed');

- this will include the customer name

 

Hi Tom,

 

My account is now live and and I am testing out your changes above, yes it does insert the customers name into the transaction but when I go to print the barcode out or reprint through 'my account' it says 'INVALID TRANSACTION ID'

 

Any ideas?


Lifes a bitch, then you marry one, then you die!

Share this post


Link to post
Share on other sites

Tom,

 

I have installed the PayOffline module but when I click on 'Confirm Order' in checkout_confirmation.php it takes me back to checkout_payment.php?payment_error=payofflinepro&error=Data+error with the error

MODULE_PAYMENT_PAYOFFLINEPRO_TEXT_ERROR

 

Data error

 

This occurs in both Testing and Live mode.

 

Anthony Lloyd

Making Tracks


Tony Lloyd - "Backbone of the Making Tracks Online Experience" - See GE Manual p19 :lol:

lloydy_sig.jpg

Share this post


Link to post
Share on other sites

Hi,

 

The first part is because of a missing define in the language file, add the following to includes/languages/english/modules/payment/payofflinepro.php

define('MODULE_PAYMENT_PAYOFFLINEPRO_TEXT_ERROR','Error processing payment. The error returned was: ');

 

As for the actual error 'Data error' it's quite difficult to say what the problem is as PayOffline don't have an integration document listing the error messages. If you open includes/modules/payment/patofflinepro.php and edit line 126:

 

From

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($response['InsertTransactionResult']['diffgram']['dsBarcode']['Results']['Description']), 'SSL', true, false));

to

//tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($response['InsertTransactionResult']['diffgram']['dsBarcode']['Results']['Description']), 'SSL', true, false));

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode('<pre>'.print_r($response,true).'</pre>'), 'SSL', true, false));

and try the transaction again.

 

When the error occurs copy the results and post them here.

 

Tom

Edited by perfectpassion

Share this post


Link to post
Share on other sites

Tom, sorry for the delay in getting back to you, I started from scratch again with my store and installed the POL module first and it didn't have a problem so must have been conflicting with one of my other installed modules.

 

Module works fine now :-) Thanks very much for your help.

 

Tony


Tony Lloyd - "Backbone of the Making Tracks Online Experience" - See GE Manual p19 :lol:

lloydy_sig.jpg

Share this post


Link to post
Share on other sites

We have an account with payoffline, and I have just installed this module.

 

Everything seems to work fine with the test server; emails generated, barcodes sent etcetc, but when I flop to the live server, changing my merchant info to the live settings (ID and key) I get the following error when I press continue on the 'confirm order' page in the checkout process.

 

 

Constructor error

 

wsdl error: HTTP ERROR: CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS

 

 

I have checked;

 

PHP is v4.4.4 so seems ok

cURL is enabled on my sever host

 

 

I didn't have SSL installed on my host server, so I paid to have my server account upgraded to shared SSL, and retried this on the live server; same error message.

 

I haven't installed any details of my ssl directory anywhere in osc; should I, and if so, where?

 

If it is not the ssl, any other ideas???

 

 

Ta.

Share this post


Link to post
Share on other sites

In your osc admin, if you go to Tools->Server Info, check you have the following (or similar entries):

CURL support enabled

CURL Information libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5

and

OpenSSL support enabled

OpenSSL Version OpenSSL 0.9.8c 05 Sep 2006

 

Tom

Share this post


Link to post
Share on other sites
In your osc admin, if you go to Tools->Server Info, check you have the following (or similar entries):

 

and

Tom

 

 

Hi, Tom

 

 

The only line I can find that talks about cURL or ssl is one that says 'ssl support - enabled'.

 

Doesn't mention openssl or curl anywhere else.

 

How do I get round this?

 

 

Thanks.

 

:'(

Share this post


Link to post
Share on other sites

you need to get in touch with your hosting company about having cURL (with openssl) installed - they may have their reasons for not having it installed in which case it would require a move unfortunately!

Share this post


Link to post
Share on other sites

hi,

I install payOffline, and have problems with /catalog/payofflinepro_payslip.php

Becouse I get not a barcode but some emty page with this:

 

Top » Catalog My Account | Log Off | Cart Contents | Checkout

CatalogCarpet cleaning machinesCatering Tea & Coffe 10 Tagged Tea Bag Cartons 22ct Semi Gold Tea Pot Range 25 & 50 Tagged Tea Bag Cartons Acrylic Boxes 25 enveloped tea Calico Bags - Flavours Calico Bags - Souvenir Cartons - Pure ceylon teas Classic Flavours Honey & Tea gift sets in softwoo Large Calico Bags/Wooden chests Mat Baskets - Pure ceylon Porcelain Elephant Tea Caddies/S Porcelain Tea Caddies Porcelain Tea Caddies Porcelain Tea Pots & Caddies Softwood Mini Tea Chests Flavour Softwood Mini Tea Chests Souveni Softwood mini wooden chests Softwood Tea Chest - Flavours Softwood Tea Chest - Gift Softwood Tea Chest - Premium Her Softwood Tiny Tea Chests Classic Special Tea Gift Collections Special Tea Gift Presentations Spices Tea Caddies Upright Softwood boxes Wooden Chests 25 enveloped Wooden CottagesCatering AreaseBayFloorcareGeneral AreasPaper ProductsRotary machinesScrubber drier machinesTextiles and Laundry CareWashroomWet & dry vacuums

$categorybox

$manufacturerbox

$whatsnewbox

$specialbox

$searchbox

$informationbox

 

 

$cartbox

$maninfobox

$orderhistorybox

$bestsellersbox

$reviewsbox

$tellafriendbox

$languagebox

$currenciesbox

Share this post


Link to post
Share on other sites

Just installed this great contribution. The problem is that when I install it and then go to the checkout page the payment option is not there. Is it because I have not been given my merchant ID and Key yet. It installs OK so I don't think there is a problem.


I don't bother doing backups. I love the thrill of screwing it all up!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×