diff --git a/README.md b/README.md index b9f414d..3a783cd 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ This repository contains the OpenCart PostFinance Checkout payment module that ## Documentation -* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/opencart-2.3/1.0.7/docs/en/documentation.html) +* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/opencart-2.3/1.0.8/docs/en/documentation.html) ## License -Please see the [license file](https://github.com/pfpayments/opencart-2.3/blob/1.0.7/LICENSE) for more information. \ No newline at end of file +Please see the [license file](https://github.com/pfpayments/opencart-2.3/blob/1.0.8/LICENSE) for more information. \ No newline at end of file diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 429638a..68f5fef 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -21,7 +21,7 @@

Documentation

  • - + Source
  • @@ -48,7 +48,7 @@

    1. -

      Download the extension.

      +

      Download the extension.

    2. Extract the files and upload the content of the Upload directory into the root directory of your store using FTP/SSH.

      diff --git a/upload/admin/view/template/extension/postfinancecheckout/transaction.tpl b/upload/admin/view/template/extension/postfinancecheckout/transaction.tpl index fb4067b..e9067dc 100644 --- a/upload/admin/view/template/extension/postfinancecheckout/transaction.tpl +++ b/upload/admin/view/template/extension/postfinancecheckout/transaction.tpl @@ -64,12 +64,12 @@ > - - diff --git a/upload/system/library/postfinancecheckout/helper.php b/upload/system/library/postfinancecheckout/helper.php index adfa03a..8d7c5cd 100644 --- a/upload/system/library/postfinancecheckout/helper.php +++ b/upload/system/library/postfinancecheckout/helper.php @@ -37,15 +37,21 @@ private function __construct(Registry $registry){ /** * Create a customer identifier to verify that the session. - * Either a concat of given values for guest or the user id (hashed). - * If not enough guest information exists to create an identifier null is returned. + * Either the customer id, + * a concat of given values for guest (hashed), + * the user id, + * a hash of the current cart key, + * a hash of the current token, + * or the current order id. + * + * If not enough information exists to create an identifier null is returned. * * @return string | null */ public function getCustomerSessionIdentifier(){ $customer = $this->getCustomer(); if (isset($customer['customer_id']) && $this->registry->get('customer')->isLogged()) { - return $customer['customer_id']; + return "customer_" . $customer['customer_id']; } $id = ''; if (isset($customer['firstname'])) { @@ -60,7 +66,24 @@ public function getCustomerSessionIdentifier(){ if (isset($customer['telephone'])) { $id .= $customer['telephone']; } - return empty($id) ? null : hash('sha512', $id); + if($id) { + return "guest_" . hash('sha512', $id); + } + $data = $this->registry->get('session')->data; + if(isset($data['user_id'])) { + return "user_" . $data['user_id']; + } + if(isset($data['cart']) && is_array($data['cart']) && count($data['cart'] == 1)) { + $cartKeys = array_keys($data['cart']); + return "cart_" .hash('sha512', $cartKeys[0]); + } + if(isset($data['token'])) { + return "token_" . hash('sha512', $data['token']); + } + if(isset($data['order_id'])) { + return "order_" . $data['order_id']; + } + return null; } /** @@ -236,8 +259,9 @@ public function getCustomer(){ else if (isset($data['guest'])) { return $data['guest']; } + $this->log("Unable to retrieve customer from session."); $this->log($data); - throw new Exception('Could not extract customer data.'); + return array(); } /** @@ -386,7 +410,7 @@ public function getSuccessUrl(){ public function getFailedUrl($order_id){ return str_replace('&', '&', PostFinanceCheckoutVersionHelper::createUrl($this->getCatalogUrl(), 'checkout/checkout', array( - 'order_id' => $order_id + 'order_id' => $order_id ), $this->registry->get('config')->get('config_secure'))); } @@ -499,25 +523,27 @@ public function rewrite($url){ public function isAdmin(){ return defined('HTTPS_CATALOG') && defined('HTTP_CATALOG'); } - + /** - * Get the starting value of LIMIT for db queries. Used for paginated requests. - * + * Get the starting value of LIMIT for db queries. + * Used for paginated requests. + * * @param int $page * @return int */ - public function getLimitStart($page) { + public function getLimitStart($page){ $limit = $this->registry->get('config')->get('config_limit_admin'); return ($page - 1) * $limit; } - + /** - * Get the end value of LIMIT for db queries. Used for paginated requests. + * Get the end value of LIMIT for db queries. + * Used for paginated requests. * * @param int $page * @return int */ - public function getLimitEnd($page) { + public function getLimitEnd($page){ $limit = $this->registry->get('config')->get('config_limit_admin'); return $page * $limit; } diff --git a/upload/system/library/postfinancecheckout/modification/PostFinanceCheckoutXFeeProCompatibility.ocmod.xml b/upload/system/library/postfinancecheckout/modification/PostFinanceCheckoutXFeeProCompatibility.ocmod.xml new file mode 100644 index 0000000..ff1c1dc --- /dev/null +++ b/upload/system/library/postfinancecheckout/modification/PostFinanceCheckoutXFeeProCompatibility.ocmod.xml @@ -0,0 +1,19 @@ + + + PostFinanceCheckoutXFeeProCompatibility + postfinancecheckout compatibility: patch for X-fee Pro. + + 1.0.0 + Customweb GmbH + http://github.com/postfinancecheckout-payment/opencart + + + + + + + diff --git a/upload/system/library/postfinancecheckout/version_helper.php b/upload/system/library/postfinancecheckout/version_helper.php index 7e2a10a..5eba7d0 100644 --- a/upload/system/library/postfinancecheckout/version_helper.php +++ b/upload/system/library/postfinancecheckout/version_helper.php @@ -28,6 +28,10 @@ public static function getModifications(){ 'file' => 'PostFinanceCheckoutQuickCheckoutCompatibility.ocmod.xml', 'default_status' => 0 ), + 'PostFinanceCheckoutXFeeProCompatibility' => array( + 'file' => 'PostFinanceCheckoutXFeeProCompatibility.ocmod.xml', + 'default_status' => 0 + ), 'PostFinanceCheckoutPreventConfirmationEmail' => array( 'file' => 'PostFinanceCheckoutPreventConfirmationEmail.ocmod.xml', 'default_status' => 0