ai-payments
                                
                                
                                
                                    ai-payments copied to clipboard
                            
                            
                            
                        Implement Orders API for pay later payment methods
This patch overrides a couple of Omnipay methods to implement the Mollie Orders API, which is needed for Klarna Pay later and Klarna Slice payment options.
I was not sure if it would be cleaner to modify some methods at Aimeos\MShop\Service\Provider\Payment\Omnipay directly, but ultimately decided to do it like this. Feel free to adapt or modify.
Coverage decreased (-11.5%) to 61.923% when pulling a3d9f79534121c644df243bb88847891aac7de87 on nvindice:2018.10 into b4a5103c251cf489301883bb5df8ff63341cb5b9 on aimeoscom:2018.10.
What do you think of this solution altogether? It's not beautiful, because we have a lot of code duplicates here. However, the "order" methods might be too specific to add them to Aimeos\MShop\Service\Provider\Payment\Omnipay IMHO. Not sure how to do it best. What do you think?
EDIT: I will upload the changes later with some additional fixes for coupon handling.
It's hard to split the updateSync and processOrder methods further so this is currently the best option.
Can you please add tests so the code coverage doesn't decrease?
Sorry, I'm not able to write the tests right now. Most of the tests from Omnipay should work, as the methods are copied with minor adaptions. The apiType = order is needed. Can you help me with that?
Not at the moment
@nvindice Any update on this?
Well, we are using it in production without any issues - I'll try to build some tests in the next couple of weeks...
Writing tests is more work than expected, because Omnipay/Dummy does not support orders, as Omnipay/omnipay-mollie does. Not sure how to continue best, as I'm not used to work with PHPUnit tests. Any tips for me?
(Push)
Are you going to add the missing tests for your code in the near future? Then, we could merge your PR
As said, I need some help on how to write those tests without a fitting Omnipay/Dummy method. Can you help me with this?
IMO, this PR brings a valuable new component to Aimeos: paying with Mollie/Klarna-PayLater, Apple Pay (?) and other advanced payment methods.