From 976292bc35e0a22de72e73f520973be998ba8dc3 Mon Sep 17 00:00:00 2001 From: Jacqueline Rinnhofer Date: Mon, 28 Aug 2017 09:34:55 +0200 Subject: [PATCH 1/3] #5 Add consumerDeviceId --- .../payment/wirecard_checkout_page.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/includes/modules/payment/wirecard_checkout_page.php b/includes/modules/payment/wirecard_checkout_page.php index 42f91d4..19411b5 100644 --- a/includes/modules/payment/wirecard_checkout_page.php +++ b/includes/modules/payment/wirecard_checkout_page.php @@ -172,6 +172,18 @@ function confirmation() { $consumerID = $_SESSION['customer_id']; } + if(isset($_SESSION['wcp-consumerDeviceId'])) { + $consumerDeviceId = $_SESSION['wcp-consumerDeviceId']; + } else { + $timestamp = microtime(); + $consumerDeviceId = md5($consumerID . "_" . $timestamp); + $_SESSION['wcp-consumerDeviceId'] = $consumerDeviceId; + } + $ratepay = ''; + $ratepay .= ''; + $ratepay .= ''; + $ratepay .= ''; + echo $ratepay; $sql = 'SELECT customers_dob, customers_fax FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id="' . $consumerID . '" LIMIT 1;'; $result = tep_db_query($sql); @@ -198,7 +210,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); @@ -328,6 +340,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; } From 1fcd4151e6f91449877743b2f440792b84805c0f Mon Sep 17 00:00:00 2001 From: Jacqueline Rinnhofer Date: Mon, 28 Aug 2017 09:36:45 +0200 Subject: [PATCH 2/3] #5 Update pluginversion --- .../modules/payment/wirecard_checkout_page.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/modules/payment/wirecard_checkout_page.php b/includes/modules/payment/wirecard_checkout_page.php index 19411b5..28e662b 100644 --- a/includes/modules/payment/wirecard_checkout_page.php +++ b/includes/modules/payment/wirecard_checkout_page.php @@ -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'); @@ -172,17 +172,17 @@ function confirmation() { $consumerID = $_SESSION['customer_id']; } - if(isset($_SESSION['wcp-consumerDeviceId'])) { + if( isset( $_SESSION['wcp-consumerDeviceId'] ) ) { $consumerDeviceId = $_SESSION['wcp-consumerDeviceId']; } else { $timestamp = microtime(); - $consumerDeviceId = md5($consumerID . "_" . $timestamp); + $consumerDeviceId = md5( $consumerID . "_" . $timestamp ); $_SESSION['wcp-consumerDeviceId'] = $consumerDeviceId; } - $ratepay = ''; - $ratepay .= ''; - $ratepay .= ''; - $ratepay .= ''; + $ratepay = ''; + $ratepay .= ''; + $ratepay .= ''; + $ratepay .= ''; echo $ratepay; $sql = 'SELECT customers_dob, customers_fax FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id="' . $consumerID . '" LIMIT 1;'; @@ -340,9 +340,9 @@ function process_button() 'displayText' => MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_DISPLAY_TEXT, 'consumerMerchantCrmId' => md5($order->customer['email_address'])); - if(isset($_SESSION['wcp-consumerDeviceId'])) { + if( isset( $_SESSION['wcp-consumerDeviceId'] ) ) { $postData['consumerDeviceId'] = $_SESSION['wcp-consumerDeviceId']; - unset($_SESSION['wcp-consumerDeviceId']); + unset( $_SESSION['wcp-consumerDeviceId'] ); } if ( MODULE_PAYMENT_WIRECARD_CHECKOUT_PAGE_DEPOSIT == 'True' ) { From dd164d2bf54203a2e345c0b34d382d81b4e3d65a Mon Sep 17 00:00:00 2001 From: Jacqueline Rinnhofer Date: Tue, 29 Aug 2017 09:20:56 +0200 Subject: [PATCH 3/3] #5 Move ratepayscript to prevent session destroy --- .../payment/wirecard_checkout_page.php | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/includes/modules/payment/wirecard_checkout_page.php b/includes/modules/payment/wirecard_checkout_page.php index 28e662b..87e427a 100644 --- a/includes/modules/payment/wirecard_checkout_page.php +++ b/includes/modules/payment/wirecard_checkout_page.php @@ -51,7 +51,7 @@ class wirecard_checkout_page /** * constructor */ - function wirecard_checkout_page() + function __construct() { global $order, $language; @@ -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 = ''; + $ratepay .= ''; + $ratepay .= ''; + $ratepay .= ''; + echo $ratepay; + if ( count($this->_payments->get_enabled_paymenttypes()) ) { return array( 'id' => $this->code, @@ -172,18 +189,6 @@ function confirmation() { $consumerID = $_SESSION['customer_id']; } - if( isset( $_SESSION['wcp-consumerDeviceId'] ) ) { - $consumerDeviceId = $_SESSION['wcp-consumerDeviceId']; - } else { - $timestamp = microtime(); - $consumerDeviceId = md5( $consumerID . "_" . $timestamp ); - $_SESSION['wcp-consumerDeviceId'] = $consumerDeviceId; - } - $ratepay = ''; - $ratepay .= ''; - $ratepay .= ''; - $ratepay .= ''; - echo $ratepay; $sql = 'SELECT customers_dob, customers_fax FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id="' . $consumerID . '" LIMIT 1;'; $result = tep_db_query($sql);