Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Objective
Currently the magento plugin has 2 flows that will create and send invoices when merchant is using 3ds (redirect & webook). This PR aims to mitigate this issue by delaying the creation and sending of the invoices by 10secs when initiated via webhook. This delay should allow time for any redirect process to complete and update the order records to reflect that the invoice for the order has been created and sent already.
2. Description of change
A delay has been added above the 'sendInvoiceEmail' method that is called in the PendingInvoiceHandler Class handler method. The creation of the invoice from the PendingInvoiceHandler Class handler method has been moved inside the 'sendInvoiceEmail' method. A 2nd argument has been added to the 'sendInvoiceEmail' to flagh whether or not to created the invoice before sending.
A slight updated to 'Omise\Payment\Model\Api\Capabilities' class has been made. The purpose of this is to pass the exception message to the custom exception 'LocalizedException' to allow for better error debugging for interrogations.
3. Quality assurance
3DS checkout process needs to be tested. Ensure that only 1 invoice is created and sent. As we fixing a race condition there may still be very rare edge cases that still send and create 2 invoices. Therefore a 99% success rate is acceptable.
🔧 Environments:
Local php development env
i.e.
✏️ Details:
Created a order with 3DS enabled and conffirm that only 1 invoice is created and sent
4. Impact of the change
N/A
5. Priority of change
High