@advisoa/gateway-clients
Advanced tools
Comparing version 1.0.34 to 1.0.35
@@ -1,1 +0,1 @@ | ||
var P=Object.create;var l=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var N=(o,e)=>{for(var t in e)l(o,t,{get:e[t],enumerable:!0})},_=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!v.call(o,s)&&s!==t&&l(o,s,{get:()=>e[s],enumerable:!(a=T(e,s))||a.enumerable});return o};var i=(o,e,t)=>(t=o!=null?P(S(o)):{},_(e||!o||!o.__esModule?l(t,"default",{value:o,enumerable:!0}):t,o)),U=o=>_(l({},"__esModule",{value:!0}),o);var H={};N(H,{OnPay:()=>I,Quickpay:()=>E,Reepay:()=>w});module.exports=U(H);var p=i(require("node-fetch")),f=i(require("qs"));var x={SUCCESS:200,SUCCESS_NEW_RESOURCE:201,SUCCESS_WITHOUT_RESPONSE:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,FORBIDDEN:403,INTERNAL_SERVER:500},C={DEVELOPMENT:"development",PRODUCTION:"production",STAGING:"staging"},k="Something went wrong. Please try again.",O=10,$=1,L=1,G=1,M=0,b=100,Y=100,j={API_URL:"https://api.reepay.com/v1",LOGIN:"https://api.reepay.com/v1/authenticate/login",GET_PRIVATE_KEY:"https://api.reepay.com/v1/account/privkey"},K={SESSION_TIMEOUT:3e5},B=100,D={API_URL:"https://manage.quickpay.net/api",AGREEMENT:"https://manage.quickpay.net/api/agreements",ME:"https://manage.quickpay.net/api/me"},z=100,q={TRANSACTIONS:"https://api.onpay.io/v1/transaction",ACQUIRERS:"https://api.onpay.io/v1/acquirer"},W=100,Q={AUTH_TOKEN:"https://api.sumup.com/token",TRANSACTIONS:"https://api.sumup.com/v0.1/me/transactions/history",PAYOUTS:"https://api.sumup.com/v0.1/me/financials/payouts",CHECKOUTS:"https://api.sumup.com/v0.1/checkouts",PROFILE:"https://api.sumup.com/v0.1/me/"},F=100,r={RESPONSE_CODE:x,NODE_ENVIRONMENT:C,SOMETHING_WENT_WRONG:k,PER_PAGE:O,PAGE:$,DEFAULT_PAGE:L,SUCCESS:G,FAIL:M,BULK_CREATE_LIMIT:b,REEPAY_MAX_PAGE_LIMIT:Y,REEPAY:j,CLEARHAUS:K,QUICK_PAY_PAGINATION_LIMIT:B,QUICK_PAY_API_URLS:D,ON_PAY_PAGINATION_LIMIT:z,ON_PAY_APIS_URLS:q,SUM_UP_PAGINATION_LIMIT:W,SUM_UP_APIS_URLS:Q,PENSOPAY_PER_PAGE_LIMIT:F};function u(o,e,a){var a=a||[];if(typeof o=="object")for(var s in o)u(o[s],e?e+"["+s+"]":s,a);else a.push(e+"="+encodeURIComponent(o));return a.join("&")}var m=class{constructor(e){this.accessToken=e}static async getAccessToken({code:e,payload:t}){return await(await(0,p.default)("https://api.onpay.io/oauth2/access_token",{method:"POST",body:u({code:e,client_id:"paypilot",grant_type:"authorization_code",redirect_uri:`https://paypilot.advisoa.dk/api/callback/${t}`}),headers:{"Content-Type":"application/x-www-form-urlencoded","Accept-Encoding":"gzip, deflate, br"}})).json()}static async getRefreshToken(e){return await(await(0,p.default)("https://api.onpay.io/oauth2/access_token",{method:"POST",body:u({refresh_token:e,client_id:"paypilot",grant_type:"refresh_token"}),headers:{"Content-Type":"application/x-www-form-urlencoded","Accept-Encoding":"gzip, deflate, br"}})).json()}async getTransactions(){try{let e=[],t=1;for(;;){let a=await(await(0,p.default)(`${r.ON_PAY_APIS_URLS.TRANSACTIONS}?${f.default.stringify({page_size:r.ON_PAY_PAGINATION_LIMIT,page:t})}`,{method:"GET",headers:{Authorization:this.accessToken}})).json();if(e.push(...a.data),e.length!==a.meta.pagination.total)t++;else break}return e}catch{return null}}async getAcquirers(){try{return(await(await(0,p.default)(r.ON_PAY_APIS_URLS.ACQUIRERS,{method:"GET",headers:{Authorization:this.accessToken}})).json()).data}catch{return null}}},I=m;var c=i(require("axios"));var g=class{static async getTokenAndMerchants(e,t){let a=await c.default.post("https://api.reepay.com/v1/authenticate/login",{email:e,password:t},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":"",Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}});return{token:a.data.token,organisations:a.data.organisations}}static async generateAdminAPIToken(e,t,a){let s=await c.default.post("https://api.reepay.com/v1/authenticate/login",{account:t,organisation:a},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${e}`,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}}),{token:n}=s.data;return n}static async getOrganisationDetails(e){return await(await fetch("https://admin-api.reepay.com/v1/organisation/details",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async getAgreements(e){return await(await fetch("https://api.reepay.com/v1/agreement/?non_deleted=true",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async getAgreementDetails(e,t){return await(await fetch(`https://api.reepay.com/v1/agreement/${t}`,{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async generateMerchantAccessKey(e,t,a){let s=await c.default.post("https://api.reepay.com/v1/authenticate/login",{account:t,organisation:a},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${e}`,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}}),{token:n}=s.data,h=await c.default.post("https://api.reepay.com/v1/account/privkey",{},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${n}`},referrer:"https://app.reepay.com/",referrerPolicy:"strict-origin-when-cross-origin",mode:"cors",credentials:"omit"});process.exit(0)}constructor(e){this.token=Buffer.from(`${e}:`).toString("base64")}async getAll(e,t){let a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,...t}).toString();try{let s=[],n=(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`,"Content-Type":"application/json"}})).data,h=n.next_page_token;if(e.indexOf("list/")===-1)return n;for(n.content&&s.push(...n.content);h;)a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,next_page_token:h,...t}).toString(),n=(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`}})).data,n.content&&s.push(...n.content),h=n.next_page_token;return s}catch(s){return console.log("error: ",s),null}}async get(e,t){let a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,...t}).toString();return(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`,"Content-Type":"application/json"}})).data}async post(e,t){return(await c.default.post(`${r.REEPAY.API_URL}/${e}`,t,{headers:{Authorization:`Basic ${this.token}`}})).data}async put(e,t){return(await c.default.put(`${r.REEPAY.API_URL}/${e}`,t,{headers:{Authorization:`Basic ${this.token}`}})).data}async getCustomers(e){return await this.getAll("list/customer",e)}async getCharges(e){return await this.getAll("list/charge",e)}async getTransactions(e){return await this.getAll("list/transactions",e)}async getInvoices(e){return await this.get("list/invoice",e)}async getInvoice(e,t){return await this.getAll(`invoice/${e}`,t)}static async getAdminInvoices(e){return await(await fetch("https://admin-api.reepay.com/v1/organisation/invoice",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}async getCharge(e,t){return await this.getAll(`charge/${e}`,t)}async settleInvoice(e){return await this.post(`charge/${e}/settle`)}async cancelInvoice(e){return await this.post(`charge/${e}/cancel`)}async refundInvoice(e){return await this.post("refund",{invoice:e})}async getPaymentMethods(e){return await this.getAll("list/payment_method",e)}async getPayouts(e){return await this.getAll("list/payout",e)}async getWebhookSettings(){return await this.getAll("account/webhook_settings")}async setWebhookSettings(e){return await this.put("account/webhook_settings",e)}},w=g;var d=i(require("node-fetch")),A=i(require("qs"));var y=class{constructor(e){this.token=Buffer.from(`:${e}`).toString("base64")}async getAll(e,t){try{let a=[],s=1;for(;;){let n=await(await(0,d.default)(`${r.QUICK_PAY_API_URLS.API_URL}/${e}?${A.default.stringify({page:s,page_size:r.QUICK_PAY_PAGINATION_LIMIT,...t??{}})}`,{method:"GET",headers:{Authorization:`Basic ${this.token}`,"Accept-Version":"v10"}})).json();if(a.push(...n),n.length===Number(r.QUICK_PAY_PAGINATION_LIMIT))s++;else break}return a}catch(a){return console.log("error: ",a),null}}async get(e,t){try{let a=1;return await(await(0,d.default)(`${r.QUICK_PAY_API_URLS.API_URL}/${e}?${A.default.stringify({page:a,page_size:r.QUICK_PAY_PAGINATION_LIMIT,...t??{}})}`,{method:"GET",headers:{Authorization:`Basic ${this.token}`,"Accept-Version":"v10"}})).json()}catch(a){return console.log("error: ",a),null}}async getAccount(){return await this.get("account")}async getTransactions(e){return await this.getAll("payments",e)}async getPayouts(e){return await this.getAll("payouts",e)}async getFees(e){return await this.getAll("fees/formulas",e)}async getAcquirers(e){return await this.getAll("acquirers",e)}},E=y;0&&(module.exports={OnPay,Quickpay,Reepay}); | ||
var P=Object.create;var l=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var v=(o,e)=>{for(var t in e)l(o,t,{get:e[t],enumerable:!0})},_=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!N.call(o,s)&&s!==t&&l(o,s,{get:()=>e[s],enumerable:!(a=T(e,s))||a.enumerable});return o};var p=(o,e,t)=>(t=o!=null?P(S(o)):{},_(e||!o||!o.__esModule?l(t,"default",{value:o,enumerable:!0}):t,o)),C=o=>_(l({},"__esModule",{value:!0}),o);var H={};v(H,{OnPay:()=>I,Quickpay:()=>E,Reepay:()=>w});module.exports=C(H);var i=p(require("node-fetch")),f=p(require("qs"));var U={SUCCESS:200,SUCCESS_NEW_RESOURCE:201,SUCCESS_WITHOUT_RESPONSE:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,FORBIDDEN:403,INTERNAL_SERVER:500},k={DEVELOPMENT:"development",PRODUCTION:"production",STAGING:"staging"},x="Something went wrong. Please try again.",$=10,O=1,L=1,G=1,M=0,b=100,Y=100,B={API_URL:"https://api.reepay.com/v1",LOGIN:"https://api.reepay.com/v1/authenticate/login",GET_PRIVATE_KEY:"https://api.reepay.com/v1/account/privkey"},j={SESSION_TIMEOUT:3e5},K=100,z={API_URL:"https://manage.quickpay.net/api",AGREEMENT:"https://manage.quickpay.net/api/agreements",ME:"https://manage.quickpay.net/api/me"},D=100,q={TRANSACTIONS:"https://api.onpay.io/v1/transaction",ACQUIRERS:"https://api.onpay.io/v1/acquirer"},W=100,Q={AUTH_TOKEN:"https://api.sumup.com/token",TRANSACTIONS:"https://api.sumup.com/v0.1/me/transactions/history",PAYOUTS:"https://api.sumup.com/v0.1/me/financials/payouts",CHECKOUTS:"https://api.sumup.com/v0.1/checkouts",PROFILE:"https://api.sumup.com/v0.1/me/"},F=100,r={RESPONSE_CODE:U,NODE_ENVIRONMENT:k,SOMETHING_WENT_WRONG:x,PER_PAGE:$,PAGE:O,DEFAULT_PAGE:L,SUCCESS:G,FAIL:M,BULK_CREATE_LIMIT:b,REEPAY_MAX_PAGE_LIMIT:Y,REEPAY:B,CLEARHAUS:j,QUICK_PAY_PAGINATION_LIMIT:K,QUICK_PAY_API_URLS:z,ON_PAY_PAGINATION_LIMIT:D,ON_PAY_APIS_URLS:q,SUM_UP_PAGINATION_LIMIT:W,SUM_UP_APIS_URLS:Q,PENSOPAY_PER_PAGE_LIMIT:F};function u(o,e,a){var a=a||[];if(typeof o=="object")for(var s in o)u(o[s],e?e+"["+s+"]":s,a);else a.push(e+"="+encodeURIComponent(o));return a.join("&")}var m=class{constructor(e){this.accessToken=e}static async getAccessTokenByAuthorizationCode({code:e,payload:t}){return await(await(0,i.default)("https://api.onpay.io/oauth2/access_token",{method:"POST",body:u({code:e,client_id:"paypilot",grant_type:"authorization_code",redirect_uri:`https://paypilot.advisoa.dk/api/callback/${t}`}),headers:{"Content-Type":"application/x-www-form-urlencoded","Accept-Encoding":"gzip, deflate, br"}})).json()}static async getAccessTokenByRefreshToken(e){return await(await(0,i.default)("https://api.onpay.io/oauth2/access_token",{method:"POST",body:u({refresh_token:e,client_id:"paypilot",grant_type:"refresh_token"}),headers:{"Content-Type":"application/x-www-form-urlencoded","Accept-Encoding":"gzip, deflate, br"}})).json()}async getTransactions(){try{let e=[],t=1;for(;;){let a=await(await(0,i.default)(`${r.ON_PAY_APIS_URLS.TRANSACTIONS}?${f.default.stringify({page_size:r.ON_PAY_PAGINATION_LIMIT,page:t})}`,{method:"GET",headers:{Authorization:`Bearer ${this.accessToken}`}})).json();if(e.push(...a.data),e.length!==a.meta.pagination.total)t++;else break}return e}catch{return null}}async getTransaction(e){return await(await(0,i.default)(`${r.ON_PAY_APIS_URLS.TRANSACTIONS}/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.accessToken}`}})).json()}async getAcquirers(){try{return(await(await(0,i.default)(r.ON_PAY_APIS_URLS.ACQUIRERS,{method:"GET",headers:{Authorization:`Bearer ${this.accessToken}`}})).json()).data}catch{return null}}},I=m;var c=p(require("axios"));var g=class{static async getTokenAndMerchants(e,t){let a=await c.default.post("https://api.reepay.com/v1/authenticate/login",{email:e,password:t},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":"",Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}});return{token:a.data.token,organisations:a.data.organisations}}static async generateAdminAPIToken(e,t,a){let s=await c.default.post("https://api.reepay.com/v1/authenticate/login",{account:t,organisation:a},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${e}`,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}}),{token:n}=s.data;return n}static async getOrganisationDetails(e){return await(await fetch("https://admin-api.reepay.com/v1/organisation/details",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async getAgreements(e){return await(await fetch("https://api.reepay.com/v1/agreement/?non_deleted=true",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async getAgreementDetails(e,t){return await(await fetch(`https://api.reepay.com/v1/agreement/${t}`,{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}static async generateMerchantAccessKey(e,t,a){let s=await c.default.post("https://api.reepay.com/v1/authenticate/login",{account:t,organisation:a},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${e}`,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"}}),{token:n}=s.data,h=await c.default.post("https://api.reepay.com/v1/account/privkey",{},{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":`${n}`},referrer:"https://app.reepay.com/",referrerPolicy:"strict-origin-when-cross-origin",mode:"cors",credentials:"omit"});process.exit(0)}constructor(e){this.token=Buffer.from(`${e}:`).toString("base64")}async getAll(e,t){let a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,...t}).toString();try{let s=[],n=(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`,"Content-Type":"application/json"}})).data,h=n.next_page_token;if(e.indexOf("list/")===-1)return n;for(n.content&&s.push(...n.content);h;)a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,next_page_token:h,...t}).toString(),n=(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`}})).data,n.content&&s.push(...n.content),h=n.next_page_token;return s}catch(s){return console.log("error: ",s),null}}async get(e,t){let a=new URLSearchParams({size:r.REEPAY_MAX_PAGE_LIMIT,...t}).toString();return(await c.default.get(`${r.REEPAY.API_URL}/${e}${a?`?${a}`:""}`,{headers:{Authorization:`Basic ${this.token}`,"Content-Type":"application/json"}})).data}async post(e,t){return(await c.default.post(`${r.REEPAY.API_URL}/${e}`,t,{headers:{Authorization:`Basic ${this.token}`}})).data}async put(e,t){return(await c.default.put(`${r.REEPAY.API_URL}/${e}`,t,{headers:{Authorization:`Basic ${this.token}`}})).data}async getCustomers(e){return await this.getAll("list/customer",e)}async getCharges(e){return await this.getAll("list/charge",e)}async getTransactions(e){return await this.getAll("list/transactions",e)}async getInvoices(e){return await this.get("list/invoice",e)}async getInvoice(e,t){return await this.getAll(`invoice/${e}`,t)}static async getAdminInvoices(e){return await(await fetch("https://admin-api.reepay.com/v1/organisation/invoice",{headers:{accept:"application/json, text/plain, */*","accept-language":"da-DK,da;q=0.9","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-auth-token":e,Referer:"https://app.reepay.com/","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"})).json()}async getCharge(e,t){return await this.getAll(`charge/${e}`,t)}async settleInvoice(e){return await this.post(`charge/${e}/settle`)}async cancelInvoice(e){return await this.post(`charge/${e}/cancel`)}async refundInvoice(e){return await this.post("refund",{invoice:e})}async getPaymentMethods(e){return await this.getAll("list/payment_method",e)}async getPayouts(e){return await this.getAll("list/payout",e)}async getWebhookSettings(){return await this.getAll("account/webhook_settings")}async setWebhookSettings(e){return await this.put("account/webhook_settings",e)}},w=g;var d=p(require("node-fetch")),A=p(require("qs"));var y=class{constructor(e){this.token=Buffer.from(`:${e}`).toString("base64")}async getAll(e,t){try{let a=[],s=1;for(;;){let n=await(await(0,d.default)(`${r.QUICK_PAY_API_URLS.API_URL}/${e}?${A.default.stringify({page:s,page_size:r.QUICK_PAY_PAGINATION_LIMIT,...t??{}})}`,{method:"GET",headers:{Authorization:`Basic ${this.token}`,"Accept-Version":"v10"}})).json();if(a.push(...n),n.length===Number(r.QUICK_PAY_PAGINATION_LIMIT))s++;else break}return a}catch(a){return console.log("error: ",a),null}}async get(e,t){try{let a=1;return await(await(0,d.default)(`${r.QUICK_PAY_API_URLS.API_URL}/${e}?${A.default.stringify({page:a,page_size:r.QUICK_PAY_PAGINATION_LIMIT,...t??{}})}`,{method:"GET",headers:{Authorization:`Basic ${this.token}`,"Accept-Version":"v10"}})).json()}catch(a){return console.log("error: ",a),null}}async getAccount(){return await this.get("account")}async getTransactions(e){return await this.getAll("payments",e)}async getPayouts(e){return await this.getAll("payouts",e)}async getFees(e){return await this.getAll("fees/formulas",e)}async getAcquirers(e){return await this.getAll("acquirers",e)}},E=y;0&&(module.exports={OnPay,Quickpay,Reepay}); |
{ | ||
"name": "@advisoa/gateway-clients", | ||
"version": "1.0.34", | ||
"version": "1.0.35", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
23903
87