$envelope CrudBackstop::guard_payment()'s envelope. * @return array|WP_Error */ public function replay( ActionDescriptor $action, array $envelope ): array|WP_Error { $order = wc_get_order( absint( $envelope['order_id'] ?? 0 ) ); if ( ! $order instanceof \WC_Order ) { return new WP_Error( 'adafwc_object_missing', __( 'The object this change was for no longer exists.', 'agentic-daisy-ai-agent-firewall-for-woocommerce' ) ); } if ( ! current_user_can( 'edit_shop_orders' ) ) { return new WP_Error( 'adafwc_object_forbidden', __( 'The agent\'s WordPress user may no longer make this change.', 'agentic-daisy-ai-agent-firewall-for-woocommerce' ) ); } return array( 'paid' => $order->payment_complete( is_string( $envelope['transaction_id'] ?? null ) ? $envelope['transaction_id'] : '' ) ); } }