예제 #1
0
        public void SendCreateShipmentTest_GermanyAddress_TwoShipmentLabels()
        {
            try
            {
                var client = new RoyalMailApiClient(_credentials);

                var label = new PPLabel
                {
                    OrderId          = Guid.NewGuid().ToString(),
                    Printer          = "Zebra",
                    IntegrationCode1 = "I",          // <!-- RoyalMail Api serviceType -->
                    IntegrationCode2 = "MP1",        // <!-- RoyalMail Api serviceOffering -->
                    IntegrationCode3 = "E",          // <!-- RoyalMail Api serviceFormat -->
                    IntegrationCode4 = false,        // <!-- RoyalMail Api signature -->
                    ShippingDate     = DateTime.Now.ToString("yyyy-MM-dd"),
                    OrderReference   = "1028172222", // <!-- RoyalMail Api senderReference -->

                    Address = new PPLabelAddress
                    {
                        ContactName     = "Name Surname", // <!-- RoyalMail Api complementaryName -->
                        AddLine1        = "Nauwieserstrasse 17",
                        Town            = "SAARBRUECKEN",
                        County          = "",
                        Postcode        = "66111",
                        CountryCodeIso2 = "DE",
                        Email           = "*****@*****.**",
                        Phone           = "07512222222",
                    },

                    Items = new PPLabelItem[]
                    {
                        new PPLabelItem {
                            Weight = 111, Price = 100
                        },
                        new PPLabelItem {
                            Weight = 111, Price = 100
                        },
                    }
                };
                client.CreateShipment(label);
            }
            catch (Exception ex)
            {
                _log.Error("Test has failed", ex);
                throw;
            }
        }
예제 #2
0
        public void SendCreateShipmentTest_LocalAddress()
        {
            try
            {
                var client = new RoyalMailApiClient(_credentials);

                var label = new PPLabel
                {
                    OrderId          = Guid.NewGuid().ToString(),
                    Printer          = "Zebra",
                    IntegrationCode1 = "D",          // <!-- RoyalMail Api serviceType -->
                    IntegrationCode2 = "SD1",        // <!-- RoyalMail Api serviceOffering -->
                    IntegrationCode3 = "P",          // <!-- RoyalMail Api serviceFormat -->
                    IntegrationCode4 = false,        // <!-- RoyalMail Api signature -->
                    ShippingDate     = DateTime.Now.ToString("yyyy-MM-dd"),
                    OrderReference   = "1028172222", // <!-- RoyalMail Api senderReference -->

                    Address = new PPLabelAddress
                    {
                        ContactName     = "Name Surname", // <!-- RoyalMail Api complementaryName -->
                        AddLine1        = "10 Cherry Tree Grove",
                        AddLine2        = "Derbyshire",
                        Town            = "Chesterfield",
                        County          = "",
                        Postcode        = "S42 5QT",
                        CountryCodeIso2 = "GB",
                        Email           = "*****@*****.**",
                        Phone           = "07512222222",
                    },

                    Items = new PPLabelItem[]
                    {
                        new PPLabelItem {
                            Weight = 111
                        }
                    }
                };
                client.CreateShipment(label);
            }
            catch (Exception ex)
            {
                _log.Error("Test has failed", ex);
                throw;
            }
        }