public void testValidRetrieve() { Parcel testObject = ParcelTest.getDefaultObject(); Parcel retrievedObject; retrievedObject = apiResource.RetrieveParcel((string)testObject.ObjectId); Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId); }
public static Manifest getDefaultObject() { Hashtable parameters0 = new Hashtable(); Address addressFrom = AddressTest.getDefaultObject(); Address addressTo = AddressTest.getDefaultObject_2(); Parcel parcel = ParcelTest.getDefaultObject(); parameters0.Add("address_from", addressFrom.ObjectId); parameters0.Add("address_to", addressTo.ObjectId); parameters0.Add("parcels", new String[] { parcel.ObjectId }); parameters0.Add("shipment_date", now); parameters0.Add("insurance_amount", "30"); parameters0.Add("insurance_currency", "USD"); parameters0.Add("extra", "{signature_confirmation: true}"); parameters0.Add("customs_declaration", ""); parameters0.Add("metadata", "Customer ID 123456"); parameters0.Add("async", false); Shipment shipment = getAPIResource().CreateShipment(parameters0); Hashtable parameters1 = new Hashtable(); parameters1.Add("id", shipment.ObjectId); parameters1.Add("currency_code", "USD"); ShippoCollection <Rate> rateCollection = getAPIResource().GetShippingRatesSync(parameters1); List <Rate> rateList = rateCollection.Data; Rate[] rateArray = rateList.ToArray(); parameters1.Add("rate", rateArray [0].ObjectId); parameters1.Add("metadata", "Customer ID 123456"); Transaction transaction = getAPIResource().CreateTransactionSync(parameters1); Hashtable parameters2 = new Hashtable(); parameters2.Add("provider", "USPS"); parameters2.Add("shipment_date", now); parameters2.Add("address_from", addressFrom.ObjectId); List <String> transactions = new List <String>(); transactions.Add(transaction.ObjectId); parameters2.Add("transactions", transactions); return(getAPIResource().CreateManifest(parameters2)); }
public static Shipment getDefaultObject() { Hashtable parameters = new Hashtable(); Address addressFrom = AddressTest.getDefaultObject(); Address addressTo = AddressTest.getDefaultObject_2(); Parcel parcel = ParcelTest.getDefaultObject(); parameters.Add("address_from", addressFrom.ObjectId); parameters.Add("address_to", addressTo.ObjectId); parameters.Add("parcels", new String[] { parcel.ObjectId }); parameters.Add("shipment_date", now); parameters.Add("insurance_amount", "30"); parameters.Add("insurance_currency", "USD"); parameters.Add("extra", "{signature_confirmation: true}"); parameters.Add("customs_declaration", ""); parameters.Add("metadata", "Customer ID 123456"); parameters.Add("async", false); return(getAPIResource().CreateShipment(parameters)); }
public static Shipment getDefaultObject() { Hashtable parameters = new Hashtable(); Address addressFrom = AddressTest.getDefaultObject(); Address addressTo = AddressTest.getDefaultObject(); Parcel parcel = ParcelTest.getDefaultObject(); parameters.Add("object_purpose", "QUOTE"); parameters.Add("address_from", addressFrom.ObjectId); parameters.Add("address_to", addressTo.ObjectId); parameters.Add("parcel", parcel.ObjectId); parameters.Add("submission_type", "PICKUP"); parameters.Add("submission_date", "2013-12-03T12:00:00.000Z"); parameters.Add("insurance_amount", "30"); parameters.Add("insurance_currency", "USD"); parameters.Add("extra", "{signature_confirmation: true}"); parameters.Add("customs_declaration", ""); parameters.Add("reference_1", ""); parameters.Add("reference_2", ""); parameters.Add("metadata", "Customer ID 123456"); return(getAPIResource().CreateShipment(parameters)); }
public void TestValidCreate() { Parcel testObject = ParcelTest.getDefaultObject(); Assert.AreEqual("VALID", testObject.ObjectState); }