function actHandlerAwardBadge(request, reply) {
    //  NOTE : This is deactivated until LearnUpon fixes their checksum
    //  TODO : poll their closed source support to know if they fixed it
    // var certif = request.payload.toString();
    // console.log('certif', certif);
    // var rx = /,"signature":"(\w{32})"/g;
    // var signature = rx.exec(certif);
    // // we inverse the position of the comma in case it became the first item..
    // if (_.isEmpty(signature)) {
    //   rx = /"signature":"(\w{32})",/g;
    //   signature = rx.exec(certif);
    // }
    // var checksumCertif = certif.replace(rx, '');
    // // We check we caught the good regex group (md5length = 32)
    // if (signature[1] && signature[1].length === 32) {
    //   var checkValMsg = {role: 'cd-users', cmd: 'check_lms_certificate_authenticity',
    //   certif: checksumCertif, signature: signature[1]};
    //   request.seneca.act(checkValMsg, function (err, resp) {
    //     if (err) return reply(err).code(500);
    //     if (!resp.ok) return reply().code(403);

    const msg = _.defaults(
      { role: 'cd-users', cmd: 'award_lms_badge' },
      JSON.parse(request.payload)
    );
    request.seneca.act(msg, (err, resp) => {
      if (err || (resp && resp.ok === false))
        return reply(Boom.badImplementation(err || resp.why));
      reply(resp).code(200);
    });
    //   });
    // } else {
    //   // No signature found
    //   reply().code(500);
    // }
  }
/**
   * Handler to pre-verify the LMS webhook by comparing
   * the hash of the certificate as a string+pkey to the received hash
   * @param  {Object} request HapiJS request, data is raw (non-parsed)
   * @param  {Object} reply   Hapijs response
   */
Handler to pre-verify the LMS webhook by comparing
the hash of the certificate as a string+pkey to the received hash
@param  {Object} request HapiJS request, data is raw (non-parsed)
@param  {Object} reply   Hapijs response
Handler to pre - verify the LMS webhook by comparing the hash of the certificate as a string + pkey to the received hash @param { Object } request HapiJS request data is raw ( non - parsed ) @param { Object } reply Hapijs response
function actHandlerAwardBadge(request, reply) {
    const msg = _.defaults(
      { role: 'cd-users', cmd: 'award_lms_badge' },
      JSON.parse(request.payload)
    );
    request.seneca.act(msg, (err, resp) => {
      if (err || (resp && resp.ok === false))
        return reply(Boom.badImplementation(err || resp.why));
      reply(resp).code(200);
    });
     else {
  }
function actHandlerAwardBadge ( request , reply ) { const msg = _ . defaults ( { role : 'cd-users' , cmd : 'award_lms_badge' } , JSON . parse ( request . payload ) ) ; request . seneca . act ( msg , ( err , resp ) => { if ( err || ( resp && resp . ok === false ) ) return reply ( Boom . badImplementation ( err || resp . why ) ) ; reply ( resp ) . code ( 200 ) ; } ) ; }
Handler to pre-verify the LMS webhook by comparing
 the hash of the certificate as a string+pkey to the received hash
 @param  {Object} request HapiJS request, data is raw (non-parsed)
 @param  {Object} reply   Hapijs response
Handler to pre - verify the LMS webhook by comparing the hash of the certificate as a string + pkey to the received hash @param { Object } request HapiJS request data is raw ( non - parsed ) @param { Object } reply Hapijs response
//  NOTE : This is deactivated until LearnUpon fixes their checksum //  TODO : poll their closed source support to know if they fixed it // var certif = request.payload.toString(); // console.log('certif', certif); // var rx = /,"signature":"(\w{32})"/g; // var signature = rx.exec(certif); // // we inverse the position of the comma in case it became the first item.. // if (_.isEmpty(signature)) { //   rx = /"signature":"(\w{32})",/g; //   signature = rx.exec(certif); // } // var checksumCertif = certif.replace(rx, ''); // // We check we caught the good regex group (md5length = 32) // if (signature[1] && signature[1].length === 32) { //   var checkValMsg = {role: 'cd-users', cmd: 'check_lms_certificate_authenticity', //   certif: checksumCertif, signature: signature[1]}; //   request.seneca.act(checkValMsg, function (err, resp) { //     if (err) return reply(err).code(500); //     if (!resp.ok) return reply().code(403); //   }); // } else { //   // No signature found //   reply().code(500); // }