woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
321 stars 113 forks source link

Orders screen doens't load when response has `taxes` with invalid `id` value #14308

Open selanthiraiyan opened 3 weeks ago

selanthiraiyan commented 3 weeks ago

Internal - peaMlT-Yo-p2

Issue

The iOS app isn't able to parse the /wc/v3/orders response when any of the taxes under line_items have an invalid id value. The OrderItemTax mapper expects the id value to be Int64.

To reproduce, use the following line_items. Note the taxes had a String id value where the app expects Int.

 "line_items": [\
        \{\
          "id": 123,\
          "name": "Product name",\
          "product_id": 3122,\
          "variation_id": 3323,\
          "quantity": 1,\
          "tax_class": "",\
          "subtotal": "28.00",\
          "subtotal_tax": "3.64",\
          "total": "28.00",\
          "total_tax": "3.64",\
          "taxes": [\
            \{\
              "id": "stripe_tax_for_woocommerce__hst__13.0__India (GST)",\
              "total": "32.4",\
              "subtotal": "32.4"\
            \}\
          ],\
          "meta_data": [\
            \{\
              "id": 123,\
              "key": "pa_color",\
              "value": "white",\
              "display_key": "Color",\
              "display_value": "White"\
            \},\
            \{\
              "id": 124,\
              "key": "pa_logo-style",\
              "value": "avocado",\
              "display_key": "Logo Style",\
              "display_value": "Avocado"\
            \}\
          ],\
          "sku": "CHIANKD-A",\
          "price": 12,\
          "image": \{\
            "id": 123,\
            "src": "https://test.com/wp-content/uploads/2024/07/image.jpg"\
          \},\
          "parent_name": "Product name"\
        \}\
      ]

Possible Solution

Check the possibility of ignoring the taxes with invalid id values and loading the rest of the orders. Currently, the app doesn't load any orders at all, which isn't a good user experience.

dangermattic commented 3 weeks ago

Thanks for reporting! 👍

rossanafmenezes commented 1 week ago

Adding more information here regarding a recent report. Context Slack convo: p1732107537674619-slack-C6H8C3G23 Ticket: 8961210-zd-a8c

Not exactly the same issue but also a parsing problem on iOS, probably due to a plugin modifying the order info but it is being parsed correctly on Android.

For this user, searching for orders by customer name returns an error (Sorry, we could not find this order screen). Searching for order numbers, some orders work, some don't. They have two plugins that caught our attention (Advanced Product Search For WooCommerce and Ultimate Tax Exempt). That said, deactivating the plugins did not affect the search. App logs and screenshots of test sites are in Slack.