Fehler beim Akzeptieren einer Freundschaftsanfrage

var saleDetails = { saleEnd: '', cartSummary: { item_count: 0, items_subtotal_price: 0, original_total_price: 0, requires_shipping: false, total_discount: 0, total_price: 0, }, cartMessage:"[#%] discount applied for our Fall Sale", cartDiscount_code: '', fixedDiscount: '', locale: 'de', offer: { you_save: "Sie sparen", buy: "Kaufen Sie", off: "Rabatt"}, items: [ { sku : "w10k-bundle", id: 47493278040409, price: 19999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "123plus", valueOff: "money-off", spendAmount: "", discountValue: "40, 110, 110", disclaimer: "", hideSticker: false, sticker: null, stickerBi: null, addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "w10p-bundle", id: 47493274730841, price: 18999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "123plus", valueOff: "money-off", spendAmount: "", discountValue: "40, 105, 105", disclaimer: "", hideSticker: false, sticker: null, stickerBi: null, addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "704", id: 47522379628889, price: 32999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "123plus", valueOff: "money-off", spendAmount: "", discountValue: "40, 180, 180", disclaimer: "", hideSticker: false, sticker: null, stickerBi: null, addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "419", id: 47342215266649, price: 19999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" },{ sku : "428", id: 47342215233881, price: 19999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" },{ sku : "427", id: 47342215299417, price: 19999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "426", id: 47342076100953, price: 18999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "123plus", valueOff: "percent-off", spendAmount: "", discountValue: "0, 0.5, 0.3333", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/BOGO.png?v=1711013121", stickerBi: null, addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "704", id: 39556026761302, price: 32999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "430", id: 47442399789401, price: 19999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "409", id: 39473230905430, price: 31999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" }, { sku : "315", id: 40016903503958, price: 15999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" },{ sku : "316", id: 40016903536726, price: 15999, saleCopy: "", saleCopyBi: "", copyColor: "", blockBg: "", bannerBlockBgColor: false, discountType: "fixed", valueOff: "percent-off", spendAmount: "", discountValue: "0.15", disclaimer: "", hideSticker: false, sticker: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-de_b708b631-0087-44c6-9b7d-421040f297c0.png?v=1711013121", stickerBi: "\/\/www.nixplay.de\/cdn\/shop\/files\/15off-fr_ca82e4c4-24c3-4793-9de2-354cfe6a491a.png?v=1711013121", addDiscountCopy: "", addDiscountCopyBi: "" }, ] }; window.saleDetails = saleDetails; var saleFunctions = { getPrice: function (line, qtt) { var price = line.price; var quantity = qtt || 1 var valueOff = line.valueOff var values = String(line.discountValue).split(','); var totalPrice = 0 var unitPrice = 0 var difference = 0 switch (line.discountType) { case 'fixed': var discount_value = Number(values[0]); unitPrice = (valueOff === 'percent-off') ? price * (1 - discount_value) : price - (discount_value * 100); unitPrice = (Math.floor(unitPrice/100)+ 0.99)*100 finalPrice = unitPrice * quantity; difference = price - unitPrice break; case '3plus': break; case '123plus': var discount_value; if(quantity == 1) { discount_value = Number(values[0]); } else if (quantity == 2) { discount_value = Number(values[1]); } else { discount_value = Number(values[2]); } unitPrice = (valueOff === 'percent-off') ? price * (1 - discount_value) : price - ((discount_value*100) / quantity); unitPrice = (valueOff === 'percent-off') ? (Math.floor(unitPrice/100)+ 0.99)*100 : unitPrice finalPrice = unitPrice * quantity; difference = price - unitPrice break; case '1235plus': break; case '12plus': var discount_value; if(quantity == 1) { discount_value = Number(values[0]); } else { discount_value = Number(values[1]); } unitPrice = (valueOff === 'percent-off') ? price * (1 - discount_value) : price - (discount_value * 100); unitPrice = (Math.floor(unitPrice/100)+ 0.99)*100 finalPrice = unitPrice * quantity; difference = price - unitPrice break; case 'spend': var cartTriggers = String(line.spendAmount).split(','); var lastPositiveIndex = -1; cartTriggers.forEach((trigger, index) => { var triggerValue = Number(trigger) var cartValue = (Number(window.saleDetails.cartSummary.original_total_price || 0) + Number(price))/ 100 if(cartValue > triggerValue) { lastPositiveIndex = index } }); discount_value = lastPositiveIndex > -1 ? Number(values[lastPositiveIndex] || 0) : 0; unitPrice = (valueOff === 'percent-off') ? price * (1 - discount_value) : price - (discount_value * 100); finalPrice = unitPrice * quantity; difference = price - unitPrice break; case 'bogox': break; case 'bogo': break; default: console.log(`Sorry, we are out of`); } return { finalPrice: finalPrice, unitPrice: unitPrice, difference: difference } }, updateCartSummary: function(cart) { window.saleDetails.cartSummary = { item_count: cart.item_count, items_subtotal_price: cart.items_subtotal_price, original_total_price: cart.original_total_price, requires_shipping: cart.requires_shipping, total_discount: cart.total_discount, total_price: cart.total_price, } } } window.saleFunctions = saleFunctions;