Regarding creation of a new payment method in B2C demo shop
Hi everyone, I'm planning to add a new payment method on the checkout page of the demo shop provided by default from Spryker for a POC task. I was following this tutorial, $createPaymentSubForms
(vendor/spryker-shop/checkout-page/src/SprykerShop/Yves/CheckoutPage/Form/FormFactory.php, #105) . when I print the array, I still am getting the existing two plugins which are
Spryker\Yves\StepEngine\Dependency\Plugin\Form\SubFormPluginCollection Object ( [subForms:protected] => Array ( [0] => Spryker\Yves\DummyPayment\Plugin\DummyPaymentCreditCardSubFormPlugin Object ( [factory:protected] => [client:protected] => [config:protected] => ) [1] => Spryker\Yves\DummyPayment\Plugin\DummyPaymentInvoiceSubFormPlugin Object ( [factory:protected] => [client:protected] => [config:protected] => ) ) [position:protected] => 0 )
I've created this new FormPlugin Pyz\Yves\PaymentMethods\Plugin\LeaseSubFormPlugin
and added this to the src/Pyz/Yves/PaymentMethods/Dependency/Injector/CheckoutDependencyInjector.php
But it seems like that the Dependency Injector is not working as expected. I tested it successfully by adding the LeaseSubFormPlugin to the Spryker dependency Injector in the vendor folder (vendor/spryker/dummy-payment/src/Spryker/Yves/DummyPayment/Dependency/Injector/CheckoutDependencyInjector.php, #45) and then I'm able to see that the LeaseSubFormPlugin is added to the $createPaymentSubForms
array. So, this is where I need your help in figuring out what I'm missing in the Pyz namespace so that my dependency injector is not coming to effect. Thanks in advance.
Best Answer
-
I got it. I had to add a line to config/Shared/common/config_oms-development.php which is
$config[KernelConstants::DEPENDENCY_INJECTOR_YVES] = [ 'CheckoutPage' => [ NopaymentConfig::PAYMENT_PROVIDER_NAME, 'PaymentMethods', ],];
This info was not available in the spryker docs. But I got help from one of the previous discussions in the channel.
1
Answers
-
I got it. I had to add a line to config/Shared/common/config_oms-development.php which is
$config[KernelConstants::DEPENDENCY_INJECTOR_YVES] = [ 'CheckoutPage' => [ NopaymentConfig::PAYMENT_PROVIDER_NAME, 'PaymentMethods', ],];
This info was not available in the spryker docs. But I got help from one of the previous discussions in the channel.
1
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 896 Developer Corner
- 758 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 23 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random