FuelSDK-Node-SOAP
FuelSDK-Node-SOAP copied to clipboard
Add multiple deletion
plz add this !
@yebl can this change be tested?
Hi colins44 i have this monkeypatch implemented over 1 year, and working perfect:
client.SoapClient.soapRequestAsync = util.promisify(client.SoapClient.soapRequest);
client.SoapClient.updateArray = async (type, props, options) => {
const updateQueryAllAccounts = configureQueryAllAccounts(options);
if (Array.isArray(props)) {
// eslint-disable-next-line no-return-assign
props.forEach(item => (item.$ = { 'xsi:type': type }));
} else {
props.$ = { 'xsi:type': type };
}
const reqOptions = helpers.parseReqOptions(options);
const body = {
UpdateRequest: {
$: {
xmlns: 'http://exacttarget.com/wsdl/partnerAPI'
},
Options: options,
Objects: props
}
};
updateQueryAllAccounts(body.UpdateRequest, 'Options');
try {
const resp = await client.SoapClient.soapRequestAsync({
action: 'Update',
req: body,
key: 'UpdateResponse',
retry: true,
reqOptions
});
if (lodash.get(resp, 'body.OverallStatus') === 'OK') {
logger.notice('Request OK');
// logger.debug(util.inspect(resp.res.request.body));
// logger.debug(util.inspect(resp.body));
} else {
logger.error(util.inspect(resp), { props });
logger.debug(JSON.stringify(body));
// logger.error(props);
}
} catch (err) {
if (err && err.results) {
const errors = lodash.reject(err.results, { StatusCode: 'OK' });
logger.error('sales force error integration', { errors });
const valueErrors = lodash.get(errors, '0');
if (valueErrors) {
logger.debug(util.inspect(valueErrors.Object.Properties));
logger.debug(util.inspect(valueErrors.ValueErrors));
}
} else {
logger.error(util.inspect(err), { props });
logger.debug(JSON.stringify(body));
}
// logger.error(props);
// logger.error(err.results[0]);
}
};