Reply
Highlighted
Member
Posts: 5
Registered: ‎12-13-2011

Anyone implemented DPM in Perl?

I have a client who has been doing AIM for many years, implemented on a Red Hat 5 box using Perl, specifically using the Business-OnlinePayment-AuthorizeNet module.  They want to convert to DPM to reduce their PCI requirements.  I see Auth.net provides DPM APIs for several other languages, but not for Perl.  Has anyone implemented DPM in Perl?  I barely know enough PHP to be dangerous, so I can't spelunk the PHP API to see what's going on under the hood.

Absent that, can someone provide me with the lower-level requirements for the DPM conversation?  I don't have to have a Perl module to do this.  I can leverage the existing XML, LWP, and whatever else I need to do the job.

Thanks for your help.

Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Anyone implemented DPM in Perl?

Interesting idea. As it so happens, I use Perl and am fairly fluent with the PHP API, so I could probably figure out how to do that. Just a matter of translating the fingerprint formula, which I've cleaned up here from the one in the PHP AuthorizeNetSIM.php lib file (DPM layers on top of SIM):

 

public static function getFingerprint($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp) {
    $api_login_id =
        ($api_login_id ? $api_login_id :
        (defined('AUTHORIZENET_API_LOGIN_ID') ? AUTHORIZENET_API_LOGIN_ID : ''));

    $transaction_key =
        ($transaction_key ? $transaction_key :
        (defined('AUTHORIZENET_TRANSACTION_KEY') ? AUTHORIZENET_TRANSACTION_KEY : ''));
        
    $raw = "{$api_login_id}^{$fp_sequence}^{$fp_timestamp}^{$amount}^{$transaction_key}";

    return (function_exists('hash_hmac') ?
        hash_hmac('md5', $raw) :
        bin2hex(mhash(MHASH_MD5, $raw)));
}

And then parsing the response, which I believe comes back as POST variables in this case. Just follow the code as best you can and replicate it.

http://www.authorize.net/support/DirectPost_guide.pdf

http://developer.authorize.net/downloads/ (PHP SDK - see the DPM, SIM lib files)

 

This actually sounds like something that would be right up my alley and interesting to do, so if you want to just pay me a couple hundred dollars, I can hack together an adaptation for you and then all you'll have to do is add the surface stuff like extra fields and your client's site design. You can PM me here or contact me by phone or through my contact form if you're interested:

http://www.fentonwebdesignfirm.com/contact-us.php