ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 8 - AD0-E722 discussion

Report
Export

An Adobe Commerce Architect needs to customize the workflow of a monthly installments payment extension. The extension is from a partner who is contracted with the default website Payment Service Provider (PSP), 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 a webhook. The goal of the webhook 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.

Which solution should the Architect implement?

A.
Add a plugin before the $invoice->capture() and change Its input to prevent the call of the $Payment->capture()
Answers
A.
Add a plugin before the $invoice->capture() and change Its input to prevent the call of the $Payment->capture()
B.
Change the can_capture attribute for the payment method under config.xml to be <can_capture>0</can_capture>
Answers
B.
Change the can_capture attribute for the payment method under config.xml to be <can_capture>0</can_capture>
C.
Declare a capture Command with type Magento\Payment\Gateway\Command\NullCommand for the payment method CommandPool in di.xml
Answers
C.
Declare a capture Command with type Magento\Payment\Gateway\Command\NullCommand for the payment method CommandPool in di.xml
Suggested answer: C

Explanation:

Option C is the correct solution because declaring a capture command with type Magento\Payment\Gateway\Command\NullCommand for the payment method command pool in di.xml will prevent the default capture logic from being executed. The NullCommand class is a dummy implementation of the CommandInterface that does nothing.This way, the payment capture will be handled by the PSP webhook, and the invoice will be created accordingly12

Option A is not a correct solution because adding a plugin before the $invoice->capture() and changing its input to prevent the call of the $payment->capture() will require modifying the core Magento code, which is not recommended.Moreover, this solution will affect all payment methods that use the invoice capture logic, not just the monthly installments payment extension3

Option B is not a correct solution because changing the can_capture attribute for the payment method under config.xml to be <can_capture>0</can_capture> will disable the capture functionality for the payment method entirely.This means that the invoice cannot be created or captured, even by the PSP webhook4

1: https://experienceleague.adobe.com/docs/commerce-cloud-service/user-guide/payments-integrations/payment-gateway/gateway-command.html?lang=en2: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Payment/Gateway/Command/NullCommand.php3: https://experienceleague.adobe.com/docs/commerce-cloud-service/user-guide/customization/best-practices.html?lang=en#do-not-modify-core-code4: https://experienceleague.adobe.com/docs/commerce-cloud-service/user-guide/payments-integrations/payment-gateway/payment-gateway-configuration.html?lang=en#payment-method-configuration

asked 02/10/2024
Omar Olaya
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first