/// <summary> /// Create a CustomsInfo. /// </summary> /// <param name="customsInfo">Customs info to create</param> /// <returns>EasyPost.CustomsInfo instance.</returns> public async Task <CustomsInfo> CreateCustomsInfo( CustomsInfo customsInfo) { var request = new EasyPostRequest("customs_infos", Method.POST); request.AddBody(customsInfo.AsDictionary(), "customs_info"); return(await Execute <CustomsInfo>(request)); }
private Shipment createShipmentResource() { Address to = Address.Create(toAddress); Address from = Address.Create(fromAddress); Parcel parcel = Parcel.Create(new Dictionary<string, object>() { {"length", 8}, {"width", 6}, {"height", 5}, {"weight", 10} }); CustomsItem item = new CustomsItem() { description = "description" }; CustomsInfo info = new CustomsInfo() { customs_certify = "TRUE", eel_pfc = "NOEEI 30.37(a)", customs_items = new List<CustomsItem>() { item } }; return new Shipment() { to_address = to, from_address = from, parcel = parcel, customs_info = info }; }
public void TestCarrierAccounts() { Address to = Address.Create(toAddress); Address from = Address.Create(fromAddress); Parcel parcel = Parcel.Create(new Dictionary<string, object>() { {"length", 8}, {"width", 6}, {"height", 5}, {"weight", 10} }); CustomsItem item = new CustomsItem() { description = "description" }; CustomsInfo info = new CustomsInfo() { customs_certify = "TRUE", eel_pfc = "NOEEI 30.37(a)", customs_items = new List<CustomsItem>() { item } }; Shipment shipment = new Shipment(); shipment.to_address = to; shipment.from_address = from; shipment.parcel = parcel; shipment.carrier_accounts = new List<CarrierAccount> { new CarrierAccount { id = "ca_qn6QC6fd" } }; shipment.Create(); if (shipment.rates.Count > 0) Assert.IsTrue(shipment.rates.TrueForAll(r => r.carrier_account_id == "ca_qn6QC6fd")); }
/// <summary> /// Creates a new CustomsInfo /// </summary> /// <param name="model">The CustomsInfo to be created on the server</param> /// <returns>A fully populated CustomsInfo, included the new Id</returns> /// <seealso cref="http://www.easypost.com/docs#customs"/> public CustomsInfo CreateCustomsInfo(CustomsInfo model) { return(Execute <CustomsInfo>(model, EasyPostUrls.CUSTOM_INFOS)); }