const skuListFilePath=’./inventory/dsz_sku_list.csv’
const asinListFilePath=’./inventory/AmazonASIN.csv’
const csv = require(‘csvtojson’)
const CalculateRRP = require(‘./utils/CalculateRRP’)
const ASIN = ‘B07YMLMQJC’
const generateRRP = async (asin) => {
let asinList = await csv().fromFile(asinListFilePath)
let SKU
let cost
let RRP
for (let a of asinList) {
if (a.ASIN === asin) {
SKU = a.SKU
}
}
if (!SKU) {
return console.error(`Cannot find the SKU for ${asin} in AmazonASIN.csv file`)
}
let skuList = await csv().fromFile(skuListFilePath)
for (let product of skuList) {
if (product.SKU === SKU) {
cost = product.price
}
}
console.log(‘cost: ‘, cost)
if (!cost) {
return console.error(`Cannot find the ${SKU} in dsz_sku_list.csv file`)
}
RRP = await CalculateRRP(asin, cost, ‘competitive’)
console.log(`The RRP for ${asin} is ${RRP}`)
}