Skip to content

Commit

Permalink
Merge pull request #3093 from wordpress-mobile/issue/12528-new-dimens…
Browse files Browse the repository at this point in the history
…ions-field

New dimensions field
  • Loading branch information
atorresveiga authored Sep 11, 2024
2 parents 884fbb8 + 30450ea commit a6a3b2f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ class WCShippingLabelStoreTest {
val expectedResult = WCPackagesResult(
listOf(
CustomPackage("Krabica", false, "1 x 2 x 3", 1f),
CustomPackage("Obalka", true, "2 x 3 x 4", 5f)
CustomPackage("Obalka", true, "2 x 3 x 4", 5f),
CustomPackage("Flat Box", true, "5 x 6 x 4", 1f),
CustomPackage("Weird Box", false, "0 x 0 x 0", 0f)
),
listOf(
PredefinedOption("USPS Priority Mail Flat Rate Boxes",
Expand Down
18 changes: 17 additions & 1 deletion example/src/test/resources/wc/shipping-labels-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,25 @@
"is_user_defined": true,
"is_letter": true,
"name": "Obalka",
"inner_dimensions": "2 x 3 x 4",
"outer_dimensions": "2 x 3 x 4",
"box_weight": 5,
"max_weight": 0
},
{
"is_user_defined": true,
"is_letter": true,
"name": "Flat Box",
"dimensions": "5 x 6 x 4",
"box_weight": 1,
"max_weight": 0
},
{
"is_user_defined": true,
"is_letter": false,
"name": "Weird Box",
"weird_dimensions": "2 x 3 x 4",
"box_weight": 0,
"max_weight": 0
}
],
"predefined": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ class ShippingLabelRestClient @Inject constructor(private val wooNetwork: WooNet
val name: String,
@SerializedName("inner_dimensions") val innerDimensions: String?,
@SerializedName("outer_dimensions") val outerDimensions: String?,
@SerializedName("dimensions") val dimensions: String?,
@SerializedName("box_weight") val boxWeight: Float?,
@SerializedName("max_weight") val maxWeight: Float?,
@SerializedName("is_user_defined") val isUserDefined: Boolean?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class WCShippingLabelStore @Inject constructor(
CustomPackage(
title = it.name,
isLetter = it.isLetter,
dimensions = it.outerDimensions ?: it.innerDimensions ?: "",
dimensions = it.dimensions ?: it.outerDimensions ?: it.innerDimensions ?: "0 x 0 x 0",
boxWeight = it.boxWeight ?: 0f
)
}
Expand Down

0 comments on commit a6a3b2f

Please sign in to comment.