wordpress-mobile / wordpress-mobile/WordPress-Android

Domain registration fails

Open
#13,571 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Pri] Low [Type] Bug Domains
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

While testing the domain registration from the app (using domain credits), the last step failed for me without any snackbar or a message. There is just this whiteish circle that appears in the middle of the screen and that's it.

The error looks like an unexpected API object.

I'm setting the priority to low because it's only happening on one of my accounts and it doesn't happen to another person testing the same thing.

The error in the logcat is:

2020-12-09 16:12:41.493 4224-4224/org.wordpress.android.prealpha E/WordPress-API: Volley error on https://public-api.wordpress.com/rest/v1.1/me/shopping-cart/169844210/?locale=en_US
    com.android.volley.ParseError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2247 path $.products[1].extra
        at org.wordpress.android.fluxc.network.rest.GsonRequest.parseNetworkResponse(GsonRequest.java:98)
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:143)
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
        at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
     Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2247 path $.products[1].extra
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at com.google.gson.Gson.fromJson(Gson.java:841)
        at com.google.gson.Gson.fromJson(Gson.java:813)
        at org.wordpress.android.fluxc.network.rest.GsonRequest.parseNetworkResponse(GsonRequest.java:92)
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:143) 
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111) 
        at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90) 
     Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2247 path $.products[1].extra
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) 
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) 
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) 
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) 
        at com.google.gson.Gson.fromJson(Gson.java:927) 
        at com.google.gson.Gson.fromJson(Gson.java:892) 
        at com.google.gson.Gson.fromJson(Gson.java:841) 
        at com.google.gson.Gson.fromJson(Gson.java:813) 
        at org.wordpress.android.fluxc.network.rest.GsonRequest.parseNetworkResponse(GsonRequest.java:92) 
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:143) 
        at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111) 
        at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90) 

The response is:

{"cart_generated_at_timestamp":X,"blog_id":X,"cart_key":"X","coupon":"","coupon_discounts":[],"coupon_discounts_integer":[],"coupon_discounts_display":[],"is_coupon_applied":false,"has_bundle_credit":true,"next_domain_is_free":true,"next_domain_condition":"","products":[{"product_id":76,"product_name":".blog Domain Registration","product_name_en":".blog Domain Registration","product_slug":"dotblog_domain","product_cost":528,"product_cost_display":"528 K\u010d","product_cost_integer":52800,"meta":"testingquickstart.blog","cost":0,"currency":"CZK","volume":1,"quantity":null,"free_trial":false,"orig_cost":0,"cost_before_coupon":528,"coupon_savings":0,"coupon_savings_integer":0,"coupon_savings_display":"0 K\u010d","is_sale_coupon_applied":null,"extra":{"privacy":true,"registrar":"KS_RAM","domain_registration_agreement_url":"https:\/\/wordpress.com\/automattic-domain-name-registration-agreement\/","privacy_available":true,"premium":false},"bill_period":"365","months_per_bill_period":12,"is_domain_registration":true,"time_added_to_cart":1607526833,"is_bundled":true,"item_original_cost":528,"item_original_cost_integer":52800,"item_original_cost_display":"528 K\u010d","item_original_monthly_cost_integer":4400,"item_original_monthly_cost_display":"44 K\u010d","item_subtotal_monthly_cost_integer":0,"item_subtotal_monthly_cost_display":"0 K\u010d","item_original_subtotal":528,"item_original_subtotal_integer":52800,"item_original_subtotal_display":"528 K\u010d","item_subtotal":0,"item_subtotal_integer":0,"item_subtotal_display":"0 K\u010d","item_tax":0,"item_tax_rate":0,"item_total":0,"subscription_id":0,"is_renewal":false,"domain_post_renewal_expiration_date":null,"related_monthly_plan_cost_integer":0,"related_monthly_plan_cost_display":""},{"product_id":18,"product_name":"WordPress.com Credits","product_name_en":"WordPress.com Credits","product_slug":"wordpress-com-credits","product_cost":0,"product_cost_display":"0 K\u010d","product_cost_integer":0,"meta":null,"cost":-0,"currency":"CZK","volume":1,"quantity":null,"free_trial":false,"orig_cost":null,"cost_before_coupon":0,"coupon_savings":0,"coupon_savings_integer":0,"coupon_savings_display":"0 K\u010d","is_sale_coupon_applied":null,"extra":[],"bill_period":"-1","months_per_bill_period":null,"is_domain_registration":false,"time_added_to_cart":1607526833,"is_bundled":false,"item_original_cost":0,"item_original_cost_integer":0,"item_original_cost_display":"0 K\u010d","item_original_monthly_cost_integer":0,"item_original_monthly_cost_display":"","item_subtotal_monthly_cost_integer":0,"item_subtotal_monthly_cost_display":"","item_original_subtotal":0,"item_original_subtotal_integer":0,"item_original_subtotal_display":"0 K\u010d","item_subtotal":-0,"item_subtotal_integer":0,"item_subtotal_display":"0 K\u010d","item_tax":0,"item_tax_rate":0,"item_total":0,"subscription_id":0,"is_renewal":false,"domain_post_renewal_expiration_date":null,"related_monthly_plan_cost_integer":0,"related_monthly_plan_cost_display":""}],"total_cost":0,"currency":"CZK","total_cost_display":"0 K\u010d","total_cost_integer":0,"temporary":true,"tax":{"location":[],"display_taxes":false},"savings_total":528,"savings_total_display":"528 K\u010d","savings_total_integer":52800,"coupon_savings_total":0,"coupon_savings_total_display":"0 K\u010d","coupon_savings_total_integer":0,"sub_total_with_taxes_display":"0 K\u010d","sub_total_with_taxes_integer":0,"sub_total":0,"sub_total_display":"0 K\u010d","sub_total_integer":0,"total_tax":0,"total_tax_display":"0 K\u010d","total_tax_integer":0,"credits":1720,"credits_display":"1,720 K\u010d","credits_integer":172000,"allowed_payment_methods":["WPCOM_Billing_MoneyPress_Paygate","WPCOM_Billing_PayPal_Express","WPCOM_Billing_Stripe_Payment_Method","WPCOM_Billing_Web_Payment"],"create_new_blog":false,"messages":{"errors":[],"success":[]},"bundled_domain":"testingquickstart.blog"}

The screen looks like this:

Screenshot_1607527133

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the domain-registration flow and the shopping-cart response at /me/shopping-cart/169844210/?locale=en_US, then inspect GsonRequest.java around the reported parse failure. Compare the products[1].extra response shape with the client model and reproduce the credits-based registration; done means the response no longer fails silently and the flow presents an appropriate result.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.