var api = api || {}; api = { metadata: [{"Method":"GET","Url":"appapi/{company}/{store}/Cart/{customer}","ControllerName":"appapi","ActionName":"Get","Parameters":[]},{"Method":"PATCH","Url":"appapi/{company}/{store}/Cart/{customer}","ControllerName":"appapi","ActionName":"UpdateCart","Parameters":[{"Name":"updateOrdermarking","IsUriParameter":false}]},{"Method":"POST","Url":"appapi/{company}/{store}/Cart/{customer}/row","ControllerName":"appapi","ActionName":"Post","Parameters":[{"Name":"row","IsUriParameter":false}]},{"Method":"PATCH","Url":"appapi/{company}/{store}/Cart/{customer}/row","ControllerName":"appapi","ActionName":"UpdateRow","Parameters":[{"Name":"row","IsUriParameter":false}]},{"Method":"DELETE","Url":"appapi/{company}/{store}/Cart/{customer}/row/{itemNo}","ControllerName":"appapi","ActionName":"DeleteRow","Parameters":[]},{"Method":"POST","Url":"appapi/{company}/{store}/Cart/{customer}/start","ControllerName":"appapi","ActionName":"StartCart","Parameters":[]},{"Method":"POST","Url":"appapi/{company}/{store}/Cart/{customer}/end","ControllerName":"appapi","ActionName":"EndCart","Parameters":[]},{"Method":"GET","Url":"appapi/{company}/OrderHistory/{customer}","ControllerName":"appapi","ActionName":"Get","Parameters":[{"Name":"pagesize","IsUriParameter":true},{"Name":"page","IsUriParameter":true}]},{"Method":"GET","Url":"appapi/{company}/OrderHistory/{customer}/{orderid}/details","ControllerName":"appapi","ActionName":"GetDetails","Parameters":[]},{"Method":"GET","Url":"appapi/{company}/{store}/Product/{customer}/{id}","ControllerName":"appapi","ActionName":"Get","Parameters":[]},{"Method":"GET","Url":"appapi/Settings/company","ControllerName":"appapi","ActionName":"Get","Parameters":[]},{"Method":"GET","Url":"appapi/{company}/Store","ControllerName":"appapi","ActionName":"Get","Parameters":[]},{"Method":"GET","Url":"appapi/{company}/Account","ControllerName":"appapi","ActionName":"Get","Parameters":[]},{"Method":"GET","Url":"appapi/{company}/Account/customer/{customer}","ControllerName":"appapi","ActionName":"GetCustomer","Parameters":[]},{"Method":"GET","Url":"appapi/mobileauth","ControllerName":null,"ActionName":"Get","Parameters":[]},{"Method":"POST","Url":"appapi/mobileauth/refresh","ControllerName":null,"ActionName":"Post","Parameters":[{"Name":"refreshToken","IsUriParameter":false}]},{"Method":"POST","Url":"api/BackInStockNotification/GetCurrentNotifications","ControllerName":"BackInStockNotification","ActionName":"GetCurrentNotifications","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/BackInStockNotification/CreateNotifications","ControllerName":"BackInStockNotification","ActionName":"CreateNotifications","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/BackInStockNotification/RemoveNotification","ControllerName":"BackInStockNotification","ActionName":"RemoveNotification","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/GetPriceAndCurrencyForCheckout","ControllerName":"Cart","ActionName":"GetPriceAndCurrencyForCheckout","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/LockCart","ControllerName":"Cart","ActionName":"LockCart","Parameters":[]},{"Method":"POST","Url":"api/Cart/LoadCart","ControllerName":"Cart","ActionName":"LoadCart","Parameters":[]},{"Method":"POST","Url":"api/Cart/GetCartRowProduct","ControllerName":"Cart","ActionName":"GetCartRowProduct","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/GetNumberOfRows","ControllerName":"Cart","ActionName":"GetNumberOfRows","Parameters":[]},{"Method":"POST","Url":"api/Cart/GetTotalCartSum","ControllerName":"Cart","ActionName":"GetTotalCartSum","Parameters":[]},{"Method":"POST","Url":"api/Cart/AddToCart","ControllerName":"Cart","ActionName":"AddToCart","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/RemoveFromCart","ControllerName":"Cart","ActionName":"RemoveFromCart","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/RemoveCart","ControllerName":"Cart","ActionName":"RemoveCart","Parameters":[]},{"Method":"POST","Url":"api/Cart/UpdateCart","ControllerName":"Cart","ActionName":"UpdateCart","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Cart/IsProductsInStock","ControllerName":"Cart","ActionName":"IsProductsInStock","Parameters":[]},{"Method":"POST","Url":"api/Cart","ControllerName":"Cart","ActionName":"AddHistoryOrderToCart","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Compare/Properties","ControllerName":"Compare","ActionName":"GetProductsProperties","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Customer/GetAuth","ControllerName":"Customer","ActionName":"GetAuth","Parameters":[]},{"Method":"POST","Url":"api/Customer/RequestElectronicInvoice","ControllerName":"Customer","ActionName":"RequestElectronicInvoice","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Customer/GetTransportTermDescription","ControllerName":"Customer","ActionName":"GetTransportTermDescription","Parameters":[]},{"Method":"POST","Url":"api/Customer/GetCustomerData","ControllerName":"Customer","ActionName":"GetCustomerData","Parameters":[]},{"Method":"POST","Url":"api/Customer/GetCustomerUsers","ControllerName":"Customer","ActionName":"GetCustomerUsers","Parameters":[]},{"Method":"POST","Url":"api/Customer/GetCustomerInfo","ControllerName":"Customer","ActionName":"GetCustomerInfo","Parameters":[]},{"Method":"POST","Url":"api/Customer/IsRegisteredCustomer","ControllerName":"Customer","ActionName":"IsRegisteredCustomer","Parameters":[]},{"Method":"POST","Url":"api/Customer/SavePendingCustomer","ControllerName":"Customer","ActionName":"SendNewPendingCustomerRequest","Parameters":[]},{"Method":"POST","Url":"api/Customer/RequestNewUser","ControllerName":"Customer","ActionName":"RequestNewUser","Parameters":[]},{"Method":null,"Url":"api/Customer","ControllerName":"Customer","ActionName":"SendNewUserRequest","Parameters":[]},{"Method":"POST","Url":"api/CustomMarketing/GetCustomMarketing","ControllerName":"CustomMarketing","ActionName":"GetCustomMarketing","Parameters":[]},{"Method":"POST","Url":"api/DeliverySettings/GetUserReference","ControllerName":"DeliverySettings","ActionName":"GetUserReference","Parameters":[]},{"Method":"POST","Url":"api/DeliverySettings/LoadDeliverySettings","ControllerName":"DeliverySettings","ActionName":"LoadDeliverySettings","Parameters":[]},{"Method":"POST","Url":"api/DeliverySettings/GetDefaultDeliverySetting","ControllerName":"DeliverySettings","ActionName":"GetCurrentDeliverySetting","Parameters":[]},{"Method":"POST","Url":"api/DeliverySettings/GetDeliverySetting","ControllerName":"DeliverySettings","ActionName":"GetDeliverySetting","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/DeliverySettings/SaveOrderDetailsToDeliverySetting","ControllerName":"DeliverySettings","ActionName":"SaveOrderDetailsToDeliverySetting","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/DeliverySettings/SaveDeliverySetting","ControllerName":"DeliverySettings","ActionName":"SaveDeliverySetting","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/DeliverySettings/SetDeliverySettingForOrder","ControllerName":"DeliverySettings","ActionName":"SetDeliverySettingForOrder","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/DeliverySettings/DeleteDeliverySetting","ControllerName":"DeliverySettings","ActionName":"DeleteDeliverySetting","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"GET","Url":"api/Language","ControllerName":"Language","ActionName":"Get","Parameters":[{"Name":"Company","IsUriParameter":true}]},{"Method":null,"Url":"api/Language","ControllerName":"Language","ActionName":"GetLang","Parameters":[]},{"Method":"POST","Url":"api/Navigation/GetSectors","ControllerName":"Navigation","ActionName":"GetSectors","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetSectorName","ControllerName":"Navigation","ActionName":"GetSectorName","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetFamilyName","ControllerName":"Navigation","ActionName":"GetFamilyName","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetGroupName","ControllerName":"Navigation","ActionName":"GetGroupName","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetBreadcrumb","ControllerName":"Navigation","ActionName":"GetBreadcrumb","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetPages","ControllerName":"Navigation","ActionName":"GetPages","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Navigation/GetFooterLinks","ControllerName":"Navigation","ActionName":"GetFooterLinks","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/OrderHistory/Orderhistory","ControllerName":"OrderHistory","ActionName":"GetOrderHistory","Parameters":[]},{"Method":"POST","Url":"api/OrderHistory/Orderhistorydetails","ControllerName":"OrderHistory","ActionName":"GetOrderHistoryDetails","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/OrderHistory/OrderOrderConfimation","ControllerName":"OrderHistory","ActionName":"OrderOrderConfirmation","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/OrderHistory/OrderInvoiceCopy","ControllerName":"OrderHistory","ActionName":"OrderInvoiceCopy","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/OrderHistory/GetTop10","ControllerName":"OrderHistory","ActionName":"GetTop10","Parameters":[]},{"Method":"POST","Url":"api/OrderSummary/GetSummary","ControllerName":"OrderSummary","ActionName":"GetSummary","Parameters":[]},{"Method":"POST","Url":"api/Payment","ControllerName":"Payment","ActionName":"Init","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Payment/Complete","ControllerName":"Payment","ActionName":"Complete","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Payment/PaymentProviderCallback","ControllerName":"Payment","ActionName":"PaymentProviderCallback","Parameters":[]},{"Method":"POST","Url":"api/Payment/AbortPayment","ControllerName":"Payment","ActionName":"AbortPayment","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":null,"Url":"api/Payment","ControllerName":"Payment","ActionName":"GetPaymentStatus","Parameters":[]},{"Method":null,"Url":"api/Payment","ControllerName":"Payment","ActionName":"GetOrderWeightVolume","Parameters":[]},{"Method":null,"Url":"api/Payment","ControllerName":"Payment","ActionName":"CreateInitPaymentCarts","Parameters":[]},{"Method":"POST","Url":"api/PaymentTerm/GetPaymentTerms","ControllerName":"PaymentTerm","ActionName":"GetPaymentTerms","Parameters":[]},{"Method":"POST","Url":"api/Product/SendFaq","ControllerName":"Product","ActionName":"SendFaq","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/GetDisp","ControllerName":"Product","ActionName":"GetDisp","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/GetLeadTime","ControllerName":"Product","ActionName":"GetLeadTime","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/ItemBalanceStores","ControllerName":"Product","ActionName":"GetItemBalanceStores","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/AddQuickToCart","ControllerName":"Product","ActionName":"AddQuickToCart","Parameters":[]},{"Method":null,"Url":"api/Product","ControllerName":"Product","ActionName":"GetExistingQuickProductsFromCache","Parameters":[]},{"Method":null,"Url":"api/Product","ControllerName":"Product","ActionName":"GetAll","Parameters":[]},{"Method":null,"Url":"api/Product","ControllerName":"Product","ActionName":"GetQuickOrderKey","Parameters":[]},{"Method":null,"Url":"api/Product","ControllerName":"Product","ActionName":"ClearQuickOrderCache","Parameters":[]},{"Method":"POST","Url":"api/Product/GetQuickProducts","ControllerName":"Product","ActionName":"ParseQuickOrdeProducts","Parameters":[{"Name":"text","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/News","ControllerName":"Product","ActionName":"GetNews","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/Campaign","ControllerName":"Product","ActionName":"GetCampaign","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/GetFormattedPrice","ControllerName":"Product","ActionName":"GetFormattedPrice","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/Short","ControllerName":"Product","ActionName":"GetProductInfoShort","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/View","ControllerName":"Product","ActionName":"GetView","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Product/Pdf","ControllerName":"Product","ActionName":"GetPdfDocument","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Search/Suggest","ControllerName":"Search","ActionName":"Suggest","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Search/SuggestResult","ControllerName":"Search","ActionName":"SuggestResult","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Search/GetSearchResults","ControllerName":"Search","ActionName":"GetSearchResults","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Serie/Serie","ControllerName":"Serie","ActionName":"GetSerie","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/SplitOrder/GetBackorderItems","ControllerName":"SplitOrder","ActionName":"GetBackorderItems","Parameters":[]},{"Method":"POST","Url":"api/SplitOrder/HasDiscontinuedItemsWithMaxExceeded","ControllerName":"SplitOrder","ActionName":"HasDiscontinuedItemsWithMaxExceeded","Parameters":[]},{"Method":"POST","Url":"api/StartpageModules/GetModules","ControllerName":"StartpageModules","ActionName":"GetModules","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Store/GetPickupLocations","ControllerName":"Store","ActionName":"GetPickupLocations","Parameters":[]},{"Method":"POST","Url":"api/Store/GetStore","ControllerName":"Store","ActionName":"GetStore","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Store/GetStores","ControllerName":"Store","ActionName":"GetStores","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Store/GetCompanyMainOffice","ControllerName":"Store","ActionName":"GetCompanyMainOffice","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/User/IsAuthenticated","ControllerName":"User","ActionName":"IsAuthenticated","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/User/GetUserEmail","ControllerName":"User","ActionName":"GetUserEmail","Parameters":[]},{"Method":"POST","Url":"api/User/SaveUserData","ControllerName":"User","ActionName":"SaveUserData","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/User/ChangePassword","ControllerName":"User","ActionName":"ChangePassword","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/User/GetUserData","ControllerName":"User","ActionName":"GetUserData","Parameters":[]},{"Method":"POST","Url":"api/User/ResetPassword","ControllerName":"User","ActionName":"ResetPassword","Parameters":[{"Name":"request","IsUriParameter":false}]},{"Method":"POST","Url":"api/Webnews/Webnews","ControllerName":"Webnews","ActionName":"GetWebnews","Parameters":[{"Name":"request","IsUriParameter":false}]}] }; $.each(api.metadata, function(i, action) { if (!api[action.ControllerName]) { api[action.ControllerName] = {}; } api[action.ControllerName][action.ActionName] = function(parameters, successCallback, _component,headers,cache) { var url = '/' + action.Url; var data; $.each(action.Parameters, function(j, parameter) { if (parameters[parameter.Name] === undefined) { console.log('Missing parameter: ' + parameter.Name + ' for API: ' + action.ControllerName + '/' + action.ActionName); } else if (parameter.IsUriParameter) { url = url + (url.indexOf("?") === -1 ? "?" : "&") + parameter.Name + "=" + parameters[parameter.Name]; } else if (data === undefined) { data = parameters[parameter.Name]; } else { console.log('Detected multiple body-parameters for API: ' + action.ControllerName + '/' + action.ActionName); } }); if (data != null && data != "") data = JSON.stringify(data); return $.ajax({ type: action.Method, url: url, data: data, contentType: 'application/json', cache: cache === true ? true : false, headers: headers, processData: false, success: function(data, textStatus, xhr) { if (!successCallback) return; successCallback(data, _component); }, error: function(xhr, textStatus, errorThrown) { console.error(errorThrown); if(window.errorHandler){ window.errorHandler(xhr, textStatus, errorThrown); } } }); }; });