Skip to content

Commit

Permalink
Merge pull request #11 from wirecard/TPWDCEE-192
Browse files Browse the repository at this point in the history
Add consumerDeviceId
  • Loading branch information
jpy authored Aug 28, 2017
2 parents fced271 + 3a4927d commit 8c8fa98
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 5 deletions.
28 changes: 27 additions & 1 deletion catalog/controller/extension/payment/wirecard.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ControllerExtensionPaymentWirecard extends Controller
{
protected $data = array();

private $pluginVersion = '1.5.0';
private $pluginVersion = '1.5.1';

private $prefix = 'wirecard';

Expand Down Expand Up @@ -79,6 +79,8 @@ public function index()
$data['send_order'] = $this->language->get('send_order');
$data['error_init'] = $this->language->get('error_init');

$data['wcp_ratepay'] = $this->loadRatePay();

// Set Action URI
$data['action'] = $this->url->link('extension/payment/' . $prefix . '/init', '', 'SSL');

Expand All @@ -92,6 +94,30 @@ public function index()
return $this->load->view($this->template, $data);
}

/**
* create consumerDeviceId script for ratepay
*
* @return string
*/
public function loadRatePay()
{
$customerId = $this->config->get('customerId');

if(isset($_SESSION['wcpConsumerDeviceId'])) {
$consumerDeviceId = $_SESSION['wcpConsumerDeviceId'];
} else {
$timestamp = microtime();
$consumerDeviceId = md5($customerId . "_" . $timestamp);
$_SESSION['wcpConsumerDeviceId'] = $consumerDeviceId;
}
$ratepay = '<script language="JavaScript">var di = {t:"'.$consumerDeviceId.'",v:"WDWL",l:"Checkout"};</script>';
$ratepay .= '<script type="text/javascript" src="//d.ratepay.com/'.$consumerDeviceId.'/di.js"></script>';
$ratepay .= '<noscript><link rel="stylesheet" type="text/css" href="//d.ratepay.com/di.css?t='.$consumerDeviceId.'&v=WDWL&l=Checkout"></noscript>';
$ratepay .= '<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='.$consumerDeviceId.'&v=WDWL"/><param name="AllowScriptAccess" value="always"/></object>';

return $ratepay;
}

/**
* payment initialization
*/
Expand Down
1 change: 1 addition & 0 deletions catalog/controller/extension/payment/wirecard_eps.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function index() {

$data['error_init'] = $this->language->get('error_init');

$data['wcp_ratepay'] = $this->loadRatePay();
// Set Action URI
$data['action'] = $this->url->link('extension/payment/'.$prefix.'/init', '', 'SSL');

Expand Down
2 changes: 2 additions & 0 deletions catalog/controller/extension/payment/wirecard_idl.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public function index() {

$data['error_init'] = $this->language->get('error_init');

$data['wcp_ratepay'] = $this->loadRatePay();

// Set Action URI
$data['action'] = $this->url->link('extension/payment/'.$prefix.'/init', '', 'SSL');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function index() {
$data['send_order'] = $this->language->get('send_order');
$data['error_init'] = $this->language->get('error_init');

$data['wcp_ratepay'] = $this->loadRatePay();
// Set Action URI
$data['action'] = $this->url->link('extension/payment/'.$prefix.'/init', '', 'SSL');

Expand Down
1 change: 1 addition & 0 deletions catalog/controller/extension/payment/wirecard_invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function index() {
$data['send_order'] = $this->language->get('send_order');
$data['error_init'] = $this->language->get('error_init');

$data['wcp_ratepay'] = $this->loadRatePay();
// Set Action URI
$data['action'] = $this->url->link('extension/payment/'.$prefix.'/init', '', 'SSL');

Expand Down
4 changes: 4 additions & 0 deletions catalog/model/extension/payment/wirecard.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ public function sendRequest($prefix, $paymentType, $order, $birthday, $plugin_ve
->setOrderReference($this->getOrderReference($order))
->setLayout($strCustomerLayout);

if (isset($_SESSION['wcpConsumerDeviceId'])) {
$client->consumerDeviceId = $_SESSION['wcpConsumerDeviceId'];
unset($_SESSION['wcpConsumerDeviceId']);
}
if ($fields['sendBasketData'] ||
($paymentType == WirecardCEE_QPay_PaymentType::INVOICE && $this->config->get($prefix.'_provider') != 'payolution') ||
($paymentType == WirecardCEE_QPay_PaymentType::INSTALLMENT && $this->config->get($prefix.'_provider') != 'payolution')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* terms of use!
*/
?>

<?php echo $wcp_ratepay; ?>
<form class="form-horizontal" action="<?php echo $action ?>" method="post" name="wirecard_checkout_page_send" id="payment">
<input type="hidden" name="wirecard_checkout_page_window_name" value="<?php echo $window_name; ?>">
<fieldset id="payment">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* terms of use!
*/
?>
<?php echo $wcp_ratepay; ?>

<form class="form-horizontal" action="<?php echo $action ?>" method="post" name="wirecard_checkout_page_send" id="payment">
<input type="hidden" name="wirecard_checkout_page_window_name" value="<?php echo $window_name; ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
?>


<?php echo $wcp_ratepay; ?>
<form action="<?php echo $action ?>" method="post" name="wirecard_checkout_page_send" id="payment">
<input type="hidden" name="wirecard_checkout_page_window_name" value="<?php echo $window_name; ?>">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* terms of use!
*/
?>

<?php echo $wcp_ratepay; ?>
<form class="form-horizontal" action="<?php echo $action ?>" method="post" name="wirecard_checkout_page_send" id="payment">
<fieldset id="payment">
<legend><?php echo $text_title; ?></legend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* terms of use!
*/
?>

<?php echo $wcp_ratepay; ?>
<form class="form-horizontal" action="<?php echo $action ?>" method="post" name="wirecard_checkout_page_send" id="payment">
<input type="hidden" name="wirecard_checkout_page_window_name" value="<?php echo $window_name; ?>">
<fieldset id="payment">
Expand Down

0 comments on commit 8c8fa98

Please sign in to comment.