Skip to content

Commit

Permalink
Merge pull request #61 from wirecard/TPWDCEE-190
Browse files Browse the repository at this point in the history
Add consumerDeviceId
  • Loading branch information
jpy authored Aug 31, 2017
2 parents 261c3a1 + 5b726a8 commit 477797b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
18 changes: 17 additions & 1 deletion Frontend/WirecardCheckoutSeamless/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getCapabilities()
*/
public function getVersion()
{
return '1.10.4';
return '1.10.5';
}

/**
Expand Down Expand Up @@ -1016,6 +1016,20 @@ public function onPostDispatch(Enlight_Event_EventArgs $args)

$view->addTemplateDir($this->Path() . 'Views/common/');
$view->addTemplateDir($this->Path() . 'Views/responsive/');
$customerId = Shopware()->WirecardCheckoutSeamless()->Config()->customerid;

if(Shopware()->Session()->offsetGet('wcsConsumerDeviceId') != null) {
$consumerDeviceId = Shopware()->Session()->offsetGet('wcsConsumerDeviceId');
} else {
$timestamp = microtime();
$consumerDeviceId = md5($customerId . "_" . $timestamp);
Shopware()->Session()->offsetSet('wcsConsumerDeviceId', $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>';
$view->ratePayScript = $ratepay;

// Output of common errors
if (null != Shopware()->WirecardCheckoutSeamless()->wirecard_action) {
Expand Down Expand Up @@ -1149,6 +1163,8 @@ public function onPostDispatch(Enlight_Event_EventArgs $args)
$confirmMailFailed = $variables['confirmMailDeliveryFailed'];
$view->addTemplateDir($this->Path() . 'Views/common/');
$view->addTemplateDir($this->Path() . 'Views/responsive/');
//consumerDeviceId session must be set null here
Shopware()->Session()->offsetSet('wcsConsumerDeviceId', null);

$view->pendingPayment = $args->getSubject()->Request()->get('pending');
$view->confirmMailFailed = $confirmMailFailed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ public function getData()
return $this->_basket;
}

/**
* Destructor
*/
public function __destruct()
{
unset( $this );
}

/***************************************
* PROTECTED METHODS *
***************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,6 @@ public function getImageUrl()
return null;
}

/**
* Destructor
*/
public function __destruct()
{
unset( $this );
}

/***************************************
* PROTECTED METHODS *
***************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,6 @@ public function getRequestData()
return (array) $this->_requestData;
}

/**
* Destructor
*/
public function __destruct()
{
unset( $this );
}

/**************************
* PROTECTED METHODS *
**************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

return Array(
'MODULE_NAME' => 'WirecardCEE_Stdlib',
'MODULE_VERSION' => '3.0.2',
'MODULE_VERSION' => '3.0.3',
'DEPENDENCIES' => array(
'SCRIPTING_LANG' => 'PHP',
'SCRIPTING_LANG_VERSION' => '5.2'
Expand Down
5 changes: 5 additions & 0 deletions Frontend/WirecardCheckoutSeamless/Models/Seamless.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public function initPayment($confirmUrl)

$init->setConfirmUrl($confirmUrl);
$init->setOrderReference(Shopware()->WirecardCheckoutSeamless()->wWirecardCheckoutSeamlessId);
if(Shopware()->Session()->offsetGet('wcsConsumerDeviceId') != null) {
$init->consumerDeviceId = Shopware()->Session()->offsetGet('wcsConsumerDeviceId');
//default set to null, but no effect
Shopware()->Session()->offsetSet('wcsConsumerDeviceId', null);
}

foreach ($cfg->wirecardCheckoutSeamlessParameters() as $action => $value) {
if (!is_null($value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
oldShopVersion = {$oldShopVersion|json_encode};
}
</script>
{if isset($ratePayScript)}
{$ratePayScript}
{/if}
{/block}


Expand Down
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 plugin for Shopware

[![License](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/wirecard/Shopware-WCS/master/LICENSE)
[![Shopware](https://img.shields.io/badge/Shopware-v5.3.1-green.svg)](https://www.shopware.com/)
[![Shopware](https://img.shields.io/badge/Shopware-v5.3.2-green.svg)](https://www.shopware.com/)
[![PHP v7](https://img.shields.io/badge/php-v7-yellow.svg)](http://www.php.net)
[![PHP v5.6](https://img.shields.io/badge/php-v5.6-yellow.svg)](http://www.php.net)

Expand Down

0 comments on commit 477797b

Please sign in to comment.