Example #1
0
        public static Order getDefaultObject()
        {
            Address   addressFrom = AddressTest.getDefaultObject();
            Address   addressTo   = AddressTest.getDefaultObject_2();
            Hashtable items       = new Hashtable();

            items.Add("total_amount", "10.45");
            items.Add("weight_unit", "kg");
            items.Add("title", "package");
            List <Hashtable> lineItems = new List <Hashtable>();

            lineItems.Add(items);

            Hashtable parameters = new Hashtable();

            parameters.Add("total_tax", "0.00");
            parameters.Add("from_address", addressFrom.ObjectId);
            parameters.Add("to_address", addressTo.ObjectId);
            parameters.Add("line_items", lineItems);
            parameters.Add("shipping_method", null);
            parameters.Add("weight", 0);
            parameters.Add("shop_app", "Shippo");
            parameters.Add("currency", "USD");
            parameters.Add("shipping_cost_currency", "USD");
            parameters.Add("shipping_cost", null);
            parameters.Add("subtotal_price", "0");
            parameters.Add("total_price", "0");
            parameters.Add("order_status", "PAID");
            parameters.Add("hidden", false);
            parameters.Add("order_number", "LOREM #1");
            parameters.Add("weight_unit", "kg");
            parameters.Add("placed_at", "2020-11-12T23:59:59");

            return(getAPIResource().CreateOrder(parameters));
        }
        public static CustomsDeclaration getDefaultObject_2()
        {
            CustomsItem customsItem     = CustomsItemTest.getDefaultObject();
            Address     addressImporter = AddressTest.getDefaultObject();
            Hashtable   parameters      = new Hashtable();

            parameters.Add("exporter_reference", "");
            parameters.Add("importer_reference", "");
            parameters.Add("contents_type", "MERCHANDISE");
            parameters.Add("contents_explanation", "T-Shirt purchase");
            parameters.Add("invoice", "#123123");
            parameters.Add("license", "");
            parameters.Add("certificate", "");
            parameters.Add("notes", "");
            parameters.Add("eel_pfc", "NOEEI_30_37_a");
            parameters.Add("aes_itn", "");
            parameters.Add("non_delivery_option", "ABANDON");
            parameters.Add("certify", true);
            parameters.Add("certify_signer", "Laura Behrens Wu");
            parameters.Add("address_importer", addressImporter.ObjectId);
            parameters.Add("incoterm", "");
            parameters.Add("metadata", "Order ID #123123");
            parameters.Add("b13a_filing_option", "FILED_ELECTRONICALLY");
            parameters.Add("b13a_number", "AA9999202008311");

            JArray customsItems = new JArray();

            customsItems.Add((string)customsItem.ObjectId);

            parameters.Add("items", customsItems);
            return(getAPIResource().CreateCustomsDeclaration(parameters));
        }
Example #3
0
        public static async Task <Shipment> GetDefaultObject()
        {
            Address addressFrom = await AddressTest.GetDefaultObject();

            Address addressTo = await AddressTest.GetDefaultObject2();

            Parcel parcel = await ParcelTest.GetDefaultObject();

            var parameters = new CreateShipment
            {
                AddressFrom  = addressFrom.ObjectId,
                AddressTo    = addressTo.ObjectId,
                Async        = false,
                Metadata     = "Customer ID 123456",
                ShipmentDate = DateTime.Now
            };

            parameters.AddParcel(parcel.ObjectId);
            parameters.CustomsDeclaration = "";
            parameters.Extra = new ShipmentExtra
            {
                Insurance = new ShipmentExtraInsurance
                {
                    Amount   = 30,
                    Currency = "USD"
                },
                SignatureConfirmation = ShippoEnums.SignatureConfirmations.STANDARD
            };

            return(await GetShippoClient().CreateShipment(parameters));
        }
        public void testValidRetrieve()
        {
            Address testObject = AddressTest.getDefaultObject();
            Address retrievedObject;

            retrievedObject = apiResource.RetrieveAddress((string)testObject.ObjectId);
            Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId);
        }
Example #5
0
        public static Manifest getDefaultObject()
        {
            Hashtable parameters = new Hashtable();

            parameters.Add("provider", "USPS");
            parameters.Add("submission_date", "2014-05-16T23:59:59Z");
            parameters.Add("address_from", AddressTest.getDefaultObject().ObjectId);

            return(getAPIResource().CreateManifest(parameters));
        }
        public async Task TestValidRetrieve()
        {
            Manifest testObject = await ManifestTest.GetDefaultObject(await AddressTest.GetDefaultObject2());

            Manifest retrievedObject;

            retrievedObject = await shippoClient.RetrieveManifest(testObject.ObjectId);

            Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId);
        }
        public async Task TestValidRetrieve()
        {
            Address testObject = await AddressTest.GetDefaultObject();

            Address retrievedObject;

            retrievedObject = await shippoClient.RetrieveAddress(testObject.ObjectId);

            Assert.AreEqual(testObject.ObjectId, retrievedObject.ObjectId);
        }
        public static async Task <Manifest> GetDefaultObject(BaseAddress addressTo)
        {
            var     parameters0 = new CreateShipment();
            Address addressFrom = await AddressTest.GetDefaultObject();

            Parcel parcel = await ParcelTest.GetDefaultObject();

            parameters0.AddressFrom = addressFrom.ObjectId;
            parameters0.AddressTo   = addressTo;
            parameters0.AddParcel(parcel.ObjectId);
            parameters0.ShipmentDate       = DateTime.Now;
            parameters0.CustomsDeclaration = "";
            parameters0.Extra = new ShipmentExtra
            {
                Insurance = new ShipmentExtraInsurance
                {
                    Amount   = 30,
                    Currency = "USD"
                },
                SignatureConfirmation = ShippoEnums.SignatureConfirmations.STANDARD
            };
            parameters0.Metadata = "Customer ID 123456";
            parameters0.Async    = false;

            Shipment shipment = await GetShippoClient().CreateShipment(parameters0);

            ShippoCollection <Rate> rateCollection = await GetShippoClient().GetShippingRatesSync(shipment.ObjectId, "USD");

            List <Rate> rateList = rateCollection.Data;

            Rate[] rateArray = rateList.ToArray();

            var createTransaction = new CreateTransaction
            {
                Rate     = rateArray[0].ObjectId,
                Metadata = "Customer ID 123456"
            };

            Transaction transaction = await GetShippoClient().CreateTransactionSync(createTransaction);

            var parameters2 = new CreateManifest
            {
                ShipmentDate        = DateTime.Now,
                AddressFromObjectId = addressFrom.ObjectId,
                Provider            = "usps"
            };

            var transactions = new List <string>();

            transactions.Add(transaction.ObjectId);
            parameters2.TransactionsIds = transactions.ToArray();

            return(await GetShippoClient().CreateManifest(parameters2));
        }
        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));
        }
Example #11
0
        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()
        {
            Address testObject = AddressTest.getDefaultObject();

            Assert.AreEqual(true, testObject.IsComplete);
        }
        public void TestValidCreate()
        {
            Address testObject = AddressTest.getDefaultObject();

            Assert.AreEqual("VALID", testObject.ObjectState);
        }
        public async Task TestValidCreate()
        {
            Address testObject = await AddressTest.GetDefaultObject();

            Assert.AreEqual(true, testObject.IsComplete);
        }