Skip to content

Commit

Permalink
Merge pull request #9 from wirecard/TPWDCEE-203
Browse files Browse the repository at this point in the history
Tpwdcee 203
  • Loading branch information
jpy authored Aug 28, 2017
2 parents 81c99a6 + dcf43c0 commit 2ea3361
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Wirecard Checkout Page plugin for VirtueMart 3.0

Tested with Joomla 3.6.5/VirtueMart 3.0.18.
Tested with Joomla 3.7.5/VirtueMart 3.2.4.

Our [Online Guides](https://guides.wirecard.at/) provide further information on payment methods and additional features. Please observe our [terms of use](https://guides.wirecard.at/shop_plugins:info#terms_of_use) regarding plugins.

Expand Down
15 changes: 15 additions & 0 deletions update/plg_vmpayment_wirecardceecheckout_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,19 @@
<maintainerurl>https://www.wirecard.at/</maintainerurl>
<targetplatform name="joomla" version="3.6"/>
</update>
<update>
<name>Wirecard Checkout Page</name>
<description>Wirecard - Your Full Service Payment Provider</description>
<type>plugin</type>
<folder>vmpayment</folder>
<element>wirecardceecheckout</element>
<version>1.7.1</version>
<client>site</client>
<downloads>
<downloadurl type="full" format="zip">https://github.com/wirecard/virtuemart3-wcp/archive/1.7.1.zip</downloadurl>
</downloads>
<maintainer>Wirecard</maintainer>
<maintainerurl>https://www.wirecard.at/</maintainerurl>
<targetplatform name="joomla" version="3.6"/>
</update>
</updates>
37 changes: 29 additions & 8 deletions wirecardceecheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class plgVmPaymentwirecardceecheckout extends vmPSPlugin

protected static $WINDOW_NAME = 'WirecardCEECheckoutFrame';
protected static $PLUGIN_NAME = 'VirtueMart2_CheckoutPage';
protected static $PLUGIN_VERSION = '1.7.0';
protected static $PLUGIN_VERSION = '1.7.1';

protected $_method;
protected $_order;
Expand Down Expand Up @@ -678,7 +678,6 @@ public function plgVmOnCheckoutCheckDataPayment(VirtueMartCart $cart)
break;
}
}

return $found;
}

Expand Down Expand Up @@ -833,13 +832,28 @@ protected function getPluginHtml($plugin, $selectedPlugin, $pluginSalesPrice)
$birthYear = $sessionWirecard->birthYear;
}

$customer_id = $this->_getCustomerId();

if( isset( $_SESSION['wcp-consumerDeviceId'] ) ) {
$consumerDeviceId = $_SESSION['wcp-consumerDeviceId'];
} else {
$timestamp = microtime();
$consumerDeviceId = md5( $customer_id . "_" . $timestamp );
$_SESSION['wcp-consumerDeviceId'] = $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>';

$html = $this->renderByLayout('displaypayment', array(
'paymenttypes' => $this->_getEnabledPaymentTypes(),
'paymentmethod_id' => $plugin->$pluginmethod_id,
'paymenttype_selected' => $paymenttype_selected,
'birth_day' => $birthDay,
'birth_month' => $birthMonth,
'birth_year' => $birthYear
'birth_year' => $birthYear,
'ratepay_script' => $ratepay
));

return $html;
Expand Down Expand Up @@ -937,6 +951,11 @@ protected function _initiatePayment($cart)
->setAutoDeposit($this->_getAutoDeposit($paymentType))
->setWindowName($this->_getWindowName());

if ( isset( $_SESSION['wcp-consumerDeviceId'] ) ){
$client->consumerDeviceId = $_SESSION['wcp-consumerDeviceId'];
unset( $_SESSION['wcp-consumerDeviceId'] );
}

if ($paymentType == \WirecardCEE_QPay_PaymentType::MASTERPASS) {
$client->setShippingProfile('NO_SHIPPING');
}
Expand Down Expand Up @@ -1309,11 +1328,13 @@ protected function _setConsumerBillingInformation(WirecardCEE_Stdlib_ConsumerDat
$session = JFactory::getSession();
$data = $session->get('WIRECARDCEECHECKOUT', null, 'vm');
$sessionWirecard = unserialize($data);
$birthDay = $sessionWirecard->birthDay;
$birthMonth = $sessionWirecard->birthMonth;
$birthYear = $sessionWirecard->birthYear;
$birthday = new DateTime($birthYear . "-" . $birthMonth . "-" . $birthDay);
$consumerData->setBirthDate($birthday);
if (isset($sessionWirecard->birthDay)) {
$birthDay = $sessionWirecard->birthDay;
$birthMonth = $sessionWirecard->birthMonth;
$birthYear = $sessionWirecard->birthYear;
$birthday = new DateTime($birthYear . "-" . $birthMonth . "-" . $birthDay);
$consumerData->setBirthDate($birthday);
}
}
$consumerData->setEmail($billingData->email);

Expand Down
2 changes: 1 addition & 1 deletion wirecardceecheckout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<authorUrl>http://www.wirecard.at/</authorUrl>
<copyright>Copyright (C) 2013 Wirecard. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>1.7.0</version>
<version>1.7.1</version>
<description>VMPAYMENT_WIRECARDCEECHECKOUT_PAYMENT_DESCRIPTION</description>

<files>
Expand Down
1 change: 1 addition & 0 deletions wirecardceecheckout/tmpl/displaypayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
?>
<input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_<?php echo $viewData['paymentmethod_id'] ?>"
value="<?php echo $viewData['paymentmethod_id'] ?>" style="display:none;">
<?php echo $viewData['ratepay_script'] ?>
</div>
<?php
$url = JURI::root() . 'images/stories/virtuemart/' . $this->_psType . '/';
Expand Down

0 comments on commit 2ea3361

Please sign in to comment.