PayU-EMEA / plugin_magento_2

Plugin for Magento versions: >2.0.6, 2.1, 2.2
GNU General Public License v3.0
18 stars 13 forks source link

Customer IP is missing when cart is synced from external source #16

Closed jochhop closed 6 years ago

jochhop commented 6 years ago

PayU payment method shows "Transaction has been declined. Please try again later." error when trying to complete a checkout synced from an external cart (this case was tested with Vue Storefront: https://github.com/DivanteLtd/vue-storefront)

The error appears because customer IP is missing when following this checkout flow. The below response comes from PayU API:

Array
(
    [status] => ERROR_VALUE_MISSING
    [response] => Array
        (
            [status] => Array
                (
                    [statusCode] => ERROR_VALUE_MISSING
                    [severity] => ERROR
                    [code] => 8010
                    [codeLiteral] => MISSING_CUSTOMER_IP
                    [statusDesc] => Missing required field
                )

        )

)

The proposed fix checks if customer IP is empty in order object. In case it is, then customer IP will be pulled from remote address

regdos commented 6 years ago

thank's for your contribution