Closed krausandre closed 4 years ago
Thanks for your hint!
$service->getCosts()
doesn't exist but $service->getPrice()->getCosts()
should yield the correct result.
Can you create a PR with that change?
Well, it seems that both solutions are working. Let us take your suggestion.
https://github.com/aimeos/aimeos-core/blob/9a0d3f94291fe0f7e2ec450098ad9dc6f36b67d6/lib/mshoplib/src/MShop/Service/Provider/Payment/PayPalExpress.php#L725
After debugging I found this message from PayPal: Invalid shipping total; it should equal the shipping amount of the selected shipping option.&L_SEVERITYCODE0=Error
After checking the code, it seems that $deliveryCosts at line 725 is never initialized.
Therefore, I changed that line from
$values['L_SHIPPINGOPTIONAMOUNT' . $lastPos] = number_format( $deliveryCosts, 2, '.', '' );
to
$values['L_SHIPPINGOPTIONAMOUNT' . $lastPos] = number_format( $service->getCosts(), 2, '.', '' );
Now everything works fine for me.
This error only appears, if you have shipping costs. If shipping is for free, there is no problem.
What do you think about that?