public ActionResult ShippingItemDestroy([DataSourceRequest] DataSourceRequest request, ShippingItem vendor)
        {
            BL.ShippingItems blShippingItems = new BL.ShippingItems();
            ShippingItem     model           = blShippingItems.SoftDelete(vendor);

            return(Json(new[] { model }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet));
        }
        /// <inheritdoc />
        /// <summary>
        /// Create a shipping item A shipping item represents a shipping option and cost. SKUs have to be unique in the entire store. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; SHIPPING_ADMIN
        /// </summary>
        /// <param name="cascade">Whether to cascade group changes, such as in the limited gettable behavior. A 400 error will return otherwise if the group is already in use with different values.</param>
        /// <param name="shippingItem">The shipping item object</param>
        public void CreateShippingItem(bool?cascade, ShippingItem shippingItem)
        {
            mWebCallEvent.WebPath = "/store/shipping";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (cascade != null)
            {
                mWebCallEvent.QueryParams["cascade"] = KnetikClient.ParameterToString(cascade);
            }

            mWebCallEvent.PostBody = KnetikClient.Serialize(shippingItem); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mCreateShippingItemStartTime = DateTime.Now;
            mWebCallEvent.Context        = mCreateShippingItemResponseContext;
            mWebCallEvent.RequestType    = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mCreateShippingItemStartTime, "CreateShippingItem", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        public ActionResult ShippingItemCreate([DataSourceRequest] DataSourceRequest request, ShippingItem shippingitem)
        {
            BL.ShippingItems blShippingItems = new BL.ShippingItems();
            ShippingItem     model           = blShippingItems.Insert(shippingitem);

            return(Json(new[] { model }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet));
        }
        public void it_gets_checkout_snippet(
            List <CartItem> cartItems,
            ShippingItem shippingItem)
        {
            var sut   = new CheckoutClient(TestConfig.OrderBaseUri, TestConfig.MerchantId, TestConfig.SharedSecret);
            var items = new List <ICartItem>();

            items.AddRange(cartItems);
            items.Add(shippingItem);

            var testUrl = "http://www.mysite.com";

            var checkoutUris = new CheckoutUris(
                new Uri(testUrl), new Uri(testUrl), new Uri(testUrl), new Uri(testUrl));

            var response = sut.Checkout(items, Locale.Norway, checkoutUris);

            response.Snippet.Should().NotBeNullOrWhiteSpace();
            response.Location.AbsoluteUri.Should().StartWith(TestConfig.OrderBaseUri.ToString());
        }
        /// <inheritdoc />
        /// <summary>
        /// Update a shipping item &lt;b&gt;Permissions Needed:&lt;/b&gt; SHIPPING_ADMIN
        /// </summary>
        /// <param name="id">The id of the shipping item</param>
        /// <param name="cascade">Whether to cascade group changes, such as in the limited gettable behavior. A 400 error will return otherwise if the group is already in use with different values.</param>
        /// <param name="shippingItem">The shipping item object</param>
        public void UpdateShippingItem(int?id, bool?cascade, ShippingItem shippingItem)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateShippingItem");
            }

            mWebCallEvent.WebPath = "/store/shipping/{id}";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            if (cascade != null)
            {
                mWebCallEvent.QueryParams["cascade"] = KnetikClient.ParameterToString(cascade);
            }

            mWebCallEvent.PostBody = KnetikClient.Serialize(shippingItem); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mUpdateShippingItemStartTime = DateTime.Now;
            mWebCallEvent.Context        = mUpdateShippingItemResponseContext;
            mWebCallEvent.RequestType    = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mUpdateShippingItemStartTime, "UpdateShippingItem", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
示例#6
0
        public IActionResult Cost(int length, int height, int width, int weight)
        {
            ShippingItem newShippingItem = new ShippingItem(length, width, height, weight);

            return(View(newShippingItem));
        }
示例#7
0
 public OrderConfirmationData()
 {
     SelectedShippingItem = new ShippingItem();
     SelectedPaymentItem  = new PaymentItem();
 }
示例#8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Acessando a API, Aguarde um  momento...");
            Console.WriteLine("");

            Acquirer acquirer = new Acquirer("INFORMAR O TOKEN");

            //Preenchendo os dados principais
            TransactionRequest request = new TransactionRequest
            {
                SellerCEP            = "74063010",
                RecipientCEP         = "71691024",
                ShipmentInvoiceValue = 200.00f,
                RecipientCountry     = "BR",
                ShippingServiceCode  = null,
                Coupom = null
            };

            //Preenchendo os dados dos itens
            ShippingItem item = new ShippingItem
            {
                Weight    = 5.00f,
                Length    = 50.00f,
                Height    = 50.00f,
                Width     = 50.00f,
                Diameter  = 50.00f,
                SKU       = null,
                Category  = null,
                Quantity  = 1.00f,
                isFragile = false
            };

            request.ShippingItemArray.Add(item);

            ShippingItem item2 = new ShippingItem
            {
                Weight    = 5.00f,
                Length    = 50.00f,
                Height    = 50.00f,
                Width     = 50.00f,
                Diameter  = 50.00f,
                SKU       = null,
                Category  = null,
                Quantity  = 1.00f,
                isFragile = false
            };

            request.ShippingItemArray.Add(item2);

            var acquirerTask = acquirer.ReturnShippingAsync(request);

            acquirerTask.ContinueWith(tarefa =>
            {
                foreach (var u in tarefa.Result)
                {
                    Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}",
                                      u.ServiceCode,
                                      u.ServiceDescription,
                                      u.Carrier,
                                      u.ShippingPrice,
                                      u.DeliveryTime,
                                      u.Msg,
                                      u.Error,
                                      u.OriginalDeliveryTime,
                                      u.OriginalShippingPrice,
                                      u.ResponseTime
                                      );
                }
            },
                                      TaskContinuationOptions.OnlyOnRanToCompletion
                                      );

            Console.ReadLine();
        }
        private Control GetTableRadioButton(ShippingItem shippingListItem)
        {
            var tr = new HtmlTableRow();
            var td = new HtmlTableCell();

            if (divScripts.Visible == false)
            {
                divScripts.Visible = shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint;
            }

            var radioButton = new RadioButton
            {
                GroupName = "ShippingRateGroup",
                ID        = PefiksId + shippingListItem.Id, //+ "|" + shippingListItem.Rate
                CssClass  = "radio-shipping"
            };

            if (String.IsNullOrEmpty(_selectedID.Value.Replace(PefiksId, string.Empty)))
            {
                _selectedID.Value = radioButton.ID;
            }

            radioButton.Checked = radioButton.ID == _selectedID.Value;

            string strShippingPrice = shippingListItem.Rate != 0 ? CatalogService.GetStringPrice(shippingListItem.Rate, Currency.Value, Currency.Iso3) : shippingListItem.ZeroPriceMessage;

            radioButton.Text = string.Format("{0} <span class='price'>{1}</span>",
                                             shippingListItem.MethodNameRate, strShippingPrice);

            //if (shippingListItem.Ext != null && shippingListItem.Ext.Type == ExtendedType.Pickpoint)
            //{
            //    string temp;
            //    if (shippingListItem.Ext.Pickpointmap.IsNotEmpty())
            //        temp = string.Format(",{{city:'{0}', ids:null}}", shippingListItem.Ext.Pickpointmap);
            //    else
            //        temp = string.Empty;
            //    radioButton.Text +=
            //        string.Format(
            //            "<br/><div id=\"address\">{0}</div><a href=\"#\" onclick=\"PickPoint.open(SetPickPointAnswerAdmin{1});return false\">" +
            //            "{2}</a><input type=\"hidden\" name=\"pickpoint_id\" id=\"pickpoint_id\" value=\"\" /><br />",
            //            pickAddress.Value, temp, Resources.Resource.Client_OrderConfirmation_Select);
            //}

            radioButton.Text += ShippingMethodService.RenderExtend(shippingListItem, 0, pickAddress.Value, false);

            var panel = new Panel {
                CssClass = "inline-b"
            };

            using (var img = new Image {
                ImageUrl = SettingsGeneral.AbsoluteUrl + "/" + ShippingIcons.GetShippingIcon(shippingListItem.Type, shippingListItem.IconName, shippingListItem.MethodNameRate)
            })
            {
                panel.Controls.Add(img);
                td.Controls.Add(panel);
            }

            var panel2 = new Panel {
                CssClass = "inline-b"
            };

            panel2.Controls.Add(radioButton);

            td.Controls.Add(panel2);
            tr.Controls.Add(td);

            return(tr);
        }
示例#10
0
        /// <summary>
        /// Changes a shippingitem record of the specified shippingitem ID to be inactive
        /// </summary>
        /// <param name="shippingorderID">The integer ID of the shippingitem to make inactive </param>
        public ShippingItem SoftDeleteByID(int shippingorderID)
        {
            ShippingItem shippingitem = SelectByID(shippingorderID);

            return(SoftDelete(shippingitem));
        }
示例#11
0
 /// <summary>
 /// Changes the shippingitem status to not active
 /// </summary>
 /// <param name="shippingitem">The shippingitem record that is to be made inactive</param>
 public ShippingItem SoftDelete(ShippingItem shippingitem)
 {
     //shippingitem.IsActive = false;
     return(repository.Update <ShippingItem>(shippingitem));
 }
示例#12
0
 /// <summary>
 /// Inserts the shippingitem record into the database
 /// </summary>
 /// <param name="shippingitem">The new ShippingItem record that is to be inserted into the database.</param>
 /// <returns>The inserted ShippingItem record (complete with new ShippingItemID)</returns>
 public ShippingItem Insert(ShippingItem shippingitem)
 {
     return(repository.Insert <ShippingItem>(shippingitem));
 }
示例#13
0
 /// <summary>
 /// Updates the shippingitem record with applied changes
 /// </summary>
 /// <param name="shippingitem">The shippingitem record with the shippingorderID populated that is to be updated.</param>
 /// <returns>The shippingitem record back, unaltered.</returns>
 public ShippingItem Update(ShippingItem shippingitem)
 {
     return(repository.Update <ShippingItem>(shippingitem));
 }