An Adobe Commerce Architect needs to customize the workflow of a monthly installments payment extension. The extension is from a partner that is contracted with the default website PSR which has its own legacy extension (a module using deprecated payment method). The installment payment partner manages only initializing a payment, and then hands the capture to be executed by the PSP. Once the amount is successfully captured, the PSP notifies the website through an IPN. The goal of the IPN is only to create an "invoice" and save the 'capture information' to be used later for refund requests through the PSP itself. The Architect needs the most simple solution to capture the requested behavior without side effects.
Which solution should the Architect implement?
- Add a plugin before the $invoice-> () and changes its input to prevent the call of the $payment-> capture()
- Change the can_ capture attribute for the payment method under config.xml to be <can_capture>0</can_capture>
- Declare a capture command with type Magento\payment\Gateway\Command\NullCommand for the payment method CommandPool in di.zm1
Answer(s): C
Explanation:
The best solution for the Adobe Commerce Architect to implement in order to capture the requested behavior without side effects is to declare a capture command with type Magento\payment\Gateway\Command\NullCommand for the payment method CommandPool in di.xml. This will allow the partner to initialize the payment and then hand the capture over to the PSP, while also preventing the website from calling the $payment->capture() method. It will also allow the PSP to notify the website through an IPN, which will create an "invoice" and save the 'capture information' to be used later for refund requests through the PSP itself. The Architect should implement the solution of declaring a capture command with type Magento\Payment\Gateway\Command\NullCommand for the payment method CommandPool in di.xml. This command will do nothing when the capture method is called on the payment method, which is the desired behavior since the capture is handled by the PSP. The NullCommand class implements \Magento\Payment\Gateway\CommandInterface and overrides the execute() method to return null. Option A is incorrect because adding a plugin before the $invoice->capture() method and changing its input will not prevent the call of the $payment->capture() method, but rather change the invoice object that is passed to it. Option B is incorrect because changing the can_capture attribute for the payment method under config.xml to be <can_capture>0</can_capture> will not prevent the capture method from being called, but rather disable the capture option in the Admin panel.
Reference:
https://devdocs.magento.com/guides/v2.4/payments-integrations/base- integration/facade-configuration.html
Reveal Solution Next Question