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
[API] Adding inexistent payment method #12657
Conversation
arti0090
commented
May 20, 2021
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
License | MIT |
b8f42d2
to
1ba1e7c
Compare
features/checkout/paying_for_order/preventing_not_available_payment_method_selection.feature
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Validator/Constraints/ChoosePaymentMethodEligibilityValidator.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
2771ba5
to
7a15180
Compare
src/Sylius/Bundle/ApiBundle/Validator/Constraints/ChoosePaymentMethodEligibility.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Validator/Constraints/ChoosePaymentMethodEligibility.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Validator/Constraints/ChoosePaymentMethodEligibilityValidator.php
Outdated
Show resolved
Hide resolved
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
|
||
function it_throws_an_exception_if_constraint_does_not_type_of_choose_payment_method_eligibility(): void | ||
{ | ||
$constraint = new class() extends Constraint implements PaymentMethodCodeAwareInterface { |
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.
You can simplify this spec to sth like:
function it_throws_an_exception_if_constraint_is_not_an_instance_of_chosen_shipping_method_eligibility(): void
{
$this
->shouldThrow(\InvalidArgumentException::class)
->during('validate', [new ChoosePaymentMethod('code'), new class() extends Constraint {}])
;
}
.../Bundle/ApiBundle/spec/Validator/Constraints/ChoosePaymentMethodEligibilityValidatorSpec.php
Outdated
Show resolved
Hide resolved
97d40e7
to
5639dd7
Compare
5639dd7
to
b6d2e02
Compare
/** | ||
* @When I try to select :paymentMethodCode payment method | ||
*/ | ||
public function iTryToSelectPaymentMethod(string $paymentMethodCode): void |
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.
it is a duplication of method iChoosePaymentMethod
can you use it instead of making a new one?
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.
It is not in 100%, the call is same (endpoint) but content is differently created see: $request->setContent(['paymentMethod' => $this->iriConverter->getItemIriFromResourceClass(PaymentMethod::class, ['code' => $paymentMethodCode])]);
Thanks, @arti0090! 🎉 |