Sylius / PayPalPlugin

Official integration with PayPal Commerce Platform
37 stars 56 forks source link

Got 500 in select payment #154

Closed jdeveloper closed 3 years ago

jdeveloper commented 3 years ago

When I go to the page of selecting payment method a got the following error:

ArgumentCountError
Too few arguments to function Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType::__construct(), 0 passed in /var/www/html/vendor/symfony/form/FormRegistry.php on line 91 and at least 1 expected

Screenshot_20201107_120555

If I comment in src/Resources/config/services.xml of the plugin the following lines:

<service
    id="sylius.form.type.checkout_select_payment"
    class="Sylius\PayPalPlugin\Form\Type\SelectPaymentType"
>
    <argument>%sylius.model.order.class%</argument>
    <argument>%sylius.form.type.checkout_select_payment.validation_groups%</argument>
    <tag name="form.type" />
</service>

The page works becouse it takes de default SelectPaymentType of sylius.

Zales0123 commented 3 years ago

Hello @jdeveloper! Are you sure you use the latest version of the plugin (v1.0.0-RC.2 right now, 1.0.0 coming soon!)? It was indeed a bug but should be fixed a long time ago. Let me know if you check it out :) 🖖

jdeveloper commented 3 years ago

@Zales0123 I am sure I use the latest version of the plugin. Here the entry in composer.lock

{
  "name": "sylius/paypal-plugin",
  "version": "v1.0.0-RC.2",
  "source": {
    "type": "git",
    "url": "https://github.com/Sylius/PayPalPlugin.git",
    "reference": "9f02b80dedc9ab79f227f79ee240109faaddc203"
  },
  "dist": {
    "type": "zip",
    "url": "https://api.github.com/repos/Sylius/PayPalPlugin/zipball/9f02b80dedc9ab79f227f79ee240109faaddc203",
    "reference": "9f02b80dedc9ab79f227f79ee240109faaddc203",
    "shasum": ""
  },
  "require": {
    "nyholm/append-query-string": "^0.1.1",
    "php": "^7.3",
    "phpseclib/phpseclib": "^2.0",
    "sylius/sylius": "^1.7"
  },
  "conflict": {
    "symplify/package-builder": "^8.3.24"
  },
  "require-dev": {
    "behat/behat": "^3.6.1",
    "behat/mink-selenium2-driver": "^1.4",
    "dmore/behat-chrome-extension": "^1.3",
    "dmore/chrome-mink-driver": "^2.7",
    "friends-of-behat/mink": "^1.8",
    "friends-of-behat/mink-browserkit-driver": "^1.4",
    "friends-of-behat/mink-extension": "^2.4",
    "friends-of-behat/page-object-extension": "^0.3",
    "friends-of-behat/suite-settings-extension": "^1.0",
    "friends-of-behat/symfony-extension": "^2.1",
    "friends-of-behat/variadic-extension": "^1.3",
    "lakion/mink-debug-extension": "^1.2.3",
    "phpspec/phpspec": "^6.1",
    "phpstan/phpstan": "0.12.25",
    "phpstan/phpstan-doctrine": "0.12.13",
    "phpstan/phpstan-webmozart-assert": "0.12.4",
    "phpunit/phpunit": "^8.5",
    "sensiolabs/security-checker": "^6.0",
    "sylius-labs/coding-standard": "^3.1",
    "symfony/browser-kit": "^4.4",
    "symfony/debug-bundle": "^4.4|^5.0",
    "symfony/dotenv": "^4.4|^5.0",
    "symfony/intl": "^4.4|^5.0",
    "symfony/web-profiler-bundle": "^4.4|^5.0",
    "symfony/web-server-bundle": "^4.4|^5.0",
    "vimeo/psalm": "3.11.4"
  },
  "type": "sylius-plugin",
  "extra": {
    "branch-alias": {
      "dev-master": "1.0-dev"
    }
  },
  "autoload": {
    "psr-4": {
      "Sylius\\PayPalPlugin\\": "src/",
      "Tests\\Sylius\\PayPalPlugin\\": "tests/"
    }
  },
  "notification-url": "https://packagist.org/downloads/",
  "license": [
    "MIT"
  ],
  "description": "PayPal plugin for Sylius.",
  "keywords": [
    "sylius",
    "sylius-plugin"
  ],
  "support": {
    "issues": "https://github.com/Sylius/PayPalPlugin/issues",
    "source": "https://github.com/Sylius/PayPalPlugin/tree/v1.0.0-RC.2"
  },
  "time": "2020-10-13T08:43:07+00:00"
}
Zales0123 commented 3 years ago

Thank you for your answer. I've just tried a fresh install of the plugin on both Sylius 1.7 and 1.8 and it worked well :/ Can you also tell me what exactly version of Sylius you use and do you use the sandbox mode of the plugin or not? It could be helpful :)

jdeveloper commented 3 years ago

Thanks for yous answer. We are using

Zales0123 commented 3 years ago

It's strange... it still works for me 🤯 Can you debug the parameter sylius.form.type.checkout_select_payment.validation_groups and show me the result?

jdeveloper commented 3 years ago

Hi

The result is

[ 'sylius' ]
jdeveloper commented 3 years ago

Sorry for making you spend time. I just figured out that we have redifined the sylius_shop_checkout_select_payment route and so I had to change the form parameter, now it works. As you asked for the validation groups I went to search if the plugin had this route redefined so I found out the form parameter needed to be changed

Thanks for your attention.