Skip to content

Commit e2ba250

Browse files
committed
Encode customs form details in package to be purchased
1 parent 601c268 commit e2ba250

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Modules/Sources/Networking/Model/ShippingLabel/Packages/WooShippingPackagePurchase.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,17 @@ extension WooShippingPackagePurchase: Encodable {
106106
try container.encode(productIDs, forKey: .products)
107107

108108
if let hazmat = package.hazmatCategory {
109-
try container.encode(package.hazmatCategory, forKey: .hazmat)
109+
try container.encode(hazmat, forKey: .hazmat)
110+
}
111+
112+
if let form = package.customsForm {
113+
try container.encode(form.contentsType.rawValue, forKey: .contentsType)
114+
try container.encode(form.contentExplanation, forKey: .contentsExplanation)
115+
try container.encode(form.restrictionType.rawValue, forKey: .restrictionType)
116+
try container.encode(form.restrictionComments, forKey: .restrictionComments)
117+
try container.encode(form.nonDeliveryOption.rawValue, forKey: .nonDeliveryOption)
118+
try container.encode(form.itn, forKey: .itn)
119+
try container.encode(form.items, forKey: .items)
110120
}
111121

112122
if selectedRate.signatureRate != nil {
@@ -195,6 +205,13 @@ extension WooShippingPackagePurchase: Encodable {
195205
case saturdayDelivery = "saturday_delivery"
196206
case additionalHandling = "additional_handling"
197207
case hazmat
208+
case contentsType = "contents_type"
209+
case contentsExplanation = "contents_explanation"
210+
case restrictionType = "restriction_type"
211+
case restrictionComments = "restriction_comments"
212+
case nonDeliveryOption = "non_delivery_option"
213+
case itn
214+
case items
198215
}
199216

200217
private enum ParameterKeys {

0 commit comments

Comments
 (0)