Skip to content

Commit

Permalink
Merge pull request #6 from wirecard/TPWDCEE-199
Browse files Browse the repository at this point in the history
Tpwdcee 199
  • Loading branch information
jpy authored Aug 29, 2017
2 parents f724e5b + dd164d2 commit 8ec80a3
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions includes/modules/payment/wirecard_checkout_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_IFRAME', 'ext/modules/payment/wirecard/checkout_page_iframe.php');
define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_SUCCESS', 'ext/modules/payment/wirecard/checkout_page_success.php');

define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_PLUGINVERSION', '1.6.0');
define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_PLUGINVERSION', '1.6.1');

define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_TRANSACTION_TABLE', 'wirecard_checkout_page_transaction');
define('MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_WINDOW_NAME', 'wirecardCheckoutPageIFrame');
Expand All @@ -51,7 +51,7 @@ class wirecard_checkout_page
/**
* constructor
*/
function wirecard_checkout_page()
function __construct()
{
global $order, $language;

Expand Down Expand Up @@ -146,6 +146,23 @@ function javascript_validation()
*/
function selection() {

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

if ( count($this->_payments->get_enabled_paymenttypes()) ) {
return array(
'id' => $this->code,
Expand Down Expand Up @@ -198,7 +215,7 @@ function checkBirthday(){
var year = birthdate.getFullYear();
var today = new Date();
var limit = new Date((today.getFullYear() - minAge), today.getMonth(), today.getDate());
if (birthdate < limit) {
if (birthdate <= limit) {
$(\'#wcp-birthday\').val(birthdate);
$(\'#wcp-no-valid-birthday\').hide();
$(\'#tdb5\').attr(\'disabled\', false);
Expand Down Expand Up @@ -328,6 +345,11 @@ function process_button()
'displayText' => MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_DISPLAY_TEXT,
'consumerMerchantCrmId' => md5($order->customer['email_address']));

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

if ( MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_DEPOSIT == 'True' ) {
$postData['autoDeposit'] = true;
}
Expand Down

0 comments on commit 8ec80a3

Please sign in to comment.