Skip to content

Commit

Permalink
v1.3.13 Release (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmitzcarsten authored Feb 24, 2021
1 parent d007fe2 commit a21742b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiener/mollie-payments-plugin",
"description": "Mollie Payments",
"version": "v1.3.12",
"version": "v1.3.13",
"type": "shopware-platform-plugin",
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ test: ## Starts all Tests
# ------------------------------------------------------------------------------------------------------------

release: ## Creates a new ZIP package
@cd .. && zip -qq -r -0 MolliePayments-$(PLUGIN_VERSION).zip MolliePayments/ -x '*.git*' '*.reports*' '*.travis.yml*' '*/tests*' '*/makefile' '*.DS_Store'
@cd .. && zip -qq -r -0 MolliePayments-$(PLUGIN_VERSION).zip MolliePayments/ -x '*.git*' '*.reports*' '*.travis.yml*' '*/tests*' '*/makefile' '*.DS_Store' '*phpunit*'
2 changes: 1 addition & 1 deletion src/Factory/MollieApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getClient(?string $salesChannelId = null, ?Context $context = nu

// @todo Add plugin version variable
$this->apiClient->addVersionString(
'MollieShopware6/1.3.12'
'MollieShopware6/1.3.13'
);
} catch (Exception $e) {
$this->logger->error($e->getMessage(), [$e]);
Expand Down
3 changes: 2 additions & 1 deletion src/Helper/PaymentStatusHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\AndFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\MultiFilter;
use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions;
use Shopware\Core\System\StateMachine\StateMachineRegistry;
use Shopware\Core\System\StateMachine\Transition;
Expand Down Expand Up @@ -168,7 +169,7 @@ public function processPaymentStatus(
$molliePaymentMethodId = $this->paymentMethodRepository->searchIds(
(new Criteria())
->addFilter(
new AndFilter([
new MultiFilter('AND', [
new ContainsFilter('handlerIdentifier', 'Kiener\MolliePayments\Handler\Method'),
new EqualsFilter('customFields.mollie_payment_method_name', $currentCustomerSelectedPaymentMethod)
]
Expand Down
3 changes: 2 additions & 1 deletion src/Storefront/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Kiener\MolliePayments\Service\SettingsService;
use Kiener\MolliePayments\Service\TransactionService;
use Kiener\MolliePayments\Setting\MollieSettingStruct;
use Kiener\MolliePayments\Validator\DoesOpenPaymentExist;
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\Order;
Expand Down Expand Up @@ -250,7 +251,7 @@ public function payment(SalesChannelContext $context, $transactionId): ?Response
&& $this->settingsService->getSettings($context->getSalesChannel()->getId())
->isShopwareFailedPaymentMethod() === false
) {
if ($mollieOrder->status != PaymentStatus::STATUS_OPEN) {
if (!DoesOpenPaymentExist::validate($mollieOrder->payments()->getArrayCopy())) {
$mollieOrder->createPayment([]);
}

Expand Down
31 changes: 31 additions & 0 deletions src/Validator/DoesOpenPaymentExist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Kiener\MolliePayments\Validator;


use Mollie\Api\Resources\Payment;
use Mollie\Api\Types\PaymentStatus;

/**
* @copyright 2021 dasistweb GmbH (https://www.dasistweb.de)
*/
class DoesOpenPaymentExist
{

/**
* @param Payment[] $payments
* @return bool
*/
public static function validate(array $payments): bool
{
if (count($payments) === 0) {
return false;
}

$filteredPayments = array_filter($payments, function (Payment $payment) {
return $payment->status === PaymentStatus::STATUS_OPEN;
});

return count($filteredPayments) > 0;
}
}

0 comments on commit a21742b

Please sign in to comment.