Align mobile SDK size recommendation API requests with web implementation#165
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aligns the Android SDK's size recommendation API requests with the web implementation by updating parameter naming conventions and adding support for shoe size recommendations.
Key changes:
- Renamed API methods to distinguish between item and shoe size recommendations
- Updated API parameter names from camelCase to snake_case to match web standards
- Added footwear data support to user body profiles
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| VirtusizeAPIService.kt | Renamed method and added new shoe size recommendation API method |
| VirtusizeAPIServiceImpl.kt | Implemented separate endpoints for item and shoe size recommendations |
| BodyProfileRecommendedSizeParams.kt | Updated parameter naming to snake_case and added shoe-specific parameter mapping |
| UserBodyProfile.kt | Added footwear data field to support shoe recommendations |
| VirtusizeApi.kt | Added new API endpoint for shoe size recommendations |
| Test files | Updated tests to reflect new parameter naming and added footwear data assertions |
| val jsn = JSONObject(apiRequest.params).toString(); | ||
| print(jsn); |
There was a problem hiding this comment.
Debug code should be removed from production. The line creating jsn variable and the print(jsn) statement appear to be debugging code that should not be included in the final implementation.
| val jsn = JSONObject(apiRequest.params).toString(); | |
| print(jsn); |
| withContext(Dispatchers.IO) { | ||
| val apiRequest = VirtusizeApi.getSize(productTypes, storeProduct, userBodyProfile) | ||
| val jsn = JSONObject(apiRequest.params).toString(); | ||
| print(jsn); |
There was a problem hiding this comment.
Debug code should be removed from production. This print statement appears to be debugging code that should not be included in the final implementation.
| print(jsn); |
| val jsn = JSONObject(apiRequest.params).toString(); | ||
| print(jsn); |
There was a problem hiding this comment.
Debug code should be removed from production. The line creating jsn variable and the print(jsn) statement appear to be debugging code that should not be included in the final implementation.
| val jsn = JSONObject(apiRequest.params).toString(); | |
| print(jsn); |
| withContext(Dispatchers.IO) { | ||
| val apiRequest = VirtusizeApi.getShoeSize(productTypes, storeProduct, userBodyProfile) | ||
| val jsn = JSONObject(apiRequest.params).toString(); | ||
| print(jsn); |
There was a problem hiding this comment.
Debug code should be removed from production. This print statement appears to be debugging code that should not be included in the final implementation.
| print(jsn); |
| userBodyProfileResponse.successData!!, | ||
| ) | ||
| return bodyProfileRecommendedSizeResponse.successData?.get(0)?.sizeName | ||
| if (storeProduct.productType == 17) { |
There was a problem hiding this comment.
Magic number 17 should be replaced with a named constant or enum value to improve code readability and maintainability. Consider defining a constant like PRODUCT_TYPE_SHOES = 17 or using an enum.
| if (storeProduct.productType == 17) { | |
| if (storeProduct.productType == PRODUCT_TYPE_SHOES_ID) { |
| "toeShape" to "greek", | ||
| "size" to "30.5", | ||
| "type" to "sneakers", | ||
| "brand" to "virtusize", |
There was a problem hiding this comment.
Brand name inconsistency: 'virtusize' should be capitalized as 'Virtusize' to match the brand name used elsewhere in the codebase (line 99 shows 'Virtusize').
| "brand" to "virtusize", | |
| "brand" to "Virtusize", |
There was a problem hiding this comment.
@mikhail-yevstratiev please update the brand name
| fun paramsToMap(): Map<String, Any> { | ||
| return emptyMap<String, Any>() | ||
| .plus( | ||
| mapOf("app_origin" to 2), |
There was a problem hiding this comment.
Magic number 2 should be replaced with a named constant to improve code readability and maintainability. Consider defining a constant like APP_ORIGIN_ANDROID = 2.
| mapOf("app_origin" to 2), | |
| mapOf("app_origin" to APP_ORIGIN_ANDROID), |
There was a problem hiding this comment.
@mikhail-yevstratiev resolve the comment
| "toeShape" to "greek", | ||
| "size" to "30.5", | ||
| "type" to "sneakers", | ||
| "brand" to "virtusize", |
There was a problem hiding this comment.
@mikhail-yevstratiev please update the brand name
| * @param userBodyProfile [UserBodyProfile] | ||
| * @see ApiRequest | ||
| */ | ||
| fun getShoeSize( |
There was a problem hiding this comment.
getShoeSize -> getShoeSizeRecommendation
| fun paramsToMap(): Map<String, Any> { | ||
| return emptyMap<String, Any>() | ||
| .plus( | ||
| mapOf("app_origin" to 2), |
There was a problem hiding this comment.
@mikhail-yevstratiev resolve the comment
🔗 Related Links
⬅️ As Is
Explain the current situation of the code
Android SDK uses outdated size recommendation API requests
➡️ To Be
☑️ Checklist
Log.detc are removedproduction