CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Moneris Payment Module Tweaks
Pages: [1]

Author Topic: Moneris Payment Module Tweaks  (Read 3065 times)

dmccarney

  • Guest
Moneris Payment Module Tweaks
August 25, 2009, 11:41:50 am
I was hoping someone could help me out a little bit with some minor tweaks I'm making to the Moneris payment module. Specifically the file Moneris.php in /sites/all/modules/civicrm/CRM/Core/Payment

The basic problem is that the Moneris module isn't forwarding along any 'Item" details to the Moneris service we used for credit card transaction processing. So if a client purchases two tickets to our event then the receipt is blank in the items section rather then having a subtotal break-down listing the ticket item, a quantity of 2, and the individual item price.

I've been dumping the $params parameter that is passed to the doDirectPayment() method of the Moneris.php file to see what kind of data I have to work with and when (if someone has a link to more concrete API docs about this, you'd be my best friend). It appears like I can probably find the item price by running a query against the "civicrm_option_value" table using the key from the "price_3" array from the $params parameter.  So that solves one part of things...

The main problem I'm stuck on now is how to find out the quantity of each item. Specifically in relation to multiple-person event registrations. I'm also worried about building changes that are too specific to certain conditions and will be fragile overall.

Once I've got the quantity and price information for the item(s), it is just a matter of fanagling them into a specially crafted array that I can "setItems" with on the $mpgCustInfo structure that is passed to the Moneris backend (as per the Moneris API spec).

I feel like I'm bumbling around the source in the wrong way but I really don't have the time to learn the whole CiviCRM architecture for this (hopefully) minor change. I'm a fairly experienced PHP programmer, but I could use some CiviCRM specific help!

If things pan out, and I can get a reasonable solution working I would have zero problem whatsoever sending a patch back to CiviCRM. It would sure be easier then having to patch the file after every upgrade!

Thanks again, let me know if you need more information. Just in case it's helpful I've attached some of my $param dumps to show what information I _know_ is available to me. The first dump is from a donation, the second from an event registration and the third from a multi-person event registration. The XXX's are censored data (privacy etc). The credit card # is for the Moneris test env, and thus not a secret.

- dan


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Moneris Payment Module Tweaks
August 25, 2009, 12:39:13 pm

a similar issue has come out in another thread:

http://forum.civicrm.org/index.php/topic,9299.html

I think the best bet would be for CiviCRM to introduce another hook and call it with the "form" object before we call doDirectPayment / doTransferCheckout. We should also send in the parameters that we are sending to the payment processor.

any listener could then add / remove parameters that are being sent to doDirectPayment by examining the form object and/or making db calls to get various values. This keeps it a bit clean and eliminates additional code in the paymentProcessor

do you think this will work for you?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

dmccarney

  • Guest
Re: Moneris Payment Module Tweaks
August 26, 2009, 07:06:14 am
Hi there,

Yes, this kind of a hook would probably work perfectly for me.

I assume that having that integrated into a build will probably take a considerable amount of time though, correct? Would it be available in a CVS nightly or something a little bit sooner?

joe murray

  • Guest
Re: Moneris Payment Module Tweaks
September 03, 2009, 05:09:46 am
Documentation for Moneris is available at https://esplusqa.moneris.com/connect/en/process/apis/PHP/index.html

When we originally implemented this payment gateway we did a bit of hack to send a single transaction detail line to Moneris to allow us to track what account the revenue was for. The reason was that the original client for this had multiple sub-organizations for which it accepted donations, and we wanted for audit purposes to be able to correlate the email confirmation at the time of the transaction cc'd to staff with the transactions information available later from Moneris. I'd have to look at the code to see whether this code ended up in what was submitted to svn. I believe it may have since at that time if I recall there wasn't general support in CiviCRM for using this functionality, and we may have thought it was useful as a basis for further development but not a problem if included without being fully developed as transaction details.

The original implementor of the code was Alan Dixon - I think his email is available on this forum somewhere.

HTH,
Joe

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Moneris Payment Module Tweaks

This forum was archived on 2017-11-26.