After Payment Decorator with PaypalExpress
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
After Payment Decorator with PaypalExpress
Hi all,
I am using Aimeos 2020.10.6 with PHP 7.3. The system is pretty good!
The only issue I found up to now is to add a decorator that performs some operations after the payment (done through PaypalExpress).
I found a related topic laravel-package-f18/hook-into-order-com ... t2687.html, however, even following the procedure explained there I ended up with having problems.
Basically, I redefined the updatedSync function in this way:
I have a specific use case that doesn't allow me to use the cronjob function provided by Aimeos.
However, the status there is always pending.
I also tried to move the logic in the updatePush function, but the result is exactly the same.
Instead, if I remove the decorator I created, the payment succeed.
Can someone please help me? What am I doing wrong?
Looking forward for a reply, thanks for the time and help!
I am using Aimeos 2020.10.6 with PHP 7.3. The system is pretty good!
The only issue I found up to now is to add a decorator that performs some operations after the payment (done through PaypalExpress).
I found a related topic laravel-package-f18/hook-into-order-com ... t2687.html, however, even following the procedure explained there I ended up with having problems.
Basically, I redefined the updatedSync function in this way:
Code: Select all
public function updateSync(
\Psr\Http\Message\ServerRequestInterface $request,
\Aimeos\MShop\Order\Item\Iface $order
): \Aimeos\MShop\Order\Item\Iface {
....
if ($paymentStatus == \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED) {
send_email_to_user_and_update_db
}
return $order;
}
However, the status there is always pending.
I also tried to move the logic in the updatePush function, but the result is exactly the same.
Instead, if I remove the decorator I created, the payment succeed.
Can someone please help me? What am I doing wrong?
Looking forward for a reply, thanks for the time and help!
Re: After Payment Decorator with PaypalExpress
If you write a decorator and want the underlying object to do its job, you need to call
first. Thus, your code should look like:
Code: Select all
$this->getProvider()->updateSync($request, $orderItem);
Code: Select all
public function updateSync(
\Psr\Http\Message\ServerRequestInterface $request,
\Aimeos\MShop\Order\Item\Iface $order
) : \Aimeos\MShop\Order\Item\Iface
{
$order = $this->getProvider()->updateSync($request, $order);
if ($order->getPaymentStatus() == \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED) {
send_email_to_user_and_update_db
}
return $order;
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: After Payment Decorator with PaypalExpress
Ok, thanks a lot for the reply. That solved the issue and is exactly what I was looking for!