@shipengine/connect
Version:
The official developer tooling for building ShipEngine connect apps
17 lines (14 loc) • 772 B
JavaScript
const { logger, NotImplementedError, UnAuthorizedError } = require("@shipengine/connect-runtime");
const mapRequest = (request) => { throw new NotImplementedError(); };
const callApi = async (request) => { throw new NotImplementedError(); };
module.exports.ShipmentNotification = async (request) => {
logger.info('This is a log that I can find using the `connect logs` command after publishing.')
const thirdPartyRequest = mapRequest(request);
const response = await callApi(thirdPartyRequest);
if(response.status === 401) {
throw new UnAuthorizedError('Invalid login credentials.');
}
// Ex: if your connection form allows users to enter in
// store id's or other things, validate that those things
// belong to the account.
}