-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Checkout] Preventing payment step completion without a selected method #6217
[Checkout] Preventing payment step completion without a selected method #6217
Conversation
tuka217
commented
Sep 26, 2016
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Related tickets | - |
License | MIT |
c31369a
to
9c05d47
Compare
public function iShouldNotBeAbleToCompleteThePaymentStep() | ||
{ | ||
Assert::true( | ||
$this->selectPaymentPage->hasNoAvailableNextStepButton(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about isNextStepButtonUnavailable
?
<div class="header">{{ 'sylius.ui.warning'|trans }}</div> | ||
<p>{{ 'sylius.ui.no_payment_methods_available'|trans }}.</p> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line
/** @var CorePaymentInterface $shipment */ | ||
Assert::isInstanceOf($shipment, CorePaymentInterface::class); | ||
|
||
$paymentMethods = $this->paymentMethodRepository->findBy(['enabled' => true]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use $this->paymentMethodRepository->findEnabledForChannel($channel)
method.
if ($channel->hasPaymentMethod($paymentMethod)) { | ||
return $paymentMethod; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic will not be necessary after the above comment, but should be removed from the DefaultShippingMethodResolver
also (in a separate PR).
a2eb195
to
69c3289
Compare
@@ -0,0 +1,53 @@ | |||
@checkout | |||
Feature: Preventing payment step completion without a selected method | |||
In order to be prevent from finish payment step without selected method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should be prevented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above + from finishing the payment step without selecting a method
/ from finishing the payment step with no method selected
Feature: Preventing payment step completion without a selected method | ||
In order to be prevent from finish payment step without selected method | ||
As a Customer | ||
I want to be prevent from finish payment step without selected method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
@@ -1212,6 +1212,36 @@ public function thereShouldBeInformationAboutNoShippingMethodsAvailableFormMyShi | |||
} | |||
|
|||
/** | |||
* @Given I do not select any payment method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@When
154da14
to
9caf1c7
Compare
…ut step [PaymentBundle] Fix not blank constraint for payment method from payment
[Payment] Add UnresolvedDefaultPaymentMethodException, DefaultPaymentMethodResolver
{ | ||
Assert::true( | ||
$this->selectPaymentPage->isNextStepButtonUnavailable(), | ||
'The "next step" button should be disabled, but it does not.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is not.
although I'd be in favour of dropping this part in every method as it doesn't bring any value. If the message is in an exception and it says The "next step" button should be disabled.
it's quite obvious what happened without an overly explicit explanation.
@@ -19,6 +19,8 @@ sylius: | |||
payment: | |||
currency_code: | |||
not_valid: The currency code you entered is invalid. | |||
method: | |||
not_blank: 'Please select payment method.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a payment method.
{% endfor %} | ||
</div> | ||
</div> | ||
{% else %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it even physically possible to get to this checkout step without a payment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I should suppose that channel cannot be created without payment method then it is impossible. Otherwise you can create a shop without payment method at all and then it could happen.
*/ | ||
final class UnresolvedDefaultPaymentMethodExceptionSpec extends ObjectBehavior | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line
$this->getDefaultPaymentMethod($payment)->shouldReturn($firstPaymentMethod); | ||
} | ||
|
||
function it_throws_exception_if_there_is_no_enabled_payment_methods( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there_are_no
namespace spec\Sylius\Component\Payment\Resolver; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
9caf1c7
to
fa1d4f7
Compare
fa1d4f7
to
b435df6
Compare
@@ -36,4 +38,4 @@ sylius: | |||
not_blank: Please enter the fee percent. | |||
code: | |||
not_blank: 'Please enter payment method code.' | |||
unique: 'The payment method with given code already exists.' | |||
unique: 'The payment method with given code already exists.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line.
@@ -54,7 +54,7 @@ public function it_does_not_allow_to_select_payment_for_order_that_is_not_addres | |||
$this->addressOrder($orderId); | |||
|
|||
$url = sprintf('/api/checkouts/select-payment/%d', $orderId); | |||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType); | |||
$this->client->request('PATCH', $url, [], [], static::$authorizedHeaderWithContentType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9d969fa
to
2114400
Compare
2114400
to
15b65c0
Compare
Thank you Ania! 👍 |
[Checkout] Preventing payment step completion without a selected method