Capture Code in bng701_add_order_capture_charge_action
-
We were seeing some odd behavior on our site that led us to look into the plugin code. The odd behavior was: we changed the NMI gateway we were using (updated the API key in the plugin settings) and following that every time we opened the order page for an order that was pending capture on the old gateway, the order would get marked as captured / processing. Of course it wasn’t actually captured in the gateway, but it appeared to have been captured in Woocommerce.
Looking in the code, I see that the function bng701_add_order_capture_charge_action, which adds the capture action to the order actions menu, also has code that will attempt to capture the order (and add notes to that effect) under certain circumstances. It seems the code tries to call the NMI API to get the status of the order and will only abstain from capturing if the order was found and its status is pending. If the order was not found, or it was found but its status was something other than pending, it will try to capture the order.
I don’t understand why this code is here. The logic itself doesn’t make sense to me, but furthermore, why is it present in a function that should only add an action to the order actions menu? Please help me understand the logic behind this if this is intentional; if it’s intended to work this way, perhaps the code should be removed.
- The topic ‘Capture Code in bng701_add_order_capture_charge_action’ is closed to new replies.