Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Only one payment method allowed - #77

Merged
Zales0123 merged 2 commits into
Sylius:masterfrom
bartoszpietrzak1994:allow-only-one-payment-method
Sep 6, 2018
Merged

Only one payment method allowed#77
Zales0123 merged 2 commits into
Sylius:masterfrom
bartoszpietrzak1994:allow-only-one-payment-method

Conversation

@bartoszpietrzak1994

Copy link
Copy Markdown
Contributor

screen shot 2018-09-05 at 10 03 47

Scenario: Being unable to add multiple payment methods
    When I create a new order for "jon.snow@the-wall.com" and channel "United States"
    And I select "Cash on Delivery" payment method
    Then adding another payment method should not be possible

Fixes #52

;
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

{
return $this
->getElement('payments')
->find('css', '[data-form-collection="Add"]') !== null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting gone wrong here :( And I suppose it should be '[data-form-collection="add"]'?

{
return $this->getElement('payments')->find(
'css', '[data-form-collection="add"]') !== null
;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still looks bad (I know, I'm annoying xD)

return $this->getElement('payments')->find('css', '[data-form-collection="add"]') !== null;

or

return
    $this->getElement('payments')->find('css', '[data-form-collection="add"]') !== null
;

It should fit in one line

@bartoszpietrzak1994
bartoszpietrzak1994 force-pushed the allow-only-one-payment-method branch 2 times, most recently from 0f71e89 to 2286bc9 Compare September 5, 2018 11:14
@bartoszpietrzak1994
bartoszpietrzak1994 force-pushed the allow-only-one-payment-method branch from 2286bc9 to b5cc8e5 Compare September 6, 2018 07:49
@Zales0123
Zales0123 merged commit 2db1a2f into Sylius:master Sep 6, 2018
@Zales0123

Copy link
Copy Markdown
Contributor

🔫

@wadjeroudi

Copy link
Copy Markdown

@Zales0123 @bartoszpietrzak1994
I think this kind of validation should be added to a different group than sylius or maybe add the constraint in the NewOrderType.
If in your app you have a different workflow for payments, the plugin shouldn't add the validation globally.

Prometee pushed a commit to Prometee/AdminOrderCreationPlugin that referenced this pull request May 14, 2024
[General] Cleanup code and apply Sylius codestyle
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants