Last active
August 16, 2019 17:53
-
-
Save jeffdonthemic/7029a481d0333b8cf9800cf26b912c18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create the association object with the final data | |
associations = { | |
"elements": elements | |
} | |
// create all of the associations | |
request({ | |
url: 'https://api.clover.com:443/v3/merchants/'+process.env.CLOVER_MERCHANT_ID+'/category_items', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': 'Bearer ' + _accessToken | |
}, | |
body: JSON.stringify(associations) | |
}, function(error, response, body){ | |
console.log('DEBUG[CLOVER]: Creating all associations for items in ' + categoryId + ' for ' + elements.length + ' items.'); | |
if(error) { | |
console.log('ERROR[CLOVER]: Could not create all associations for category items in: '+categoryId); | |
console.log(error); | |
reject(error); | |
} else { | |
console.log('DEBUG[CLOVER]: Made clover callout to create all category association successfully for: '+categoryId); | |
resolve(true); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment