diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/com.extend.extendproductprotection/src/Archive.zip b/com.extend.extendproductprotection/src/Archive.zip new file mode 100644 index 0000000..14bb4ff Binary files /dev/null and b/com.extend.extendproductprotection/src/Archive.zip differ diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_offer_modal_controller.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_offer_modal_controller.js deleted file mode 100644 index eedda50..0000000 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_offer_modal_controller.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - *@name: EXTEND SUITESCRIPT SDK - Sales Order Trigger Offer Controller - *@description: - * Plan presentation suitelet controller - * - *@copyright Aimpoint Technology Services, LLC - *@author Michael Draper - * - *@NApiVersion 2.x - *@NScriptType ClientScript - *@NModuleScope Public -*/ -define(['N/url', - '../lib/customscript_ext_util' -], - function (url, EXTEND_UTIL) { - var exports = {}; - exports.fieldChanged = function (context) { - - console.log('Event Handler', context); - const objEventRouter = { - 'custpage_select': _handleSelectInput, - 'custpage_item_select': _handleItemInput - } - console.log('objEventRouter', objEventRouter); - - if (typeof objEventRouter[context.fieldId] !== 'function') { - return; - } - try { - objEventRouter[context.fieldId](context); - } catch (e) { } - return true; - - }; - exports.saveRecord = function (context) { - var objCurrentRec = context.currentRecord; - const planCount = objCurrentRec.getLineCount({ sublistId: 'custpage_plans' }); - var stItemId = ''; - // Get line information from selected line - for (var i = 0; i < planCount; i++) { - - var isSelected = objCurrentRec.getSublistValue({ - sublistId: 'custpage_plans', - fieldId: 'custpage_select', - line: i - }); - - if (isSelected) { - stItemId = objCurrentRec.getSublistValue({ - sublistId: 'custpage_plans', - fieldId: 'custpage_item_id', - line: i - }); - break; - } - } - if (!stItemId) { - alert('You have not selected a plan. Please select a plan before submitting.'); - return false; - } - else { - return true; - } - }; - function _handleSelectInput(context) { - - var objCurrentRec = context.currentRecord; - var stLineIndex = objCurrentRec.getCurrentSublistIndex({ sublistId: 'custpage_plans' }); - var stLineCount = objCurrentRec.getLineCount({ sublistId: 'custpage_plans' }); - var bTrue = objCurrentRec.getCurrentSublistValue({ sublistId: 'custpage_plans', fieldId: 'custpage_select' }); - - if (bTrue == true) { - for (var i = 0; i < stLineCount; i++) { - if (i == stLineIndex) continue; - objCurrentRec.selectLine({ sublistId: 'custpage_plans', line: i }); - objCurrentRec.setCurrentSublistValue({ sublistId: 'custpage_plans', fieldId: 'custpage_select', value: false }); - objCurrentRec.commitLine({ sublistId: 'custpage_plans' }); - } - } - - return true; - } - function _handleItemInput(context) { - //update sublist on item field change - var objCurrentRec = context.currentRecord; - var stItemId = objCurrentRec.getValue({ fieldId: 'custpage_item_select' }); - console.log('stItemId', stItemId); - var stItemName = objCurrentRec.getText({ fieldId: 'custpage_item_select' }); - var stItemList = objCurrentRec.getValue({ fieldId: 'custpage_item_list' }); - var stItemQty; - var stLineNum; - var stItemRefId; - - if (!EXTEND_UTIL.objectIsEmpty(stItemId)) { - var arrItemList = JSON.parse(stItemList); - //var stItemQty = arrItemList.find(x => x.id === stItemId).quantity; - var objItem = _searchArray(stItemId, 'id', arrItemList); - stItemQty = objItem.qty; - stLineNum = objItem.line; - stItemRefId = objItem.refId; - } - - var URL = url.resolveScript({ - scriptId: 'customscript_ext_offer_presentation_sl', - deploymentId: 'customdeploy_ext_offer_presentation_sl', - params: { - 'itemid': stItemId, - 'itemtext': stItemName, - 'arrItemid': stItemList, - 'line': stLineNum, - 'quantity': stItemQty, - 'refid': stItemRefId - } - }); - - //avoid the standard NetSuite warning message when navigating away - if (window.onbeforeunload) { - window.onbeforeunload = function () { null; }; - }; - //refresh window - window.open(URL, '_self', false); - return true; - } - function _searchArray(nameKey, prop, myArray) { - for (var i = 0; i < myArray.length; i++) { - if (myArray[i][prop] === nameKey) { - return myArray[i]; - } - } - } - exports.handleClose = function () { - window.close(); - } - - return exports; - }); \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_so_offer_controller_cs.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_so_offer_controller_cs.js deleted file mode 100644 index e2b5fb3..0000000 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_so_offer_controller_cs.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - *@name: EXTEND SUITESCRIPT SDK - Offer Modal Controller - *@description: - * Client script that supoorts button on Sales Order. The script - * checks if the items are protection plan items and calls a popup suitelet - * for the user to select the appropriate protection plan. - * - *@copyright Extend, Inc. - *@author Michael Draper - * - *@NApiVersion 2.0 - *@NScriptType ClientScript - *@NModuleScope Public -*/ -define([ - 'N/url', - 'N/runtime', - 'N/search', - 'N/currentRecord', - '../lib/customscript_ext_util', - '../lib/customscript_ext_config_lib' -], - function (url, runtime, search, currentRecord, EXTEND_UTIL, EXTEND_CONFIG) { - var exports = {}; - exports.pageInit = function () { - - }; - exports.validateLine = function (context) { - log.debug('Validating Line', context); - - var objEventRouter = { - 'item': _handleItemInput - } - - if (typeof objEventRouter[context.sublistId] !== 'function') { - return true; - } - try { - objEventRouter[context.sublistId](context); - } catch (e) { - - } - return true; - }; - function _handleItemInput(context) { - - log.debug('Handling Input', context); - log.debug('Sublist', context.currentRecord.getSublist({ sublistId: context.sublistId })); - log.debug('config', EXTEND_CONFIG.getConfig()); - var refIdValue = EXTEND_CONFIG.getConfig().refId; - - var objCurrentRecord = context.currentRecord; - - var arrItemList = []; - var stExtendItem = runtime.getCurrentScript().getParameter({ name: 'custscript_ext_protection_plan' }); - - var stItemId = objCurrentRecord.getCurrentSublistValue({ - sublistId: context.sublistId, - fieldId: 'item' - }); - if (stExtendItem == stItemId) { - return; - } - - var stItemRefId = stItemId; - var stLineNum = objCurrentRecord.getCurrentSublistIndex({ - sublistId: context.sublistId - }); - var stItemName = objCurrentRecord.getCurrentSublistText({ - sublistId: context.sublistId, - fieldId: 'item' - }); - var intQty = objCurrentRecord.getCurrentSublistValue({ - sublistId: context.sublistId, - fieldId: 'quantity' - }); - if (refIdValue) { - // Lookup to item to see if it is eligible for warranty offers - var arrItemLookup = search.lookupFields({ - type: 'item', - id: stItemId, - columns: refIdValue - }); - for (var prop in arrItemLookup) { - var stItemRefId = arrItemLookup[prop]; - break; - } - } - - - var objItem = {}; - objItem.id = stItemId; - objItem.name = stItemName; - objItem.qty = intQty; - objItem.line = stLineNum; - objItem.refId = stItemRefId; - //log.debug('objItem', objItem); - //push to array - arrItemList.push(objItem); - arrItemList = JSON.stringify(arrItemList); - log.debug('arrItemList', arrItemList); - - _callSuitelet(arrItemList, stItemId, stItemName, stLineNum, intQty, stItemRefId); - - return true; - } - - exports.openSuitelet = function (context) { - log.debug('Open Suitelet', context); - - var objCurrentRecord = currentRecord.get(); - //create item array - var arrItemList = []; - var stSublistId = 'item'; - var linecount = objCurrentRecord.getLineCount({ - sublistId: stSublistId - }); - log.debug('linecount', linecount); - log.debug('config', EXTEND_CONFIG.getConfig()); - var refIdValue = EXTEND_CONFIG.getConfig().refId; - //get extend item - var stExtendItem = runtime.getCurrentScript().getParameter({ name: 'custscript_ext_protection_plan' }); - - //loop item sublist or retrieve for single line item if validate line function - for (var i = 0; i < linecount; i++) { - var stItemId = objCurrentRecord.getSublistValue({ - sublistId: stSublistId, - fieldId: 'item', - line: i - }); - - var stItemRefId = stItemId; - var stItemName = objCurrentRecord.getSublistText({ - sublistId: stSublistId, - fieldId: 'item', - line: i - }); - var intQty = objCurrentRecord.getSublistText({ - sublistId: stSublistId, - fieldId: 'quantity', - line: i - }); - if (refIdValue) { - // Lookup to item to see if it is eligible for warranty offers - var arrItemLookup = search.lookupFields({ - type: 'item', - id: stItemId, - columns: refIdValue - }); - - for (var prop in arrItemLookup) { - var stItemRefId = arrItemLookup[prop]; - break; - } - } - - var objItem = {}; - objItem.id = stItemId; - objItem.name = stItemName; - objItem.qty = intQty; - objItem.line = i; - objItem.refId = stItemRefId; - //log.debug('objItem', objItem); - //push to array - if (stExtendItem != stItemId) { - arrItemList.push(objItem); - } - } - var stArrayItemList = JSON.stringify(arrItemList); - log.debug('stArrayItemList', stArrayItemList); - _callSuitelet(stArrayItemList, arrItemList[0].id, arrItemList[0].name, arrItemList[0].line, arrItemList[0].qty, arrItemList[0].refId); - } - - function _callSuitelet(arrItemList, stItemId, stItemName, stLineNum, stItemQty, stItemRefId) { - //Resolve suitelet URL - var slUrl = url.resolveScript({ - scriptId: 'customscript_ext_offer_presentation_sl', - deploymentId: 'customdeploy_ext_offer_presentation_sl', - params: { - 'itemid': stItemId, - 'itemtext': stItemName, - 'arrItemid': arrItemList, - 'line': stLineNum, - 'quantity': stItemQty, - 'refid': stItemRefId - } - }); - //Call the pop up suitelet - window.open(slUrl, '_blank', 'screenX=300,screenY=300,width=900,height=500,titlebar=0,status=no,menubar=no,resizable=0,scrollbars=0'); - - } - return exports; - - }); \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_api_lib.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_api_lib.js index 7b7b9e2..9dedfb5 100644 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_api_lib.js +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_api_lib.js @@ -19,13 +19,12 @@ * CREATE PRODUCTS * API Documentation: https://developers.extend.com/default#tag/Products/paths/~1stores~1{storeId}~1products/post */ - exports.createProduct = function (arrProducts, bIsBatch, bIsUpsert) { - var config = extendConfig.getConfig(); + exports.createProduct = function (arrProducts, bIsBatch, bIsUpsert, config) { + // var config = extendConfig.getConfig(); try { var response = https.post({ url: config.domain + '/stores/' + config.storeId + '/products?upsert=' + bIsUpsert + '?batch=' + bIsBatch, headers: { - Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, 'Accept': 'application/json;version=' + config.version @@ -44,14 +43,13 @@ * UPDATE PRODUCT * API Documentation: https://developers.extend.com/default#tag/Products/paths/~1stores~1{storeId}~1products~1{productId}/put */ - exports.updateProduct = function (objProductDetails, stItemId) { + exports.updateProduct = function (objProductDetails, stItemId, config) { // log.debug('Extend Product Details', objProductDetails); - var config = extendConfig.getConfig(); + // var config = extendConfig.getConfig(); try { var response = https.put({ url: config.domain + '/stores/' + config.storeId + '/products/' + stItemId, headers: { - Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, 'Accept': 'application/json;version=' + config.version @@ -70,8 +68,8 @@ * GET PRODUCT * API Documentation: https://developers.helloextend.com/2020-08-01#tag/Products/paths/~1stores~1{storeId}~1products~1{productId}/get */ - exports.getProduct = function (stItemId) { - var config = extendConfig.getConfig(); + exports.getProduct = function (stItemId, config) { + //var config = extendConfig.getConfig(); try { var response = https.get({ url: config.domain + '/stores/' + config.storeId + '/products/' + stItemId, @@ -93,8 +91,8 @@ * DELETE PRODUCT * API Documentation: https://developers.extend.com/default#tag/Products/paths/~1stores~1{storeId}~1products~1{productId}/delete */ - exports.deleteProduct = function (stItemId) { - var config = extendConfig.getConfig(); + exports.deleteProduct = function (stItemId, config) { + //var config = extendConfig.getConfig(); try { var response = https.get({ url: config.domain + '/stores/' + config.storeId + '/products/' + stItemId, @@ -118,8 +116,8 @@ * GET OFFERS * API Documentation: https://developers.extend.com/default#operation/getOffer */ - exports.getPlansByItem = function (stItemId) { - var config = extendConfig.getConfig(); + exports.getOffers= function (stItemId, config) { + // var config = extendConfig.getConfig(); try { var response = https.get({ url: config.domain + '/offers?storeId=' + config.storeId + '&productId=' + stItemId, @@ -133,30 +131,27 @@ return response; } } catch (e) { - log.debug('Error Fetcing Plans', JSON.stringify(e.message)); + log.debug('Error Calling API', JSON.stringify(e.message)); return; } }; - /*****************************************CONTRACTS*****************************************/ - + + /*****************************************LEADS*****************************************/ /** - * CREATE CONTRACT - * API Documentation: https://developers.extend.com/default#operation/createContracts + * CREATE LEAD + * API Documentation: https://developers.helloextend.com/2020-08-01#tag/Leads/paths/~1stores~1{storeId}~1leads/post */ - exports.createWarrantyContract = function (objContractDetails) { - var config = extendConfig.getConfig(); - - + exports.createLead = function (objLeadDetails, config) { + // var config = extendConfig.getConfig(); try { var response = https.post({ - url: config.domain + '/stores/' + config.storeId + '/contracts', + url: config.domain + '/stores/' + config.storeId + '/leads', headers: { - Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, 'Accept': 'application/json;version=' + config.version }, - body: JSON.stringify(objContractDetails), + body: JSON.stringify(objLeadDetails), }); if (response) { return response; @@ -167,21 +162,20 @@ } }; /** - * UPDATE CONTRACT - * API Documentation: https://developers.helloextend.com/2020-08-01#operation/updateContracts - */ - exports.updateWarrantyContract = function (objContractDetails, stContractId) { - var config = extendConfig.getConfig(); + * GET LEAD OFFERS + * API Documentation: https://developers.helloextend.com/2020-08-01#tag/Leads/paths/~1leads~1{leadToken}~1offers/get + */ + exports.getLeadOffers = function (objLeadDetails, config) { + //var config = extendConfig.getConfig(); try { - var response = https.put({ - url: config.domain + '/contracts/' + stContractId, + var response = https.get({ + url: config.domain + '/leads/' + config.storeId + '/offers', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, 'Accept': 'application/json;version=' + config.version }, - body: JSON.stringify(objContractDetails), }); if (response) { return response; @@ -191,47 +185,53 @@ return; } }; + /*****************************************ORDERS*****************************************/ /** - * CANCEL CONTRACT - * API Documentation: https://developers.extend.com/default#operation/refundContract + * CREATE ORDER + * API Documentation: https://docs.extend.com/reference/orderscreate */ - exports.cancelWarrantyContract = function (stContractId, bIsCommit) { - var config = extendConfig.getConfig(); + exports.createOrder = function (objOrderDetails, config) { + // var config = extendConfig.getConfig(); + try { var response = https.post({ - url: config.domain + '/stores/' + config.storeId + '/contracts/' + stContractId + '/refund?commit=' + bIsCommit, + url: config.domain + '/orders', headers: { 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, - 'Accept': 'application/json;version=' + config.version + 'Accept': 'application/json;version=' + config.version, + 'X-Idempotency-Key': exports.generateUUID() }, + body: JSON.stringify(objOrderDetails), }); if (response) { return response; } } catch (e) { - log.debug('Error Cancelling Contract', JSON.stringify(e.message)); + log.debug('Error Calling API', JSON.stringify(e.message)); return; } }; - /*****************************************LEADS*****************************************/ /** - * CREATE LEAD - * API Documentation: https://developers.helloextend.com/2020-08-01#tag/Leads/paths/~1stores~1{storeId}~1leads/post - */ - exports.createLead = function (objLeadDetails) { - var config = extendConfig.getConfig(); + * UPDATE ORDER LINE FULFILLMENT + * API Documentation: https://docs.extend.com/reference/lineitemsfulfill + */ + exports.fulfillOrderLine = function (objOrderDetails, config) { + // var config = extendConfig.getConfig(); try { + var guid = exports.generateUUID(); + log.debug('guid', guid); + var response = https.post({ - url: config.domain + '/stores/' + config.storeId + '/leads', + url: config.domain + '/line-items/fulfill', headers: { - Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, - 'Accept': 'application/json;version=' + config.version + 'Accept': 'application/json;version=' + config.version, + 'X-Idempotency-Key' : exports.generateUUID() }, - body: JSON.stringify(objLeadDetails), + body: JSON.stringify(objOrderDetails), }); if (response) { return response; @@ -241,21 +241,25 @@ return; } }; + /** - * GET LEAD OFFERS - * API Documentation: https://developers.helloextend.com/2020-08-01#tag/Leads/paths/~1leads~1{leadToken}~1offers/get + * REFUND CONTRACT + * API Documentation: https://docs.extend.com/reference/refundscreate */ - exports.getLeadOffers = function (objLeadDetails) { - var config = extendConfig.getConfig(); + exports.refundContract = function (objRefundDetails, config) { + // var config = extendConfig.getConfig(); + + log.debug('requestRefund', "objRefundDetails - "+JSON.stringify(objRefundDetails)) + try { - var response = https.get({ - url: config.domain + '/leads/' + config.storeId + '/offers', + var response = https.post({ + url: config.domain + '/refunds', headers: { - Accept: 'application/json', 'Content-Type': 'application/json', 'X-Extend-Access-Token': config.key, 'Accept': 'application/json;version=' + config.version }, + body: JSON.stringify(objRefundDetails), }); if (response) { return response; @@ -265,6 +269,69 @@ return; } }; + /** + * GET REFUND QUOTE + * API Documentation: https://docs.extend.com/reference/refundsget + */ + exports.getRefundQuote = function (objRefundDetails, config) { + // var config = extendConfig.getConfig(); + try { + var response = https.get({ + url: config.domain + '/refunds', + headers: { + 'Content-Type': 'application/json', + 'X-Extend-Access-Token': config.key, + 'Accept': 'application/json;version=' + config.version + }, + body: JSON.stringify(objRefundDetails), + }); + if (response) { + return response; + } + } catch (e) { + log.debug('Error Calling API', JSON.stringify(e.message)); + return; + } + }; +/** + * REQUEST REFUND + * API Documentation: https://docs.extend.com/reference/refundscreate + */ + exports.requestRefund = function (objRefundDetails, config) { + // var config = extendConfig.getConfig(); + try { + var response = https.post({ + url: config.domain + '/refunds', + headers: { + 'Content-Type': 'application/json', + 'X-Extend-Access-Token': config.key, + 'Accept': 'application/json;version=' + config.version + }, + body: JSON.stringify(objRefundDetails), + }); + if (response) { + return response; + } + } catch (e) { + log.debug('Error Calling API', JSON.stringify(e.message)); + return; + } +}; +exports.generateUUID = function () { + var d = new Date().getTime();//Timestamp + var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now()*1000)) || 0;//Time in microseconds since page-load or 0 if unsupported + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16;//random number between 0 and 16 + if(d > 0){//Use timestamp until depleted + r = (d + r)%16 | 0; + d = Math.floor(d/16); + } else {//Use microseconds since page-load if supported + r = (d2 + r)%16 | 0; + d2 = Math.floor(d2/16); + } + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); + }); +} return exports; }); diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_config_lib.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_config_lib.js index 0bf1bc3..ce992f9 100644 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_config_lib.js +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_config_lib.js @@ -2,7 +2,7 @@ * keyconfig * @NApiVersion 2.1 */ - define([ +define([ 'N/runtime', 'N/search' ], @@ -10,100 +10,84 @@ var exports = {}; const objExtendEnvironment = { SANDBOX: 1, - PRODUCTION: 2 + PRODUCTION: 2 } - exports.getConfig = function () { + exports.getConfig = function (stExtendConfigRecId) { //Get storeId & APIkey from config custom record - var SB_STORE_ID; - var SB_API_KEY; - var SB_API_VERSION; - var SB_EMAIL; - var SB_REF_ID; + var STORE_ID; var API_KEY; - var API_VERSION; + var API_VERSION = 'latest'; var REF_ID; - + var EMAIL; + var ENVIRONMENT = 'demo'; + var PRODUCT_ITEM; + var DOMAIN = 'https://api-demo.helloextend.com'; + + + //var stExtendConfigRecId = runtime.getCurrentScript().getParameter('custscript_ext_config_rec'); + log.debug('_getConfig: stExtendConfigRecId ', stExtendConfigRecId); + + var arrFilters = ["internalId", "is", stExtendConfigRecId]; + var customrecord_ext_configurationSearchObj = search.create({ type: "customrecord_ext_configuration", - filters:[], + filters: [ + arrFilters + ], columns: - [ - search.createColumn({name: "custrecord_ext_environment", label: "Environment "}), - search.createColumn({name: "custrecord_ext_api_key", label: "API Key"}), - search.createColumn({name: "custrecord_ext_api_version", label: "API Version"}), - search.createColumn({name: "custrecord_ext_demo_email", label: "Email"}), - search.createColumn({name: "custrecord_ext_store_id", label: "Store ID"}), - search.createColumn({name: "custrecord_ext_ref_id", label: "Ref ID"}), - ] - }); - var searchResultCount = customrecord_ext_configurationSearchObj.runPaged().count; - customrecord_ext_configurationSearchObj.run().each(function(result){ - var stEnvironment = result.getValue({ name: 'custrecord_ext_environment' }); - if(stEnvironment == objExtendEnvironment.SANDBOX){ - SB_STORE_ID = result.getValue({ name: 'custrecord_ext_store_id' }); - SB_API_KEY = result.getValue({ name: 'custrecord_ext_api_key' }); - SB_API_VERSION = result.getValue({ name: 'custrecord_ext_api_version' }); - SB_EMAIL = result.getValue({ name: 'custrecord_ext_demo_email' }); - SB_REF_ID = result.getValue({ name: 'custrecord_ext_ref_id' }); + [ + search.createColumn({ name: "custrecord_ext_environment", label: "Environment " }), + search.createColumn({ name: "custrecord_ext_api_key", label: "API Key" }), + search.createColumn({ name: "custrecord_ext_api_version", label: "API Version" }), + search.createColumn({ name: "custrecord_ext_demo_email", label: "Email" }), + search.createColumn({ name: "custrecord_ext_store_id", label: "Store ID" }), + search.createColumn({ name: "custrecord_ext_ref_id", label: "Ref ID" }), + search.createColumn({ name: "custrecord_ext_pp_item", label: "Product Protection Item" }), - }else{ - STORE_ID = result.getValue({ name: 'custrecord_ext_store_id' }); - API_KEY = result.getValue({ name: 'custrecord_ext_api_key' }); - API_VERSION = result.getValue({ name: 'custrecord_ext_api_version' }); - REF_ID = result.getValue({ name: 'custrecord_ext_ref_id' }); + ] + }); + var searchResultCount = customrecord_ext_configurationSearchObj.runPaged().count; + customrecord_ext_configurationSearchObj.run().each(function (result) { + ENVIRONMENT = result.getValue({ name: 'custrecord_ext_environment' }); + log.debug('_getConfig: ENVIRONMENT ', ENVIRONMENT); + switch (Number(ENVIRONMENT)) { + case objExtendEnvironment.SANDBOX: + DOMAIN = 'https://api-demo.helloextend.com' + break; + case objExtendEnvironment.PRODUCTION: + DOMAIN = 'https://api.helloextend.com' + break; + default: + DOMAIN = 'https://api-demo.helloextend.com' + }; + log.debug('_getConfig: DOMAIN ', DOMAIN); + STORE_ID = result.getValue({ name: 'custrecord_ext_store_id' }); + API_KEY = result.getValue({ name: 'custrecord_ext_api_key' }); + EMAIL = result.getValue({ name: 'custrecord_ext_demo_email' }); + REF_ID = result.getValue({ name: 'custrecord_ext_ref_id' }); + if (result.getValue({ name: 'custrecord_ext_api_version' })) { + API_VERSION = result.getValue({ name: 'custrecord_ext_api_version' }); } + PRODUCT_ITEM = result.getValue({ name: 'custrecord_ext_pp_item' }); return true; - }); + }); - var objSandbox = { - storeId: SB_STORE_ID, - key: SB_API_KEY, - domain: 'https://api-demo.helloextend.com', - version: SB_API_VERSION, - email: SB_EMAIL, //IMPORTATN: SB and Testing environemnts requires manual assignment of a test email - refId: SB_REF_ID - }; - var objProd = { + var objExtendConfig = { storeId: STORE_ID, key: API_KEY, - domain: 'https://api.helloextend.com', + domain: DOMAIN, version: API_VERSION, - refId: REF_ID + email: EMAIL, //IMPORTATN: SB and Testing environemnts requires manual assignment of a test email + refId: REF_ID, + product_plan_item: PRODUCT_ITEM, }; - //param is custom record extend config - var stEnvironment = runtime.getCurrentScript().getParameter('custscript_ext_environment'); - log.audit('stEnvironment', stEnvironment); - switch(stEnvironment){ - case objExtendEnvironment.SANDBOX: - stEnvironment = 'SANDBOX' - break; - case objExtendEnvironment.PRODUCTION: - stEnvironment = 'PRODUCTION'; - break; - default: - stEnvironment = 'SANDBOX'; - }; - - var objKeys = {}; - - objKeys['SANDBOX'] = objSandbox; - objKeys['PRODUCTION'] = objSandbox; //Demo Purposes - //objKeys['PRODUCTION'] = objProd; - //by runtime or by global param - //runtime - /* - return objKeys[runtime.envType]; - */ - //global param - return objKeys[stEnvironment]; - - + return objExtendConfig; } return exports; diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_util.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_util.js index b4c1ea2..98002d2 100644 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_util.js +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/lib/customscript_ext_util.js @@ -3,7 +3,8 @@ *@description: Structures the various JSON request bodies to the Extend API * @NApiVersion 2.x */ - define([ +define([ + 'N/runtime', 'N/search', 'N/record', 'N/error', @@ -11,98 +12,605 @@ '../lib/customscript_ext_config_lib' ], - function (search, record, error, EXTEND_API, EXTEND_CONFIG) { - var exports = {}; + function (runtime, search, record, error, EXTEND_API, EXTEND_CONFIG) { + var exports = {}; /** - * Contract Functions + * Order Functions */ - //create extend contracts - exports.createExtendContracts = function (objExtendData, objSalesOrderRecord) { - log.debug('EXTEND UTIL _createExtendContracts:', '**ENTER**'); - log.debug('EXTEND UTIL _createExtendContracts: SO ID', objSalesOrderRecord.id); + //create extend order + exports.createExtendOrder = function (objSalesOrderRecord, objExtendConfig) { + log.audit('EXTEND UTIL _createExtendOrder:', '**ENTER**'); + log.audit('EXTEND UTIL _createExtendOrder: SO ID', objSalesOrderRecord.id); + var objExtendOrderRequestJSON = {}; - for (key in objExtendData) { + //build order data obj + var objExtendData = {}; + //get SO header data + objExtendData = exports.getSalesOrderInfo(objSalesOrderRecord); + log.audit('EXTEND UTIL _createExtendOrder: getSalesOrderInfo objExtendData', objExtendData); + //build array of items + var objExtendItemData = exports.getSalesOrderItemInfo(objSalesOrderRecord, objExtendConfig); + log.audit('EXTEND UTIL _createExtendOrder: objExtendItemData', objExtendItemData); + //format items + objExtendData.lineItems = exports.buildExtendItemJSON(objExtendItemData, objExtendConfig); + log.audit('EXTEND UTIL _createExtendOrder: objExtendData', objExtendData); - var objExtendContractRequestJSON = {}; - var stQuantity = objExtendData[key].quantity; - log.debug('EXTEND UTIL _createExtendContracts: Quantity of Line', stQuantity); - var arrContractIds = []; - var stExtendContractQty = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_qty', line: objExtendData[key].line }); - var stExtendContractId = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: objExtendData[key].line });; + //build order json obj + objExtendOrderRequestJSON = exports.buildExtendOrderJSON(objExtendData, objExtendConfig); + log.audit('EXTEND UTIL _createExtendOrder: objExtendOrderRequestJSON', objExtendOrderRequestJSON); + //call api + var objExtendResponse = EXTEND_API.createOrder(objExtendOrderRequestJSON, objExtendConfig); + log.audit('EXTEND UTIL _createExtendOrder: Extend Response Object: ', objExtendResponse); + //handle response + if (objExtendResponse.code === 201) { + var objExtendResponseBody = JSON.parse(objExtendResponse.body); + exports.handleOrderResponse(objExtendResponseBody, objSalesOrderRecord); + //make SO as extend order created + objSalesOrderRecord.setValue({ fieldId: 'custbody_ext_order_create', value: true }); + var stExtendOrderId = objExtendResponseBody.id; + log.debug('EXTEND UTIL _createExtendOrder: stExtendOrderId: ', stExtendOrderId); + objSalesOrderRecord.setValue({ fieldId: 'custbody_ext_order_id', value: stExtendOrderId }); - if (stExtendContractId) { - arrContractIds = JSON.parse(stExtendContractId); - } - // Create contract call for quantity fulfilled on the Extend item - for (var i = 0; i < stQuantity; i++) { - objExtendContractRequestJSON = exports.buildExtendContractJSON(objExtendData[key]); - log.debug('EXTEND UTIL _createExtendContracts: objExtendContractRequestJSON', objExtendContractRequestJSON); + } else { + log.error('EXTEND UTIL _createExtendContracts', objExtendResponse); + objSalesOrderRecord.setValue({ fieldId: 'custbody_ext_process_error', value: true }); + // create user note attached to record + var objNoteRecord = record.create({ + type: record.Type.NOTE, + }) + objNoteRecord.setValue('transaction', objSalesOrderRecord.id); + objNoteRecord.setValue('title', 'Extend Order Create Error'); + objNoteRecord.setValue('note', JSON.stringify(objExtendResponse)); + var stNoteId = objNoteRecord.save(); + } + + objSalesOrderRecord.save(); + }; + //fulfill items on order + exports.fulfillExtendOrder = function (objSalesOrderRecord, stFulfillmentId, objExtendConfig) { + log.audit('EXTEND UTIL _fulfillExtendOrder:', '**ENTER**'); + log.audit('EXTEND UTIL _fulfillExtendOrder: SO ID', objSalesOrderRecord.id + '|' + stFulfillmentId); - var objExtendResponse = EXTEND_API.createWarrantyContract(objExtendContractRequestJSON); - log.debug('EXTEND UTIL _createExtendContracts: Extend Response Object: ' + i, objExtendResponse); - if (objExtendResponse.code === 201) { + //build order data obj + var objExtendData = {}; + //get fulfillment data + objExtendData = exports.getFulfillmentData(objSalesOrderRecord, objExtendConfig); + log.audit('EXTEND UTIL _fulfillExtendOrder: getFulfillmentData objExtendData', objExtendData); + + for (key in objExtendData) { + //build fulfillment json obj + var objExtendFulfillRequestJSON = {}; + objExtendFulfillRequestJSON = exports.buildExtendFulfillJSON(objExtendData[key]); + log.audit('EXTEND UTIL _fulfillExtendOrder: objExtendFulfillRequestJSON', objExtendFulfillRequestJSON); + var bSuccess = true; + // Create contract call for quantity fulfilled on the Extend item + for (var i = 0; i < objExtendData[key].quantity; i++) { + //get extend contract array for line + log.debug('EXTEND UTIL _fulfillExtendOrder: objExtendFulfillRequestJSON', objExtendData[key].contractIds + typeof objExtendData[key].contractIds); + //call api + var objExtendResponse = EXTEND_API.fulfillOrderLine(objExtendFulfillRequestJSON, objExtendConfig); + log.audit('EXTEND UTIL _fulfillExtendOrder: Extend Response Object: ', objExtendResponse); + //handle response + if (objExtendResponse.code === 200 || objExtendResponse.code === 201) { var objExtendResponseBody = JSON.parse(objExtendResponse.body); - arrContractIds.push(objExtendResponseBody.id); - stExtendContractQty++; + //push new contract id to contracts array + objExtendData[key].contractIds.push(objExtendResponseBody.contractId); + } else { - log.error('EXTEND UTIL _createExtendContracts', objExtendResponse); - objSalesOrderRecord.setValue({ fieldId: 'custbody_ext_process_error', value: true }); + bSuccess = false; + log.error('EXTEND UTIL _fulfillExtendOrder', objExtendResponse); + //submit fields + record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: stFulfillmentId, + values: { + 'custbody_ext_process_error': true + }, + options: { + enableSourcing: false, + ignoreMandatoryFields: true + } + }); // create user note attached to record var objNoteRecord = record.create({ type: record.Type.NOTE, }) - objNoteRecord.setValue('transaction', objSalesOrderRecord.id); - objNoteRecord.setValue('title', 'Extend Contract Create Error | Line ' + key); - objNoteRecord.setValue('note', JOSN.stringify(objExtendResponse)); + objNoteRecord.setValue('transaction', stFulfillmentId); + objNoteRecord.setValue('title', 'Extend Order Create Error'); + objNoteRecord.setValue('note', JSON.stringify(objExtendResponse)); var stNoteId = objNoteRecord.save(); } + //submit fields to IF + if (bSuccess) { + record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: stFulfillmentId, + values: { + 'custbody_ext_order_create': true + }, + options: { + enableSourcing: false, + ignoreMandatoryFields: true + } + }); + } } - log.debug('EXTEND UTIL _createExtendContracts: arrContractIds', arrContractIds); - log.debug('EXTEND UTIL _createExtendContracts: new stExtendContractQty', stExtendContractQty); + log.debug('EXTEND UTIL _fulfillExtendOrder: contractIDs', key + '|' + objExtendData[key].contractIds); + + //set contract column on SO line + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: key, value: JSON.stringify(objExtendData[key].contractIds) }); + } + objSalesOrderRecord.save(); + + }; + + //refund item by line item transaction id + exports.refundExtendOrder = function (objRefundData, objExtendConfig) { + log.audit('EXTEND UTIL _refundExtendOrder:', '**ENTER**'); + log.audit('EXTEND UTIL _refundExtendOrder: objRefundData', JSON.stringify(objRefundData)); + + var intQuantityToRefund = parseInt(objRefundData['QTY']); + var arrActiveIDs = objRefundData['activeIDs']; + var arrCanceledIDs = objRefundData['canceledIDs']; + // var objLineToRefund = {'lineItemTransactionId' : objRefundData['lineItemTransactionId']} + // var objContractToRefund = {'contractId' : objRefundData['lineItemTransactionId']} + + //check if contract id has been canceled + function checkIfCanceled(contractToCancel, arrCanceledIDs) { + return arrCanceledIDs.length > 0 ? arrCanceledIDs.includes(contractToCancel) : false; + } + + var intContractsCanceled = arrCanceledIDs ? arrCanceledIDs.length : 0; + var intContractsStillActive = arrActiveIDs ? arrActiveIDs.length - intContractsCanceled : 0; + + if (intContractsStillActive > 0) { + log.debug('refundExtendOrder', "There is/are still " + intContractsStillActive + " active contract(s)."); + + + for (var index = 0; index < arrActiveIDs.length; index++) { + var contractId = arrActiveIDs[index]; + var bIsCanceled = checkIfCanceled(contractId, arrCanceledIDs); + + if (bIsCanceled) { + log.debug('refundExtendOrder', contractId + " has been canceled."); + continue; + } else { + log.debug('refundExtendOrder', "Attempting to cancel " + contractId); + var objContractToRefund = { 'contractId': contractId } + var objExtendResponse = EXTEND_API.refundContract(objContractToRefund, objExtendConfig); + + if (objExtendResponse.code === 201) { + arrCanceledIDs.push(contractId); + log.debug("refundExtendOrder", JSON.stringify(arrCanceledIDs)); + } + + } + } + } else { + log.error('refundExtendOrder', "All contracts have been refunded/canceled."); + } + + var objRefundedRecord = record.load({ + type: objRefundData.TYPE, + id: objRefundData.ID + }); + + //handle response + if (objExtendResponse.code === 201) { + var objExtendResponseBody = JSON.parse(objExtendResponse.body); + log.debug('EXTEND UTIL _refundExtendOrder: objExtendResponseBody: ', JSON.stringify(objExtendResponseBody)); + + var lineNumber = objRefundedRecord.findSublistLineWithValue({ + sublistId: 'item', + fieldId: 'lineuniquekey', + value: objRefundData['UNIQUE_KEY'] + }); + log.debug("refundExtendOrder", "lineNumber - " + lineNumber) + // exports.handleOrderResponse(objExtendResponseBody, objRefundedRecord); + + objRefundedRecord.setSublistValue({ + sublistId: 'item', + fieldId: 'custcol_ext_canceled_contract_ids', + line: lineNumber, + value: JSON.stringify(arrCanceledIDs) + }); + //make transaction as extend order processed + objRefundedRecord.setValue({ fieldId: 'custbody_ext_order_create', value: true }); + // var stExtendOrderId = objExtendResponseBody.id; + + } else { + log.error('EXTEND UTIL _refundExtendOrder', objExtendResponse); + objRefundedRecord.setValue({ fieldId: 'custbody_ext_process_error', value: true }); + // create user note attached to record + var objNoteRecord = record.create({ + type: record.Type.NOTE, + }) + objNoteRecord.setValue('transaction', objRefundedRecord.id); + objNoteRecord.setValue('title', 'Extend Refund Error'); + objNoteRecord.setValue('note', JSON.stringify(objExtendResponse.body)); + var stNoteId = objNoteRecord.save(); + } + + objRefundedRecord.save(); + + + }; + + /***********************************Support Functions********************************************/ + exports.getFulfillmentData = function (objNewRecord, objExtendConfig) { + log.debug('_getExtendData: Get Extend Data', '**ENTER**'); + var objExtendItemData = {}; + + //var stExtendItemId = runtime.getCurrentScript().getParameter('custscript_ext_protection_plan'); + //move extend item to config record instead of param + var stExtendItemId = objExtendConfig.product_plan_item; + + var stLineCount = objNewRecord.getLineCount({ sublistId: 'item' }); + + for (var i = 0; i < stLineCount; i++) { + var stItemId = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }); + //Check if item is one of the configured extend items + if (stExtendItemId === stItemId) { + log.debug('_getExtendData: Item Found | Line ', stItemId + ' | ' + i); + var arrContractIDs = []; + //get qty of contracts created & compare to extend item qty + var stContractIDs = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: i }); + var arrContractIDs = JSON.parse(stContractIDs); + log.debug('_getExtendData: stContractID', arrContractIDs + '|' + typeof arrContractIDs); + // var arrContracyQty = JSON.parse(objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: i })); + var stExtendItemQty = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantity', line: i }); + + if (arrContractIDs.length < stExtendItemQty) { + var stContractQty = arrContractIDs.length; + //get related item from extend line + var stExtendItemRefId = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i }); + log.debug('_getExtendData: stExtendItemRefId', stExtendItemRefId); + + //check for new fulfillments + for (var j = 0; j < stLineCount; j++) { + var stRelatedItem = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: j }); + if (stRelatedItem === stExtendItemRefId) { + var stRelatedItemQtyFulfilled = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantityfulfilled', line: j }); + if (stRelatedItemQtyFulfilled <= stExtendItemQty && stRelatedItemQtyFulfilled > stContractQty) { + + var stUniqueKey = i; + // Start building the Extend Order Info Object + objExtendItemData[stUniqueKey] = {}; + objExtendItemData[stUniqueKey].quantity = Math.min(stRelatedItemQtyFulfilled, (stExtendItemQty - stContractQty)); + objExtendItemData[stUniqueKey].line = i; + objExtendItemData[stUniqueKey].lineItemID = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_line_id', line: i }); + objExtendItemData[stUniqueKey].contractIds = arrContractIDs; + + } + } + } + + } + } + } + + log.debug('_getExtendData: return objExtendItemData', objExtendItemData); + + return objExtendItemData + }; + exports.handleOrderResponse = function (objExtendResponseBody, objSalesOrderRecord) { + + log.debug('EXTEND UTIL _createExtendOrder: Extend Response Body Parsed: ', objExtendResponseBody); + var arrLineItems = objExtendResponseBody.lineItems; + var objExtendResponseData = {}; + + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData: ', objExtendResponseData); + + for (var i = 0; i < arrLineItems.length; i++) { + log.debug('EXTEND UTIL _createExtendOrder: arrLineItems: ', arrLineItems[i]); + var line = arrLineItems[i].lineItemTransactionId; + // line = line.substring(objSalesOrderRecord.id.toString().length, line.length); + line = line.split('-'); + + log.debug('EXTEND UTIL _createExtendOrder: line: ', line + '|' + typeof line); + stUniqueKey = line[1]; + + objExtendResponseData[stUniqueKey] = {}; + objExtendResponseData[stUniqueKey].contractIds = []; + objExtendResponseData[stUniqueKey].leadTokens = []; + objExtendResponseData[stUniqueKey].lineItemTransactionId = arrLineItems[i].lineItemTransactionId; + if (line[2]) { + objExtendResponseData[stUniqueKey].extendLine = line[2]; + } + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData[stUniqueKey]: ', objExtendResponseData[stUniqueKey]); + + } + for (var j = 0; j < arrLineItems.length; j++) { + log.debug('EXTEND UTIL _createExtendOrder: j loop arrLineItems: ', arrLineItems[j]); + var line = arrLineItems[j].lineItemTransactionId; + // line = line.substring(objSalesOrderRecord.id.toString().length, line.length); + line = line.split('-'); + stUniqueKey = line[1]; + + if (arrLineItems[j].type == 'contract') { + if (arrLineItems[j].contractId) { + objExtendResponseData[stUniqueKey].contractIds.push(arrLineItems[j].contractId); + } + } + if (arrLineItems[j].type == 'lead') { + if (arrLineItems[j].leadToken) { + objExtendResponseData[stUniqueKey].leadTokens.push(arrLineItems[j].leadToken); + } + } + } + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData', objExtendResponseData); + + for (key in objExtendResponseData) { + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData[key].contractIds: ', key + '|' + objExtendResponseData[key].contractIds); + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData[key].leadTokens: ', key + '|' + objExtendResponseData[key].leadTokens); + log.debug('EXTEND UTIL _createExtendOrder: objExtendResponseData[key].lineItemTransactionId: ', key + '|' + objExtendResponseData[key].lineItemTransactionId); // If Extend contract is created, populate the appropriate custom column field for contracts // on the Sales Order line - objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_qty', line: objExtendData[key].line, value: stExtendContractQty }); - objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: objExtendData[key].line, value: JSON.stringify(arrContractIds) }); + var stContractIds = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: key }); + var stLeadTokens = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_lead_token', line: key }); + log.debug('EXTEND UTIL _createExtendOrder: stContractIds | stLeadTokens: ', stContractIds + '|' + stLeadTokens); + + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: key, value: JSON.stringify(objExtendResponseData[key].contractIds) }); + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_lead_token', line: key, value: JSON.stringify(objExtendResponseData[key].leadTokens) }); + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_line_id', line: key, value: objExtendResponseData[key].lineItemTransactionId }); + if (objExtendResponseData[key].extendLine) { + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_id', line: objExtendResponseData[key].extendLine, value: JSON.stringify(objExtendResponseData[key].contractIds) }); + } } + return objSalesOrderRecord; - objSalesOrderRecord.save(); }; - //get Sales Order Info required for contract create - exports.getSalesOrderInfo = function (objExtendData, objSalesOrderRecord) { + exports.getSalesOrderInfo = function (objSalesOrderRecord) { log.debug('EXTEND UTIL _getSalesOrderInfo:', '**ENTER**'); + var objExtendData = {}; + log.debug('EXTEND UTIL _getSalesOrderInfo: ExtendData Object', objExtendData); + var objCustomerInfo = exports.getCustomerInfo(objSalesOrderRecord.getValue({ fieldId: 'entity' })); + var objShipAddress = exports.getAddress(objSalesOrderRecord, 'shippingaddress'); + var objBillAddress = exports.getAddress(objSalesOrderRecord, 'billingaddress'); + //Build SO Info Object + objExtendData.id = objSalesOrderRecord.getValue({ fieldId: 'tranid' }); + objExtendData.tran_date = exports.getepochDate(); + objExtendData.currency = 'USD'; + objExtendData.order_number = objSalesOrderRecord.getValue({ fieldId: 'tranid' }); + objExtendData.total_amount = objSalesOrderRecord.getValue({ fieldId: 'total' }); + objExtendData.name = objSalesOrderRecord.getText({ fieldId: 'entity' }).replace(/[0-9]/g, ''); + objExtendData.email = objCustomerInfo.email; + objExtendData.phone = objCustomerInfo.phone; + objExtendData.bill_address1 = objBillAddress.address1; + objExtendData.bill_address2 = objBillAddress.address2; + objExtendData.bill_city = objBillAddress.city; + objExtendData.bill_state = objBillAddress.state; + objExtendData.bill_zip = objBillAddress.zip; + objExtendData.bill_country = objBillAddress.country; + objExtendData.ship_address1 = objShipAddress.address1; + objExtendData.ship_address2 = objShipAddress.address2; + objExtendData.ship_city = objShipAddress.city; + objExtendData.ship_state = objShipAddress.state; + objExtendData.ship_zip = objShipAddress.zip; + objExtendData.ship_country = objShipAddress.country; + return objExtendData; + }; + exports.getSalesOrderItemInfo = function (objSalesOrderRecord, objExtendConfig) { + //////////////////////////SUPPORT FUNCTIONS/////////////////////////// + var stLineCount = objSalesOrderRecord.getLineCount({ sublistId: 'item' }); + log.debug('_getExtendData: Get Extend Data', '**ENTER**'); + + var objExtendItemData = {}; + + var stExtendProductItemId = objExtendConfig.product_plan_item; + for (var i = 0; i < stLineCount; i++) { + var stItemId = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }); + stUniqueKey = i; + if (stExtendProductItemId !== stItemId) { + objExtendItemData[stUniqueKey] = {}; + } + //Check if item is one of the configured extend items + if (stExtendProductItemId === stItemId) { + log.debug('_getExtendData: Item Found | Line ', stItemId + ' | ' + i); + //get value of leadtoken column on extend line + var stLeadToken = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_lead_token', line: i }); + log.debug('_getExtendData: stLeadToken', stLeadToken + '|' + typeof stLeadToken); + + //if extend line has lead token mark isLead = T + if (stLeadToken) { + log.debug('_getExtendData: stLeadToken ', stLeadToken); + objExtendItemData[stUniqueKey] = {}; + objExtendItemData[stUniqueKey].isLead = true; + objExtendItemData[stUniqueKey].leadToken = stLeadToken; + objExtendItemData[stUniqueKey].quantity = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantity', line: i }); + // Start building the Extend Order Plan Info Object + objExtendItemData[stUniqueKey].extend_plan_id = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_plan_id', line: i }); + objExtendItemData[stUniqueKey].extend_line = "" + i; + objExtendItemData[stUniqueKey].plan_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'rate', line: i }) * 100); + if (exports.objectIsEmpty(objExtendItemData[stUniqueKey].plan_price)) { + objExtendItemData[stUniqueKey].plan_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'amount', line: i }) / objExtendItemData[stUniqueKey].quantity * 100); + + } + //set Extend Line Item Transaction ID on Extend Line + objExtendItemData[stUniqueKey].lineItemID = "" + objSalesOrderRecord.id + "-" + i; + } else { + //get related item from extend line + var stExtendItemRefId = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i }); + for (var j = 0; j < stLineCount; j++) { + var stRelatedItem = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: j }); + if (stRelatedItem === stExtendItemRefId) { + log.debug('_getExtendData: stRelatedItem| stExtendItemRefId ', stRelatedItem + ' | ' + stExtendItemRefId); + stUniqueKey = j; + // Start building the Extend Order Plan Info Object + objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i }); + objExtendItemData[stUniqueKey].extend_plan_id = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_plan_id', line: i }); + objExtendItemData[stUniqueKey].itemId = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i });; + objExtendItemData[stUniqueKey].extend_line = i; + objExtendItemData[stUniqueKey].plan_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'rate', line: i }) * 100); + if (exports.objectIsEmpty(objExtendItemData[stUniqueKey].plan_price)) { + objExtendItemData[stUniqueKey].plan_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'amount', line: i }) / objExtendItemData[stUniqueKey].quantity * 100); + + } + //set Extend Line Item Transaction ID of related product on Extend Line + objExtendItemData[stUniqueKey].lineItemID = "" + objSalesOrderRecord.id + "-" + j + "-" + i; + var stRelatedItemID = "" + objSalesOrderRecord.id + "-" + j + "-" + i; + objSalesOrderRecord.setSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_line_id', line: i, value: stRelatedItemID }); + } + } + } + } else { + // Start building the Extend Order Item Info Object + objExtendItemData[stUniqueKey].quantity = objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantity', line: i }); + objExtendItemData[stUniqueKey].itemId = stItemId + objExtendItemData[stUniqueKey].line = i; + objExtendItemData[stUniqueKey].purchase_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'rate', line: i }) * 100); + if (exports.objectIsEmpty(objExtendItemData[stUniqueKey].purchase_price)) { + objExtendItemData[stUniqueKey].purchase_price = parseInt(objSalesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'amount', line: i }) / objExtendItemData[stUniqueKey].quantity * 100); + + } + objExtendItemData[stUniqueKey].lineItemID = "" + objSalesOrderRecord.id + "-" + i; + if (objExtendItemData[stUniqueKey].extend_line) { + objExtendItemData[stUniqueKey].lineItemID = objExtendItemData[stUniqueKey].lineItemID + "-" + objExtendItemData[stUniqueKey].extend_line; + } + } - for (stKey in objExtendData) { - log.debug('EXTEND UTIL _getSalesOrderInfo: Key', stKey); - log.debug('EXTEND UTIL _getSalesOrderInfo: ExtendData Object', objExtendData); - var objCustomerInfo = exports.getCustomerInfo(objSalesOrderRecord.getValue({ fieldId: 'entity' })); - //Build SO Info Object - objExtendData[stKey].id = objSalesOrderRecord.getValue({ fieldId: 'tranid' }); - objExtendData[stKey].tran_date = exports.getepochDate(); - objExtendData[stKey].currency = 'USD'; - objExtendData[stKey].order_number = objSalesOrderRecord.getValue({ fieldId: 'tranid' }); - objExtendData[stKey].total_amount = objSalesOrderRecord.getValue({ fieldId: 'total' }); - objExtendData[stKey].name = objSalesOrderRecord.getText({ fieldId: 'entity' }).replace(/[0-9]/g, ''); - objExtendData[stKey].email = objCustomerInfo.email; - objExtendData[stKey].phone = objCustomerInfo.phone; - objExtendData[stKey].bill_address1 = objCustomerInfo.bill_address1; - objExtendData[stKey].bill_address2 = objCustomerInfo.bill_address2; - objExtendData[stKey].bill_city = objCustomerInfo.bill_city; - objExtendData[stKey].bill_state = objCustomerInfo.bill_state; - objExtendData[stKey].bill_zip = objCustomerInfo.bill_zip; - objExtendData[stKey].bill_country = objCustomerInfo.bill_country; - objExtendData[stKey].ship_address1 = objCustomerInfo.ship_address1; - objExtendData[stKey].ship_address2 = objCustomerInfo.ship_address2; - objExtendData[stKey].ship_city = objCustomerInfo.ship_city; - objExtendData[stKey].ship_state = objCustomerInfo.ship_state; - objExtendData[stKey].ship_zip = objCustomerInfo.ship_zip; - objExtendData[stKey].ship_country = objCustomerInfo.ship_country; } - return objExtendData; + return objExtendItemData; + }; + // Build the Extend API JSON for order lines + exports.buildExtendItemJSON = function (objValues, objExtendConfig) { + //item json + var lineItems = []; + for (key in objValues) { + //if line is leadToken contract + if (objValues[key].isLead) { + //objValues.refId = exports.getItemRefId(objValues[key].itemId, objExtendConfig); + var item = { + 'leadToken': objValues[key].leadToken, + 'quantity': objValues[key].quantity, + 'lineItemTransactionId': objValues[key].lineItemID + } + if (objValues[key].extend_plan_id && objValues[key].plan_price) { + item.plan = { + 'id': objValues[key].extend_plan_id.toString(), + 'purchasePrice': objValues[key].plan_price + } + } + } + else { + //get product refId + log.debug('_buildExtendItemJSON: objValues', objValues); + objValues[key].refId = exports.getItemRefId(objValues[key].itemId, objExtendConfig); + var item = { + 'product': { + 'id': objValues[key].refId, + // 'serialNumber': objValues.serial_number, + 'purchasePrice': objValues[key].purchase_price + }, + 'status': 'unfulfilled', + 'quantity': objValues[key].quantity, + 'lineItemTransactionId': objValues[key].lineItemID + } + if (objValues[key].extend_plan_id && objValues[key].plan_price) { + item.plan = { + 'id': objValues[key].extend_plan_id.toString(), + 'purchasePrice': objValues[key].plan_price + } + } + } + + lineItems.push(item); + + + } + log.debug('_buildExtendItemJSON: lineItems', lineItems); + + return lineItems; }; - exports.getItemRefId = function(stItemId){ - var refIdValue = EXTEND_CONFIG.getConfig().refId; + // Build the Extend API JSON for order creation + exports.buildExtendOrderJSON = function (objValues, objExtendConfig) { + log.debug('EXTEND UTIL _buildExtendOrderJSON:', '**ENTER**'); + + // Date is a string and we need to format for extend + const stTranDate = new Date(objValues.tran_date); + + //If Demo use demo email for contracts + // var config = EXTEND_CONFIG.getConfig(); + if (objExtendConfig.email) { + objValues.email = objExtendConfig.email; + } + + var objJSON = { + 'currency': objValues.currency, + 'customer': { + 'email': objValues.email, + 'name': objValues.name, + 'phone': objValues.phone, + 'billingAddress': { + 'address1': objValues.bill_address1, + 'address2': objValues.bill_address2, + 'city': objValues.bill_city, + 'postalCode': objValues.bill_zip, + 'countryCode': objValues.bill_country, + 'province': objValues.bill_state, + }, + 'shippingAddress': { + 'address1': objValues.ship_address1, + 'address2': objValues.ship_address2, + 'city': objValues.ship_city, + 'postalCode': objValues.ship_zip, + 'countryCode': objValues.ship_country, + 'province': objValues.ship_state + + } + }, + 'storeId': objExtendConfig.storeId, + 'lineItems': objValues.lineItems, + 'total': parseInt(objValues.total_amount * 100), + 'transactionId': objValues.id, + 'saleOrigin': { + 'integratorId': 'netsuite' + } + } + + return objJSON; + }; + // Build the Extend API JSON for line fulfillment + exports.buildExtendFulfillJSON = function (objValues) { + var objJSON = { + 'lineItemTransactionId': objValues.lineItemID + } + return objJSON; + }; + /***********************************Support Functions********************************************/ + //get Address Subrecord fields from transaction + exports.getAddress = function (objSalesOrderRecord, addressField) { + var address = objSalesOrderRecord.getSubrecord({ + fieldId: addressField + }); + var objAddress = { + address1: address.getValue({ + fieldId: 'addr1' + }), + address2: address.getValue({ + fieldId: 'addr2' + }), + city: address.getValue({ + fieldId: 'city' + }), + state: address.getValue({ + fieldId: 'state' + }), + country: address.getValue({ + fieldId: 'country' + }), + zip: address.getValue({ + fieldId: 'zip' + }) + }; + return objAddress; + }; + //get Item's reference ID + exports.getItemRefId = function (stItemId, objExtendConfig) { + // var config = EXTEND_CONFIG.getConfig(); + var refIdValue = objExtendConfig.refId; var stItemRefId = stItemId; if (refIdValue) { // Lookup to item to see if it is eligible for warranty offers @@ -111,13 +619,20 @@ id: stItemId, columns: refIdValue }); + log.debug('EXTEND UTIL _getItemRefId:', arrItemLookup); + for (var prop in arrItemLookup) { - var stItemRefId = arrItemLookup[prop] + if (arrItemLookup[prop][0].text) { + var stItemRefId = arrItemLookup[prop][0].text; + } else { + var stItemRefId = arrItemLookup[prop] + } break; } } + return stItemRefId; - } + }; //get Transaction Date required for contract create exports.getTransactionDate = function (stDate) { var stTimeDate = new Date(stDate); @@ -166,79 +681,7 @@ } return stPurchasePrice; }; - - // Build the Extend API JSON for contract creation - exports.buildExtendContractJSON = function (objValues) { - log.debug('EXTEND UTIL _buildExtendContractJSON:', '**ENTER**'); - - // Date is a string and we need to format for extend - const stTranDate = new Date(objValues.tran_date); - - //get product refId - objValues.refId = exports.getItemRefId(objValues.itemId); - //If Demo use demo email for contracts - log.debug('demo email', EXTEND_CONFIG.getConfig()); - if(EXTEND_CONFIG.getConfig().email){ - objValues.email = EXTEND_CONFIG.getConfig().email; - } - var objJSON = { - 'transactionId': objValues.id, - 'transactionDate': objValues.tran_date, -// 'transactionTotal': objValues.total_amount * 100, - - 'transactionTotal': { - 'currencyCode': objValues.currency, - 'amount': parseInt(objValues.total_amount * 100) - }, - - 'currency': objValues.currency, - 'poNumber': objValues.order_number, - 'customer': { - 'email': objValues.email, - 'name': objValues.name, - 'phone': objValues.phone, - 'billingAddress': { - 'address1': objValues.bill_address1, - 'address2': objValues.bill_address2, - 'city': objValues.bill_city, - 'provinceCode': objValues.bill_state, - 'countryCode': objValues.bill_country, - 'postalCode': objValues.bill_zip - }, - 'shippingAddress': { - 'address1': objValues.ship_address1, - 'address2': objValues.ship_address2, - 'city': objValues.ship_city, - 'provinceCode': objValues.ship_state, - 'countryCode': objValues.ship_country, - 'postalCode': objValues.ship_zip - } - }, - 'product': { - 'referenceId': objValues.refId, - // 'purchasePrice': objValues.purchase_price * 100, - - 'purchasePrice': { - 'currencyCode': objValues.currency, - 'amount': parseInt(objValues.purchase_price * 100), - } - - // 'serialNumber' : objValues.serial_number - }, - 'plan': { - // 'purchasePrice': objValues.plan_price * 100, - - 'purchasePrice': { - 'currencyCode': objValues.currency, - 'amount': parseInt(objValues.plan_price * 100), - }, - - 'planId': objValues.extend_plan_id - } - }; - return objJSON; - }; - + /***********************************Support Functions********************************************/ /** * Performs empty validations */ @@ -266,7 +709,6 @@ }); return objCustomError; }; - /** * Performs search with no size limitations */ diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_contract_mr.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_contract_mr.js deleted file mode 100644 index 6deebf4..0000000 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_contract_mr.js +++ /dev/null @@ -1,204 +0,0 @@ -/** - *@name: EXTEND SUITESCRIPT SDK - Create Contract from Fulfillment JS - *@description: - * This script invokes a call to the Extend Contracts POST endpoint whenever - * an item with a protection plan is fulfilled - * - *@copyright Extend, Inc - *@author Michael Draper - * - *@NApiVersion 2.x - *@NScriptType MapReduceScript - *@ModuleScope Public - */ - define([ - 'N/runtime', - 'N/record', - 'N/search', - '../lib/customscript_ext_util' -], - function (runtime, record, search, EXTEND_UTIL) { - var exports = {}; - - exports.getInputData = function () { - try { - log.audit('getInputData', '** START **'); - //todo build search in getinput instead of param? - var stSalesOrderSearchID = runtime.getCurrentScript().getParameter('custscript_ext_so_search'); - - log.debug('stSalesOrderSearchID', stSalesOrderSearchID); - var salesOrderSearch = search.load({ - id: stSalesOrderSearchID - }); - - return salesOrderSearch; - - } catch (e) { - log.error('getInputData', 'error: ' + e); - } - } - exports.map = function (context) { - try { - log.debug('map', '** START **'); - var contextValues = JSON.parse(context.value); - var stFulfillmentId = contextValues.id; - var stSalesOrderId = contextValues.values.createdfrom.value; - log.audit('stSalesOrderId | stFulfillmentId', stSalesOrderId + '|' + stFulfillmentId); - - context.write({ - key: stSalesOrderId, - value: stFulfillmentId - }); - - } catch (e) { - log.error('map', 'error: ' + e); - var id = record.submitFields({ - type: record.Type.SALES_ORDER, - id: stSalesOrderId, - values: { - 'custbody_ext_process_error': true - }, - options: { - enableSourcing: false, - ignoreMandatoryFields: true - } - }); - //create user note attached to record - var objNoteRecord = record.create({ - type: record.Type.NOTE, - }) - objNoteRecord.setValue('transaction', stSalesOrderId); - objNoteRecord.setValue('title', stSalesOrderId); - objNoteRecord.setValue('note', e.message); - objNoteRecord.save(); - - } - } - exports.reduce = function (context) { - try { - log.debug('reduce', '** START **'); - - var stSalesOrderId = context.key; - log.audit('reduce', 'stSalesOrderId: ' + stSalesOrderId); - - //Load associated Saled Order Record - var objSalesOrderRecord = record.load({ - type: 'salesorder', - id: stSalesOrderId - }); - - var stLineCount = objSalesOrderRecord.getLineCount({ sublistId: 'item' }); - - log.debug('reduce: Line Count', stLineCount); - - if (stLineCount > 0) { - log.debug('reduce: Get Extend Data', '**START**'); - var objExtendData = _getExtendData(stLineCount, objSalesOrderRecord); - log.audit('reduce: Line Data to Extend Object', objExtendData); - - if (!EXTEND_UTIL.objectIsEmpty(objExtendData)) { - log.audit('reduce: Item object not empty: PASS', EXTEND_UTIL.objectIsEmpty(objExtendData)); - // Get Extend Details from Sales Order - objExtendData = EXTEND_UTIL.getSalesOrderInfo(objExtendData, objSalesOrderRecord); - log.audit('reduce: SO Data to Extend Object', objExtendData); - EXTEND_UTIL.createExtendContracts(objExtendData, objSalesOrderRecord); - } - } - - } catch (e) { - log.error('reduce', 'key: ' + context.key + ' error: ' + e); - record.submitFields({ - type: record.Type.SALES_ORDER, - id: stSalesOrderId, - values: { - 'custbody_ext_process_error': true - }, - options: { - enableSourcing: false, - ignoreMandatoryFields: true - } - }); - // create user note attached to record - var objNoteRecord = record.create({ - type: record.Type.NOTE, - }) - objNoteRecord.setValue('transaction', stSalesOrderId); - objNoteRecord.setValue('title', 'Extend Error Contract Create'); - objNoteRecord.setValue('note', JSON.stringify(e.message)); - var stNoteId = objNoteRecord.save(); - log.debug('reduce', 'stNoteId: ' + stNoteId); - - } - } - exports.summarize = function (summary) { - log.audit('summarize', '** START **'); - try { - var mapKeys = []; - summary.mapSummary.keys.iterator().each(function (key) { - mapKeys.push(key); - return true; - }); - if (mapKeys.length < 1) { - log.debug('summarize', 'No results were processed'); - } - log.debug('summarize', JSON.stringify(summary)); - - } catch (e) { - log.error('summarize', 'error: ' + e); - } - } - - //////////////////////////SUPPORT FUNCTIONS/////////////////////////// - - function _getExtendData(stLineCount, objNewRecord) { - log.debug('_getExtendData: Get Extend Data', '**ENTER**'); - var objExtendItemData = {}; - - var stExtendItemId = runtime.getCurrentScript().getParameter('custscript_ext_protection_plan'); - for (var i = 0; i < stLineCount; i++) { - var stItemId = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }); - //Check if item is one of the configured extend items - if (stExtendItemId === stItemId) { - log.debug('_getExtendData: Item Found | Line ', stItemId + ' | ' + i); - //get qty of contracts created & compare to extend item qty - var stContractQty = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_contract_qty', line: i }); - var stExtendItemQty = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantity', line: i }); - - if (stContractQty < stExtendItemQty) { - - //get related item from extend line - var stExtendItemRefId = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i }); - //check for new fulfillments - for (var j = 0; j < stLineCount; j++) { - var stRelatedItem = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: j }); - if (stRelatedItem === stExtendItemRefId) { - - var stRelatedItemQtyFulfilled = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'quantityfulfilled', line: j }); - if (stRelatedItemQtyFulfilled <= stExtendItemQty && stRelatedItemQtyFulfilled > stContractQty) { - - var stUniqueKey = i; - // Start building the Extend Order Info Object - objExtendItemData[stUniqueKey] = {}; - objExtendItemData[stUniqueKey].quantity = Math.min(stRelatedItemQtyFulfilled, (stExtendItemQty - stContractQty)); - objExtendItemData[stUniqueKey].item = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i }); - objExtendItemData[stUniqueKey].line = i; - objExtendItemData[stUniqueKey].purchase_price = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'rate', line: j }); - objExtendItemData[stUniqueKey].extend_plan_id = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_plan_id', line: i }); - objExtendItemData[stUniqueKey].itemId = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'custcol_ext_associated_item', line: i });; - objExtendItemData[stUniqueKey].plan_price = objNewRecord.getSublistValue({ sublistId: 'item', fieldId: 'rate', line: i }); - - } - } - } - - } - } - } - - log.debug('_getExtendData: return objExtendItemData', objExtendItemData); - - return objExtendItemData - }; - - return exports; - }); diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_order_mr.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_order_mr.js new file mode 100644 index 0000000..75c4753 --- /dev/null +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_order_mr.js @@ -0,0 +1,104 @@ +/** + *@name: EXTEND SUITESCRIPT SDK - Create Contract from Fulfillment JS + *@description: + * This script invokes a call to the Extend Contracts POST endpoint whenever + * an item with a protection plan is fulfilled + * + *@copyright Extend, Inc + *@author Michael Draper + * + *@NApiVersion 2.x + *@NScriptType MapReduceScript + *@ModuleScope Public + */ +define([ + 'N/runtime', + 'N/record', + 'N/search', + '../lib/customscript_ext_util', + '../lib/customscript_ext_config_lib' + +], + function (runtime, record, search, EXTEND_UTIL, EXTEND_CONFIG) { + var exports = {}; + + exports.getInputData = function () { + try { + log.audit('getInputData', '** START **'); + //todo build search in getinput instead of param? + var stSalesOrderSearchID = runtime.getCurrentScript().getParameter('custscript_ext_order_search'); + + log.debug('stSalesOrderSearchID', stSalesOrderSearchID); + var salesOrderSearch = search.load({ + id: stSalesOrderSearchID + }); + + return salesOrderSearch; + + } catch (e) { + log.error('getInputData', 'error: ' + e); + } + } + exports.reduce = function (context) { + try { + log.debug('reduce', '** START **'); + + var stSalesOrderId = context.key; + log.audit('reduce', 'stSalesOrderId: ' + stSalesOrderId); + //Load associated Saled Order Record + var objSalesOrderRecord = record.load({ + type: 'salesorder', + id: stSalesOrderId + }); + // Get Extend Details from Sales Order + var stExtendConfigRecId = runtime.getCurrentScript().getParameter('custscript_ext_config_rec'); + var objExtendConfig = EXTEND_CONFIG.getConfig(stExtendConfigRecId); + objExtendData = EXTEND_UTIL.createExtendOrder(objSalesOrderRecord, objExtendConfig); + + } catch (e) { + log.error('reduce', 'key: ' + context.key + ' error: ' + e); + record.submitFields({ + type: record.Type.SALES_ORDER, + id: stSalesOrderId, + values: { + 'custbody_ext_process_error': true + }, + options: { + enableSourcing: false, + ignoreMandatoryFields: true + } + }); + // create user note attached to record + var objNoteRecord = record.create({ + type: record.Type.NOTE, + }) + objNoteRecord.setValue('transaction', stSalesOrderId); + objNoteRecord.setValue('title', 'Extend Error Order Create'); + objNoteRecord.setValue('note', JSON.stringify(e.message)); + var stNoteId = objNoteRecord.save(); + log.debug('reduce', 'stNoteId: ' + stNoteId); + + } + } + exports.summarize = function (summary) { + log.audit('summarize', '** START **'); + try { + var mapKeys = []; + summary.mapSummary.keys.iterator().each(function (key) { + mapKeys.push(key); + return true; + }); + if (mapKeys.length < 1) { + log.debug('summarize', 'No results were processed'); + } + log.debug('summarize', JSON.stringify(summary)); + + } catch (e) { + log.error('summarize', 'error: ' + e); + } + } + + + + return exports; + }); diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_fulfill_order_mr.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_fulfill_order_mr.js new file mode 100644 index 0000000..f026c9c --- /dev/null +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_fulfill_order_mr.js @@ -0,0 +1,109 @@ +/** + *@name: EXTEND SUITESCRIPT SDK - Create Contract from Fulfillment JS + *@description: + * This script invokes a call to the Extend Contracts POST endpoint whenever + * an item with a protection plan is fulfilled + * + *@copyright Extend, Inc + *@author Michael Draper + * + *@NApiVersion 2.x + *@NScriptType MapReduceScript + *@ModuleScope Public + */ +define([ + 'N/runtime', + 'N/record', + 'N/search', + '../lib/customscript_ext_util', + '../lib/customscript_ext_config_lib' + +], + function (runtime, record, search, EXTEND_UTIL, EXTEND_CONFIG) { + var exports = {}; + + exports.getInputData = function () { + try { + log.audit('getInputData', '** START **'); + //todo build search in getinput instead of param? + var stFulfillmentSearchID = runtime.getCurrentScript().getParameter('custscript_ext_fulfill_search'); + + log.debug('stFulfillmentSearchID', stFulfillmentSearchID); + var fulfillmentSearch = search.load({ + id: stFulfillmentSearchID + }); + + return fulfillmentSearch; + + } catch (e) { + log.error('getInputData', 'error: ' + e); + } + } + + exports.map = function (context) { + try { + log.debug('map', '** START **'); + log.audit('map context', context); + + var contextValues = JSON.parse(context.value); + var stFulfillmentId = contextValues.id; + var stSalesOrderId = contextValues.values.createdfrom.value; + log.audit('stSalesOrderId | stFulfillmentId', stSalesOrderId + '|' + stFulfillmentId); + + //Load associated Saled Order Record + var objSalesOrderRecord = record.load({ + type: 'salesorder', + id: stSalesOrderId + }); + // Get Extend Details from Fulfillment + var stExtendConfigRecId = runtime.getCurrentScript().getParameter('custscript_ext_config'); + var objExtendConfig = EXTEND_CONFIG.getConfig(stExtendConfigRecId); + objExtendData = EXTEND_UTIL.fulfillExtendOrder(objSalesOrderRecord, stFulfillmentId, objExtendConfig); + + + } catch (e) { + log.error('map', 'error: ' + e); + var id = record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: stFulfillmentId, + values: { + 'custbody_ext_process_error': true + }, + options: { + enableSourcing: false, + ignoreMandatoryFields: true + } + }); + //create user note attached to record + var objNoteRecord = record.create({ + type: record.Type.NOTE, + }) + objNoteRecord.setValue('transaction', stFulfillmentId); + objNoteRecord.setValue('title', stFulfillmentId); + objNoteRecord.setValue('note', e.message); + objNoteRecord.save(); + + } + } + exports.summarize = function (summary) { + log.audit('summarize', '** START **'); + try { + var mapKeys = []; + summary.mapSummary.keys.iterator().each(function (key) { + mapKeys.push(key); + return true; + }); + if (mapKeys.length < 1) { + log.debug('summarize', 'No results were processed'); + } + log.debug('summarize', JSON.stringify(summary)); + + } catch (e) { + log.error('summarize', 'error: ' + e); + } + } + + + + return exports; + }); diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_refund_contract_mr.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_refund_contract_mr.js new file mode 100644 index 0000000..d3ad3a1 --- /dev/null +++ b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_refund_contract_mr.js @@ -0,0 +1,147 @@ +/** + *@name: EXTEND SUITESCRIPT SDK - Create Contract from Fulfillment JS + *@description: + * This script invokes a call to the Extend Refunds POST endpoint whenever + * a protection plan is refunded + * + *@copyright Extend, Inc + *@author Michael Draper + * + *@NApiVersion 2.x + *@NScriptType MapReduceScript + *@ModuleScope Public + */ + define([ + 'N/runtime', + 'N/record', + 'N/search', + '../lib/customscript_ext_util', + '../lib/customscript_ext_config_lib' + +], + function (runtime, record, search, EXTEND_UTIL, EXTEND_CONFIG) { + var exports = {}; + + exports.getInputData = function () { + try { + log.audit('getInputData', '** START **'); + //todo build search in getinput instead of param? + var stRefundSearchID = runtime.getCurrentScript().getParameter('custscript_ext_refund_search'); + + log.debug('stRefundSearchID', stRefundSearchID); + var refundSearch = search.load({ + id: stRefundSearchID + }); + + return refundSearch; + + } catch (e) { + log.error('getInputData', 'error: ' + e); + } + } + + exports.reduce = function (context) { + try { + log.debug('reduce', '** START **'); + + var stRefundId = context.key; + log.debug('reduce', 'stRefundId: ' + stRefundId); + + var objContextValues = JSON.parse(context.values[0]); + log.debug('reduce', 'objContextValues: ' + JSON.stringify(objContextValues)); + + var stRefundType = objContextValues['recordType'] + log.debug('reduce', 'stRefundType: ' + stRefundType); + + var stLineUniqueKey = objContextValues.values.lineuniquekey; + log.debug('reduce', 'stLineUniqueKey: ' + stLineUniqueKey); + + var stQuantityToRefund = objContextValues.values.quantity + log.debug('reduce', 'stQuantityToRefund: ' + stQuantityToRefund); + + var stLineTranID = objContextValues.values.custcol_ext_line_id + log.debug('reduce', 'stLineTranID: ' + stLineTranID); + + var arrActiveIDs = objContextValues.values.custcol_ext_contract_id; + log.debug('reduce', 'arrActiveIDs: ' + arrActiveIDs + " type - "+typeof arrActiveIDs); + arrActiveIDs = arrActiveIDs ? JSON.parse(arrActiveIDs) : []; + + var arrCanceledIDs = objContextValues.values.custcol_ext_canceled_contract_ids; + log.debug('reduce', 'arrCanceledIDs: ' + arrCanceledIDs + " type - "+typeof arrCanceledIDs); + arrCanceledIDs = arrCanceledIDs ? JSON.parse(arrCanceledIDs) : []; + + var objRefundData = { + 'ID' : stRefundId, + 'TYPE' : stRefundType, + 'UNIQUE_KEY' : stLineUniqueKey, + 'QTY' : stQuantityToRefund, + 'lineItemTransactionId' : stLineTranID, + 'activeIDs' : arrActiveIDs, + 'canceledIDs' : arrCanceledIDs + } + + //call to refund by line item transaction id + var stExtendConfigRecId = runtime.getCurrentScript().getParameter('custscript_ext_config_record'); + var objExtendConfig = EXTEND_CONFIG.getConfig(stExtendConfigRecId); + objExtendData = EXTEND_UTIL.refundExtendOrder(objRefundData, objExtendConfig); + + //Load associated Saled Order Record + // var objRefundRecord = record.load({ + // type: stRefundType, + // id: stRefundId + // }); + + // log.debug('reduce', 'objRefundRecord - '+ JSON.stringify(objRefundRecord)); + // Get Extend Details from Sales Order + // objExtendData = EXTEND_UTIL.refundExtendOrder(objRefundRecord); + + } catch (e) { + log.error('reduce', 'key: ' + context.key + ' error: ' + e); + + record.submitFields({ + type: stRefundType, + id: stRefundId, + values: { + 'custbody_ext_process_error': true + }, + options: { + enableSourcing: false, + ignoreMandatoryFields: true + } + }); + + // create user note attached to record + var objNoteRecord = record.create({ + type: record.Type.NOTE, + }) + + objNoteRecord.setValue('transaction', stFulfillmentId); + objNoteRecord.setValue('title', 'Extend Error Contract Refund'); + objNoteRecord.setValue('note', JSON.stringify(e.message)); + var stNoteId = objNoteRecord.save(); + log.debug('reduce', 'stNoteId: ' + stNoteId); + + } + } + + exports.summarize = function (summary) { + log.audit('summarize', '** START **'); + try { + var mapKeys = []; + summary.mapSummary.keys.iterator().each(function (key) { + mapKeys.push(key); + return true; + }); + + if (mapKeys.length < 1) { + log.debug('summarize', 'No results were processed'); + } + log.debug('summarize', JSON.stringify(summary)); + + } catch (e) { + log.error('summarize', 'error: ' + e); + } + } + + return exports; + }); diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/suitelet/customscript_ext_offer_modal_sl.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/suitelet/customscript_ext_offer_modal_sl.js deleted file mode 100644 index fa9adc8..0000000 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/suitelet/customscript_ext_offer_modal_sl.js +++ /dev/null @@ -1,396 +0,0 @@ -/** - *@name: EXTEND SUITESCRIPT SDK - Offer Modal Suitelet - *@description: - * Suitelet called by Sales Order client script to display protection plans - * in a popup window. The user can then select a warranty and on submit, - * the suitelet will post and append a new line for the Warranty non-inventory item - * with the description and pricing. - * - *@copyright Extend, Inc. - *@author Michael Draper - * - *@NApiVersion 2.x - *@NScriptType Suitelet - *@NModuleScope Public - */ -define([ - 'N/ui/serverWidget', - 'N/runtime', - 'N/http', - 'N/error', - '../lib/customscript_ext_api_lib' -], - function (ui, runtime, http, error, api) { - - var exports = {}; - - exports.onRequest = function (context) { - var objEventRouter = {}; - - objEventRouter[http.Method.GET] = _handleGet; - objEventRouter[http.Method.POST] = _handlePost; - - if (!objEventRouter[context.request.method]) { - _handleError(context); - } - try { - objEventRouter[context.request.method](context); - } catch (e) { } - }; - - - function _handleGet(context) { - - _renderForm(context); - } - // Post Handler - function _handlePost(context) { - try { - log.debug('POST: Context Object', JSON.stringify(context)); - - var objRequest = context.request; - - var objExtendItem = {}; - - var stPlanCount = objRequest.getLineCount({ group: 'custpage_plans' }); - objExtendItem.stWarrantyItemId = runtime.getCurrentScript().getParameter({ name: 'custscript_ext_protection_plan' }); - - //Line Number - // var stProductLine = objRequest.parameters.custpage_line_num; - // log.debug('POST: Product Line', stProductLine); - - objExtendItem.stItemId = objRequest.parameters.custpage_item_select; - objExtendItem.stItemName = objRequest.parameters.custpage_item_name.trim(); - objExtendItem.stItemQty = objRequest.parameters.custpage_item_qty; - objExtendItem.stPlanId = ''; - objExtendItem.stPrice = 0; - objExtendItem.stDescription = ''; - - // Get line information from selected line - for (var i = 0; i < stPlanCount; i++) { - - var bSelected = objRequest.getSublistValue({ group: 'custpage_plans', name: 'custpage_select', line: i }) == "T" ? true : false; - - if (bSelected) { - - objExtendItem.stPlanId = objRequest.getSublistValue({ group: 'custpage_plans', name: 'custpage_item_id', line: i }); - objExtendItem.stPrice = objRequest.getSublistValue({ group: 'custpage_plans', name: 'custpage_plan_price', line: i }); - - objExtendItem.stTerm = objRequest.getSublistValue({ group: 'custpage_plans', name: 'custpage_plan_term', line: i }); - objExtendItem.stDescription = _getDescription(objExtendItem.stTerm); - objExtendItem.stDescription += ' | ' + objExtendItem.stItemName; - break; - } - } - log.debug('objExtendItem', objExtendItem); - - var html = _buildhtml(objExtendItem); - // Write repsponse - context.response.write(html); - - } catch (e) { - log.error('POST error', e); - } - } - function _buildhtml(objExtendItem) { - // Prepare window.opener html to post values back to the line - try { - var html = ""; - html += " "; - html += " "; - html += " "; - html += ""; - - return html; - } catch (e) { - log.error('POST error', e); - - } - }; - function _getDescription(stTerm) { - var stText = ''; - //term change to formula instead of case - var stTermYears = parseInt(stTerm) / 12; - log.debug('stTermYears', stTermYears); - stText = "Extend " + stTermYears + "yr Protection Plan"; - return stText; - }; - function _handleError(context) { - - throw error.create({ - name: "SSS_UNSUPPORTED_REQUEST_TYPE", - message: "Suitelet only supports GET and POST", - notifyOff: true - }); - }; - // Builds Suitelet Form - function _renderForm(context) { - try { - log.debug('GET Params', context.request.parameters); - // Get plans and populate sublist - log.debug('arrItemList', context.request.parameters.arrItemid + typeof context.request.parameters.arrItemid); - var arrItemList = []; - arrItemList = JSON.parse(context.request.parameters.arrItemid); - var stItemInternalId = context.request.parameters.itemid; - var stItemRefId = context.request.parameters.refid; - log.debug('stItemRefId', stItemRefId); - - // Create the form - var objForm = ui.createForm({ - title: 'Extend Protection Plans', - hideNavBar: true - }); - /** - * HEADER FIELDS - */ - //Hidden field of line number - var objLineNumField = objForm.addField({ - id: 'custpage_line_num', - type: ui.FieldType.INTEGER, - label: 'Line Number' - }); - objLineNumField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - //Hidden field of item array - var objItemListField = objForm.addField({ - id: 'custpage_item_list', - type: ui.FieldType.TEXTAREA, - label: 'Item List' - }); - objItemListField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - if (context.request.parameters.arrItemid) { - objItemListField.defaultValue = context.request.parameters.arrItemid; - - } - //Hidden field of item name - var objItemNameField = objForm.addField({ - id: 'custpage_item_name', - type: ui.FieldType.TEXT, - label: 'Item Name' - }); - objItemNameField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - if (context.request.parameters.itemtext) { - objItemNameField.defaultValue = context.request.parameters.itemtext; - - } - //Hidden field of item refid - var objItemRefIdField = objForm.addField({ - id: 'custpage_item_ref_id', - type: ui.FieldType.TEXT, - label: 'Item Ref ID' - }); - objItemRefIdField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - if (context.request.parameters.refid) { - objItemRefIdField.defaultValue = context.request.parameters.refid; - - } - //Hidden field of item name - var objItemQtyField = objForm.addField({ - id: 'custpage_item_qty', - type: ui.FieldType.TEXT, - label: 'Item Quantity' - }); - objItemQtyField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - if (context.request.parameters.quantity) { - objItemQtyField.defaultValue = context.request.parameters.quantity; - - } - //Telesales Script Group - var objScriptGroup = objForm.addFieldGroup({ - id: 'custpage_script', - label: 'Telesales Script' - }); - //OFFER TELESALES ASK SCRIPT - var objOfferTextField = objForm.addField({ - id: 'custpage_offer_text', - type: ui.FieldType.TEXTAREA, - label: 'Customer Ask:', - container: 'custpage_script' - }); - objOfferTextField.updateBreakType({ - breakType: ui.FieldBreakType.STARTCOL - }); - objOfferTextField.updateDisplayType({ - displayType: ui.FieldDisplayType.INLINE - }); - objOfferTextField.defaultValue = "We have several protection plans available for your purchase \n These protection plans cover accidental damage in addition to standard defects \n Would you be interested in protecting your purchase with us today? \n "; - //Next Steps Group - var objProcessGroup = objForm.addFieldGroup({ - id: 'custpage_process', - label: 'Adding an Extend Protection Plan' - }); - //OFFER TELESALES INSTRUCTION SCRIPT - var objProcessScript = objForm.addField({ - id: 'custpage_process_text', - type: ui.FieldType.TEXTAREA, - label: 'Instructions', - container: 'custpage_process' - }); - objProcessScript.updateBreakType({ - breakType: ui.FieldBreakType.STARTCOL - }); - objProcessScript.updateDisplayType({ - displayType: ui.FieldDisplayType.INLINE - }); - objProcessScript.defaultValue = "1. Select an Item from the drop down list \n 2.Check the box next to the protection plan your customer has selected \n 3. Click on the blue submit button to add the protection plan and return to the order \n 4. If the customer does not want a protection plan, simply click cancel"; - var objItemGroup = objForm.addFieldGroup({ - id: 'custpage_item', - label: 'Item' - }); - var objItemSelectField = objForm.addField({ - id: 'custpage_item_select', - type: ui.FieldType.SELECT, - label: 'Select Item', - container: 'custpage_item' - }); - //Iterate Items from params - for (var i = 0; i < arrItemList.length; i++) { - objItemSelectField.addSelectOption({ - value: arrItemList[i].id, - text: arrItemList[i].name - }); - } - if (stItemInternalId) { - objItemSelectField.defaultValue = stItemInternalId; - } - /** - * BUILD SUBLIST - */ - // Add plans sublist - var objPlanList = objForm.addSublist({ - id: 'custpage_plans', - type: ui.SublistType.LIST, - label: 'Eligble Plans' - }); - objPlanList.addField({ - id: 'custpage_select', - type: ui.FieldType.CHECKBOX, - label: 'Select' - }); - var objItemIdField = objPlanList.addField({ - id: 'custpage_item_id', - type: ui.FieldType.TEXT, - label: 'ID' - }); - objItemIdField.updateDisplayType({ - displayType: ui.FieldDisplayType.HIDDEN - }); - objPlanList.addField({ - id: 'custpage_plan_title', - type: ui.FieldType.TEXT, - label: 'Title' - }); - objPlanList.addField({ - id: 'custpage_plan_term', - type: ui.FieldType.TEXT, - label: 'Coverage Term (Months)' - }); - objPlanList.addField({ - id: 'custpage_plan_price', - type: ui.FieldType.CURRENCY, - label: 'Price' - }); - - // Add Submit Button - objForm.addButton({ - id: 'custpage_cancel', - label: 'Cancel', - functionName: 'handleClose()' - }); - objForm.addSubmitButton('Submit'); - /** - * POPULATE SUBLIST - */ - if (stItemRefId) { - try { - var objResponse = api.getPlansByItem(stItemRefId); - log.debug('OFFER MODAL SUITELET: Offers JSON Response', objResponse); - if (objResponse.code == 200) { - var objResponseBody = JSON.parse(objResponse.body); - - log.debug('OFFER MODAL SUITELET: Offers JSON Response', objResponseBody); - - var objPlans = objResponseBody.plans; - log.debug('OFFER MODAL SUITELET: objPlans', objPlans); - - var arrPlans = objPlans.base; - log.debug('OFFER MODAL SUITELET: arrPlans', arrPlans); - - if (arrPlans.length == 0) { - var arrPlans = objPlans.adh; - } - - log.debug('arrPlans', arrPlans); - - //Populate Sublist Values - for (var i = 0; i < arrPlans.length; i++) { - objPlanList.setSublistValue({ - id: 'custpage_item_id', - line: i, - value: arrPlans[i].id - }); - objPlanList.setSublistValue({ - id: 'custpage_plan_title', - line: i, - value: arrPlans[i].title - }); - objPlanList.setSublistValue({ - id: 'custpage_plan_term', - line: i, - value: parseInt(arrPlans[i].contract.termLength) - }); - objPlanList.setSublistValue({ - id: 'custpage_plan_price', - line: i, - value: parseFloat(arrPlans[i].price) / 100 - }); - } - } - - } catch (e) { - - } - - } - //Set Client handler - objForm.clientScriptModulePath = '../client/customscript_ext_offer_modal_controller.js'; - //Write Page - context.response.writePage(objForm); - } catch (e) { - - } - }; - return exports; - - }); \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/userevent/customscript_ext_offer_modal_ue.js b/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/userevent/customscript_ext_offer_modal_ue.js deleted file mode 100644 index fe33b04..0000000 --- a/com.extend.extendproductprotection/src/FileCabinet/SuiteApps/com.extend.extendproductprotection/userevent/customscript_ext_offer_modal_ue.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - *@name: EXTEND SUITESCRIPT SDK - Offer Modal Controller - *@description: - * User Event script that shows a button on Sales Order to call a popup suitelet - * for the user to select the appropriate protection plan. - * - *@copyright Extend, Inc. - *@author Michael Draper - * - *@NApiVersion 2.x - *@NScriptType UserEventScript - */ - define(['N/runtime'], function(runtime) { - // Add button for Suitelet - var exports = {}; - exports.beforeLoad = function(context){ - - - var objEventRouter = { - 'create': _addButton, - 'edit': _addButton - } - - if (typeof objEventRouter[context.type] !== 'function') { - return true; - } - - objEventRouter[context.type](context); - return true; - - } - function _addButton(context){ - try - { - const recCurrent = context.newRecord; - const objForm = context.form; - objForm.clientScriptModulePath = '../client/customscript_ext_so_offer_controller_cs.js'; - objForm.addButton({ - id : 'custpage_open_suitelet', - label: 'Add Protection Plan', - functionName: 'openSuitelet()' - }); - } catch (error) - { - log.error('beforeLoad_addButton', error.message); - } - } - - return exports; - - -}); \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_create.xml b/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_create.xml new file mode 100644 index 0000000..20fa619 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_create.xml @@ -0,0 +1,61 @@ + + 2 + F + F + F + F + F + F + F + F + T + F + F + F + F + F + F + F + F + F + F + F + T + F + F + F + F + + + + + NORMAL + + + F + CHECKBOX + + F + + F + F + F + + + + + + + + + + 2 + + F + F + + + + T + + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_id.xml b/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_id.xml new file mode 100644 index 0000000..90ed8c0 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_order_id.xml @@ -0,0 +1,61 @@ + + 2 + F + F + F + F + F + F + F + F + T + F + T + F + F + F + F + F + F + F + F + F + T + F + F + F + F + + + + + NORMAL + + + F + TEXT + + F + + F + F + F + + + + + + + + + + 2 + + F + F + + + + T + + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/custbody_ext_process_error.xml b/com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_process_error.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/custbody_ext_process_error.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custbody_ext_process_error.xml diff --git a/com.extend.extendproductprotection/src/Objects/custcol_ext_associated_item.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_associated_item.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/custcol_ext_associated_item.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_associated_item.xml diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_canceled_contract_ids.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_canceled_contract_ids.xml new file mode 100644 index 0000000..a1d8db7 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_canceled_contract_ids.xml @@ -0,0 +1,53 @@ + + 2 + F + F + F + F + F + F + F + F + F + F + F + F + F + F + F + F + F + F + T + F + F + F + F + F + F + + + + + NORMAL + + + F + TEXTAREA + Array of cancelled contract ids. + F + F + + + + + + + 2 + + F + + + + T + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/custcol_ext_contract_id.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_contract_id.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/custcol_ext_contract_id.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_contract_id.xml diff --git a/com.extend.extendproductprotection/src/Objects/custcol_ext_contract_qty.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_lead_token.xml similarity index 90% rename from com.extend.extendproductprotection/src/Objects/custcol_ext_contract_qty.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_lead_token.xml index bba641a..e6a5e6f 100644 --- a/com.extend.extendproductprotection/src/Objects/custcol_ext_contract_qty.xml +++ b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_lead_token.xml @@ -1,6 +1,6 @@ - + 2 - T + F F F F @@ -33,11 +33,11 @@ F - INTEGER + TEXT F F - + diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_line_id.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_line_id.xml new file mode 100644 index 0000000..6222c79 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_line_id.xml @@ -0,0 +1,53 @@ + + 2 + F + F + F + F + F + F + T + F + F + F + F + F + F + F + F + F + F + F + T + F + F + F + F + F + F + + + + + NORMAL + + + F + TEXT + + F + F + + + + + + + 2 + + F + + + + T + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/custcol_ext_plan_id.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_plan_id.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/custcol_ext_plan_id.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_plan_id.xml diff --git a/com.extend.extendproductprotection/src/Objects/custcol_ext_plan_term.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_plan_term.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/custcol_ext_plan_term.xml rename to com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_plan_term.xml diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_so_line.xml b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_so_line.xml new file mode 100644 index 0000000..75d47f6 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custcol_ext_so_line.xml @@ -0,0 +1,53 @@ + + 2 + F + F + F + F + F + F + T + F + F + F + F + F + F + F + F + F + F + F + T + F + F + F + F + F + F + + + + + NORMAL + + + F + TEXT + + F + F + + + + + + + 2 + + F + + + + T + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Fields/custitem_ext_item_ref_id.xml b/com.extend.extendproductprotection/src/Objects/Fields/custitem_ext_item_ref_id.xml new file mode 100644 index 0000000..6b3e5ff --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Fields/custitem_ext_item_ref_id.xml @@ -0,0 +1,51 @@ + + 2 + F + T + T + T + F + F + F + F + F + F + F + F + F + + + + + NORMAL + + + F + TEXT + F + + F + F + F + F + F + BOTH + + + + + + + + + + 2 + + F + F + + + + T + ITEMMAIN + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customlist_ext_environment.xml b/com.extend.extendproductprotection/src/Objects/Records/customlist_ext_environment.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/customlist_ext_environment.xml rename to com.extend.extendproductprotection/src/Objects/Records/customlist_ext_environment.xml diff --git a/com.extend.extendproductprotection/src/Objects/customrecord_ext_configuration.xml b/com.extend.extendproductprotection/src/Objects/Records/customrecord_ext_configuration.xml similarity index 87% rename from com.extend.extendproductprotection/src/Objects/customrecord_ext_configuration.xml rename to com.extend.extendproductprotection/src/Objects/Records/customrecord_ext_configuration.xml index 2688533..83bf1e1 100644 --- a/com.extend.extendproductprotection/src/Objects/customrecord_ext_configuration.xml +++ b/com.extend.extendproductprotection/src/Objects/Records/customrecord_ext_configuration.xml @@ -274,5 +274,44 @@ T + + 2 + F + F + F + F + + + + + NORMAL + + + F + SELECT + F + + F + F + F + + + + + + SET_NULL + + F + + + 2 + -10 + F + + + + T + + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customscript_ext_config_validate_ue.xml b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_config_validate_ue.xml similarity index 100% rename from com.extend.extendproductprotection/src/Objects/customscript_ext_config_validate_ue.xml rename to com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_config_validate_ue.xml diff --git a/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_create_order_mr.xml b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_create_order_mr.xml new file mode 100644 index 0000000..4be1161 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_create_order_mr.xml @@ -0,0 +1,105 @@ + + + F + Extend | MR | Order Create + F + + T + [/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_order_mr.js] + + + 2 + F + F + F + + + + + NORMAL + + + SELECT + + F + F + + + + + + NO_ACTION + 2 + -119 + + T + + + 2 + F + F + F + + + + + NORMAL + + + SELECT + + F + F + + + + + + NO_ACTION + -119 + 2 + + T + + + + + 1 + 1 + [scriptid=customsearch_ext_order_create] + T + DEBUG + T + ADMINISTRATOR + NOTSCHEDULED + Extend | MR | Order Create + 60 + + + + 2022-06-15 + 01:00:00Z + + + + + 1 + 1 + [scriptid=customsearch_ext_order_create_2] + T + DEBUG + T + ADMINISTRATOR + NOTSCHEDULED + Extend | MR | Order Create - On Demand + 60 + + + + 2023-02-07 + 02:00:00Z + + + + + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_fulfill_order_mr.xml b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_fulfill_order_mr.xml new file mode 100644 index 0000000..d8c0fb2 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_fulfill_order_mr.xml @@ -0,0 +1,59 @@ + + + F + Extend | MR | Fulfill Order + F + + T + [/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_fulfill_order_mr.js] + + + 2 + F + F + F + + + + + NORMAL + + + SELECT + + F + F + + + + + + NO_ACTION + 2 + -119 + + T + + + + + 1 + 1 + [scriptid=customsearch_ext_fulfillment] + T + DEBUG + T + ADMINISTRATOR + NOTSCHEDULED + Extend | MR | Fulfill Order + 60 + + + + 2022-06-25 + 01:00:00Z + + + + + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customscript_ext_create_contract_mr.xml b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_refund_create_mr.xml similarity index 75% rename from com.extend.extendproductprotection/src/Objects/customscript_ext_create_contract_mr.xml rename to com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_refund_create_mr.xml index 0e27417..0650ca4 100644 --- a/com.extend.extendproductprotection/src/Objects/customscript_ext_create_contract_mr.xml +++ b/com.extend.extendproductprotection/src/Objects/Scripts/customscript_ext_refund_create_mr.xml @@ -1,13 +1,13 @@ - + F - Extend | MR | Contract Create + Extend | MR | Refund Create F T - [/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_create_contract_mr.js] + [/SuiteApps/com.extend.extendproductprotection/mapreduce/customscript_ext_refund_contract_mr.js] - + 2 F F @@ -23,7 +23,7 @@ F F - + @@ -36,21 +36,21 @@ - + 1 1 - [scriptid=customsearch_ext_contract_create] + [scriptid=customsearch_ext_order_refund] T DEBUG T ADMINISTRATOR NOTSCHEDULED - Extend | MR | Contract Create + Extend | MR | Refund Create 60 - 2022-03-01 + 2022-11-08 02:00:00Z diff --git a/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_fulfillment.xml b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_fulfillment.xml new file mode 100644 index 0000000..cbef55d --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_fulfillment.xml @@ -0,0 +1,7 @@ + + + + [scriptid=custbody_ext_order_create] + + 764fde57f5ddd6e99e7f335eebba02a661803ea757eeb0274aab931c18eff9b4@GZC@2023.1.11@H4sIAAAAAAAA/+1dW2/iuhZ+39L+Dyh9O9IuxKEXEGUrJKbNbi4ol85wXqIMuHuyD5cqpDPT0fnxx84FwrXFJHCYeD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XY6ytKqb2/dxtX6Uc6weMEQyXW/nHMsL8wXnuN6fc6wSgZOxBipV3cSqutlfVTdlU9VtrKrb/VV1WzZVNWJVNfZXVaNsquKTBRK/Y4W0TVk8xRLpzLWVLnp4Cm3xpdMWSLQFKLQFSqctIdGWQKEtoXTaqifaqlNoq146bV0l2rqi0NZV6bSVEHiegsHzpaPwfMLheQoSz5eOxfMJjecpeDxfOiLPJ0yep6DyfOm4PEi4PKDg8qB0XB4kXB5QcHlQOi4PEi4PKLg8KB2XBwmXBxRcHpSOy4OEywMKLg9Kx+VBwuUBBZcHpePyIOHygILLg9JxeZBweUDB5UHpuDxIuDyg4PKgdFweJFweUHB5UDouLyRcXqDg8kLpuLyQcHmBgssL58zlKR/777GTMVIr2ONR/9IWx8Of8m8Ue8qn+0LC7QUKbi+UjtsLCbcXKLi9cM7c/jBkru5JjFS4xws3JFSYG/aIsJMiLuHwAgWHF0rH4YWEwwsUHF44Zw5/IOJW9hRGKrzdA3GNPBHXODHiUgVQcHWhdFy9nnD1OgVXr58zVz+QfX5wT2CkWn4PBrqyWTA/Droi+JQIrSfx+DpFPL5eunh8PeHsdQrOXj8Lzr6aFG2kShItFPjeyP+JhsaXf9AglKaT0PMnKGj//tv/ADFWv1+BsQAA + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create.xml b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create.xml new file mode 100644 index 0000000..463fc85 --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create.xml @@ -0,0 +1,7 @@ + + + + [scriptid=custbody_ext_order_create] + + 238a872c32ca375f6e60e69875b5789c5c43e963fe74490b1e682d44050f8f1f@GZC@2023.1.11@H4sIAAAAAAAA/+1cW2/iyBJ+X2n/g+W8HWkx5EISRFgZuwne+ILa7SScF8sDnR2fAwbZJjMZnR9/qm0M5pYEp0lmNo6QCO3u6qrqqvqq2m03//w+HgmPNIz8SXAl1ipVUaD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6OWauVnvmenrlsWS1dhzSGAne/QlZFJHkObKWQlVYpRZMwBr+fjYPXV/oWJq5i6Y5hfkx5nGOAw55Nop6Pqo31hWm8vThObnsgW0GmqpnXLzwL9ZzlrdgExIYwhj7+1IcV3XO7JnlMCyNF62nIJPa6KW6nvdpaeLIdsyy3wPIvB5E23yCStczNwmeqWWt7EuJkSdZD6PxFKy++LYN1qoqt5nrHVORWvnsmzX/pE9uoZV/NmJnhyGPsAm8gWwiNqY22aOA6oIL5r6y1wPs4MgrSnP7qNA+h28HLTsxbkrg27yWtsihtCiqtq3SnkrMHmba+xSb/lBO7WhOXseg1kSV7mIrHrceMFnsE0k3vdSDM+xnL/BzI6OlWH/F+TnRljp6MiXlYMbClbxPhDY9wrpC/hbho8RQgzUmzKVa5z5DiuXj7asvfdqh97gXcz7szosfA9zbC4PXJf9rwuXPwiz7NIYxOHGleAix+Z7cYMtVnP5uBN6bP0U6uN6XtzL1eoVvP+c01uvcZQDboBDS2dSB7jhKsZcup2LQ9DTG5g4OPc3PZQe31Mr4Wk9a3yVmn092YtFrULTHpdH9MWgeLD0OWQqo6S1V1tr+qzj6bquqpqur7q6r+2VR1nqrqfH9VnX82VV2kqrrYX1UXn01Vl6mqLvdX1eVnU1VtXpbVnqnLdimrVqAw+8W1lZVbtQLaqv0K2lpvSrYBpBfezdr6/bf/A2HA3UznVQAA + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create_2.xml b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create_2.xml new file mode 100644 index 0000000..2a7549c --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_create_2.xml @@ -0,0 +1,7 @@ + + + + [scriptid=custbody_ext_order_create] + + 2e7f5223b3a01dd3454629fea32c1a24c0f5278a446ed3b05f20e647f9624a76@GZC@2023.1.11@H4sIAAAAAAAA/+1c7W/iOBP/ftL9D1H67aQlQLe0RZRTSEzJNS/IcdpyX6IsuLc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qsEk/O8oTm1KTzTFjbZ8IkeO8+vu2Y8YPPucbmh7/ZUBdhfIAMSY3PH7R6qRFLRyt3PppbQj7WYqk+N5fMfeg5j4ecv7dLXhQuWbjkgV0yc/qE1TMcffP0PX3z8r19s1IunLNwzgM7J4dbAxsc8/N7Omal8u6eWS088z09c9GyXLsOaAQV7m6VrIpIfHh5qZKVlimFkyACv5+O/beX+hYmrmLpjmEepz7OMMBhjydWz7GKY31uGvtXx/GmPbIVZKqaef3KAd6XLG/JJiA2BBH0GT4OYUV33K+JzxZjpGhdDZnEXjXFzbSXW3NPtmWWxR5Y9v1W0vpLsNKWmVkMmWpW2p6FKF6S1RA6e1vYq697Yp3KYrOx2jERuZntnkrzX/rMdiHZVyNiZjjyGLvAG8gWQGNio03quw6oYPYrbd3zhVIpNWk21/KUD4HbxotOzHPiGDfrJS2zK60LLa2qd6vC05O4G1/Llj2my65WxEVcekuUSU8D87iJltJiZ/jd5GY9wrxfEpCdAxld3eoh3i86WJqjK2NiHlYMbOmbRNjjHQRL5G8hRlo8BUjy03SKZe5T1Hgp9r7Z8jedypp5AfcDW4xoFfjeRBi8Pv5PG7x0kGvepzGA0bEjzcqB+e/0fkOq+vRnw/fG9CXa8fWGtJm5tyt04z2YmUZ3foidDWJvbdw4kL0IAKxlw7GOpD0JMZkn359m5rKF2nvJuHYPig37vIuU2RxpSdbk9hU3Od+Kw6v3Blins+04vFzILnD4bHccXgXFoyFoLlXVElXVdldV7VdT1cxNzndX1fmvpqqLRFUXu6vq4ldT1WWiqsvdVXX5q6mqMquvKi8UWNuUVclRYf3k2kprpUoObVV+OW1VZ9qq5tBW9WfQ1mpTvPshvfJe9ebvv/0fHMr/X6NdAAA= + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_refund.xml b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_refund.xml new file mode 100644 index 0000000..7e1a64b --- /dev/null +++ b/com.extend.extendproductprotection/src/Objects/Searches/customsearch_ext_order_refund.xml @@ -0,0 +1,9 @@ + + + + [appid=com.extend.extendproductprotection, scriptid=custcol_ext_contract_id] + [scriptid=custcol_ext_canceled_contract_ids] + [scriptid=custcol_ext_line_id] + + 53a9fce61f7454f31f05c3099529c7fac0ebaf26bef69ce188245f0fd6256ea3@GZC@2023.1.11@H4sIAAAAAAAA/+1dW3OjuBJ+36r9Dy7nbatOHHNxLuV4C4OccILBwyWTnBeKMcoOuw5OYTwzmdoffwSI+IaTWFwcD5qaKgcBLXVLX+vrRojunz8eJ41vMJh5U/+y2T4+aTagP566nv/XZdMyB/85a/7Z+/23rj+bTccXBgw8Z+L9hK725W84DsWpHzqeD4MGEuPPLuKrLptfw/DpotX6/v37sQ/D2dwL4fF4+tiajb/CR2fWii9rNuaee9k0DVPSbxmeYVieuzCcb9A1oBOMv16M57Nw+jiLD2z4I7SngQsDO4APc9+9aHdOO50Oc86f8zzfXKhwctxuNkLvEc5C5/EJqbRyXQ8r8ug8PaFWr9zVQ02M2juB7l8wQA0O4HFSO/rBegfHyZ3HSRuH8UG3tSw0rcKFD57vhUh8r5tcLS2VuHA2DryncIquDyCqyzWfn2BjPHFms8tmcr3+Ut7sGUDQxWsbqKZ+320t7uh1vzmTOZz1urfRb+PBg5P4RCpkkBY0k3OXzRtwb48E8Ua4As1Ga8cbDVGXR6YtS82orT9/XjZnYYAGC7Lea93VbcW17FDZQAaKZEtgIFiKaavCEDXWhU/Qd9H4fL6Bz5dNZTp2JlB6seQFNpIpmwo4Otlo4R/Rv0SBhmWA+LABfoRIZuPfhhY1t6Hnam7agPsR2KjdDBx/5oyj7icQrwhX9sjqK7L4IvjLdDqBjt/shcEcEopUZMPcFPjgTGakEkeajqxfsNChIF7LKihWqA6GsioBvVipxrX2GZlVvSnYrDoYAF0HUhld9iK7lM5biC+lGxfiB5o+LEu2Dgzkh4xixd/K4LMtGEh4ZPhyZF/pwui6LNFL00Ahki0V2dnUZdEExUkeCne2rn02dpvs4vZIsiH0FWBLuqwotqR9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hgc7DAEwQ5Tu2CHwcEOQxDsMATBzoFbCwcwDEEAw9QugGFwAMMQBDAMQQBz4NbCoQhDEIowhxyKkFkLP7NgCB5aMLV7asHgeIAhiAeY2sUDLI4HWIJ4gD3keIDMWvjBBUvw4IKt3YMLFnN5loDLs7Xj8izm8iwBl2drx+VZzOVZAi7P1o7Ls5jLswRcnq0dl2cxl2cJuDxbOy7PYi7PEnB5tnZcnsVcniXg8mztuDyLuTxLwOXZ2nF5DnN5joDLc7Xj8hzm8hwBl+dqx+U5zOU5Ai7P1Y7Lc5jLcwRcnqsdl+cwl+cIuDxXOy7PYS7PEXB5rnZcnsNcniPg8lztuDyHuTxHwOW52nF5DnN5joDLc7Xj8hzm8hwBl+dqx+V5zOV5Ai7P147L85jL8wRcnq8dl+cxl+cJuDxfOy7PYy7PE3B5/pC5PPmKuffuihmblXvfurjN7TJfTudZCrcpdp+r33jM7XkCbs/XjtvzmNvzBNyeP2Runw+Z69tbxiZ85wvC6b6XhWEvErZXxKUGIODwfO04PI85PE/A4flD5vA5Ebe2O2W8CcHJDog7LxJx5/tFXAdz9Q4BV+/Ujqt3MFfvEHD1ziFz9Zzs852bS8amZXdgoGu7ThbHQdcE7xWhOB/fIcjHd2qXj+9gzt4h4Oydg+Ds60Xxhny40ICB50y8n9DVvvwNx6E49UPH82HQ+/23/wPKvHcloe0AAA== + \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_modal_ue.xml b/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_modal_ue.xml deleted file mode 100644 index c204f3b..0000000 --- a/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_modal_ue.xml +++ /dev/null @@ -1,26 +0,0 @@ - - Displays button on Sales Order to trigger suitelet that displays warranty offers - F - Extend | UE | Offer Modal - F - - T - F - [/SuiteApps/com.extend.extendproductprotection/userevent/customscript_ext_offer_modal_ue.js] - - - F - T - F - F - - - ACTION|ADVANCEDREVREC|BANKCONNECTIVITY|BANKSTATEMENTPARSER|BUNDLEINSTALLATION|CLIENT|CONSOLRATEADJUSTOR|CSVIMPORT|CUSTOMGLLINES|CUSTOMMASSUPDATE|DATASETBUILDER|DEBUGGER|EMAILCAPTURE|FICONNECTIVITY|FIPARSER|MAPREDUCE|OTHER|PAYMENTGATEWAY|PAYMENTPOSTBACK|PLATFORMEXTENSION|PORTLET|PROMOTIONS|RECORDACTION|RESTLET|RESTWEBSERVICES|SCHEDULED|SDFINSTALLATION|SHIPPINGPARTNERS|SUITELET|TAXCALCULATION|USEREVENT|USERINTERFACE|WEBSERVICES|WORKBOOKBUILDER|WORKFLOW - T - DEBUG - SALESORDER - - TESTING - - - \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_presentation_sl.xml b/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_presentation_sl.xml deleted file mode 100644 index 3838222..0000000 --- a/com.extend.extendproductprotection/src/Objects/customscript_ext_offer_presentation_sl.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - F - Extend | SLET | Offer Modal - F - - T - F - [/SuiteApps/com.extend.extendproductprotection/suitelet/customscript_ext_offer_modal_sl.js] - - - 2 - F - F - F - - - - - NORMAL - - - SELECT - - F - F - - - - - - NO_ACTION - 2 - [scriptid=customlist_ext_environment] - COMPANY - T - - - 2 - F - F - F - - - - - NORMAL - - - SELECT - - F - F - - - - - - SET_NULL - 2 - -10 - COMPANY - T - - - - - F - F - T - - - - - T - F - DEBUG - - RELEASED - Extend | SLET | Offer Modal - - - \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customscript_ext_so_offer_controller_cs.xml b/com.extend.extendproductprotection/src/Objects/customscript_ext_so_offer_controller_cs.xml deleted file mode 100644 index a086d87..0000000 --- a/com.extend.extendproductprotection/src/Objects/customscript_ext_so_offer_controller_cs.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - F - Extend | CS | Offer Modal - F - - T - F - [/SuiteApps/com.extend.extendproductprotection/client/customscript_ext_so_offer_controller_cs.js] - - - F - T - F - F - - - ACTION|ADVANCEDREVREC|BANKCONNECTIVITY|BANKSTATEMENTPARSER|BUNDLEINSTALLATION|CLIENT|CONSOLRATEADJUSTOR|CSVIMPORT|CUSTOMGLLINES|CUSTOMMASSUPDATE|DATASETBUILDER|DEBUGGER|EMAILCAPTURE|FICONNECTIVITY|FIPARSER|MAPREDUCE|OTHER|PAYMENTGATEWAY|PAYMENTPOSTBACK|PLATFORMEXTENSION|PORTLET|PROMOTIONS|RECORDACTION|RESTLET|RESTWEBSERVICES|SCHEDULED|SDFINSTALLATION|SHIPPINGPARTNERS|SUITELET|TAXCALCULATION|USEREVENT|USERINTERFACE|WEBSERVICES|WORKBOOKBUILDER|WORKFLOW - T - DEBUG - SALESORDER - RELEASED - - - \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/Objects/customsearch_ext_contract_create.xml b/com.extend.extendproductprotection/src/Objects/customsearch_ext_contract_create.xml deleted file mode 100644 index 52be189..0000000 --- a/com.extend.extendproductprotection/src/Objects/customsearch_ext_contract_create.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 4e3200cde4c015a64d1deaa05f16607d13418615f6c2a2fdd8ea7f35d5d4d491@GZC@2022.1.12@H4sIAAAAAAAA/+1dW2+jSBZ+H2n+A6LfVmrfOlfLyQhDOWbCxYIiifcF0XZlwi7GFuB0p7U/fg9gHMzFCRjiyS6tViem4FzqO7c6pqoHf/xcWNQzcVxzaV/R3VaHpog9W85N+68rWsOjrxf0H9e//zawXXc566vEMQ3L/EXm8vd/kZnHLm3PMG3iUEDGdvvBXVf0k+et+u32jx8/Wjbx3LXpkdZsuWi7syeyMNx2cBtNrc35FY1VzCl3vdNe79vpSV81nslcJYYze+rP1q63XLjBB5389PQZcHOMGfziEMMj/e7ZyflZt3N22Tu/uKRftei0ujTlmQviesZiBVrt3AfaUNRGn4WxWoHwO09eg6S+2BaZ/0UckNshrVAI+LFR32mFT7ZCUcXgw6AdJxpnMyePpm16wCK4CtfD57jkdRiZE3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G/wjDlHvP3FkXnTmXuKEve25exsjNbeTnBx5obzADpLpbHM64ZvHwfk3dehX8ZMPJCfoOk4gHV7+TV78b/T8H/EHfQeyDF+9hFHBDDkvSfML/e6a2LoG07v5lH1PuePrMkgO2mlR9kr36OgjJU86P4wkd7unGMDsZc3LoJ2DwautRNi/YRPRzvHMkyrj28r90W7MCNKe/p5gHu1nr+XsxvCEig0H/0wMndVULItIqfMAjjg/JE4EeYrqPFxkh9+EUbD0ceopspClWkVnfeywuoOcJNelWLjEitjtahUl9HednLDjBIV9L3M7wMYRC++J9B/qxfwzk0Bcm2AyMnZRh9eTPhnbZPm8My+D9j5OHzAn+7dP+M99Kz4tmduucmbmdUtGrTPz3uyd/D7Sv+mkSPbebXVkZe+Tj8je78qPnz8Bl4L1NIT1tFpYTxtYjwvrWQjrWbWwnjWwHhfW8xDW82phPW9gPS6sFyGsF9XCetHAelxYL0NYL6uF9bKB9biwdjeNrG6hTtbbwHY/pJXVILv/e7gA2W7FyHYbZAsim7ocNqWjy7n/tQ7c8/tv/wUxfuQxqGcAAA== - \ No newline at end of file diff --git a/com.extend.extendproductprotection/src/deploy.xml b/com.extend.extendproductprotection/src/deploy.xml index 235c594..4b728fa 100644 --- a/com.extend.extendproductprotection/src/deploy.xml +++ b/com.extend.extendproductprotection/src/deploy.xml @@ -3,8 +3,11 @@ ~/FileCabinet/SuiteApps/com.extend.extendproductprotection/* - ~/Objects/* - + ~/Objects/Records/* + ~/Objects/Fields/* + ~/Objects/Searches/* + ~/Objects/Scripts/* + ~/Translations/* diff --git a/com.extend.extendproductprotection/src/manifest.xml b/com.extend.extendproductprotection/src/manifest.xml index 0ebe867..8d40b4b 100644 --- a/com.extend.extendproductprotection/src/manifest.xml +++ b/com.extend.extendproductprotection/src/manifest.xml @@ -24,6 +24,7 @@ WORKORDERS RECEIVABLES PAYABLES + MATRIXITEMS \ No newline at end of file