mmabingo / WC_CyberSourceSecureAcceptance_SOP

CyberSource Secure Acceptance Silent Order Post Gateway Plugin for WooCommerce
4 stars 4 forks source link

Device fingerprint javascript #2

Open lemusi opened 8 years ago

lemusi commented 8 years ago

Hi again,

There is a javascript for device fingerprint that my bank is asking I include in the transaction. I thought you might want to use it as well, because I ticked the option in settings and it doesn't seem to work since the devicefingerprint field on the bank transaction in Cybersource is empty (as well as the IP address, but that's another issue).

Here is the simple code but please advice and where is the best place to put it in your code:

<html>
<head>
<script src="cybs_devicefingerprint.js"></script>
</head>

<body>
    <a style="color: #ff0000"> <b>PROFILING MY DEVICE...</b></a>

    <form action="displayresponse.jsp" method="post">
        Sample param 1: <input type="text" name="param1"><br>
        Sample param 2: <input type="text" name="param2"><br>
        <script>
            document
                    .write('<input type="hidden" name="deviceFingerprintID" value="'
                            + cybs_dfprofiler("lrodrig", "test") + '">');
        </script>
        <input type="submit" value="Submit">
    </form>

    <a style="color: #00ff23"> <b>FINISHED...</b></a>
</body>
</html>

And this is the java script (cybs_devicefingerprint.js):


/*
<!doctype html> -> Esta etiqueta debe de estar en la página, 
                   donde se define el document type. De
                   lo contraio aparecera un warning de 
                   Active-X
                   This label should be on the page where the document type is defined otherwise a warning Active-X may show
*/

 function cybs_dfprofiler(merchantID,environment)
 {  

    if (environment.toLowerCase() == 'live') {
        var org_id = 'k8vif92e';
    } else {
        var org_id = '1snn5n9w';
    }

    var sessionID = new Date().getTime();

    var paragraphTM = document.createElement("p");
    str = "background:url(https://h.online-metrix.net/fp/clear.png?org_id=" + org_id + "&session_id=" + merchantID + sessionID + "&m=1)";

    paragraphTM.styleSheets = str;
    paragraphTM.height = "0";
    paragraphTM.width = "0";
    paragraphTM.hidden = "true";

    document.body.appendChild(paragraphTM);

    var img = document.createElement("img");

    str = "https://h.online-metrix.net/fp/clear.png?org_id=" + org_id + "&session_id=" + merchantID + sessionID + "&m=2";
    img.src = str;

    document.body.appendChild(img);

    var tmscript = document.createElement("script");
    tmscript.src = "https://h.online-metrix.net/fp/check.js?org_id=" + org_id + "&session_id=" + merchantID + sessionID;
    tmscript.type = "text/javascript";

    document.body.appendChild(tmscript);

    var objectTM = document.createElement("object");
    objectTM.data = "https://h.online-metrix.net/fp/fp.swf?org_id=" + org_id + "&session_id=" + merchantID + sessionID;
    objectTM.width = "1";
    objectTM.height = "1";
    objectTM.id = "thm_fp";

    var param = document.createElement("param");
    param.name = "movie";
    param.value = "https://h.online-metrix.net/fp/fp.swf?org_id=" + org_id + "&session_id=" + merchantID + sessionID;
    objectTM.appendChild(param);

    document.body.appendChild(objectTM);

    return sessionID;
 }

Secure Acceptance Implementation

Invoke the function “cybs_dfprofiler( merchantID, environment)” passing the parameters Merchant Id and the Environment (test or production). The returned value of the function cybs_dfprofiler(…) is the DeviceFingerprintID.

a) Parameters function cybs_dfprofiler(Parameter 1, Parameter 2) :

 Parameter 1: merchantID  cybersource_merchantid

 Parameter 2: environment  test  live

Pass the value of DeviceFingerprintID to the hidden parameter: device_fingerprint_id for secure acceptance implementation.

Please take note that parameter needs to be signed. • Use payment_form for Secure Acceptance Web Mobile • Use signed_datafields for Secure Acceptance SOP

Regards,

Ivan

mmabingo commented 8 years ago

Hi Ivan,

A fix for this bug has been patched under v1.2.0-beta.

I know you may feel uncomfortable to use a beta version but I must state that the final version will be released in the shortest possible as I am currently implementing an auto plugin updater for GitHub hosted WordPress plugins.

Kind Regards,

Mikochi

lemusi commented 7 years ago

Hi Mikochi,

I tried your latest beta release but it's still presenting the same issue with the device fingerprint.

http://atempoproductions.com/wp-content/uploads/2016/10/Capture2.JPG

It's saying it's "Not Submitted".

Any ideas on how to fix it?

Thanks.

Ivan

lemusi commented 7 years ago

hi.. just to let you know that it is actually working... I don't know what are the conditions for it to work, but now it works... thanks.

Ivan.