Skip to content

Commit

Permalink
Release 1.0.38
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrowanwallee committed Sep 15, 2022
1 parent cd395e1 commit 424d282
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# OXID 4.8

v1.0.37, 2022-8
v1.0.38, 2022-9

This repository contains the OXID PostFinance Checkout payment module that enables the shop to process payments with [PostFinance Checkout](https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html).

Expand All @@ -19,8 +19,8 @@ Support queries can be issued on the [PostFinance Checkout support site](https:/

## Documentation

* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/oxid-4.8/1.0.37/docs/en/documentation.html)
* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/oxid-4.8/1.0.38/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/pfpayments/oxid-4.8/blob/1.0.37/LICENSE) for more information.
Please see the [license file](https://github.com/pfpayments/oxid-4.8/blob/1.0.38/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 @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/oxid-4.8/releases/tag/1.0.37/">
<a href="https://github.com/pfpayments/oxid-4.8/releases/tag/1.0.38/">
Source
</a>
</li>
Expand All @@ -49,7 +49,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/pfpayments/oxid-4.8/releases/tag/1.0.37/">Download</a> the extension.</p>
<p><a href="https://github.com/pfpayments/oxid-4.8/releases/tag/1.0.38/">Download</a> the extension.</p>
</li>
<li>
<p>Extract the files and upload them to the root directory of your store using FTP/SSH.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PostFinanceCheckout\Sdk\Model\RefundState;
use PostFinanceCheckout\Sdk\Model\TransactionCompletionState;
use PostFinanceCheckout\Sdk\Model\TransactionVoidState;
use Pfc\PostFinanceCheckout\Core\Exception\OptimisticLockingException;
use Pfc\PostFinanceCheckout\Core\Service\CompletionService;
use Pfc\PostFinanceCheckout\Core\Service\RefundService;
use Pfc\PostFinanceCheckout\Core\Service\VoidService;
Expand Down Expand Up @@ -58,6 +59,9 @@ class_exists(\Pfc\PostFinanceCheckout\Application\Model\Transaction::class);
} else {
throw new \Exception(PostFinanceCheckoutModule::instance()->translate('No order selected'));
}
} catch (OptimisticLockingException $e) {
$this->_aViewData['pfc_postFinanceCheckout_enabled'] = $e->getMessage();
return $this->_sThisTemplate;
} catch (\Exception $e) {
$this->_aViewData['pfc_error'] = $e->getMessage();
return 'pfcPostFinanceCheckoutError.tpl';
Expand Down
3 changes: 3 additions & 0 deletions pfc/PostFinanceCheckout/Application/Controller/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function notify()
} catch (\Exception $e) {
header("HTTP/1.1 500 Internal Server Error");
echo($e->getMessage());
$message = "Oops, something was wrong. {$e->getMessage()} - {$e->getTraceAsString()}.";
PostFinanceCheckoutModule::log(Logger::ERROR, $message);
PostFinanceCheckoutModule::getUtilsView()->addErrorToDisplay($message);
exit();
}
header("HTTP/1.1 200 OK");
Expand Down
4 changes: 2 additions & 2 deletions pfc/PostFinanceCheckout/Application/Model/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ class_exists('oxobjectexception'); $exception = oxNew('oxobjectexception');
" where {$coreTableName}.oxid = " . $database->quote($this->getId()) .
" and {$coreTableName}.pfcversion = {$dbVersion}";
PostFinanceCheckoutModule::log(Logger::DEBUG, "Updating transaction with query [$updateQuery]");

$this->beforeUpdate();
$affected = \oxdb::getDb()->execute($updateQuery);

if ($affected === 0) {
throw new OptimisticLockingException($this->getId(), $this->_sTableName, $updateQuery);
}
Expand Down
5 changes: 2 additions & 3 deletions pfc/PostFinanceCheckout/Core/Webhook/AbstractOrderRelated.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ abstract class AbstractOrderRelated extends AbstractWebhook
{
const NO_ORDER = 1;
const OPTIMISTIC_RETRIES = 6;
const SECONDS_TO_WAIT = 1;

/**
* Processes the received order related webhook request.
Expand All @@ -35,7 +36,6 @@ public function process(Request $request)
}
for($i = 0; $i <= self::OPTIMISTIC_RETRIES; $i++) {
try {
\oxdb::getDb()->startTransaction();
$entity = $this->loadEntity($request);
$orderId = $this->getOrderId($entity);
$order = $this->loadOrder($orderId);
Expand All @@ -51,14 +51,13 @@ public function process(Request $request)
}
}

\oxdb::getDb()->commitTransaction();
}catch(OptimisticLockingException $e){
PostFinanceCheckoutModule::log(Logger::WARNING, "Optimistic locking query: " . $e->getQueryString());
PostFinanceCheckoutModule::rollback();
if($i === self::OPTIMISTIC_RETRIES) {
throw $e;
}
sleep(1);
sleep(self::SECONDS_TO_WAIT);
}
catch (\Exception $e) {
PostFinanceCheckoutModule::log(Logger::ERROR, $e->getMessage() . ' - ' . $e->getTraceAsString());
Expand Down
11 changes: 11 additions & 0 deletions pfc/PostFinanceCheckout/Core/Webhook/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ protected function getTransactionId($transaction)
*/
protected function processOrderRelatedInner(\oxorder $order, $entity)
{
$finalStates = [
TransactionState::FAILED,
TransactionState::VOIDED,
TransactionState::DECLINE,
TransactionState::FULFILL
];

/* @var $entity \PostFinanceCheckout\Sdk\Model\Transaction */
if (in_array($entity->getState(), $finalStates)) {
return false;
}

/* @var $order \Pfc\PostFinanceCheckout\Extend\Application\Model\Order */
if ($entity && $entity->getState() !== $order->getPostFinanceCheckoutTransaction()->getState()) {
$cancel = false;
Expand Down
6 changes: 3 additions & 3 deletions pfc/PostFinanceCheckout/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# OXID 4.8

v1.0.37, 2022-8
v1.0.38, 2022-9

This repository contains the OXID PostFinance Checkout payment module that enables the shop to process payments with [PostFinance Checkout](https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html).

Expand All @@ -19,8 +19,8 @@ Support queries can be issued on the [PostFinance Checkout support site](https:/

## Documentation

* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/oxid-4.8/1.0.37/docs/en/documentation.html)
* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/oxid-4.8/1.0.38/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/pfpayments/oxid-4.8/blob/1.0.37/LICENSE) for more information.
Please see the [license file](https://github.com/pfpayments/oxid-4.8/blob/1.0.38/LICENSE) for more information.
2 changes: 1 addition & 1 deletion pfc/PostFinanceCheckout/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'en' => 'PFC PostFinanceCheckout Module'
),
'thumbnail' => 'out/pictures/picture.png',
'version' => '1.0.37',
'version' => '1.0.38',
'author' => 'customweb GmbH',
'url' => 'https://www.customweb.com',
'email' => 'info@customweb.com',
Expand Down

0 comments on commit 424d282

Please sign in to comment.