magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

Unable to palce order status with Paypal #8296

Closed allamgr closed 7 years ago

allamgr commented 7 years ago

Preconditions

  1. Magento CE 2.1.2 is installed, and development mode active
  2. PayPal payment method is set up with a little hack that set the method available for my country(Dominican Republic) install this custom module (https://github.com/allamgr/magento2-allamgr-paypal) 3.Set Store/Sales/Payment Methods with the following configuration

Merchant Country: Dominican Republic

Paypal Express Checkout Sandbox Mode: Yes API Uses Proxy: No Enable this solution: Yes Enable In-Context Checkout Experience: Yes --Advance Config --Payment Applicable From: All Allowed Contries --Debug Mode: Yes --Enable SSL verification: Yes --Transfer Cart Line Items: Yes --Transfer Shipping Options: No --Require Customer's Billing Address: No --Billing Agreement Signup: Never --Skip Order Review Step: Yes

Steps to reproduce

  1. Add product to cart
  2. Proceed to chekout
  3. Select Shipping Address
  4. Select Payapal as Payment method
  5. Place order

Expected result

  1. Magento place the order successfully and send the user to success order page

Actual result

  1. array_key_exists(): The first argument should be either a string or an integer in /home/clarapru/public_html/vendor/magento/module-sales/Model/Order/Payment.php on line 371
joni-jones commented 7 years ago

Hi, @allamgr, unfortunately, we don't provide investigation for 3d party extensions.

I've tested Magento Express Checkout on 2.1.3 version and all works fine. Please, try to reproduce your issue with Express Checkout from Magento and update this issue.

joni-jones commented 7 years ago

We are closing this issue because it hasn’t been updated in more than two weeks.

If you still can reproduce the issue, please, be free to reopen it.

maderlock commented 7 years ago

I get a similar issue without the hack on 2.1.9.

The problem is a warning, but we develop with these turned on. On attempting to place the order, returning from PayPa successfully:

[2017-10-04 11:33:56] main.CRITICAL: Exception message: Warning: array_key_exists(): The first argument should be either a string or an integer in .../web-root/vendor/magento/module-sales/Model/Order/Payment.php on line 359 Trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'array_key_exist...', '...', 359, Array)

1 .../web-root/vendor/magento/module-sales/Model/Order/Payment.php(359): array_key_exists(true, Array)

2 .../web-root/vendor/magento/module-sales/Model/Order.php(858): Magento\Sales\Model\Order\Payment->place()

3 .../web-root/vendor/magento/module-sales/Model/Order.php(1047): Magento\Sales\Model\Order->_placePayment()

4 .../web-root/vendor/magento/module-sales/Model/Service/OrderService.php(190): Magento\Sales\Model\Order->place()

...

maderlock commented 6 years ago

I've tracked down the issue to magento/module-paypal/Model/Express.php line 389:

$status = true;

This then gets set on the order model on line 431.

When we get to magento/module-sales/Model/Order/Payment.php it gets the status from the order as TRUE, so at line 359 of that file it throws a PHP error because a boolean is not a valid input to the array_key_exists function.

maderlock commented 6 years ago

As a workaround I've created a plugin for Paypal\Model\Express which sets order status to null if it's set to true. This is finally allowing orders to go through in Order mode.

zlik commented 6 years ago

The issue is reproducible in Magento v.2.2.3 (PHP warnings on).

sshymko commented 6 years ago

The issue is marked closed, but per the above it seems to be reproducible on the late Magento releases. Could you please reopen?