Your IP : 3.133.150.11


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/public/hobbyclick/bitrix/js/sale/barcode/src/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/public/hobbyclick/bitrix/js/sale/barcode/src/checker.js

/**
 * Check if barcode exist
 */
export default class Checker
{
	/**
	 * @param {string} barcode
	 * @param {integer} basketId
	 * @param {integer} orderId
	 * @param {integer} storeId
	 * @returns {Promise<T>}
	 */
	static isBarcodeExist(barcode, basketId, orderId, storeId)
	{
		return BX.ajax.runAction('sale.barcode.isBarcodeExist', {
			data: {
				barcode: barcode,
				basketId: basketId,
				orderId: orderId,
				storeId: storeId
			}
		})
		.then(
			// Success
			(response) => {
				if(response.data
					&& typeof response.data.RESULT !== 'undefined'
				)
				{
					return response.data.RESULT;
				}

				throw new Error('Result is unknown');
			}
		);
	}
}