-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement Orders API for pay later payment methods #22
base: 2018.10
Are you sure you want to change the base?
Conversation
$response = $provider->completeAuthorize( $params )->send(); | ||
$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED; | ||
} | ||
elseif( $this->getValue('apiType', 'payment') == 'order' ) |
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.
Shouldn't this be the first if-clause?
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.
Agreed, will change that.
$response = $provider->authorize( $data )->send(); | ||
$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED; | ||
} | ||
elseif( $this->getValue( 'apiType', '' ) === 'order' ) |
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.
Same order here?
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.
Sorry, it was a long day. Yes, same apiType in request and sync methods. I will remove the default in the other clause and switch positions here.
* @param array $params POST parameters passed to the provider | ||
* @return \Omnipay\Common\CreditCard Credit card object | ||
*/ | ||
protected function getCardDetails( \Aimeos\MShop\Order\Item\Base\Iface $base, array $params ) |
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.
Why did you overwrite that method and removed some values?
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.
Mollie API / Klarna is very strict on the phone number format. I'm not sure if an automatic transformation is a good idea when it comes to the payment process. So I removed the phone numbers altogether, Klarna will ask for them at a later stage if necessary.
Addiontally, GDPR makes it difficult to pass this information, IMHO.
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.
From the GDPR point of view, the shipping address and the e-mail should be removed as well
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.
Right, but they are necessary for the Orders API. Phone number is not. So I think a shop provider could argue with Article 6 here.
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 EDIT: I will upload the changes later with some additional fixes for coupon handling. |
It's hard to split the |
Sorry, I'm not able to write the tests right now. Most of the tests from |
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 |
(Push) |
Are you going to add the missing tests for your code in the near future? |
As said, I need some help on how to write those tests without a fitting IMO, this PR brings a valuable new component to Aimeos: paying with Mollie/Klarna-PayLater, Apple Pay (?) and other advanced 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.