Skip to content

Commit

Permalink
Merge pull request #21 from wirecard/tpwdcee191
Browse files Browse the repository at this point in the history
#20 add consumerDeviceId
  • Loading branch information
rinnhofer committed Aug 25, 2017
2 parents 51d4049 + 42c44e2 commit 812c423
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Wirecard Checkout Seamless extension for Magento

[![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/Magento-WCS/master/LICENSE)
[![Magento Community Edition 1.9.3.1](https://img.shields.io/badge/Magento_CE-v1.9.3.1-green.svg)](https://www.magento.com/)
[![Magento Community Edition 1.9.3.4](https://img.shields.io/badge/Magento_CE-v1.9.3.4-green.svg)](https://www.magento.com/)
[![PHP v5.6](https://img.shields.io/badge/php-v5.6-yellow.svg)](http://www.php.net)

Wirecard Checkout Seamless extension for Magento.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,18 @@ public function getDataStorageUrl()
return $this->_dataStorageUrl;
}

public function getConsumerDeviceId() {
$session = Mage::getModel('customer/session');

if (strlen($session->getData('wirecard_cs_consumerDeviceId'))) {
return $session->getData('wirecard_cs_consumerDeviceId');
}
else {
$timestamp = microtime();
$consumerDeviceId = md5(Mage::helper('wirecard_checkoutseamless')->getConfigData('settings/customer_id') . "_" . $timestamp);
$session->setData('wirecard_cs_consumerDeviceId', $consumerDeviceId);
return $consumerDeviceId;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function initPayment($storageId, $orderIdent)
$order = $this->getOrder();
/** @var Wirecard_CheckoutSeamless_Helper_Data $helper */
$helper = Mage::helper('wirecard_checkoutseamless');
$session = Mage::getModel('customer/session');

$precision = 2;

Expand Down Expand Up @@ -183,6 +184,11 @@ public function initPayment($storageId, $orderIdent)

$init->mage_orderId = $this->getOrder()->getRealOrderId();

if (strlen($session->getData('wirecard_cs_consumerDeviceId'))) {
$init->consumerDeviceId = $session->getData('wirecard_cs_consumerDeviceId');
$session->unsetData('wirecard_cs_consumerDeviceId');
}

$init->generateCustomerStatement($helper->getConfigData('options/shopname'));

if ($helper->getConfigData('options/sendbasketinformation')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<config>
<modules>
<wirecard_checkoutseamless>
<version>4.2.0</version>
<version>4.2.1</version>
</wirecard_checkoutseamless>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,21 @@
<div id="wirecard-checkoutseamless-iframe-div-body">
<iframe src="about:blank" id="wirecard-checkoutseamless-iframe"></iframe>
</div>
</div>
</div>

<?php if (strlen($this->getConsumerDeviceId())) { ?>
<!-- wirecard checkout seamless device id script -->
<script language="JavaScript">
var di = {t:'<?php echo $this->getConsumerDeviceId(); ?>',v:'WDWL',l:'Checkout'};
</script>
<script type="text/javascript" src="//d.ratepay.com/<?php echo $this->getConsumerDeviceId(); ?>/di.js"></script>
<noscript>
<link rel="stylesheet" type="text/css" href="//d.ratepay.com/di.css?t=<?php echo $this->getConsumerDeviceId(); ?>&v=WDWL&l=Checkout">
</noscript>
<object type="application/x-shockwave-flash" data="//d.ratepay.com/WDWL/c.swf" width="0" height="0">
<param name="movie" value="//d.ratepay.com/WDWL/c.swf" />
<param name="flashvars" value="t=<?php echo $this->getConsumerDeviceId(); ?>&v=WDWL"/>
<param name="AllowScriptAccess" value="always"/>
</object>
<!-- end of wirecard checkout seamless device id script -->
<?php } ?>

0 comments on commit 812c423

Please sign in to comment.