Beispiel #1
0
        public string SubmitExpressOrder(PayPalTransaction paypaltransaction)
        {
            CK1 clint   = new CK1();
            var request = new ExpressCompleteOrderRequest()
            {
                UserKey    = CK1Config.getUserKey(),
                Token      = CK1Config.getToken(),
                ActionType = EnumActionType.Submit,
                OrderSign  = paypaltransaction.OrderSign,
            };
            ExpressCompleteOrderResponse response = clint.ExpressCompleteOrder(request);

            return(response.Message);
        }
Beispiel #2
0
        public string DeleteExpressOrder(PaymentTransactionType paymenttransaction)
        {
            CK1 clint   = new CK1();
            var request = new ExpressCompleteOrderRequest()
            {
                UserKey    = CK1Config.getUserKey(),
                Token      = CK1Config.getToken(),
                ActionType = EnumActionType.Cancel,
                OrderSign  = paymenttransaction.OrderSign,
            };
            ExpressCompleteOrderResponse response = clint.ExpressCompleteOrder(request);

            return(response.Message);
        }
Beispiel #3
0
        public ShipOrder AddOutboundOrder(DispatchRequest dispatchrequest, PayPalTransaction paypaltransaction)
        {
            #region 生成包裹

            var product = new List <ExpressProduct>();

            foreach (var item in paypaltransaction.PayPalTransactionPaymentItems)
            {
                product.Add(new ExpressProduct
                {
                    CustomsTitleCN = "怀表",
                    CustomsTitleEN = "POCKET WATCH",
                    Quantity       = Convert.ToInt32(item.PaymentItemQuantity),
                    SKU            = item.Association.Product.Sku,
                    Weight         = item.Association.Product.Weight,
                    DeclareValue   = dispatchrequest.goodsDeclareWorth / paypaltransaction.PayPalTransactionPaymentItems.Count
                });
            }


            var packageList = new List <ExpressPackage>();
            packageList.Add(new ExpressPackage
            {
                Custom        = dispatchrequest.Custom,
                ShipToAddress = new ShipToAddress
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                    Province = dispatchrequest.ShipToState,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                },
                Packing = new Evisou.Ims.Contract.chukou1.Packing
                {
                    Height = dispatchrequest.Height,
                    Length = dispatchrequest.Length,
                    Width  = dispatchrequest.Width,
                },
                Remark      = "备注信息",
                Status      = OrderExpressState.Initial,
                TrackCode   = "",
                Weight      = dispatchrequest.goodsWeight,
                ProductList = product.ToArray(),
            });

            var orderDetail = new ExpressOrder
            {
                IsTracking  = false,
                Location    = "GZ",
                Remark      = "测试订单",
                PackageList = packageList.ToArray(),
            };

            #endregion

            ShipOrder order   = new ShipOrder();
            var       clint   = new CK1();
            var       request = new ExpressAddOrderNewRequest
            {
                UserKey        = CK1Config.getUserKey(),
                Token          = CK1Config.getToken(),
                Submit         = false,
                OrderDetail    = orderDetail,
                ExpressTypeNew = dispatchrequest.Express,
            };

            ExpressAddOrderResponse response = clint.ExpressAddOrderNew(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Beispiel #4
0
        public ShipOrder AddOutboundOrder(DispatchRequest dispatchrequest, PaymentTransactionType paymenttransaction)
        {
            ShipOrder order = new ShipOrder();
            CK1       clint = new CK1();

            #region 生成包裹

            var productList = new List <OutStoreProduct>();

            foreach (var item in paymenttransaction.PaymentItemInfo.PaymentItem)
            {
                productList.Add(new OutStoreProduct()
                {
                    SKU      = item.Association.Product.Sku,
                    Quantity = Convert.ToInt32(item.Quantity),
                });
            }

            var packageList = new List <OutStorePackage>();
            packageList.Add(new OutStorePackageNew()
            {
                ProductList   = productList.ToArray(),
                ShipToAddress = new ShipToAddress()
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                    Province = dispatchrequest.ShipToState,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                },
                Shipping     = OutStoreShipping.None,
                ShippingV2_1 = ConvertOutStoreShippingV2_1(dispatchrequest.Express.ToUpper())
            });


            #endregion 生成包裹

            var request = new OutStoreAddOrderRequest()
            {
                UserKey     = CK1Config.getUserKey(),
                Token       = CK1Config.getToken(),
                Submit      = false,
                OrderDetail = new OutStoreOrder()
                {
                    State       = OrderOutState.Initial,
                    PackageList = packageList.ToArray(),
                },
            };

            switch (dispatchrequest.Warehouse.ToUpper())
            {
            case "US":
                request.OrderDetail.Warehouse = EnumWarehouse.US;
                break;

            case "AU":
                request.OrderDetail.Warehouse = EnumWarehouse.AU;
                break;

            case "UK":
                request.OrderDetail.Warehouse = EnumWarehouse.UK;
                break;

            case "NJ":
                request.OrderDetail.Warehouse = EnumWarehouse.NJ;
                break;

            case "DE":
                request.OrderDetail.Warehouse = EnumWarehouse.DE;
                break;
            }

            request.Submit = false;
            var response = clint.OutStoreAddOrder(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }