Skip to content

Commit

Permalink
Release 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
sbossert committed Feb 4, 2019
1 parent a337958 commit 9eca501
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Please see the [license file](https://github.com/pfpayments/opencart-2.3/blob/1.0.8/LICENSE) for more information.
4 changes: 2 additions & 2 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.7/">
<a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.8/">
Source
</a>
</li>
Expand All @@ -48,7 +48,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.7/">Download</a> the extension.</p>
<p><a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.8/">Download</a> the extension.</p>
</li>
<li>
<p>Extract the files and upload the content of the <code>Upload</code> directory into the root directory of your store using FTP/SSH.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
><?php echo $column_authorization_amount; ?></a>
</td>
<td class="text-right">
<a href="<?php echo $sort_created; ?>"
<a href="<?php echo $sort_created_at; ?>"
class="<?php if($filters['sort'] == 'created_at') { echo strtolower($filters['order']); } ?>"
><?php echo $column_created; ?></a>
</td>
<td class="text-right">
<a href="<?php echo $sort_updated; ?>"
<a href="<?php echo $sort_updated_at; ?>"
class="<?php if($filters['sort'] == 'updated_at') { echo strtolower($filters['order']); } ?>"
><?php echo $column_updated; ?></a>
</td>
Expand Down
52 changes: 39 additions & 13 deletions upload/system/library/postfinancecheckout/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -386,7 +410,7 @@ public function getSuccessUrl(){
public function getFailedUrl($order_id){
return str_replace('&amp;', '&',
PostFinanceCheckoutVersionHelper::createUrl($this->getCatalogUrl(), 'checkout/checkout', array(
'order_id' => $order_id
'order_id' => $order_id
), $this->registry->get('config')->get('config_secure')));
}

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<modification>
<code>PostFinanceCheckoutXFeeProCompatibility</code>
<name>postfinancecheckout compatibility: patch for X-fee Pro.
</name>
<version>1.0.0</version>
<author>Customweb GmbH</author>
<link>http://github.com/postfinancecheckout-payment/opencart</link>
<file path="catalog/model/extension/total/xfeepro.php">
<operation>
<search><![CDATA[
strstr($payment_method,'xpayment') === false
]]></search>
<add position="replace"><![CDATA[
strstr($payment_method,'xpayment') === false && strstr($payment_method,'postfinancecheckout_') === false
]]></add>
</operation>
</file>
</modification>
4 changes: 4 additions & 0 deletions upload/system/library/postfinancecheckout/version_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9eca501

Please sign in to comment.