Support only for offline payment methods#86
Merged
bartoszpietrzak1994 merged 4 commits intoSylius:masterfrom Oct 12, 2018
Merged
Conversation
f7d2fba to
0b44857
Compare
pamil
suggested changes
Oct 3, 2018
src/Entity/CreditMemoUnit.php
Outdated
| 'taxes_total' => $this->taxesTotal, | ||
| ]); | ||
|
|
||
| return ($serialized !== false) ? $serialized : ''; |
Contributor
There was a problem hiding this comment.
I think we should throw an exception instead of silently returning an empty string.
pamil
approved these changes
Oct 3, 2018
| } | ||
| } | ||
|
|
||
| return $paymentMethods; |
Contributor
There was a problem hiding this comment.
Not a big one, but you can get rid of that unset and phpdoc by using array_filter:
return array_filter(
$this->paymentMethodRepository->findEnabledForChannel($channel),
function (PaymentMethodInterface $paymentMethod): bool {
Assert::notNull($paymentMethod->getGatewayConfig());
return $paymentMethod->getGatewayConfig()->getFactoryName() === 'offline';
}
);e1aca17 to
309420d
Compare
|
|
||
| $this->session->getFlashBag()->add('success', 'sylius_refund.units_successfully_refunded'); | ||
| } catch (CommandDispatchException $exception) { | ||
| Assert::notNull($exception->getPrevious()); |
Contributor
There was a problem hiding this comment.
Using Assert::notNull() may result in throwing unhandled InvalidArgumentException - what about simple and more user friendly solution:
if (null === $exception->getPrevious()) {
$this->session->getFlashBag()->add('error', 'sylius.ui.unexpected_error_occurred');
}
wdyt?
Contributor
Author
There was a problem hiding this comment.
The thing is, there will always be a previous exception, as it's done automatically and silencing it could make more harm than good 😄 I'd leave it as it is (without it PHPStan is not passing)
309420d to
a97c5f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See PS in #85 description