VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Payment Modules => Topic started by: rwcorbett on December 17, 2009, 18:21:25 pm

Title: Beanstream payment method for Virtuemart
Post by: rwcorbett on December 17, 2009, 18:21:25 pm
Hi there all,

Just so you know - I don't really have time to maintain this... and am busy so if I don't reply to your questions then it's not because I don't like you, it's because I am too busy! This is released under the MIT Licence so you can use it however you want, but I will not be officially supporting it.

I have worked up a new payment method to communicate with Beanstream (also works with TD Canada Trust's OnlineMart). It is based on the built-in PayPal module and is a variation on the idea given to me by erikas_boy (gotta give credit where credit is due - thanks Chris!). Everything you need - including setup examples - should be in the .zip

Code: [Select]
* Beanstream Payment Processing Plugin
* - takes the customer offsite to enter in the creditcard info on Beanstream's server
* - the DB is queried to auto-fill most of the sections on the form
* - the payment form option for "Allow Price Modification" should be set to 'no' on your
*   Beanstream control panel
* - HOW TO INSTALL: (see images included in the zip)
* 1) YOU WILL NEED TO FILL YOU MERCHANT ID IN ON LINE 51 below.
* 2) create a new payment method using payment class = ps_payment & method type = HTML-Form based
* 3) copy and paste this entire PHP block (line 1 to line 70) into the configuration block
*
* based on the PayPal module that is included with VirtueMart
* date: 16 Dec, 2009
* written by Robb Corbett

{edit: it is now on gitHub} fork project or download from here : https://github.com/rwcorbett/VirtueMart_Beanstream_Payment_Method (https://github.com/rwcorbett/VirtueMart_Beanstream_Payment_Method)

{edit: it's really just a simple PHP form submit to Beanstream's payment site. I modded some files that existed in in the default VM install to make them talk with Beanstream. It was done when working on Joomla 1.4 (I think) and an old version of VM. But please take alook and then write your own implementation based on this as I'm sure that the newer versions of Joomla, VM, and the Beanstream API will require you to change things anyways.}

Have Fun!  ;)

-Robb
Title: Re: Beanstream payment method for Virtuemart
Post by: jboulton on March 21, 2010, 03:06:09 am
With Beanstream and Virtuemart are you able to have subscription payments and Interac transactions?

I am not a Beanstream client; however I am looking into their services.  I am currently an Internetsecure client and use Authorize.net with them; however I can't incorporate subscription payments or Intarac transactions with the Authorize.net payment module.

Title: Re: Beanstream payment method for Virtuemart
Post by: Syn on April 09, 2010, 04:00:46 am
Thanks for creating this.  I haven't installed it yet, but are there any bugs that you've noticed?

Has anyone else tried this?
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on April 19, 2010, 13:40:23 pm
Thanks for creating this.  I haven't installed it yet, but are there any bugs that you've noticed?

Has anyone else tried this?
Thanks! My client (there's only one using it right now) hasn't reported anything to me yet so I can't say for sure...

With Beanstream and Virtuemart are you able to have subscription payments and Interac transactions?
... I can't incorporate subscription payments or Intarac transactions with the Authorize.net payment module.
I haven't tried this with Interac yet - my client didn't have that option. They're website does say that they accept it though - maybe try the customer support/tech suport at 1.888.472.2072. Found at their site: http://www.beanstream.com/public/index.asp (http://www.beanstream.com/public/index.asp)
Title: Re: Beanstream payment method for Virtuemart
Post by: shamsmughal on June 10, 2010, 17:43:22 pm
Hi, I am trying to figure out the way to customize the BeanStream so it should send the confirmation email when the Order is confirmed from BeanStream Payment Processor.

Right now, it sends the confirmation email before the anything is approved by BeanStream.

Please help
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 10, 2010, 18:23:18 pm
Right now, it sends the confirmation email before the anything is approved by BeanStream.
2 quick questions:
- what is sending the email? Joomla, Virtuemart or Beanstream?

- is your page receiving the confirmation POST variable in the HTTP header?

Could you maybe post some code so we can see what you're working with? (you can exclude your merchant ID and personal stuff.
Title: Re: Beanstream payment method for Virtuemart
Post by: shamsmughal on June 10, 2010, 20:56:28 pm
rwcorbett, thanks for your prompt reply.

I have copied your code and instructions at the top of this post. I go to my Virtumart Administration then Add Payment Method. Set up the BeanStream configuration as you posted in this thread.

When from the cart we submit order, it goes to the beanstream page where we have to fill out our payment information. As when we are filling the information, a mail received that "The Following order was received." Even we didn't submit the payment form yet.

In one other thread I found there are two files to be placed in administrator/components/com_virtuemart/classes/payments/  one is ps_beanstream.php and other is ps_beanstream.cfg.php.

We have not included this because there are no attachment with your post.

Please help
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 10, 2010, 21:43:17 pm
As when we are filling the information, a mail received that "The Following order was received." Even we didn't submit the payment form yet.

There is nothing in my PHP code that is sending email so it is one of those other things I mentioned that is sending it. Who is the mail from? Can you post the mail header for me?

In one other thread I found there are two files to be placed in administrator/components/com_virtuemart/classes/payments/  one is ps_beanstream.php and other is ps_beanstream.cfg.php.

We have not included this because there are no attachment with your post.
No - I decided to use the built in HTML payment method - my 'module' is simply a PHP/HTML script that submits the payment to Beanstream... so no, I did not write the ps_ files.
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 10, 2010, 22:17:01 pm
hmmm... it looks like the email is coming from Virtuemart to me. Check the settings for the store and get back to me.
Title: Re: Beanstream payment method for Virtuemart
Post by: shamsmughal on June 10, 2010, 22:26:18 pm
Robb, Store settings are seems to be perfect. As per my understanding, when using PayPal IPN we can customize the http response. But with BeanStream not getting the right way. I have checked all the files with no luck.

Please help.
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 11, 2010, 01:05:59 am
As per my understanding, when using PayPal IPN we can customize the http response.
Yes, PayPal IPN can do that, but my method doesn't use that as far as I know... what do you have the "Payment class name" set to on your "Payment Methods" admin page? IT SHOULD NOT be using the ps_paypal one... it should use ps_payment, VirtueMart's generic payment PHP processor.
I know that ps_paypal does contain PHPMailer code... but neither ps_payment or my Beanstream addon do not.

Check that first... but if that is not it then try looking at: /administrator/components/com_virtuemart/notify.php or
/administrator/components/com_virtuemart/classes/payment/ps_payment.php

and see what you can sort out. Also, trace your HTTP headers before, during and after the transaction... maybe we can find out where this mystery email is being generated from.

Since my client (there's only one using it right now) hasn't really complained about anything of that nature yet I have had no reason to disrupt their site with further development so I'm not really able to re-write the module at this time, too many other things going on.

I can help you try to troubleshoot if you get me that info...
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 11, 2010, 01:07:43 am
oh and @ shamsmughal... your're going to want to go into your previous post and edit out the email addresses and IP routes... just replace them with xxxxxxx@xx.xxx or something. No need for unwanted spam!  ;D

-Robb
Title: Re: Beanstream payment method for Virtuemart
Post by: shamsmughal on June 11, 2010, 16:07:02 pm
Rob, I didn't understand your last post. What email address and Ip routes and unwanted spam?

I have checked the notify.php and ps_payment.php. I think notify.php is only used for paypal and we can not use with BeanStream.

As ps_payment.php is the default process for the ones who don't have their own class.

Can you please tell me where I can find the default code for sending confirmation email?

Thanks
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on June 11, 2010, 17:40:58 pm
Rob, I didn't understand your last post. What email address and Ip routes and unwanted spam?
the whole world can see your email address and IP's here: http://forum.virtuemart.net/index.php?topic=64471.msg239933#msg239933 (http://forum.virtuemart.net/index.php?topic=64471.msg239933#msg239933)
Quote
Can you please tell me where I can find the default code for sending confirmation email?

I think that you are trying to do something like this:
insert at line 60:

Code: [Select]
// ## SEND AN EMAIL ##
// NOTE: I haven't tested this mailout yet... it could be modified to
// send a confirmation email upon successful transaction. I am not sure which
// variables Beanstream sends back to server upon successful (or failed) transaction.
$to = "foo@example.com";
$subject = "the subject";
$message = "hello world from PHP Mail\nthe transaction ID was " . $db->f("order_id");
$headers = "From: bar@example.com" . '\r\n' . "Reply-To: bar@example.com" . '\r\n' . "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
// ## END PHP MAIL ##

NOTE: I haven't tested this mailout yet... it could be modified to
send a confirmation email upon successful transaction. I am not sure which
variables Beanstream sends back to server upon successful (or failed) transaction.
Title: Re: Beanstream payment method for Virtuemart
Post by: Syn on July 02, 2010, 20:47:41 pm
Thanks for your great work rwcorbett.  Will this process American Express payments too?
Title: Re: Beanstream payment method for Virtuemart
Post by: Syn on July 12, 2010, 09:04:16 am
I've been playing with this payment mod for a few days now and it's definitely well done.  However, it doesn't seem to log payment information on the backend, especially if the transaction was declined.  Was it meant to do this, or was this not implemented?

I'm still trying to figure out what exactly is done on the beanstream end of things and what needs to be implemented directly from our end.  In testing though, it has generally worked well.
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on July 15, 2010, 15:12:46 pm
Thanks @Syn!

I haven't implemented American Express... is that maybe something that BeanStream does?

As for backend logging... it wasn't a requirement for my client so I didn't implement it.

It really shouldn't bee too difficult if you know your way around PHP and MySQL.

What is it that you are trying to do with backend logging specifically?
Title: Re: Beanstream payment method for Virtuemart
Post by: omineau on August 04, 2010, 22:03:05 pm
Hi,

Is there a reason why this link:
http://rwc.cbwebco.com/rwcsvn/Beanstream%20Payment%20Method.v1.0.zip (http://rwc.cbwebco.com/rwcsvn/Beanstream%20Payment%20Method.v1.0.zip) doesn't work?

Thanks
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on August 05, 2010, 00:12:05 am
sorry - try this: http://rwcorbett.ca/Beanstream%20Payment%20Method.v1.01.zip
moved some things on the server... SVN repo got changed.

everything here now:
https://github.com/rwcorbett/VirtueMart_Beanstream_Payment_Method
Title: Re: Beanstream payment method for Virtuemart
Post by: Syn on August 05, 2010, 21:22:39 pm
Thanks @Syn!

I haven't implemented American Express... is that maybe something that BeanStream does?

As for backend logging... it wasn't a requirement for my client so I didn't implement it.

It really shouldn't bee too difficult if you know your way around PHP and MySQL.

What is it that you are trying to do with backend logging specifically?

I basically wanted to have the payment log recorded on the Virtuemart backend.  Your solutions works well, but in this partcular case I needed something that records the payment info on the backend and also prevents orders from being confirmed if the transaction is declined.

I implemented the other solution on this site, that was created a few years ago.  It seems to be working well.
Title: Re: Beanstream payment method for Virtuemart
Post by: rwcorbett on August 05, 2010, 21:24:30 pm
@Syn

could you forward me the link to that solution! I must have missed it (hence I wrote this) and would like to try it out  ;D

thanks in advance!
Title: Re: Beanstream payment method for Virtuemart
Post by: omineau on August 05, 2010, 22:44:16 pm
Thanks for the link.
Title: Re: Beanstream payment method for Virtuemart
Post by: kraymitchell on August 20, 2010, 20:28:49 pm
Has anything been done on this mod for the backend payment info being recorded? Wouldn't want confirmations sent out when they were declined!

Title: Re: Beanstream payment method for Virtuemart
Post by: GooRu on April 28, 2011, 19:48:09 pm
Hi...

Any chance you have some code that does not transfer to Beanstream but does it on site?

Curt


Hi there all,

I have worked up a new payment method to communicate with Beanstream (also works with TD Canada Trust's OnlineMart)

It is based on the built-in PayPal module and is a variation on the idea given to me by erikas_boy (gotta give credit where credit is due - thanks Chris!)

Everything you need - including setup examples - should be in the .zip


Code: [Select]
* Beanstream Payment Processing Plugin
* - takes the customer offsite to enter in the creditcard info on Beanstream's server
* - the DB is queried to auto-fill most of the sections on the form
* - the payment form option for "Allow Price Modification" should be set to 'no' on your
*   Beanstream control panel
* - HOW TO INSTALL: (see images included in the zip)
* 1) YOU WILL NEED TO FILL YOU MERCHANT ID IN ON LINE 51 below.
* 2) create a new payment method using payment class = ps_payment & method type = HTML-Form based
* 3) copy and paste this entire PHP block (line 1 to line 70) into the configuration block
*
* based on the PayPal module that is included with VirtueMart
* date: 16 Dec, 2009
* written by Robb Corbett / Cape Breton Web Design
* (c) Robb Corbett / Cape Breton Web Design
* contact me at: robb@cbwebco.com -or- robb.corbett@gmail.com
* if you choose to use this implementation you are welcome to, but please leave this header
*   inplace. I assume no liability for the functioning of this module on your site.

{edit: fixed url, again} HERE IS A LINK TO THE FILE : http://rwcorbett.ca/Beanstream%20Payment%20Method.v1.1.zip (http://rwcorbett.ca/Beanstream%20Payment%20Method.v1.1.zip)

Just so you know - I don't really have time to maintain this... and am busy so if I don't reply to your questions then it's not because I don't like you, it's because I am too busy! This is released under the MIT Licence so you can use it however you want, but I will not be officially supporting it.

Have Fun!  ;)

-Robb

robb [at] cbwebco.com
www.capebretonwebdesign.com
Title: Re: Beanstream payment method for Virtuemart
Post by: bkfish on September 21, 2011, 07:12:24 am
Has anyone got a finished and ready to go version of this?
Title: Re: Beanstream payment method for Virtuemart
Post by: GooRu on September 21, 2011, 16:30:58 pm
There is a company that will write the gateway for $200. Anyone want to get in on it?

This will be for a Beanstream gateway that transacts on the clients site.
Title: Re: Beanstream payment method for Virtuemart
Post by: madscience on January 10, 2013, 04:27:45 am
I have Joomla 1.5.15 and this doesn't work for me.
I'm not sure why either.
on my end this is the last screen i get:


Thank you for your order.

Success Your order has been successfully placed!

A confirmation email has been sent to: admin@XXXX.com

$db1 = new ps_DB(); $q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC"; $db1->query($q); $url = "https://www.beanstream.com/scripts/payment/payment.asp"; //https://www.beanstream.com/scripts/payment/payment.asp?merchant_id=XXXXXXXXX $fName = $dbbt->f("first_name"); $lName = $dbbt->f("last_name"); $tax_total = $db->f("order_tax") + $db->f("order_shipping_tax"); $discount_total = $db->f("coupon_discount") + $db->f("order_discount"); $shipping = sprintf("%.2f", $db->f("order_shipping")); $post_variables = Array( //"errorPage"=>"https://www.beanstream.com/samples/order_form.asp", // ## NOT REQUIRED ## //"trnCardNumber"=>"XXXXXXXXX", //test MC number //"trnExpMonth"=>"12", //testing //"trnExpYear"=>"12", //testing "trnOrderNumber"=>$db->f("order_id"), "trnAmount"=>round( $db->f("order_subtotal")+$tax_total+$shipping-$discount_total, 2), "trnCardOwner"=>$dbbt->f("first_name")." ".$dbbt->f("last_name"), "ordAddress1"=>$dbbt->f('address_1'), "ordAddress2"=>$dbbt->f('address_2'), "ordCity"=>$dbbt->f('city'), "ordProvince"=>$dbbt->f('state'), "ordPostalCode"=>$dbbt->f('zip'), "ordName"=>$dbbt->f("first_name")." ".$dbbt->f("last_name"), "ordEmailAddress"=>$dbbt->f('user_email'), "ordPhoneNumber"=>$dbbt->f('phone_1'), "ordCountry"=>$db1->f('country_2_code'), //**************************************************************************** "merchant_id"=>"XXXXXXXXX" //**************************************************************************** ); if( $page == "checkout.thankyou" ) { $query_string = "?"; foreach( $post_variables as $name => $value ) { $query_string .= $name. "=" . urlencode($value) ."&"; } // ## SEND AN EMAIL ## // NOTE: I haven't tested this mailout yet... it could be modified to // send a confirmation email upon successful transaction. I am not sure which // variables Beanstream sends back to server upon successful (or failed) transaction. $to = "admin@XXXXXX.com"; $subject = "the subject"; $message = "hello world from PHP Mail\nthe transaction ID was " . $db->f("order_id"); $headers = "From: bar@example.com" . '\r\n' . "Reply-To: bar@example.com" . '\r\n' . "X-Mailer: PHP/" . phpversion(); mail($to, $subject, $message, $headers); // ## END PHP MAIL ## vmRedirect( $url . $query_string ); } else { // ## MODIFY THIS TEXT TO SUIT YOUR NEEDS ## echo '
Please read the following information, and click the button to continue.

You will be directed to a secure payment form hosted by Beanstream, where you may pay for your order using VISA or Mastercard. Once we receive confirmation of payment from Beanstream, we will ship your order. Thank you.
'; echo '
'; echo '
Proceed to Credit Card Processing →
'; foreach( $post_variables as $name => $value ) { echo ''; } echo '
'; } ?>

Follow this link to view the Order Details.


Is there anyone who can point me in the right direction for a module that works with Beanstream and virtuemart 1.5.15 ?
Any help will be greatly appreciated!
If you require some type of donation or payment let me know.

Cheers.

*Mad