Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Authorization code in email notification to orders department

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-03-2009, 03:43 PM
 
jherzog jherzog is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 93
 

Default Authorization code in email notification to orders department

I need to include the credit cart (CC) authorization code in the email notifications that are sent to the orders department. Can anyone help me or point me in the right direction on how to do this?

Thanks,
Jed

X-Cart Pro 4.2.1
__________________
Jed Herzog
Gold X-Cart 4.0.17
http://www.outliersolutions.com
Portland Advertising Agency,
Portland Web Design
Reply With Quote
  #2  
Old 12-04-2009, 04:27 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: Authorization code in email notification to orders department

I think the code is in the $cart[details] (among other things).
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote
  #3  
Old 12-07-2009, 11:53 AM
 
jherzog jherzog is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 93
 

Default Re: Authorization code in email notification to orders department

I think you are right, it may be $cart['advinfo']. However The $cart variable/info does not seem to be "available" to this email tpl and I am not sure how to change that. The tpl mainly uses the $order variable but that does not include cc auth data.

Any suggestions?

Thanks,
Jed
__________________
Jed Herzog
Gold X-Cart 4.0.17
http://www.outliersolutions.com
Portland Advertising Agency,
Portland Web Design
Reply With Quote
  #4  
Old 12-09-2009, 01:18 PM
 
jherzog jherzog is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 93
 

Default Re: Authorization code in email notification to orders department

Ok, To make this happen I plan on adding a section to skin1/mail/html/order_notification_admin.tpl. But this template would need the variable $order['extra']['advinfo'].

This variable is set in include/func/func.order.php
In the function func_select_order() ~line 119.

It is not available for this template because the area type is not right. Hence it does not satisfy this if() statement:
if (defined('AREA_TYPE') && AREA_TYPE != 'C' && isset($order['extra']['advinfo']))

Any suggestions on what I should do?

I could:
1) directly query the database and and decrypt this information. But doing this type of php in a TPL is not ideal.
2) I could remove or modify this if() statement.

Removing the if statement is easiest but seems, at first, like a security risk. But how sensitive is this data to begin with? I do not store cc numbers and this if() statement does not return cc numbers, only authorization codes. Even if a malicious person figured out a way to access this exemption (which won't be straight forward) I don't think they could do anything harmful with the information.

The data in this variable is something like:
--- Advanced info ---
Reason: Approved: AuthCode: 010101;
PNRef: E19E3A285702 AVS info: International AVS result: N;
AVS result: Street match: Match;
Zip match: No Match CAVV info: No Match

I appreciate any opinions
Jed
xcart 4.2.x
__________________
Jed Herzog
Gold X-Cart 4.0.17
http://www.outliersolutions.com
Portland Advertising Agency,
Portland Web Design
Reply With Quote
  #5  
Old 12-09-2009, 01:24 PM
 
jherzog jherzog is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 93
 

Default Re: Authorization code in email notification to orders department

I could also make an additional query in func_process_order() where the admin notification are trigger ~line 1200

With in the if() statement
if ($config['Email_Note']['eml_order_p_notif_admin'] == 'Y'){

I could add:
$orderForAdvInfo = func_query_first("select *, $o_date from $sql_tbl[orders] where $sql_tbl[orders].orderid='$orderid'");

And pass $orderForAdvInfo['extra']['advinfo']; to the tpl.

I am still modifying the core code but this exception would be limited to when orders are processed and admin notifications are set.

Just another idea
__________________
Jed Herzog
Gold X-Cart 4.0.17
http://www.outliersolutions.com
Portland Advertising Agency,
Portland Web Design
Reply With Quote
  #6  
Old 12-09-2009, 02:38 PM
 
jherzog jherzog is offline
 

Advanced Member
  
Join Date: Jan 2006
Posts: 93
 

Default Re: Authorization code in email notification to orders department

I ended up implementing my ideas in comment #5 but the code I had in that comment was not exactly right. If anyone cares I have my implementation below. I am still curious your opinions on best practices and security.

in include/func/func.order.php
in function func_process_order() on around line~1200
I changed:

if ($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {
$to_customer = $config['default_admin_language'];
func_send_mail($config["Company"]["orders_department"], "mail/order_notification_subj.tpl", "mail/order_notification_admin.tpl", $config["Company"]["orders_department"], true, true);
}

TO:

if ($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {

//query xcart for CC details
$orderForAdvInfo = func_query("SELECT khash, value FROM $sql_tbl[order_extras] WHERE orderid = '$orderid'");
if (!empty($orderForAdvInfo)) {
foreach($orderForAdvInfo as $v)
$orderForAdvInfo[$v["khash"]] = $v["value"];
}
$orderForAdvInfo = text_decrypt($orderForAdvInfo['advinfo']);
$mail_smarty->assign("advOrder", $orderForAdvInfo);

$to_customer = $config['default_admin_language'];
func_send_mail($config["Company"]["orders_department"], "mail/order_notification_subj.tpl", "mail/order_notification_admin.tpl", $config["Company"]["orders_department"], true, true);
}

I then changed
/skin1/mail/order_notification_admin.tpl
and
/skin1/mail/html/order_notification_admin.tpl
from:

{include file="mail/order_invoice.tpl"}

To:

{include file="mail/order_invoice.tpl"}
Authorization Number is {$advOrder}



As far as security, implementing it in this way should only expose that variable while admin notifications are sent. Hence a minimal risk.

Thanks,
Jed
__________________
Jed Herzog
Gold X-Cart 4.0.17
http://www.outliersolutions.com
Portland Advertising Agency,
Portland Web Design
Reply With Quote
  #7  
Old 12-15-2009, 07:39 AM
 
sabrina montrex sabrina montrex is offline
 

Member
  
Join Date: Mar 2008
Posts: 10
 

Default Re: Authorization code in email notification to orders department

Hi Jed,
I'm wondering how I can add this Authorization Code in main/orders_list.tpl (Orders History - just below each order line or in an additional column) .
I appreciate your opinion.
Thanks.
__________________
X-Cart Gold 4.3.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:51 AM.

   

 
X-Cart forums © 2001-2020