WPPizza – A Restaurant Plugin for WordPress › Support › Add-Ons › Gateways › Authorize.net (SIM) › authorize.net CIM Addon Suggestion
- AuthorPosts
- 7 January, 2015 at 2:54 pm #6857
Hi,
My client is using your plugin with Authorize.net gateway.
He wants to store customer information and credit card details using Authorize.net CIM.
Is there any possibility of extending your plugin functions to have this feature?
Do you have any suggestion on how one should go, so that any future updates from wp-pizza plugin won’t overwrite such custom codes.Will appreciate any help in this regard.
Thanks
7 January, 2015 at 3:07 pm #6859>Is there any possibility of extending your plugin functions to have this feature? Do you have any suggestion on how one should go
my suggestion would definitely be to use filters and action hooks rather than messing around in the plugin itself.
having said that, for what you want to do, i would need to add an additional filter in some place.
as I am working on on some other stuff in the plugin, it won’t be too hard to add this.when I’m done, I’ll post a quick example/dummy here that should at least send you on your way
7 January, 2015 at 11:59 pm #6876generally i am happy to add action and filter hooks in the plugin in all sorts of places for people to use
however, having had more of a think about what you said, I am a bit hazy about what it is your (or more accurately your customer) is trying to achieve.
from what i can see Authorize.net CIM stores the customer data on their server.
if the customer is registered on the site (as a wordpress user and is logged in) the data he registered with will automatically filled in (if set up that way) in the relevant order page fieldsso I’m not sure where the CIM info is supposed to fit in here
if the customer is NOT already registered as a wordpress user there’s – i would have thought – no info that could tie him into any customer data stored at a.net CIM
I’m probably missing something, so would be grateful for some clarification
PS: just to mention. storing CC info on your clients server (as opposed to on a.net’s servers) is an absolute no no …
8 January, 2015 at 4:07 pm #6883Thanks for replying.
As sometimes the clients (client of my client) receive orders on phone too.
When customer place online order, the order is processed and at the same time credit card information along with name is stored in Authorize.net CIM.
This will be done so that when the same customer places offline order there will be no need to ask for card details again.8 January, 2015 at 5:11 pm #6884still not sure i understand the workflow .
so, someone phones up and wants to order something.
then what is supposed to happen ?is the guy who gets the phonecall supposed to go to the website and then click on things to put the order together and then checkout (essentially for the client on the phone) ?
if that’s the case, how would the guy that receives the call even know which (wordpress) user it is and what data is associated with him without logging in as that user (therefore needing that users un/pw) ?
still not getting it, sorry (but maybe the workflow is supposed to be different…dunno)
8 January, 2015 at 5:54 pm #6907even if one were to somehow get that users data (let’s say by creating a specific user role which then gets a dropdown on the checkout page where he/she can select from users which – via an ajax call – could prepopulate the fields)
you will still have 4 problems
a) you’ll have to get the associated a.net CIM data
b) even if you were to get that AND prepopulate a credit card number (etc) field , a.net does not expect (and therefore does not look for those) fields so you’d have to enter them again anyway once you are at the a.net page
c) you would need an SSL certificate for your checkout
d) and most importantly – IT IS TOTALLY ILLEGAL – as you would be storing unencrypted cc numbers on your serveragain though, I might be misunderstanding things
8 January, 2015 at 6:08 pm #69101. user goes to site and places online order. makes online payment through Authorize.net gateway.
2. Once the payment is successful, the credit card details along with customer name is logged into authorize.net CIM
3. In future if the same customer makes a phone call to order, pizza company guy can log into authorize.net CIM and use the information to process the payment. this saves them from taking the card details of the user again. This process won’t be using wordpress. They only want me store the data in authorize.net CIM for future use, rest of the process will be handled by them manually.
I hope this clears the requirement.8 January, 2015 at 6:35 pm #6913ha, so after all of this , is what we are talking about simply that that client of yours wants a CIM implemntation of the authorize.net gateway , rather than the SIM one ?
(or am i just really thick here…)
reading through this:
http://community.developer.authorize.net/t5/Integration-and-Testing/Which-method-to-use-AIM-SIM-CIM-DPM/td-p/16638you apparently cannot combine the two (but admittedly i never had anything to do with CIM implementations )
8 January, 2015 at 7:01 pm #6915Well my customer wants to have SIM but at the same time add CIM so that it helps in both online and offline orders.
Are you suggesting that we should only use CIM?.
I know your plugin works on SIM, could you suggest hooks/filters that we can use?8 January, 2015 at 8:00 pm #6918i’m not really suggesting anything as such.
the main problem is, that i don’t really know anything about CIM and just have to go by some documentation/links i have been able to dig up somewhere. So if you *know* that these two can happily live together/independently, maybe the following is something that helps
after every executed order the following action runs
wppizza_on_order_executed
passing on the order id. so perhaps this sort of thing (?):
add_action( 'wppizza_on_order_executed', 'my_cim_function'); function my_cim_function($orderId){ global $wpdb; $orderDetails = $wpdb->get_row("SELECT * FROM " .$wpdb->prefix . "wppizza_orders WHERE id='".(int)$orderId."' AND initiator='anet' "); $transaction_id=$orderDetails->transaction_id; $transaction_details=maybe_unserialize($orderDetails->transaction_details); /* the above two vars hold the - you guesses it - transaction id and all transaction details returned from auth.net maybe you can now do something with this regrading CIM ? */ }
does that help perhaps ?
[edit 19-Jan-2015:] just for reference – the above can be simplified a bit . please see here
https://www.wp-pizza.com/topic/after-every-order/#post-71808 January, 2015 at 8:02 pm #6919PS, transaction_details will not contain any cc details though as they are – of course – not just being sent all over the place and stay on a.net servers….
9 January, 2015 at 8:21 am #6932Actually i am planning to use authorize.net transaction id for CIM.
In your pluggin wp_wppizza_orders.transaction_id contains authorize.net transaction id, correct?.
When authorize.net sends respose to your ipn.php file, is there any way to get transaction id without modifying your plugin?.9 January, 2015 at 11:29 am #6934>authorize.net transaction id, correct?.
yes
>get transaction id without modifying your plugin?.
you can do that as described/coded above without modifying thingshowever, that gateway – although working from what i can see – is quite old now and could be updated in a couple of places anyway. when I do this , i could easily also put an action hook in there that passes on the tx id with which you can do as you like
9 January, 2015 at 12:35 pm #6935that would be great. Any idea when you will be able to add new hooks?.
9 January, 2015 at 12:39 pm #6936next couple of days or so, maybe later today even
9 January, 2015 at 3:50 pm #6939Thanks
9 January, 2015 at 11:53 pm #6973hi
having had a look at the way it is right now, this might take a few more days to bring it up to scratch.
in the meantime though (in case you want to get going) you can do the following (which will be part of the next update)
on approx line 833 of wppizza-gateway-authorize.net.php you will find
function gateway_transaction_execute($gatewayReply,$orderId){
right after that just add
do_action('wppiza_gateway_anet_verified',$gatewayReply, $orderId);
so it will read
function gateway_transaction_execute($gatewayReply,$orderId){ do_action('wppiza_gateway_anet_verified',$gatewayReply, $orderId);
and so forth.
in your themes functions.php you can then go wild as in
add_action('wppiza_gateway_anet_verified','my_function',10,2); function my_function($gwreply,$orderid){ /* do your cim stuff with the reply from authorize.net contained in $gwreply */ /* fyi: $orderid is the id of the order in the wppizza_orders table ...just in case you need it for something*/ }
note, this action hook will only run when the reply from auth net has been (again) verified to make sure currencies etc match (but i guess that should be just fine, as otherwise it would mean someone has tampered with stuff somewhere)
hope that helps for the moment
9 January, 2015 at 11:56 pm #6974PS: “my_function” should probably be changed to something more meaningful
10 January, 2015 at 12:06 am #6975PPS (sorry but just in case)
if you want to run your function “before” it gets verified again just add
do_action('wppiza_gateway_anet_reply',$gatewayReply);
right after
function gateway_handle_response($gatewayReply){
instead (will also be added to the next update, just for good measure)
and then do
add_action('wppiza_gateway_anet_reply','my_function'); function my_function($gwreply){ /* do your cim stuff with the reply from authorize.net contained in $gwreply */ }
just thought i’d mention it in case it’s useful
as ever, any questions , just shout
10 January, 2015 at 7:28 pm #6989This reply has been marked as private. - AuthorPosts
- The topic ‘authorize.net CIM Addon Suggestion’ is closed to new replies.