Closed shaunek-hero closed 7 months ago
@shaunek-hero this is an interesting one. From a validation standpoint, this is important:
The BitPayIpnProcess->execute() method starts and there is a line in that method that calls $bitpay_invoice = $this->factory->create()->getInvoice( $invoice_id, Facade::POS, false ); which we think does a live HTTP call to get the invoice
It does perform a live lookup, because we should check that the inbound webhook is valid. Another solution here would be HMAC, which would eliminate the need to make the extra network call, but I don't believe that's currently implemented.
I'll talk to a few teammates and see what might be a good path forward here. I'm thinking that we might need to think of something creative based on a combination of the IPN + the state that's fetched. For example, if a paid
IPN comes in but the live status is complete
, then we should be able to safely assume that the IPN is valid.
Hey @shaunek-hero just a quick update on this -- we've talked it over as a group and are documenting a way forward with today's validation method of using a GET on the invoice. We'll continue to discuss HMAC to help eliminate the need for the extra API call.
To summarize:
Okay thanks for the update.
Just wanted to let you know we have seen this happen a couple more times since our original report. We unfortunately aren't getting strong take up on our Bitpay payment option, so we are only getting a few orders a week this way, which translates into our 4-5 occurrences of this being a relatively high percentage of the overall orders. Good thing is our operations guys know how to spot and handle these cases now.
Thanks for working on this!
@shaunek-hero & @bobbrodie The plugin allows Admins to set a WooCommerce Order status change for the following BitPay Invoice status updates via Webhook:
Since we’re validating Webhook data against the live Invoice data, I think we can use this as a guide for a change to the plugin:
I don’t think we need to be concerned about other statuses for this case since we're primarily concerned about making sure that Webhooks update an Order’s status for processing.
@p-maguire I discussed this with my colleague @farjad6 and we think your idea would work nicely for what we have seen.
We are using version 5.3.2.
Normally the IPN messages come in and the Woo order status updates just fine, but we have now seen two different orders have an issue where an IPN message was delivered but the order status did not get updated to the appropriate status. @farjad6 , my coworker, has determined that this is a timing issue. Let me describe step by step what happened:
BitPayIpnProcess->execute()
method starts and there is a line in that method that calls$bitpay_invoice = $this->factory->create()->getInvoice( $invoice_id, Facade::POS, false );
which we think does a live HTTP call to get the invoiceBitPayIpnProcess->process_processing()
methodBitPayIpnProcess->validate_bitpay_status_in_available_statuses()
method. The error log file shows the following=================================================
======================INCOMING IPN ERROR=========================== Wrong BitPay status. Status: complete available statuses: Array ( [0] => confirmed )
=================================================