1

I know Virtuemart 1.1.9 is not supported anymore, but I've a lot of customization on my installed online Joomla website. i can't move it' to latest versions of joomla and VM as well.

Please read the scenario.. I've joomla 1.5 with virtuemart 1.1.9- Whenever a user process credit card payment through authorize.net, after completion the process the user sees a message of "thank you, your order has been completed... regardless of transaction response either that is failed or succeeded.

My Need is.. I want an email to be sent to my email address when a transaction is failed. I can't check authorize.net's statements on my mobile.

What I Question is... how can i send email to myself and which files and functions are working to check the responses form the authorize.net server.

Please let me know If this question is confusing... I will try to elaborate it more easy to understand.

1 Answer 1

1

After a lot of effort I finally reached to those pages what contains all the transaction details.

while using Authorize.net, Transaction request is sent in Json/XML format to the authorize.net server and after processing a response is returned back in same XML/Json format. Following page works for this regards

joomlasite/administrator/components/com_virtuemart/classes/payment/ps_authorize.php

Now in this file search process_payment function,

process_payment

This is the main function for all payment modules that use direct connections to a payment gateway (like authorize.net or eWay XML). This is the place, where the payment details are validated and captured on success. Returns true on success, false on failure.

And this the what I customized according to the response from the payment gateway.

I echoed all the response and then according to status 1,3,4 or any I created a php email script to send an email to specified email address

temporarily echo the response from the server

$vmLogger->err('result: '. $result);

It will show all the responses as error on after transaction.

$Message = 
'**Notification:**A Transaction was attempt. Authorize.net responded 
   **'.$response[3].'**. 
Details are as under:


========= ORDER INFORMATION =========
Invoice : '.$response[36].'
Amount : '.$order_total.'

============== RESULTS ==============
Response : '.$response[3].'
Authorization Code : '.$response[4].'
Transaction ID : '.$response[6].'

==== CUSTOMER BILLING INFORMATION ===
First Name : '. substr($dbst->f("first_name"), 0, 50).'
Last Name : '. substr($dbst->f("last_name"), 0, 50).'
E-Mail : '.$dbbt->f("user_email");

 $cc_headers = "MIME-Version: 1.0" . "\r\n";
 $cc_headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 //this address will show as "from" in email box
 $cc_headers = 'From:<[email protected]>'. "\r\n"; 

 //$vendor_mail fetches virtuemart's vendor's email.
 $to_email = $vendor_mail;
 $cc_subject = "Transaction attempt - ".$response[3];
 $cc_message = $Message;

now I customized the responses according to their status.

        ...
elseif ($response[0] == '2') {
....//some codes
            mail($to_email,$cc_subject,$cc_message,$cc_headers);
.....
elseif ($response[0] == '3') {
....//some codes
            mail($to_email,$cc_subject,$cc_message,$cc_headers);
.....
elseif ($response[0] == '4') {
....//some codes
            mail($to_email,$cc_subject,$cc_message,$cc_headers);
.....

This will send email to the vendor if response is failed, declined or any other issued but not successful.

you can customize response for successful payment too under

 if ($response[0] == '1') {
 ............. email is successful

I hope other developers may find this helpful.

Regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.