mpesa-snap
Version:
Mpesa Add-on
2 lines • 1.58 kB
JavaScript
/*MPESA SNAP*/
var s=p;function e(){var t=["toString","environment","116agkpYx","apply","4004stroOI","base64","__awaiter","url","398504bvhFwc","34014omhXJX","from","850790vuTrlG","https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials","7494goowce","application/json","8517290dNrgFY","9xlwuaj","Basic ","668211aBwYlV","production","next","1961335XYMPeH"];return(e=function(){return t})()}(()=>{for(var t=p,n=e();;)try{if(585829==-parseInt(t(165))+-parseInt(t(158))/2+parseInt(t(156))/3*(-parseInt(t(171))/4)+parseInt(t(168))/5+-parseInt(t(160))/6*(-parseInt(t(173))/7)+-parseInt(t(177))/8*(-parseInt(t(163))/9)+parseInt(t(162))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}})();var t=this&&this[s(175)]||function(n,s,c,u){return new(c=c||Promise)(function(r,e){var t=p;function a(t){var n=p;try{i(u[n(167)](t))}catch(t){e(t)}}function o(t){try{i(u.throw(t))}catch(t){e(t)}}function i(t){var n;t.done?r(t.value):((n=t.value)instanceof c?n:new c(function(t){t(n)})).then(a,o)}i((u=u[t(172)](n,s||[]))[t(167)]())})};import{useApi as c}from"../util/useAxios";function p(t,n){var r=e();return(p=function(t,n){return r[t-=156]})(t,n)}let n=i=>t(void 0,void 0,void 0,function*(){var t=s;try{var n=t(166)===i[t(170)]?"https://api.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials":t(159),r=c(),{consumer_key:e,consumer_secret:a}=i,o={Authorization:t(164)+Buffer[t(157)](e+":"+a)[t(169)](t(174)),"content-type":t(161)};return yield r.get((null==i?void 0:i[t(176)])||n,{headers:Object.assign({},o)})}catch(t){throw t}});export{n as auth};