Edit in GitHubLog an issue

Gateway Command Pool

All gateway commands implemented for a particular payment provider, should be added to a command pool for this provider. A command pool is a set of gateway commands available for integration with a particular payment provider. The pool is added to the configuration of the payment provider using dependency injection.

Interface

The basic interface for a command pool is \Magento\Payment\Gateway\Command\CommandPoolInterface. It implements the Pool pattern

Default implementation

The default CommandPool implements CommandPoolInterface and takes a list of commands as an optional argument for the constructor.

Command pool configuration for a particular provider

Following is an example of the command pool configuring for the Braintree payment provider, and adding it to the provider's payment method configuration (app/code/Magento/Braintree/etc/di.xml).

Copied to your clipboard
...
<!-- BraintreeCommandPool - a command pool for the Braintree payments provider -->
<virtualType name="BraintreeCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">BraintreeAuthorizeCommand</item>
<item name="sale" xsi:type="string">BraintreeSaleCommand</item>
<item name="capture" xsi:type="string">BraintreeCaptureStrategyCommand</item>
...
</argument>
</arguments>
</virtualType>
...
<!-- Adding BraintreeCommandPool to the Braintree payment method configuration:-->
<virtualType name="BraintreeFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
...
<argument name="commandPool" xsi:type="object">BraintreeCommandPool</argument>
</arguments>
</virtualType>
...

(The code sample is from Magento Open Source v2.1. Although the payment provider gateway was added in v2.0, the particular default implementation using the gateway were added in v2.1.)

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.