Gateway Command Pool
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
).
(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.)