Exemplo n.º 1
0
        public GetShippingDetailsResponse Execute()
        {
            NVPCodec encoder = new NVPCodec();

            encoder["METHOD"] = METHOD;
            encoder["TOKEN"] = this.Token;

            var decoder = executorService.Execute(encoder);

            string strAck = decoder["ACK"].ToLower();
            if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
            {
                var address = new Address()
                {
                    Name = decoder["SHIPTONAME"],
                    AddressLineOne = decoder["SHIPTOSTREET"],
                    AddressLineTwo = decoder["SHIPTOSTREET2"],
                    Town = decoder["SHIPTOCITY"],
                    County = decoder["SHIPTOSTATE"],
                    PostCode = decoder["SHIPTOZIP"],
                    Country = decoder["SHIPTOCOUNTRYNAME"],
                    CountryCode = decoder["SHIPTOCOUNTRYCODE"]
                };

                var customer = new Customer() {
                    FirstName = decoder["FIRSTNAME"],
                    LastName = decoder["LASTNAME"],
                    Email = decoder["EMAIL"],
                    ContactAddress = address,
                    ExternalReference = decoder["PAYERID"],
                    CustomerType = "PayPal",
                    DateCreated = DateTime.Now
                };

                customer.Addresses = new List<Address>();
                customer.Addresses.Add(address);

                return new GetShippingDetailsResponse()
                {
                    ShippingAddress = address,
                    Customer = customer
                };
            }
            else
            {

                throw new PayPalExeception(decoder["L_ERRORCODE0"], decoder["L_SHORTMESSAGE0"], decoder["L_LONGMESSAGE0"]);
            }
        }
Exemplo n.º 2
0
 public IEnumerable<ShippingMethod> GetShippingMethods(Address address, decimal weight, int width, int height, int depth)
 {
     return dbContext.ShippingMethods.ToList();
 }