woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
278 stars 134 forks source link

Get list of packages #12284

Open atorresveiga opened 1 month ago

atorresveiga commented 1 month ago

This task is for adding network support for getting packages using the latest plugin endpoint /wcshipping/v1/packages

Here is the endpoint's documentation https://github.com/woocommerce/woocommerce-shipping/blob/trunk/docs/api/packages.md

⚠ We don't have support yet for this endpoint. We can start using the WCS&T endpoint to get the lists of packages and migrate to the new endpoint when it is ready.

This is the old endpoint /wc/v1/connect/packages/

Sample response ``` { "data": { "success": true, "storeOptions": { "currency_symbol": "$", "dimension_unit": "cm", "weight_unit": "kg", "origin_country": "US" }, "formSchema": { "custom": { "type": "array", "title": "Box Sizes", "description": "Items will be packed into these boxes based on item dimensions and volume. Outer dimensions will be passed to the delivery service, whereas inner dimensions will be used for packing. Items not fitting into boxes will be packed individually.", "default": [], "items": { "type": "object", "title": "Box", "required": [ "name", "inner_dimensions", "box_weight", "max_weight" ], "properties": { "name": { "type": "string", "title": "Name" }, "is_user_defined": { "type": "boolean" }, "inner_dimensions": { "type": "string", "title": "Inner Dimensions (L x W x H)", "pattern": "^(\\d+|(?:\\d*\\.\\d+)) x (\\d+|(?:\\d*\\.\\d+)) x (\\d+|(?:\\d*\\.\\d+))$" }, "outer_dimensions": { "type": "string", "title": "Outer Dimensions (L x W x H)", "pattern": "^(\\d+|(?:\\d*\\.\\d+)) x (\\d+|(?:\\d*\\.\\d+)) x (\\d+|(?:\\d*\\.\\d+))$" }, "box_weight": { "type": "number", "title": "Weight of Box (lbs)" }, "max_weight": { "type": "number", "title": "Max Weight (lbs)" }, "is_letter": { "type": "boolean", "title": "Letter" } } } }, "predefined": { "usps": { "pri_flat_boxes": { "title": "USPS Priority Mail Flat Rate Boxes", "definitions": [ { "inner_dimensions": "21.91 x 13.65 x 4.13", "outer_dimensions": "21.91 x 13.65 x 4.13", "box_weight": 0, "is_flat_rate": true, "id": "small_flat_box", "name": "Small Flat Rate Box", "dimensions": "21.91 x 13.65 x 4.13", "max_weight": 31.75, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true }, { "inner_dimensions": "27.94 x 21.59 x 13.97", "outer_dimensions": "28.57 x 22.22 x 15.24", "box_weight": 0, "is_flat_rate": true, "id": "medium_flat_box_top", "name": "Medium Flat Rate Box 1, Top Loading", "dimensions": { "inner": "27.94 x 21.59 x 13.97", "outer": "28.57 x 22.22 x 15.24" }, "max_weight": 31.75, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true }, { "inner_dimensions": "34.61 x 30.16 x 8.57", "outer_dimensions": "35.56 x 30.48 x 8.89", "box_weight": 0, "is_flat_rate": true, "id": "medium_flat_box_side", "name": "Medium Flat Rate Box 2, Side Loading", "dimensions": { "inner": "34.61 x 30.16 x 8.57", "outer": "35.56 x 30.48 x 8.89" }, "max_weight": 31.75, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true }, { "inner_dimensions": "30.48 x 30.48 x 13.97", "outer_dimensions": "31.11 x 31.11 x 15.24", "box_weight": 0, "is_flat_rate": true, "id": "large_flat_box", "name": "Large Flat Rate Box", "dimensions": { "inner": "30.48 x 30.48 x 13.97", "outer": "31.11 x 31.11 x 15.24" }, "max_weight": 31.75, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true }, { "inner_dimensions": "19.21 x 13.81 x 1.59", "outer_dimensions": "19.21 x 13.81 x 1.59", "box_weight": 0, "is_flat_rate": true, "id": "dvd_flat", "name": "DVD Flat Rate (International Only)", "dimensions": "19.21 x 13.81 x 1.59", "max_weight": 1.81, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true }, { "inner_dimensions": "23.49 x 15.87 x 5.08", "outer_dimensions": "23.49 x 15.87 x 5.08", "box_weight": 0, "is_flat_rate": true, "id": "large_video_flat", "name": "1096L - Large Video Flat Rate (International Only)", "dimensions": "23.49 x 15.87 x 5.08", "max_weight": 1.81, "is_letter": false, "group_id": "pri_flat_boxes", "can_ship_international": true } ] }, "pri_envelopes": { "title": "USPS Priority Mail Flat Rate Envelopes", "definitions": [ { "inner_dimensions": "31.75 x 24.13 x 1.27", "outer_dimensions": "31.75 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "flat_envelope", "name": "Flat Rate Envelope", "dimensions": [ "31.75 x 24.13 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_envelopes", "can_ship_international": true }, { "inner_dimensions": "38.1 x 24.13 x 1.27", "outer_dimensions": "38.1 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "legal_flat_envelope", "name": "Legal Flat Rate Envelope", "dimensions": [ "38.1 x 24.13 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_envelopes", "can_ship_international": true }, { "inner_dimensions": "31.75 x 24.13 x 1.27", "outer_dimensions": "31.75 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "padded_flat_envelope", "name": "Padded Flat Rate Envelope", "dimensions": [ "31.75 x 24.13 x 1.27", "31.75 x 19.05 x 3.81", "31.75 x 13.97 x 6.35", "31.75 x 8.89 x 8.89" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_envelopes", "can_ship_international": true }, { "inner_dimensions": "31.75 x 24.13 x 1.27", "outer_dimensions": "31.75 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "window_flat_envelope", "name": "Window Flat Rate Envelope (12.5\" x 9.5\")", "dimensions": [ "31.75 x 24.13 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_envelopes", "can_ship_international": true }, { "inner_dimensions": "25.4 x 15.24 x 1.27", "outer_dimensions": "25.4 x 15.24 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "small_flat_envelope", "name": "Small Flat Rate Envelope", "dimensions": [ "25.4 x 15.24 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_envelopes", "can_ship_international": true } ] }, "pri_boxes": { "title": "USPS Priority Mail Boxes", "definitions": [ { "inner_dimensions": "95.72 x 15.56 x 12.86", "outer_dimensions": "95.72 x 15.56 x 12.86", "box_weight": 0, "is_flat_rate": false, "id": "medium_tube", "name": "Priority Mail Medium Tube", "dimensions": "95.72 x 15.56 x 12.86", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "63.5 x 15.24 x 14.92", "outer_dimensions": "63.5 x 15.24 x 14.92", "box_weight": 0, "is_flat_rate": false, "id": "small_tube", "name": "Priority Mail Small Tube", "dimensions": "63.5 x 15.24 x 14.92", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "19.05 x 13.02 x 36.51", "outer_dimensions": "19.05 x 13.02 x 36.51", "box_weight": 0, "is_flat_rate": false, "id": "shoe_box", "name": "Priority Mail Shoe Box", "dimensions": "19.05 x 13.02 x 36.51", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "17.78 x 17.78 x 15.24", "outer_dimensions": "17.78 x 17.78 x 15.24", "box_weight": 0, "is_flat_rate": false, "id": "priority_4", "name": "Priority Mail Box - 4", "dimensions": "17.78 x 17.78 x 15.24", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "30.48 x 30.48 x 20.32", "outer_dimensions": "30.48 x 30.48 x 20.32", "box_weight": 0, "is_flat_rate": false, "id": "priority_7", "name": "Priority Mail Box - 7", "dimensions": "30.48 x 30.48 x 20.32", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "38.73 x 31.43 x 7.62", "outer_dimensions": "39.69 x 31.59 x 7.94", "box_weight": 0, "is_flat_rate": false, "id": "priority_1095", "name": "Priority Mail Box - 1095", "dimensions": { "inner": "38.73 x 31.43 x 7.62", "outer": "39.69 x 31.59 x 7.94" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "23.49 x 15.87 x 5.08", "outer_dimensions": "24.29 x 16.35 x 5.56", "box_weight": 0, "is_flat_rate": false, "id": "priority_1096L", "name": "Priority Mail Box - 1096L", "dimensions": { "inner": "23.49 x 15.87 x 5.08", "outer": "24.29 x 16.35 x 5.56" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "29.21 x 33.34 x 6.03", "outer_dimensions": "29.53 x 34.13 x 6.35", "box_weight": 0, "is_flat_rate": false, "id": "priority_1097", "name": "Priority Mail Box - 1097", "dimensions": { "inner": "29.21 x 33.34 x 6.03", "outer": "29.53 x 34.13 x 6.35" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "19.21 x 13.81 x 1.59", "outer_dimensions": "19.21 x 13.81 x 1.59", "box_weight": 0, "is_flat_rate": false, "id": "priority_dvd", "name": "Priority Mail DVD Box", "dimensions": "19.21 x 13.81 x 1.59", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true }, { "inner_dimensions": "29.53 x 38.42 x 1.27", "outer_dimensions": "29.53 x 38.42 x 1.27", "box_weight": 0, "is_flat_rate": false, "id": "priority_tyvek_envelope", "name": "Priority Mail Tyvek Envelope", "dimensions": "29.53 x 38.42 x 1.27", "max_weight": 31.75, "is_letter": true, "service_group_ids": [ "priority", "priority_international" ], "group_id": "pri_boxes", "can_ship_international": true } ] }, "pri_express_envelopes": { "title": "USPS Priority Mail Express Flat Rate Envelopes", "definitions": [ { "inner_dimensions": "31.75 x 24.13 x 1.27", "outer_dimensions": "31.75 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "express_flat_envelope", "name": "Flat Rate Envelope", "dimensions": [ "31.75 x 24.13 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_express_envelopes", "can_ship_international": true }, { "inner_dimensions": "38.1 x 24.13 x 1.27", "outer_dimensions": "38.1 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "express_legal_flat_envelope", "name": "Legal Flat Rate Envelope", "dimensions": [ "38.1 x 24.13 x 1.27" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_express_envelopes", "can_ship_international": true }, { "inner_dimensions": "31.75 x 24.13 x 1.27", "outer_dimensions": "31.75 x 24.13 x 1.27", "box_weight": 0, "is_flat_rate": true, "id": "express_padded_flat_envelope", "name": "Padded Flat Rate Envelope", "dimensions": [ "31.75 x 24.13 x 1.27", "31.75 x 19.05 x 3.81", "31.75 x 13.97 x 6.35", "31.75 x 8.89 x 8.89" ], "max_weight": 31.75, "is_letter": true, "group_id": "pri_express_envelopes", "can_ship_international": true } ] }, "pri_express_boxes": { "title": "USPS Priority Mail Express Boxes", "definitions": [ { "inner_dimensions": "38.73 x 31.43 x 7.62", "outer_dimensions": "39.69 x 31.59 x 7.94", "box_weight": 0, "is_flat_rate": false, "id": "express_box", "name": "Priority Mail Express Box", "dimensions": { "inner": "38.73 x 31.43 x 7.62", "outer": "39.69 x 31.59 x 7.94" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "27.94 x 21.59 x 13.97", "outer_dimensions": "28.57 x 22.22 x 15.24", "box_weight": 0, "is_flat_rate": false, "id": "express_box_1", "name": "Priority Mail Express Box 1", "dimensions": { "inner": "27.94 x 21.59 x 13.97", "outer": "28.57 x 22.22 x 15.24" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "30.16 x 8.57 x 34.61", "outer_dimensions": "30.48 x 8.89 x 35.56", "box_weight": 0, "is_flat_rate": false, "id": "express_box_2", "name": "Priority Mail Express Box 2", "dimensions": { "inner": "30.16 x 8.57 x 34.61", "outer": "30.48 x 8.89 x 35.56" }, "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "95.72 x 15.56 x 12.86", "outer_dimensions": "95.72 x 15.56 x 12.86", "box_weight": 0, "is_flat_rate": false, "id": "express_medium_tube", "name": "Priority Mail Express Medium Tube", "dimensions": "95.72 x 15.56 x 12.86", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "63.5 x 15.24 x 14.92", "outer_dimensions": "63.5 x 15.24 x 14.92", "box_weight": 0, "is_flat_rate": false, "id": "express_small_tube", "name": "Priority Mail Express Small Tube", "dimensions": "63.5 x 15.24 x 14.92", "max_weight": 31.75, "is_letter": false, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "29.53 x 38.42 x 1.27", "outer_dimensions": "29.53 x 38.42 x 1.27", "box_weight": 0, "is_flat_rate": false, "id": "express_tyvek_envelope", "name": "Priority Mail Express Tyvek Envelope", "dimensions": "29.53 x 38.42 x 1.27", "max_weight": 31.75, "is_letter": true, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true }, { "inner_dimensions": "14.92 x 25.4 x 1.27", "outer_dimensions": "14.92 x 25.4 x 1.27", "box_weight": 0, "is_flat_rate": false, "id": "express_window_envelope", "name": "Priority Mail Express Window Envelope", "dimensions": "14.92 x 25.4 x 1.27", "max_weight": 31.75, "is_letter": true, "service_group_ids": [ "priority_exp", "priority_express_international" ], "group_id": "pri_express_boxes", "can_ship_international": true } ] } }, "dhlexpress": { "domestic_and_international": { "title": "DHL Express", "definitions": [ { "inner_dimensions": "24.89 x 30.48 x 2.54", "outer_dimensions": "24.89 x 30.48 x 2.54", "box_weight": 0, "is_flat_rate": false, "id": "SmallPaddedPouch", "name": "Small Padded Pouch", "dimensions": "24.89 x 30.48 x 2.54", "max_weight": 45.36, "is_letter": true, "group_id": "domestic_and_international", "can_ship_international": true }, { "inner_dimensions": "30.22 x 35.56 x 2.54", "outer_dimensions": "30.22 x 35.56 x 2.54", "box_weight": 0, "is_flat_rate": false, "id": "LargePaddedPouch", "name": "Large Padded Pouch", "dimensions": "30.22 x 35.56 x 2.54", "max_weight": 45.36, "is_letter": true, "group_id": "domestic_and_international", "can_ship_international": true }, { "inner_dimensions": "25.65 x 14.73 x 14.99", "outer_dimensions": "25.65 x 14.73 x 14.99", "box_weight": 0, "is_flat_rate": false, "id": "Box2Cube", "name": "Box #2 Cube", "dimensions": "25.65 x 14.73 x 14.99", "max_weight": 45.36, "is_letter": false, "group_id": "domestic_and_international", "can_ship_international": true }, { "inner_dimensions": "31.75 x 28.19 x 3.81", "outer_dimensions": "31.75 x 28.19 x 3.81", "box_weight": 0, "is_flat_rate": false, "id": "Box2Small", "name": "Box #2 Small", "dimensions": "31.75 x 28.19 x 3.81", "max_weight": 45.36, "is_letter": false, "group_id": "domestic_and_international", "can_ship_international": true }, { "inner_dimensions": "33.53 x 32 x 5.08", "outer_dimensions": "33.53 x 32 x 5.08", "box_weight": 0, "is_flat_rate": false, "id": "Box2Medium", "name": "Box #2 Medium", "dimensions": "33.53 x 32 x 5.08", "max_weight": 45.36, "is_letter": false, "group_id": "domestic_and_international", "can_ship_international": true }, { "inner_dimensions": "44.45 x 31.75 x 7.62", "outer_dimensions": "44.45 x 31.75 x 7.62", "box_weight": 0, "is_flat_rate": false, "id": "Box3Large", "name": "Box #3 Large", "dimensions": "44.45 x 31.75 x 7.62", "max_weight": 45.36, "is_letter": false, "group_id": "domestic_and_international", "can_ship_international": true } ] } } } }, "formData": { "custom": [ { "name": "testing ", "is_letter": false, "inner_dimensions": "12.0 x 12.0 x 12.0", "box_weight": 0.1, "is_user_defined": true, "max_weight": 0 } ], "predefined": [] } } } ```
dangermattic commented 1 month ago

Thanks for reporting! 👍