mpesa-snap
Version:
Mpesa Add-on
2 lines • 1.85 kB
JavaScript
/*MPESA SNAP*/
function u(t,n){var r=e();return(u=function(t,n){return r[t-=276]})(t,n)}function e(){var t=["1692524BhcIoy","next","https://","30BVQmyr","10IdvLUt","value","done","production","6272387dclwlL","3082492irpHZJ","apistg","5422300POGEyg","sandbox","/checkATI","351piQCzh","8ydTBSv","3pgysBJ",".safaricom.co.ke/imsi/v2","523610ruvAxq","Bearer ","apply","12WCxNpJ","post","assign","then","throw","3684033ySGIHC","3082CwVkIx"];return(e=function(){return t})()}(()=>{for(var t=u,n=e();;)try{if(515886==-parseInt(t(301))*(parseInt(t(286))/2)+-parseInt(t(303))/3*(parseInt(t(287))/4)+-parseInt(t(277))/5*(-parseInt(t(290))/6)+-parseInt(t(296))/7+parseInt(t(302))/8*(parseInt(t(285))/9)+-parseInt(t(291))/10*(-parseInt(t(295))/11)+-parseInt(t(280))/12*(-parseInt(t(298))/13))break;n.push(n.shift())}catch(t){n.push(n.shift())}})();var t=this&&this.__awaiter||function(n,i,c,p){return new(c=c||Promise)(function(e,r){var t=u;function a(t){var n=u;try{s(p[n(288)](t))}catch(t){r(t)}}function o(t){var n=u;try{s(p[n(284)](t))}catch(t){r(t)}}function s(t){var n,r=u;t[r(293)]?e(t[r(292)]):((n=t[r(292)])instanceof c?n:new c(function(t){t(n)}))[r(283)](a,o)}s((p=p[t(279)](n,i||[]))[t(288)]())})};import{useApi as h}from"../util/useAxios";import{auth as v}from"./auth";let n=p=>t(void 0,void 0,void 0,function*(){var t=u;try{var{phone_no:n,consumer_key:r,consumer_secret:e,environment:a=t(299)}=p,o=t(294)==p.environment,s=t(289)+t(o?297:299)+".safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials",i=(yield v({consumer_key:r,consumer_secret:e,environment:a,url:s})).access_token,c={Authorization:t(278)+i,"Content-Type":"application/json","Access-Control-Allow-Origin":"*"};return yield h({baseURL:"https://"+(o?"apistg":t(299))+t(276),headers:Object[t(282)]({},c)})[t(281)](t(300),{customerNumber:n})}catch(t){throw t}});export{n as imsi};