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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Paymate payment function for testing


Go to End


8 Posts   3634 Views

Avatar
mschiefmaker

Community Member, 187 Posts

29 November 2009 at 9:51pm

Hi

Attached is a Paymate payment function that I have been working on. I would be interested in any feedback from anyone who uses it.

There are two things that need to be improved:
1. I have had to put an echo at the top of the paid function (line 147). Without it the redirect doesn't work. Two things about this:
1.1 After the echo I get "No recipient addresses found in header No recipient addresses found in header" would be interested to know where this is coming from and what it means.
1.2 There must be a better way to do this. Would like to loose the echo but don't know how ...

2. On my system I cannot get $order->sendReceipt(); to work. I would be really interested if someone else can run this code and get it to work. I have made some changes to my general email function and I am wondering if this has caused the issue.

As I say any feedback/improvements are welcome

Thanks

Catherine

Avatar
boombox

Community Member, 44 Posts

5 December 2009 at 8:55am

Edited: 05/12/2009 8:56am

Hi ya
We have done a reasonable amount of testing on a version of Paymate payment function - with eCommerce 0.6
this is working in our environment so please use for testing

Two fields that can either be added here (commented out at present) or added to EcommerceRole Code are
State and Postcode (or Zip)

Your _config file should contain the following Info

//Define which payment methods your site uses.
Payment::set_supported_methods(array(
'PaymateExpressPayment' => 'Credit Card (Paymate)',
// If Set Up 'PayPalPayment' => 'PayPal',
// If Set Up 'DirectCreditPayment' => 'Direct Banking',
'ChequePayment' => 'Cheque'
));

// Paymate Account Details
PaymateExpressPayment::SetMerchantId("yourpaymatemerchantID");
// Use _ONE_ of the following Paymate URLs
// PaymateExpressPayment::SetPaymateUrl("https://www.paymate.com.au/PayMate/ExpressPayment"); // Set Paymate to use LIVE site
PaymateExpressPayment::SetPaymateUrl("https://www.paymate.com.au/PayMate/TestExpressPayment"); // Set Paymate to use TEST site

OK So Test this out!

Avatar
mschiefmaker

Community Member, 187 Posts

9 December 2009 at 8:00pm

Hi

Doesn't the $order->sendReceipt(); need $order->Member(); before it?
You are not passing the Contact and Address details which are editable in the the Paymate screen so they could have changed this means the Receipt and Order confirmation screen will be out of date, won't it?

Cheers

Catherine

Avatar
TotalNet

Community Member, 181 Posts

14 December 2009 at 3:33pm

Edited: 14/12/2009 3:49pm

Hi Karl, Catherine,

Karl, I'm getting the "bad class to singleton()" error we talked about before, how did you fix this? I'm using the updated version you have attached here with 0.6 beta1 and SS v2.3.4 and have added State & Postcode to the Ecommerce role.

I'll work on getting the email working when I can get this resolved, if email still isn't working for you guys. I'm sure we have the answers between us :)

Cheers,

Rich

EDIT: Typical, just found it! t'was a space after the payment method class name in _config.php

Avatar
boombox

Community Member, 44 Posts

14 December 2009 at 4:14pm

Hi Catherine,
Just checking if you were looking at the attached sample code or another verison?

Line 201 of PaymentExpressPayment.php states
$payment->MemberID = $order->MemberID;
So this is assigning the member to this payment

Lines 115 to 125 are the Contact and Address details from a member profile account in SS - and as stated additional contact fields can be configured in the EcommerceRole.php file to be assigned to a member.

Rich - I have also replaced the following code in the sample file attached which enables the automatic loading of the payment submission through to Paymate

Line 95 Added
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');

Line 148
Replaced
<script>
$('PaymentForm').submit();
</script>

With
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("input[type='submit']").hide();
jQuery('#PaymentForm').submit();
});
</script>

Cheers, Karl

Avatar
TotalNet

Community Member, 181 Posts

15 December 2009 at 3:26pm

Edited: 15/12/2009 3:28pm

Hey Karl,

Thanks for making that last change. I'm sure that used to work but it's been a long time since I worked on this!

I've made a small change in that the method now selects the live versus test URL based on the environment type (live/dev/test), not a huge improvement over editing _config.php but let me know if you're interested and I'll post an attachment or email it to you.

What I had hoped to do though is add the "state" and "postcode" fields using DataObjectDecorator but gave in and just edited EcommerceRole instead, as far as I'm concerned these are required regardless of payment method so I won't lose any sleep over it ;)

Catherine, Do you have email working now?
Also, you referred to keeping the address info in sync with the return information from Paymate, that's an interesting point, were you thinking in terms of managing fraud risk? It rasises some challenges around communicating that to the customer and it's got me thinking about recording the transaction in a bit more detail.

Well, I'm much happier with ecommerce 0.6beta1 than the earlier trunk versions I was working with. And a working Paymate payment method is the cherry on top :)

Cheers,

Rich

Avatar
boombox

Community Member, 44 Posts

15 December 2009 at 5:32pm

Edited: 15/12/2009 5:33pm

Hi Rich
I'm happy with using config at present - cheers anyway
Yep there is still issues with all 3rd party payment methods in the SS Ecommerce - with regards to a secure notification process and verification of the order back on SS website
AN IPN (independent payment notification system) is available with both Paymate and PayPal but these are yet to be implemented in any payment modules - hard to test because there isn't any debugging available when coming receiving notification back form the 3rd party payment system
We had a go but gave up - will look to do some more when getting funded for it!

Cheers Karl

Avatar
PapaBear

Community Member, 26 Posts

24 September 2010 at 10:09am

Excellent module. With minor tweaking to suit the information my client needed recorded I was able to get this working on an e-commerce site quickly and easily.

Thank you!
James.