function addOrganisation(obj, grouped, sourceId, sourceIdType, orgUrl) {
  if (!obj.assignerId) { return Promise.resolve(obj); }

  const assigner = grouped[obj.assignerId];
  if (!assigner) { return Promise.resolve(obj); }

  const orgId = assigner[names.provider][0]['@value'];

  return org.getOrganisation(orgId, orgUrl)
    .then(response => {
      let result = {};
      const styles = org.styles(response.data);

      const paymentUrl = org.paymentUrl(response.data, obj.id, sourceId, sourceIdType);
      if (paymentUrl) {
        result.paymentUrl = paymentUrl;
      }

      const link = org.referenceLink(response.data, sourceId, sourceIdType);
      if (link) {
        result.link = link;
      }

      result = _defaultsDeep(result, styles, obj);
      delete result.assignerId;

      return result;
    });
}
/**
 * Get an organisation using it's ID
 */
Get an organisation using it's ID
Get an organisation using it ' s ID
function addOrganisation(obj, grouped, sourceId, sourceIdType, orgUrl) {
  if (!obj.assignerId) { return Promise.resolve(obj); }
  const assigner = grouped[obj.assignerId];
  if (!assigner) { return Promise.resolve(obj); }
  const orgId = assigner[names.provider][0]['@value'];
  return org.getOrganisation(orgId, orgUrl)
    .then(response => {
      let result = {};
      const styles = org.styles(response.data);
      const paymentUrl = org.paymentUrl(response.data, obj.id, sourceId, sourceIdType);
      if (paymentUrl) {
        result.paymentUrl = paymentUrl;
      }
      const link = org.referenceLink(response.data, sourceId, sourceIdType);
      if (link) {
        result.link = link;
      }
      result = _defaultsDeep(result, styles, obj);
      delete result.assignerId;
      return result;
    });
}
function addOrganisation ( obj , grouped , sourceId , sourceIdType , orgUrl ) { if ( ! obj . assignerId ) { return Promise . resolve ( obj ) ; } const assigner = grouped [ obj . assignerId ] ; if ( ! assigner ) { return Promise . resolve ( obj ) ; } const orgId = assigner [ names . provider ] [ 0 ] [ '@value' ] ; return org . getOrganisation ( orgId , orgUrl ) . then ( response => { let result = { } ; const styles = org . styles ( response . data ) ; const paymentUrl = org . paymentUrl ( response . data , obj . id , sourceId , sourceIdType ) ; if ( paymentUrl ) { result . paymentUrl = paymentUrl ; } const link = org . referenceLink ( response . data , sourceId , sourceIdType ) ; if ( link ) { result . link = link ; } result = _defaultsDeep ( result , styles , obj ) ; delete result . assignerId ; return result ; } ) ; }
Get an organisation using it's ID
Get an organisation using it ' s ID