Значения параметров моих экспортируемых функций возвращаются как неопределенные, остальные мои функции работают так же.Я надеюсь, что вы можете помочь!
Кстати - я знаю, что не все параметры включены, но до этого момента он еще не работал!
Моя функция, которая не работает в моем postRequests.jsfile:
exports.getRefundCalculationApiCall = function (itemId, ngrokUrl, domain, orderId) {
console.log('ngrokurl 2' + ngrokUrl)
console.log('domain2' + domain)
console.log('orderId2' + orderId)
console.log('itemId2' + itemId)
httpRequest.post(
`${ngrokUrl}/${domain}/${orderId}`,
{
json:
{
"line_items": [
{
"line_item_id": itemId, "quantity": 1
}
]
}
},
function (error, resp, body) {
if (!error && resp.statusCode == 200) {
console.log(body)
console.log('refund line items transactions information' + JSON.stringify(body.refund.transactions[0]));
console.log('refund line items +++ information THIS IS THE ONE' + JSON.stringify(body.refund.refund_line_items[0]));
refundAmount1 = JSON.stringify(body.refund.refund_line_items[0].price);
order_id1 = body.refund.transactions[0].order_id;
amount1 = body.refund.refund_line_items[0].amount;
// constructing message to front-end with the refund expense.
response = `Your refund amount would be ${refundAmount1}, for the item: ${itemName1}. Do you accept this and wish to initiate the returns process?`
console.log('RESPONSE from getrefundCalc - work to FE?' + response)
data = [details.chatuser, response]
io.of('/main').to(socket.id).emit('response', data);
}
else {
console.log('error' + error)
}
}
)
}
вот я пытаюсь вызвать его в моем файле index.js:
console.log('ngrokurl' + ngrokUrl)
console.log('domain' + domain)
console.log('orderId' + orderId)
console.log('itemId' + itemId)
shopifyApiRequest.getRefundCalculationApiCall((itemId, ngrokUrl, domain, orderId));
моя ошибка:
ngrokurl 2undefined
domain2undefined
orderId2undefined
itemId2594597937215
errorError: Invalid URI "undefined/undefined/undefined"
Я ожидаюстандартный ответ.Есть ли что-то очевидное, что мне не хватает?