Skip to content
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

[Payment] Adding PaymentFactory #4214

Merged
merged 5 commits into from
Feb 19, 2016

Conversation

lchrusciel
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? yes
Deprecations? no
License MIT

@michalmarcinkowski michalmarcinkowski added Awaiting Review Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). labels Feb 18, 2016
@pjedrzejewski
Copy link
Member

@lchrusciel Can we also remove the dispatcher from the listener? It's never used.

@pjedrzejewski
Copy link
Member

Please take a look at the failing build, otherwise looks good to me. In a separate PR we should definitely figure out a better name than PaymentProcessor, it's more like OrderPaymentsUpdater, but still far from perfect. :/

$paymentFactoryDefinition = $container->getDefinition('sylius.factory.payment');
$paymentFactoryClass = $paymentFactoryDefinition->getClass();
$decoratedPaymentFactoryDefinition = new Definition($paymentFactoryClass);
$decoratedPaymentFactoryDefinition->setArguments([$factoryDefinition]);
Copy link
Contributor

Choose a reason for hiding this comment

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

How about squeezing this to one line:
$decoratedPaymentFactoryDefinition = new Definition($paymentFactoryClass, [$factoryDefinition]);?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@lchrusciel lchrusciel force-pushed the introduce-payment-factory branch 3 times, most recently from dfebfc4 to c1a3592 Compare February 19, 2016 08:51
pjedrzejewski pushed a commit that referenced this pull request Feb 19, 2016
@pjedrzejewski pjedrzejewski merged commit 2faa1a3 into Sylius:master Feb 19, 2016
@pjedrzejewski
Copy link
Member

Thank you Łukasz! 👍

@lchrusciel lchrusciel deleted the introduce-payment-factory branch February 26, 2016 13:42
@@ -43,15 +38,11 @@ public function __construct(FactoryInterface $paymentFactory)
/**
* {@inheritdoc}
*/
public function createPayment(OrderInterface $order)
public function processOrderPayments(OrderInterface $order)

Choose a reason for hiding this comment

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

Hi, I know this was merged a while ago, but I'm just working through an update...

Is this class (or this method) actually doing any processing?

It seems a bit pointless and could go into the Factory (or a Core extension/decoration of the Factory), because the naming is confusing now. There's no processing of order payments going on here that I can see - just creating them.

Choose a reason for hiding this comment

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

also the name implies multiple payments but this method only creates a single new payment for the total of an order. Could be something like PaymentFactory::createForOrderTotal() ?

@pjedrzejewski
Copy link
Member

@peteward Yeah, the naming is unfortunate, but we want to have it separated from payment factory because we want to allow custom implementations, which may create multiple payments or do whatever they want. That's why we have this extra service. That being said, the naming and this as a whole must be improved, I agree.

@peteward
Copy link

Understood, perhaps Provider or Builder?

pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants