Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Paymate payment function for testing

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

Page: 1
Go to End
Author Topic: 2348 Views
  • mschiefmaker
    Avatar
    Community Member
    187 Posts

    Paymate payment function for testing Link to this post

    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

    Attached Files
  • boombox
    Avatar
    Community Member
    44 Posts

    Re: Paymate payment function for testing Link to this post

    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!

    Attached Files
  • mschiefmaker
    Avatar
    Community Member
    187 Posts

    Re: Paymate payment function for testing Link to this post

    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

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: Paymate payment function for testing Link to this post

    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

  • boombox
    Avatar
    Community Member
    44 Posts

    Re: Paymate payment function for testing Link to this post

    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

    Attached Files
  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: Paymate payment function for testing Link to this post

    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

  • boombox
    Avatar
    Community Member
    44 Posts

    Re: Paymate payment function for testing Link to this post

    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

  • PapaBear
    Avatar
    Community Member
    26 Posts

    Re: Paymate payment function for testing Link to this post

    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.

    2348 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.