starling-developer-sdk
Advanced tools
Comparing version
@@ -1,2 +0,3 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.starling=e()}}(function(){var e;return function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t,n){t.exports=e("./lib/axios")},{"./lib/axios":3}],2:[function(e,t,n){(function(n){"use strict";var r=e("./../utils"),o=e("./../helpers/buildURL"),i=e("./../helpers/parseHeaders"),s=e("./../helpers/transformData"),a=e("./../helpers/isURLSameOrigin"),u="undefined"!=typeof window&&window.btoa||e("./../helpers/btoa");t.exports=function(t,c,f){var l=f.data,d=f.headers;r.isFormData(l)&&delete d["Content-Type"];var p=new XMLHttpRequest,h="onreadystatechange",g=!1;if("test"===n.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in p||a(f.url)||(p=new window.XDomainRequest,h="onload",g=!0),f.auth){var m=f.auth.username||"",v=f.auth.password||"";d.Authorization="Basic "+u(m+":"+v)}if(p.open(f.method.toUpperCase(),o(f.url,f.params,f.paramsSerializer),!0),p.timeout=f.timeout,p.onprogress=function(){},p.ontimeout=function(){},p[h]=function(){if(p&&(4===p.readyState||g)&&0!==p.status){var e="getAllResponseHeaders"in p?i(p.getAllResponseHeaders()):null,n=f.responseType&&"text"!==f.responseType?p.response:p.responseText,r={data:s(n,e,f.transformResponse),status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:e,config:f,request:p};(r.status>=200&&r.status<300||!("status"in p)&&p.responseText?t:c)(r),p=null}},p.onerror=function(){c(new Error("Network Error")),p=null},p.ontimeout=function(){var e=new Error("timeout of "+f.timeout+"ms exceeded");e.timeout=f.timeout,e.code="ECONNABORTED",c(e),p=null},r.isStandardBrowserEnv()){var y=e("./../helpers/cookies"),b=f.withCredentials||a(f.url)?y.read(f.xsrfCookieName):void 0;b&&(d[f.xsrfHeaderName]=b)}if("setRequestHeader"in p&&r.forEach(d,function(e,t){"undefined"==typeof l&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)}),f.withCredentials&&(p.withCredentials=!0),f.responseType)try{p.responseType=f.responseType}catch(w){if("json"!==p.responseType)throw w}f.progress&&("post"===f.method||"put"===f.method?p.upload.addEventListener("progress",f.progress):"get"===f.method&&p.addEventListener("progress",f.progress)),r.isArrayBuffer(l)&&(l=new DataView(l)),void 0===l&&(l=null),p.send(l)}}).call(this,e("_process"))},{"./../helpers/btoa":8,"./../helpers/buildURL":9,"./../helpers/cookies":11,"./../helpers/isURLSameOrigin":13,"./../helpers/parseHeaders":14,"./../helpers/transformData":16,"./../utils":17,_process:21}],3:[function(e,t,n){"use strict";function r(e){this.defaults=i.merge({},e),this.interceptors={request:new a,response:new a}}var o=e("./defaults"),i=e("./utils"),s=e("./core/dispatchRequest"),a=e("./core/InterceptorManager"),u=e("./helpers/isAbsoluteURL"),c=e("./helpers/combineURLs"),f=e("./helpers/bind"),l=e("./helpers/transformData");r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,this.defaults,{method:"get"},e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.withCredentials=e.withCredentials||this.defaults.withCredentials,e.data=l(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n};var d=new r(o),p=t.exports=f(r.prototype.request,d);p.defaults=d.defaults,p.interceptors=d.interceptors,p.create=function(e){return new r(e)},p.all=function(e){return Promise.all(e)},p.spread=e("./helpers/spread"),i.forEach(["delete","get","head"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))},p[e]=f(r.prototype[e],d)}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))},p[e]=f(r.prototype[e],d)})},{"./core/InterceptorManager":4,"./core/dispatchRequest":5,"./defaults":6,"./helpers/bind":7,"./helpers/combineURLs":10,"./helpers/isAbsoluteURL":12,"./helpers/spread":15,"./helpers/transformData":16,"./utils":17}],4:[function(e,t,n){"use strict";function r(){this.handlers=[]}var o=e("./../utils");r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},t.exports=r},{"./../utils":17}],5:[function(e,t,n){(function(n){"use strict";t.exports=function(t){return new Promise(function(r,o){try{var i;"function"==typeof t.adapter?i=t.adapter:"undefined"!=typeof XMLHttpRequest?i=e("../adapters/xhr"):"undefined"!=typeof n&&(i=e("../adapters/http")),"function"==typeof i&&i(r,o,t)}catch(s){o(s)}})}}).call(this,e("_process"))},{"../adapters/http":2,"../adapters/xhr":2,_process:21}],6:[function(e,t,n){"use strict";var r=e("./utils"),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(e,t){return r.isFormData(e)?e:r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(r.isUndefined(t)||(r.forEach(t,function(e,n){"content-type"===n.toLowerCase()&&(t["Content-Type"]=e)}),r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1}},{"./utils":17}],7:[function(e,t,n){"use strict";t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},{}],8:[function(e,t,n){"use strict";function r(){this.message="String contains an invalid character"}function o(e){for(var t,n,o=String(e),s="",a=0,u=i;o.charAt(0|a)||(u="=",a%1);s+=u.charAt(63&t>>8-a%1*8)){if(n=o.charCodeAt(a+=.75),n>255)throw new r;t=t<<8|n}return s}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=e("./../utils");t.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},{"./../utils":17}],10:[function(e,t,n){"use strict";t.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},{}],11:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},{"./../utils":17}],12:[function(e,t,n){"use strict";t.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},{}],13:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},{"./../utils":17}],14:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},{"./../utils":17}],15:[function(e,t,n){"use strict";t.exports=function(e){return function(t){return e.apply(null,t)}}},{}],16:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},{"./../utils":17}],17:[function(e,t,n){"use strict";function r(e){return"[object Array]"===y.call(e)}function o(e){return"[object ArrayBuffer]"===y.call(e)}function i(e){return"[object FormData]"===y.call(e)}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function l(e){return"[object Date]"===y.call(e)}function d(e){return"[object File]"===y.call(e)}function p(e){return"[object Blob]"===y.call(e)}function h(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function m(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var i in e)e.hasOwnProperty(i)&&t.call(null,e[i],i,e)}function v(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=v(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)m(arguments[n],e);return t}var y=Object.prototype.toString;t.exports={isArray:r,isArrayBuffer:o,isFormData:i,isArrayBufferView:s,isString:a,isNumber:u,isObject:f,isUndefined:c,isDate:l,isFile:d,isBlob:p,isStandardBrowserEnv:g,forEach:m,merge:v,trim:h}},{}],18:[function(e,t,n){(function(r){function o(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,i=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r),e}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(t){}}function u(){try{return n.storage.debug}catch(e){}if("undefined"!=typeof r&&"env"in r)return r.env.DEBUG}function c(){try{return window.localStorage}catch(e){}}n=t.exports=e("./debug"),n.log=s,n.formatArgs=i,n.save=a,n.load=u,n.useColors=o,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},n.enable(u())}).call(this,e("_process"))},{"./debug":19,_process:21}],19:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function o(e){function t(){}function o(){var e=o,t=+new Date,i=t-(c||t);e.diff=i,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=n.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var u=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;u++;var o=n.formatters[r];if("function"==typeof o){var i=s[u];t=o.call(e,i),s.splice(u,1),u--}return t}),s=n.formatArgs.apply(e,s);var f=o.log||n.log||console.log.bind(console);f.apply(e,s)}t.enabled=!1,o.enabled=!0;var i=n.enabled(e)?o:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;o<r;o++)t[o]&&(e=t[o].replace(/[\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){n.enable("")}function a(e){var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=o.debug=o,n.coerce=u,n.disable=s,n.enable=i,n.enabled=a,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var c,f=0},{ms:20}],20:[function(e,t,n){function r(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function o(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return s(e,f,"day")||s(e,c,"hour")||s(e,u,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,u=60*a,c=60*u,f=24*c,l=365.25*f;t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return r(e);if("number"===n&&isNaN(e)===!1)return t["long"]?i(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],21:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(d===clearTimeout)return clearTimeout(e);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?g=h.concat(g):v=-1,g.length&&u())}function u(){if(!m){var e=i(a);m=!0;for(var t=g.length;t;){for(h=g,g=[];++v<t;)h&&h[v].run();v=-1,t=g.length}h=null,m=!1,s(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,d,p=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(e){d=o}}();var h,g=[],m=!1,v=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];g.push(new c(e,t)),1!==g.length||m||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=f,p.addListener=f,p.once=f,p.off=f,p.removeListener=f,p.removeAllListeners=f,p.emit=f,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],22:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.account=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:account-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getAccount",value:function(e){var t=this.options.apiUrl+"/api/v1/accounts";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"getBalance",value:function(e){var t=this.options.apiUrl+"/api/v1/accounts/balance";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],23:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.address=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:address-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getAddresses",value:function(e){var t=this.options.apiUrl+"/api/v1/addresses";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],24:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.card=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:card-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getCard",value:function(e){var t=this.options.apiUrl+"/api/v1/cards";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],25:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.contact=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:contact-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getContacts",value:function(e){var t=this.options.apiUrl+"/api/v1/contacts";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"getContactAccount",value:function(e,t){var n=this.options.apiUrl+"/api/v1/contacts/"+t+"/accounts";return c("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,r.defaultHeaders)(e)})}},{key:"createContact",value:function(e,t,n,o,i,a){var u=this.options.apiUrl+"/api/v1/contacts";return c("POST "+u),(0,s["default"])({method:"POST",url:u,headers:(0,r.defaultHeaders)(e),body:JSON.stringify({name:t,accountType:n,accountNumber:o,sortCode:i,customerId:a})})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],26:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.customer=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:customer-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getCustomer",value:function(e){var t=this.options.apiUrl+"/api/v1/customers";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],27:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.mandate=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:mandate-service"),f=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"listMandates",value:function(e){var t=this.options.apiUrl+"/api/v1/direct-debit/mandates";return c("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"deleteMandate",value:function(e,t){var n=this.options.apiUrl+"/api/v1/direct-debit/mandates/"+t;return c("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=f})},{"../utils/http":31,axios:1,debug:18}],28:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"));else{var s={exports:{}};i(s,o.axios,o.debug),o.oauth=s.exports}}(this,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=r(t),s=r(n),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u="authorization_code",c="refresh_token",f=(0,s["default"])("starling:oauth-service"),l=function(){function e(t){o(this,e),this.options=t}return a(e,[{key:"getAccessToken",value:function(e){return this.getOAuthToken({code:e,grant_type:u,client_id:this.options.clientId,client_secret:this.options.clientSecret,redirect_uri:this.options.redirectUri})}},{key:"refreshAccessToken",value:function(e){return this.getOAuthToken({refresh_token:e,grant_type:c,client_id:this.options.clientId,client_secret:this.options.clientSecret})}},{key:"getOAuthToken",value:function(e){if(!this.options.clientId)throw Error("clientId is not configured");if(!this.options.clientSecret)throw Error("clientSecret is not configured");var t=this.options.oauthUrl+"/oauth/access-token";return f("GET "+t+" queryParams:"+JSON.stringify(e)),(0,i["default"])({url:t,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},params:e})}}]),e}();e.exports=l})},{axios:1,debug:18}],29:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"));else{var s={exports:{}};i(s,o.axios,o.debug,o.http),o.transaction=s.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=o(t),a=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=(0,a["default"])("starling:transaction-service"),f=function(e){return"MASTER_CARD"===e?"/mastercard":"FASTER_PAYMENTS_IN"===e?"/fps/in":"FASTER_PAYMENTS_OUT"===e?"/fps/out":"DIRECT_DEBIT"===e?"/direct-debit":""},l=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getTransactions",value:function(e,t,n,o){var i=this.options.apiUrl+"/api/v1/transactions"+f(o);return c("GET "+i+" from="+t+" to="+n),(0,s["default"])({method:"GET",url:i,params:{from:t,to:n},headers:(0,r.defaultHeaders)(e)})}},{key:"getTransaction",value:function(e,t,n){var o=this.options.apiUrl+"/api/v1/transactions"+f(n)+"/"+t;return c("GET "+o),(0,s["default"])({method:"GET",url:o,headers:(0,r.defaultHeaders)(e)})}}]),e}();e.exports=l})},{"../utils/http":31,axios:1,debug:18}],30:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","./entities/customer","./entities/account","./entities/address","./entities/transaction","./entities/card","./entities/oauth","./entities/contact","./entities/mandate"],i);else if("undefined"!=typeof r)i(n,t("./entities/customer"),t("./entities/account"),t("./entities/address"),t("./entities/transaction"),t("./entities/card"),t("./entities/oauth"),t("./entities/contact"),t("./entities/mandate"));else{var s={exports:{}};i(s,o.customer,o.account,o.address,o.transaction,o.card,o.oauth,o.contact,o.mandate),o.starling=s.exports}}(this,function(e,t,n,r,o,i,s,a,u){"use strict";function c(e){return e&&e.__esModule?e:{"default":e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=c(t),d=c(n),p=c(r),h=c(o),g=c(i),m=c(s),v=c(a),y=c(u),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),w=function(){function e(t){f(this,e);var n={apiUrl:"https://api.starlingbank.com",oauthUrl:"https://oauth.starlingbank.com",clientId:"",clientSecret:""};this.config=Object.assign({},n,t),this.customer=new l["default"](this.config),this.account=new d["default"](this.config),this.address=new p["default"](this.config),this.transaction=new h["default"](this.config),this.mandate=new y["default"](this.config),this.contact=new v["default"](this.config),this.card=new g["default"](this.config),this.oAuth=new m["default"](this.config)}return b(e,[{key:"getCustomer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.customer.getCustomer(e)}},{key:"getAccount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getAccount(e)}},{key:"getBalance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getBalance(e)}},{key:"getAddresses",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.address.getAddresses(e)}},{key:"getTransactions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments[2],r=arguments[3];return this.transaction.getTransactions(e,t,n,r)}},{key:"getTransaction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments[2];return this.transaction.getTransaction(e,t,n)}},{key:"listMandates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.mandate.listMandates(e)}},{key:"deleteMandate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1];return this.mandate.deleteMandate(e,t)}},{key:"getContacts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.contact.getContacts(e)}},{key:"getContactAccount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1];return this.contact.getContactAccount(e,t)}},{key:"createContact",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UK_ACCOUNT_AND_SORT_CODE",r=arguments[3],o=arguments[4],i=arguments[5];return this.contact.createContact(e,t,n,r,o,i)}},{key:"getCard",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.card.getCard(e)}},{key:"getAccessToken",value:function(e){return this.oAuth.getAccessToken(e)}},{key:"refreshAccessToken",value:function(e){return this.oAuth.refreshAccessToken(e)}}]),e}();e.exports=w})},{"./entities/account":22,"./entities/address":23,"./entities/card":24,"./entities/contact":25,"./entities/customer":26,"./entities/mandate":27,"./entities/oauth":28,"./entities/transaction":29}],31:[function(t,n,r){!function(t,n){if("function"==typeof e&&e.amd)e(["exports"],n);else if("undefined"!=typeof r)n(r);else{var o={exports:{}};n(o.exports),t.http=o.exports}}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.defaultHeaders=function(e){return{Accept:"application/json",Authorization:"Bearer "+e}}})},{}]},{},[30])(30)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.starling=e()}}(function(){var e;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){t.exports=e("./lib/axios")},{"./lib/axios":3}],2:[function(e,t,n){(function(n){"use strict";var r=e("./../utils"),o=e("./../helpers/buildURL"),i=e("./../helpers/parseHeaders"),a=e("./../helpers/transformData"),s=e("./../helpers/isURLSameOrigin"),u="undefined"!=typeof window&&window.btoa||e("./../helpers/btoa");t.exports=function(t,c,l){var f=l.data,d=l.headers;r.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest,h="onreadystatechange",m=!1;if("test"===n.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in p||s(l.url)||(p=new window.XDomainRequest,h="onload",m=!0),l.auth){var v=l.auth.username||"",g=l.auth.password||"";d.Authorization="Basic "+u(v+":"+g)}if(p.open(l.method.toUpperCase(),o(l.url,l.params,l.paramsSerializer),!0),p.timeout=l.timeout,p.onprogress=function(){},p.ontimeout=function(){},p[h]=function(){if(p&&(4===p.readyState||m)&&0!==p.status){var e="getAllResponseHeaders"in p?i(p.getAllResponseHeaders()):null,n=l.responseType&&"text"!==l.responseType?p.response:p.responseText,r={data:a(n,e,l.transformResponse),status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:e,config:l,request:p};(r.status>=200&&r.status<300||!("status"in p)&&p.responseText?t:c)(r),p=null}},p.onerror=function(){c(new Error("Network Error")),p=null},p.ontimeout=function(){var e=new Error("timeout of "+l.timeout+"ms exceeded");e.timeout=l.timeout,e.code="ECONNABORTED",c(e),p=null},r.isStandardBrowserEnv()){var y=e("./../helpers/cookies"),b=l.withCredentials||s(l.url)?y.read(l.xsrfCookieName):void 0;b&&(d[l.xsrfHeaderName]=b)}if("setRequestHeader"in p&&r.forEach(d,function(e,t){"undefined"==typeof f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)}),l.withCredentials&&(p.withCredentials=!0),l.responseType)try{p.responseType=l.responseType}catch(w){if("json"!==p.responseType)throw w}l.progress&&("post"===l.method||"put"===l.method?p.upload.addEventListener("progress",l.progress):"get"===l.method&&p.addEventListener("progress",l.progress)),r.isArrayBuffer(f)&&(f=new DataView(f)),void 0===f&&(f=null),p.send(f)}}).call(this,e("_process"))},{"./../helpers/btoa":8,"./../helpers/buildURL":9,"./../helpers/cookies":11,"./../helpers/isURLSameOrigin":13,"./../helpers/parseHeaders":14,"./../helpers/transformData":16,"./../utils":17,_process:21}],3:[function(e,t,n){"use strict";function r(e){this.defaults=i.merge({},e),this.interceptors={request:new s,response:new s}}var o=e("./defaults"),i=e("./utils"),a=e("./core/dispatchRequest"),s=e("./core/InterceptorManager"),u=e("./helpers/isAbsoluteURL"),c=e("./helpers/combineURLs"),l=e("./helpers/bind"),f=e("./helpers/transformData");r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,this.defaults,{method:"get"},e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.withCredentials=e.withCredentials||this.defaults.withCredentials,e.data=f(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n};var d=new r(o),p=t.exports=l(r.prototype.request,d);p.defaults=d.defaults,p.interceptors=d.interceptors,p.create=function(e){return new r(e)},p.all=function(e){return Promise.all(e)},p.spread=e("./helpers/spread"),i.forEach(["delete","get","head"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))},p[e]=l(r.prototype[e],d)}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))},p[e]=l(r.prototype[e],d)})},{"./core/InterceptorManager":4,"./core/dispatchRequest":5,"./defaults":6,"./helpers/bind":7,"./helpers/combineURLs":10,"./helpers/isAbsoluteURL":12,"./helpers/spread":15,"./helpers/transformData":16,"./utils":17}],4:[function(e,t,n){"use strict";function r(){this.handlers=[]}var o=e("./../utils");r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},t.exports=r},{"./../utils":17}],5:[function(e,t,n){(function(n){"use strict";t.exports=function(t){return new Promise(function(r,o){try{var i;"function"==typeof t.adapter?i=t.adapter:"undefined"!=typeof XMLHttpRequest?i=e("../adapters/xhr"):"undefined"!=typeof n&&(i=e("../adapters/http")),"function"==typeof i&&i(r,o,t)}catch(a){o(a)}})}}).call(this,e("_process"))},{"../adapters/http":2,"../adapters/xhr":2,_process:21}],6:[function(e,t,n){"use strict";var r=e("./utils"),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(e,t){return r.isFormData(e)?e:r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(r.isUndefined(t)||(r.forEach(t,function(e,n){"content-type"===n.toLowerCase()&&(t["Content-Type"]=e)}),r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1}},{"./utils":17}],7:[function(e,t,n){"use strict";t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},{}],8:[function(e,t,n){"use strict";function r(){this.message="String contains an invalid character"}function o(e){for(var t,n,o=String(e),a="",s=0,u=i;o.charAt(0|s)||(u="=",s%1);a+=u.charAt(63&t>>8-s%1*8)){if(n=o.charCodeAt(s+=.75),n>255)throw new r;t=t<<8|n}return a}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=e("./../utils");t.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else{var a=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),a.push(r(t)+"="+r(e))}))}),i=a.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},{"./../utils":17}],10:[function(e,t,n){"use strict";t.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},{}],11:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,a){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(i)&&s.push("domain="+i),a===!0&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},{"./../utils":17}],12:[function(e,t,n){"use strict";t.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},{}],13:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},{"./../utils":17}],14:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},{"./../utils":17}],15:[function(e,t,n){"use strict";t.exports=function(e){return function(t){return e.apply(null,t)}}},{}],16:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},{"./../utils":17}],17:[function(e,t,n){"use strict";function r(e){return"[object Array]"===y.call(e)}function o(e){return"[object ArrayBuffer]"===y.call(e)}function i(e){return"[object FormData]"===y.call(e)}function a(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function l(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===y.call(e)}function d(e){return"[object File]"===y.call(e)}function p(e){return"[object Blob]"===y.call(e)}function h(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function m(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var i in e)e.hasOwnProperty(i)&&t.call(null,e[i],i,e)}function g(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=g(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}var y=Object.prototype.toString;t.exports={isArray:r,isArrayBuffer:o,isFormData:i,isArrayBufferView:a,isString:s,isNumber:u,isObject:l,isUndefined:c,isDate:f,isFile:d,isBlob:p,isStandardBrowserEnv:m,forEach:v,merge:g,trim:h}},{}],18:[function(e,t,n){(function(r){function o(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,i=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r),e}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(t){}}function u(){try{return n.storage.debug}catch(e){}if("undefined"!=typeof r&&"env"in r)return r.env.DEBUG}function c(){try{return window.localStorage}catch(e){}}n=t.exports=e("./debug"),n.log=a,n.formatArgs=i,n.save=s,n.load=u,n.useColors=o,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},n.enable(u())}).call(this,e("_process"))},{"./debug":19,_process:21}],19:[function(e,t,n){function r(){return n.colors[l++%n.colors.length]}function o(e){function t(){}function o(){var e=o,t=+new Date,i=t-(c||t);e.diff=i,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());for(var a=new Array(arguments.length),s=0;s<a.length;s++)a[s]=arguments[s];a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var u=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;u++;var o=n.formatters[r];if("function"==typeof o){var i=a[u];t=o.call(e,i),a.splice(u,1),u--}return t}),a=n.formatArgs.apply(e,a);var l=o.log||n.log||console.log.bind(console);l.apply(e,a)}t.enabled=!1,o.enabled=!0;var i=n.enabled(e)?o:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;o<r;o++)t[o]&&(e=t[o].replace(/[\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function a(){n.enable("")}function s(e){var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=o.debug=o,n.coerce=u,n.disable=a,n.enable=i,n.enabled=s,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var c,l=0},{ms:20}],20:[function(e,t,n){function r(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f;case"days":case"day":case"d":return n*l;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function o(e){return e>=l?Math.round(e/l)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function i(e){return a(e,l,"day")||a(e,c,"hour")||a(e,u,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,u=60*s,c=60*u,l=24*c,f=365.25*l;t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return r(e);if("number"===n&&isNaN(e)===!1)return t["long"]?i(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],21:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function s(){v&&h&&(v=!1,h.length?m=h.concat(m):g=-1,m.length&&u())}function u(){if(!v){var e=i(s);v=!0;for(var t=m.length;t;){for(h=m,m=[];++g<t;)h&&h[g].run();g=-1,t=m.length}h=null,v=!1,a(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var f,d,p=t.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(e){d=o}}();var h,m=[],v=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new c(e,t)),1!==m.length||v||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],22:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.account=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:account-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getAccount",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/accounts";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"getBalance",value:function(e){(0,o.typeValidation)(arguments,p);var t=this.options.apiUrl+"/api/v1/accounts/balance";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],23:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.address=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:address-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getAddresses",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/addresses";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],24:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.card=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:card-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getCard",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/cards";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],25:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.contact=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:contact-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getContacts",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/contacts";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"getContactAccount",value:function(e,t){(0,o.typeValidation)(arguments,p);var n=this.options.apiUrl+"/api/v1/contacts/"+t+"/accounts";return l("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,r.defaultHeaders)(e)})}},{key:"createContact",value:function(e,t,n,i,a,u){(0,o.typeValidation)(arguments,h);var c=this.options.apiUrl+"/api/v1/contacts";return l("POST "+c),(0,s["default"])({method:"POST",url:c,headers:(0,r.defaultHeaders)(e),body:JSON.stringify({name:t,accountType:n,accountNumber:i,sortCode:a,customerId:u})})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]},{name:"customerId",validations:["required","string"]}],h=[{name:"accessToken",validations:["required","string"]},{name:"name",validations:["required","string"]},{name:"accountType",validations:["required","string"]},{name:"accountNumber",validations:["required","string"]},{name:"sortCode",validations:["required","string"]},{name:"customerId",validations:["optional","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],26:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.customer=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:customer-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getCustomer",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/customers";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],27:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.mandate=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:mandate-service"),f=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"listMandates",value:function(e){(0,o.typeValidation)(arguments,d);var t=this.options.apiUrl+"/api/v1/direct-debit/mandates";return l("GET "+t),(0,s["default"])({method:"GET",url:t,headers:(0,r.defaultHeaders)(e)})}},{key:"deleteMandate",value:function(e,t){(0,o.typeValidation)(arguments,p);var n=this.options.apiUrl+"/api/v1/direct-debit/mandates/"+t;return l("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,r.defaultHeaders)(e)})}}]),e}(),d=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]},{name:"mandateId",validations:["required","string"]}];e.exports=f})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],28:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.validator),o.oauth=a.exports}}(this,function(e,t,n,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=o(t),s=o(n),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c="authorization_code",l="refresh_token",f=(0,s["default"])("starling:oauth-service"),d=function(){function e(t){i(this,e),this.options=t}return u(e,[{key:"getAccessToken",value:function(e){return(0,r.typeValidation)(arguments,h),this.getOAuthToken({code:e,grant_type:c,client_id:this.options.clientId,client_secret:this.options.clientSecret,redirect_uri:this.options.redirectUri})}},{key:"refreshAccessToken",value:function(e){return(0,r.typeValidation)(arguments,p),this.getOAuthToken({refresh_token:e,grant_type:l,client_id:this.options.clientId,client_secret:this.options.clientSecret})}},{key:"getOAuthToken",value:function(e){if(!this.options.clientId)throw Error("clientId is not configured");if(!this.options.clientSecret)throw Error("clientSecret is not configured");var t=this.options.oauthUrl+"/oauth/access-token";return f("GET "+t+" queryParams:"+JSON.stringify(e)),(0,a["default"])({url:t,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},params:e})}}]),e}(),p=[{name:"refreshToken",validations:["required","string"]}],h=[{name:"authorizationCode",validations:["required","string"]}];e.exports=d})},{"../utils/validator":32,axios:1,debug:18}],29:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","axios","debug","../utils/http","../utils/validator"],i);else if("undefined"!=typeof r)i(n,t("axios"),t("debug"),t("../utils/http"),t("../utils/validator"));else{var a={exports:{}};i(a,o.axios,o.debug,o.http,o.validator),o.transaction=a.exports}}(this,function(e,t,n,r,o){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=i(t),u=i(n),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=(0,u["default"])("starling:transaction-service"),f=function(e){return"MASTER_CARD"===e?"/mastercard":"FASTER_PAYMENTS_IN"===e?"/fps/in":"FASTER_PAYMENTS_OUT"===e?"/fps/out":"DIRECT_DEBIT"===e?"/direct-debit":""},d=function(){function e(t){a(this,e),this.options=t}return c(e,[{key:"getTransactions",value:function(e,t,n,i){(0,o.typeValidation)(arguments,p);var a=this.options.apiUrl+"/api/v1/transactions"+f(i);return l("GET "+a+" from="+t+" to="+n),(0,s["default"])({method:"GET",url:a,params:{from:t,to:n},headers:(0,r.defaultHeaders)(e)})}},{key:"getTransaction",value:function(e,t,n){(0,o.typeValidation)(arguments,h);var i=this.options.apiUrl+"/api/v1/transactions"+f(n)+"/"+t;return l("GET "+i),(0,s["default"])({method:"GET",url:i,headers:(0,r.defaultHeaders)(e)})}}]),e}(),p=[{name:"accessToken",validations:["required","string"]},{name:"fromDate",validations:["optional","string"]},{name:"toDate",validations:["optional","string"]},{name:"source",validations:["optional","string"]}],h=[{name:"accessToken",validations:["required","string"]},{name:"transactionId",validations:["required","string"]},{name:"source",validations:["optional","string"]}];e.exports=d})},{"../utils/http":31,"../utils/validator":32,axios:1,debug:18}],30:[function(t,n,r){!function(o,i){if("function"==typeof e&&e.amd)e(["module","./entities/customer","./entities/account","./entities/address","./entities/transaction","./entities/card","./entities/oauth","./entities/contact","./entities/mandate"],i);else if("undefined"!=typeof r)i(n,t("./entities/customer"),t("./entities/account"),t("./entities/address"),t("./entities/transaction"),t("./entities/card"),t("./entities/oauth"),t("./entities/contact"),t("./entities/mandate"));else{var a={exports:{}};i(a,o.customer,o.account,o.address,o.transaction,o.card,o.oauth,o.contact,o.mandate),o.starling=a.exports}}(this,function(e,t,n,r,o,i,a,s,u){"use strict";function c(e){return e&&e.__esModule?e:{"default":e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=c(t),d=c(n),p=c(r),h=c(o),m=c(i),v=c(a),g=c(s),y=c(u),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),w=function(){function e(t){l(this,e);var n={apiUrl:"https://api.starlingbank.com",oauthUrl:"https://oauth.starlingbank.com",clientId:"",clientSecret:""};this.config=Object.assign({},n,t),this.customer=new f["default"](this.config),this.account=new d["default"](this.config),this.address=new p["default"](this.config),this.transaction=new h["default"](this.config),this.mandate=new y["default"](this.config),this.contact=new g["default"](this.config),this.card=new m["default"](this.config),this.oAuth=new v["default"](this.config)}return b(e,[{key:"getCustomer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.customer.getCustomer(e)}},{key:"getAccount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getAccount(e)}},{key:"getBalance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken; | ||
return this.account.getBalance(e)}},{key:"getAddresses",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.address.getAddresses(e)}},{key:"getTransactions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments[2],r=arguments[3];return this.transaction.getTransactions(e,t,n,r)}},{key:"getTransaction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments[2];return this.transaction.getTransaction(e,t,n)}},{key:"listMandates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.mandate.listMandates(e)}},{key:"deleteMandate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1];return this.mandate.deleteMandate(e,t)}},{key:"getContacts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.contact.getContacts(e)}},{key:"getContactAccount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1];return this.contact.getContactAccount(e,t)}},{key:"createContact",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,t=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UK_ACCOUNT_AND_SORT_CODE",r=arguments[3],o=arguments[4],i=arguments[5];return this.contact.createContact(e,t,n,r,o,i)}},{key:"getCard",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.card.getCard(e)}},{key:"getAccessToken",value:function(e){return this.oAuth.getAccessToken(e)}},{key:"refreshAccessToken",value:function(e){return this.oAuth.refreshAccessToken(e)}}]),e}();e.exports=w})},{"./entities/account":22,"./entities/address":23,"./entities/card":24,"./entities/contact":25,"./entities/customer":26,"./entities/mandate":27,"./entities/oauth":28,"./entities/transaction":29}],31:[function(t,n,r){!function(t,n){if("function"==typeof e&&e.amd)e(["exports"],n);else if("undefined"!=typeof r)n(r);else{var o={exports:{}};n(o.exports),t.http=o.exports}}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.defaultHeaders=function(e){return{Accept:"application/json",Authorization:"Bearer "+e}}})},{}],32:[function(t,n,r){!function(t,n){if("function"==typeof e&&e.amd)e(["exports"],n);else if("undefined"!=typeof r)n(r);else{var o={exports:{}};n(o.exports),t.validator=o.exports}}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(e,n,r,o){var i="undefined"==typeof o?"undefined":t(o);if("optional"==r[0]&&o&&i!==r[1])return n+" parameter in position "+e+" is an optional "+r[1]+" but was "+i;if("required"==r[0]){if(o&&i!==r[1])return n+" parameter in position "+e+" is a required "+r[1]+" but was "+i;if(!o)return n+" parameter in position "+e+" is a required "+r[1]+" but was "+o}};e.typeValidation=function(e,t){for(var r=[],o=0;o<t.length;o++){var i=o,a=t[o].name,s=t[o].validations,u=o<=e.length?e[o]:void 0,c=n(i,a,s,u);c&&r.push(c)}if(r.length)throw r}})},{}]},{},[30])(30)}); | ||
//# sourceMappingURL=starling.bundle.min.js.map |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.starling = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -11,6 +11,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.account = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -80,2 +80,3 @@ | ||
value: function getAccount(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getAccountParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/accounts'; | ||
@@ -93,2 +94,3 @@ log('GET ' + url); | ||
value: function getBalance(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getBalanceParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/accounts/balance'; | ||
@@ -108,11 +110,15 @@ log('GET ' + url); | ||
var getAccountParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
var getBalanceParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
module.exports = Account; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],2:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],2:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -122,6 +128,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.address = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -191,2 +197,3 @@ | ||
value: function getAddresses(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getAddressParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/addresses'; | ||
@@ -206,11 +213,13 @@ log('GET ' + url); | ||
var getAddressParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
module.exports = Address; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],3:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],3:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -220,6 +229,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.card = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -289,2 +298,3 @@ | ||
value: function getCard(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getCardParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/cards'; | ||
@@ -304,11 +314,13 @@ log('GET ' + url); | ||
var getCardParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
module.exports = Card; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],4:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],4:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -318,6 +330,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.contact = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -387,2 +399,3 @@ | ||
value: function getContacts(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getContactsParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/contacts'; | ||
@@ -400,2 +413,3 @@ log('GET ' + url); | ||
value: function getContactAccount(accessToken, contactId) { | ||
(0, _validator.typeValidation)(arguments, getContactAccountParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/contacts/' + contactId + '/accounts'; | ||
@@ -412,2 +426,3 @@ log('GET ' + url); | ||
value: function createContact(accessToken, name, accountType, accountNumber, sortCode, customerId) { | ||
(0, _validator.typeValidation)(arguments, createContactParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/contacts'; | ||
@@ -433,11 +448,17 @@ log('POST ' + url); | ||
var getContactsParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
var getContactAccountParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }, { name: 'customerId', validations: ['required', 'string'] }]; | ||
var createContactParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }, { name: 'name', validations: ['required', 'string'] }, { name: 'accountType', validations: ['required', 'string'] }, { name: 'accountNumber', validations: ['required', 'string'] }, { name: 'sortCode', validations: ['required', 'string'] }, { name: 'customerId', validations: ['optional', 'string'] }]; | ||
module.exports = Contact; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],5:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],5:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -447,6 +468,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.customer = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -516,2 +537,3 @@ | ||
value: function getCustomer(accessToken) { | ||
(0, _validator.typeValidation)(arguments, getCustomerParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/customers'; | ||
@@ -531,11 +553,13 @@ log('GET ' + url); | ||
var getCustomerParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
module.exports = Customer; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],6:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],6:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -545,6 +569,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.mandate = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -613,2 +637,3 @@ | ||
value: function listMandates(accessToken) { | ||
(0, _validator.typeValidation)(arguments, listMandatesParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/direct-debit/mandates'; | ||
@@ -625,2 +650,3 @@ log('GET ' + url); | ||
value: function deleteMandate(accessToken, mandateId) { | ||
(0, _validator.typeValidation)(arguments, deleteMandateParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/direct-debit/mandates/' + mandateId; | ||
@@ -639,11 +665,15 @@ log('GET ' + url); | ||
var listMandatesParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }]; | ||
var deleteMandateParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }, { name: 'mandateId', validations: ['required', 'string'] }]; | ||
module.exports = Mandate; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],7:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],7:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug'], factory); | ||
define(['module', 'axios', 'debug', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug')); | ||
factory(module, require('axios'), require('debug'), require('../utils/validator')); | ||
} else { | ||
@@ -653,6 +683,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug); | ||
factory(mod, global.axios, global.debug, global.validator); | ||
global.oauth = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug) { | ||
})(this, function (module, _axios, _debug, _validator) { | ||
'use strict'; | ||
@@ -726,2 +756,3 @@ | ||
value: function getAccessToken(authorizationCode) { | ||
(0, _validator.typeValidation)(arguments, authorizationCodeParameterDefinition); | ||
return this.getOAuthToken({ | ||
@@ -738,2 +769,3 @@ 'code': authorizationCode, | ||
value: function refreshAccessToken(refreshToken) { | ||
(0, _validator.typeValidation)(arguments, refreshTokenParameterDefinition); | ||
return this.getOAuthToken({ | ||
@@ -775,11 +807,15 @@ 'refresh_token': refreshToken, | ||
var refreshTokenParameterDefinition = [{ name: 'refreshToken', validations: ['required', 'string'] }]; | ||
var authorizationCodeParameterDefinition = [{ name: 'authorizationCode', validations: ['required', 'string'] }]; | ||
module.exports = OAuth; | ||
}); | ||
},{"axios":undefined,"debug":undefined}],8:[function(require,module,exports){ | ||
},{"../utils/validator":11,"axios":undefined,"debug":undefined}],8:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['module', 'axios', 'debug', '../utils/http'], factory); | ||
define(['module', 'axios', 'debug', '../utils/http', '../utils/validator'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module, require('axios'), require('debug'), require('../utils/http')); | ||
factory(module, require('axios'), require('debug'), require('../utils/http'), require('../utils/validator')); | ||
} else { | ||
@@ -789,6 +825,6 @@ var mod = { | ||
}; | ||
factory(mod, global.axios, global.debug, global.http); | ||
factory(mod, global.axios, global.debug, global.http, global.validator); | ||
global.transaction = mod.exports; | ||
} | ||
})(this, function (module, _axios, _debug, _http) { | ||
})(this, function (module, _axios, _debug, _http, _validator) { | ||
'use strict'; | ||
@@ -875,2 +911,3 @@ | ||
value: function getTransactions(accessToken, fromDate, toDate, source) { | ||
(0, _validator.typeValidation)(arguments, getTransactionsParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/transactions' + transactionSource(source); | ||
@@ -892,2 +929,3 @@ log('GET ' + url + ' from=' + fromDate + ' to=' + toDate); | ||
value: function getTransaction(accessToken, transactionId, source) { | ||
(0, _validator.typeValidation)(arguments, getTransactionParameterDefinition); | ||
var url = this.options.apiUrl + '/api/v1/transactions' + transactionSource(source) + '/' + transactionId; | ||
@@ -906,6 +944,10 @@ log('GET ' + url); | ||
var getTransactionsParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }, { name: 'fromDate', validations: ['optional', 'string'] }, { name: 'toDate', validations: ['optional', 'string'] }, { name: 'source', validations: ['optional', 'string'] }]; | ||
var getTransactionParameterDefinition = [{ name: 'accessToken', validations: ['required', 'string'] }, { name: 'transactionId', validations: ['required', 'string'] }, { name: 'source', validations: ['optional', 'string'] }]; | ||
module.exports = Transaction; | ||
}); | ||
},{"../utils/http":10,"axios":undefined,"debug":undefined}],9:[function(require,module,exports){ | ||
},{"../utils/http":10,"../utils/validator":11,"axios":undefined,"debug":undefined}],9:[function(require,module,exports){ | ||
(function (global, factory) { | ||
@@ -1149,2 +1191,62 @@ if (typeof define === "function" && define.amd) { | ||
},{}],11:[function(require,module,exports){ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports); | ||
global.validator = mod.exports; | ||
} | ||
})(this, function (exports) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var runRules = function runRules(pos, name, rules, value) { | ||
var valueType = typeof value === 'undefined' ? 'undefined' : _typeof(value); | ||
if (rules[0] == 'optional') { | ||
if (value && valueType !== rules[1]) { | ||
return name + ' parameter in position ' + pos + ' is an optional ' + rules[1] + ' but was ' + valueType; | ||
} | ||
} | ||
if (rules[0] == 'required') { | ||
if (value && valueType !== rules[1]) { | ||
return name + ' parameter in position ' + pos + ' is a required ' + rules[1] + ' but was ' + valueType; | ||
} else if (!value) { | ||
return name + ' parameter in position ' + pos + ' is a required ' + rules[1] + ' but was ' + value; | ||
} | ||
} | ||
}; | ||
var typeValidation = exports.typeValidation = function typeValidation(args, def) { | ||
var problems = []; | ||
for (var i = 0; i < def.length; i++) { | ||
var pos = i; | ||
var name = def[i].name; | ||
var rules = def[i].validations; | ||
var value = i <= args.length ? args[i] : undefined; | ||
var problem = runRules(pos, name, rules, value); | ||
if (problem) problems.push(problem); | ||
} | ||
if (problems.length) { | ||
throw problems; | ||
} | ||
}; | ||
}); | ||
},{}]},{},[9])(9) | ||
@@ -1151,0 +1253,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.starling=t()}}(function(){var t;return function e(t,n,i){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(r)return r(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return o(n?n:e)},f,f.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.account=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:account-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getAccount",value:function(t){var e=this.options.apiUrl+"/api/v1/accounts";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"getBalance",value:function(t){var e=this.options.apiUrl+"/api/v1/accounts/balance";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],2:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.address=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:address-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getAddresses",value:function(t){var e=this.options.apiUrl+"/api/v1/addresses";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],3:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.card=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:card-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getCard",value:function(t){var e=this.options.apiUrl+"/api/v1/cards";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],4:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.contact=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:contact-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getContacts",value:function(t){var e=this.options.apiUrl+"/api/v1/contacts";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"getContactAccount",value:function(t,e){var n=this.options.apiUrl+"/api/v1/contacts/"+e+"/accounts";return c("GET "+n),(0,a["default"])({method:"GET",url:n,headers:(0,i.defaultHeaders)(t)})}},{key:"createContact",value:function(t,e,n,o,r,s){var u=this.options.apiUrl+"/api/v1/contacts";return c("POST "+u),(0,a["default"])({method:"POST",url:u,headers:(0,i.defaultHeaders)(t),body:JSON.stringify({name:e,accountType:n,accountNumber:o,sortCode:r,customerId:s})})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],5:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.customer=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:customer-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getCustomer",value:function(t){var e=this.options.apiUrl+"/api/v1/customers";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],6:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.mandate=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:mandate-service"),f=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"listMandates",value:function(t){var e=this.options.apiUrl+"/api/v1/direct-debit/mandates";return c("GET "+e),(0,a["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"deleteMandate",value:function(t,e){var n=this.options.apiUrl+"/api/v1/direct-debit/mandates/"+e;return c("GET "+n),(0,a["default"])({method:"GET",url:n,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=f})},{"../utils/http":10,axios:void 0,debug:void 0}],7:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"));else{var a={exports:{}};r(a,o.axios,o.debug),o.oauth=a.exports}}(this,function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=i(e),a=i(n),s=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),u="authorization_code",c="refresh_token",f=(0,a["default"])("starling:oauth-service"),l=function(){function t(e){o(this,t),this.options=e}return s(t,[{key:"getAccessToken",value:function(t){return this.getOAuthToken({code:t,grant_type:u,client_id:this.options.clientId,client_secret:this.options.clientSecret,redirect_uri:this.options.redirectUri})}},{key:"refreshAccessToken",value:function(t){return this.getOAuthToken({refresh_token:t,grant_type:c,client_id:this.options.clientId,client_secret:this.options.clientSecret})}},{key:"getOAuthToken",value:function(t){if(!this.options.clientId)throw Error("clientId is not configured");if(!this.options.clientSecret)throw Error("clientSecret is not configured");var e=this.options.oauthUrl+"/oauth/access-token";return f("GET "+e+" queryParams:"+JSON.stringify(t)),(0,r["default"])({url:e,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},params:t})}}]),t}();t.exports=l})},{axios:void 0,debug:void 0}],8:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http"],r);else if("undefined"!=typeof i)r(n,e("axios"),e("debug"),e("../utils/http"));else{var a={exports:{}};r(a,o.axios,o.debug,o.http),o.transaction=a.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=(0,s["default"])("starling:transaction-service"),f=function(t){return"MASTER_CARD"===t?"/mastercard":"FASTER_PAYMENTS_IN"===t?"/fps/in":"FASTER_PAYMENTS_OUT"===t?"/fps/out":"DIRECT_DEBIT"===t?"/direct-debit":""},l=function(){function t(e){r(this,t),this.options=e}return u(t,[{key:"getTransactions",value:function(t,e,n,o){var r=this.options.apiUrl+"/api/v1/transactions"+f(o);return c("GET "+r+" from="+e+" to="+n),(0,a["default"])({method:"GET",url:r,params:{from:e,to:n},headers:(0,i.defaultHeaders)(t)})}},{key:"getTransaction",value:function(t,e,n){var o=this.options.apiUrl+"/api/v1/transactions"+f(n)+"/"+e;return c("GET "+o),(0,a["default"])({method:"GET",url:o,headers:(0,i.defaultHeaders)(t)})}}]),t}();t.exports=l})},{"../utils/http":10,axios:void 0,debug:void 0}],9:[function(e,n,i){!function(o,r){if("function"==typeof t&&t.amd)t(["module","./entities/customer","./entities/account","./entities/address","./entities/transaction","./entities/card","./entities/oauth","./entities/contact","./entities/mandate"],r);else if("undefined"!=typeof i)r(n,e("./entities/customer"),e("./entities/account"),e("./entities/address"),e("./entities/transaction"),e("./entities/card"),e("./entities/oauth"),e("./entities/contact"),e("./entities/mandate"));else{var a={exports:{}};r(a,o.customer,o.account,o.address,o.transaction,o.card,o.oauth,o.contact,o.mandate),o.starling=a.exports}}(this,function(t,e,n,i,o,r,a,s,u){"use strict";function c(t){return t&&t.__esModule?t:{"default":t}}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=c(e),d=c(n),h=c(i),p=c(o),v=c(r),g=c(a),y=c(s),b=c(u),m=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),T=function(){function t(e){f(this,t);var n={apiUrl:"https://api.starlingbank.com",oauthUrl:"https://oauth.starlingbank.com",clientId:"",clientSecret:""};this.config=Object.assign({},n,e),this.customer=new l["default"](this.config),this.account=new d["default"](this.config),this.address=new h["default"](this.config),this.transaction=new p["default"](this.config),this.mandate=new b["default"](this.config),this.contact=new y["default"](this.config),this.card=new v["default"](this.config),this.oAuth=new g["default"](this.config)}return m(t,[{key:"getCustomer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.customer.getCustomer(t)}},{key:"getAccount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getAccount(t)}},{key:"getBalance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getBalance(t)}},{key:"getAddresses",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.address.getAddresses(t)}},{key:"getTransactions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments[2],i=arguments[3];return this.transaction.getTransactions(t,e,n,i)}},{key:"getTransaction",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments[2];return this.transaction.getTransaction(t,e,n)}},{key:"listMandates",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.mandate.listMandates(t)}},{key:"deleteMandate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1];return this.mandate.deleteMandate(t,e)}},{key:"getContacts",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.contact.getContacts(t)}},{key:"getContactAccount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1];return this.contact.getContactAccount(t,e)}},{key:"createContact",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UK_ACCOUNT_AND_SORT_CODE",i=arguments[3],o=arguments[4],r=arguments[5];return this.contact.createContact(t,e,n,i,o,r)}},{key:"getCard",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.card.getCard(t)}},{key:"getAccessToken",value:function(t){return this.oAuth.getAccessToken(t)}},{key:"refreshAccessToken",value:function(t){return this.oAuth.refreshAccessToken(t)}}]),t}();t.exports=T})},{"./entities/account":1,"./entities/address":2,"./entities/card":3,"./entities/contact":4,"./entities/customer":5,"./entities/mandate":6,"./entities/oauth":7,"./entities/transaction":8}],10:[function(e,n,i){!function(e,n){if("function"==typeof t&&t.amd)t(["exports"],n);else if("undefined"!=typeof i)n(i);else{var o={exports:{}};n(o.exports),e.http=o.exports}}(this,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultHeaders=function(t){return{Accept:"application/json",Authorization:"Bearer "+t}}})},{}]},{},[9])(9)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.starling=t()}}(function(){var t;return function e(t,n,i){function o(r,s){if(!n[r]){if(!t[r]){var u="function"==typeof require&&require;if(!s&&u)return u(r,!0);if(a)return a(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[r]={exports:{}};t[r][0].call(l.exports,function(e){var n=t[r][1][e];return o(n?n:e)},l,l.exports,e,t,n,i)}return n[r].exports}for(var a="function"==typeof require&&require,r=0;r<i.length;r++)o(i[r]);return o}({1:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.account=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:account-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getAccount",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/accounts";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"getBalance",value:function(t){(0,o.typeValidation)(arguments,p);var e=this.options.apiUrl+"/api/v1/accounts/balance";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],2:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.address=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:address-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getAddresses",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/addresses";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],3:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.card=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:card-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getCard",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/cards";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],4:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.contact=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:contact-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getContacts",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/contacts";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"getContactAccount",value:function(t,e){(0,o.typeValidation)(arguments,p);var n=this.options.apiUrl+"/api/v1/contacts/"+e+"/accounts";return l("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,i.defaultHeaders)(t)})}},{key:"createContact",value:function(t,e,n,a,r,u){(0,o.typeValidation)(arguments,v);var c=this.options.apiUrl+"/api/v1/contacts";return l("POST "+c),(0,s["default"])({method:"POST",url:c,headers:(0,i.defaultHeaders)(t),body:JSON.stringify({name:e,accountType:n,accountNumber:a,sortCode:r,customerId:u})})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]},{name:"customerId",validations:["required","string"]}],v=[{name:"accessToken",validations:["required","string"]},{name:"name",validations:["required","string"]},{name:"accountType",validations:["required","string"]},{name:"accountNumber",validations:["required","string"]},{name:"sortCode",validations:["required","string"]},{name:"customerId",validations:["optional","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],5:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.customer=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:customer-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getCustomer",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/customers";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],6:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.mandate=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:mandate-service"),d=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"listMandates",value:function(t){(0,o.typeValidation)(arguments,f);var e=this.options.apiUrl+"/api/v1/direct-debit/mandates";return l("GET "+e),(0,s["default"])({method:"GET",url:e,headers:(0,i.defaultHeaders)(t)})}},{key:"deleteMandate",value:function(t,e){(0,o.typeValidation)(arguments,p);var n=this.options.apiUrl+"/api/v1/direct-debit/mandates/"+e;return l("GET "+n),(0,s["default"])({method:"GET",url:n,headers:(0,i.defaultHeaders)(t)})}}]),t}(),f=[{name:"accessToken",validations:["required","string"]}],p=[{name:"accessToken",validations:["required","string"]},{name:"mandateId",validations:["required","string"]}];t.exports=d})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],7:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.validator),o.oauth=r.exports}}(this,function(t,e,n,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=o(e),s=o(n),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c="authorization_code",l="refresh_token",d=(0,s["default"])("starling:oauth-service"),f=function(){function t(e){a(this,t),this.options=e}return u(t,[{key:"getAccessToken",value:function(t){return(0,i.typeValidation)(arguments,v),this.getOAuthToken({code:t,grant_type:c,client_id:this.options.clientId,client_secret:this.options.clientSecret,redirect_uri:this.options.redirectUri})}},{key:"refreshAccessToken",value:function(t){return(0,i.typeValidation)(arguments,p),this.getOAuthToken({refresh_token:t,grant_type:l,client_id:this.options.clientId,client_secret:this.options.clientSecret})}},{key:"getOAuthToken",value:function(t){if(!this.options.clientId)throw Error("clientId is not configured");if(!this.options.clientSecret)throw Error("clientSecret is not configured");var e=this.options.oauthUrl+"/oauth/access-token";return d("GET "+e+" queryParams:"+JSON.stringify(t)),(0,r["default"])({url:e,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},params:t})}}]),t}(),p=[{name:"refreshToken",validations:["required","string"]}],v=[{name:"authorizationCode",validations:["required","string"]}];t.exports=f})},{"../utils/validator":11,axios:void 0,debug:void 0}],8:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","axios","debug","../utils/http","../utils/validator"],a);else if("undefined"!=typeof i)a(n,e("axios"),e("debug"),e("../utils/http"),e("../utils/validator"));else{var r={exports:{}};a(r,o.axios,o.debug,o.http,o.validator),o.transaction=r.exports}}(this,function(t,e,n,i,o){"use strict";function a(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=a(e),u=a(n),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=(0,u["default"])("starling:transaction-service"),d=function(t){return"MASTER_CARD"===t?"/mastercard":"FASTER_PAYMENTS_IN"===t?"/fps/in":"FASTER_PAYMENTS_OUT"===t?"/fps/out":"DIRECT_DEBIT"===t?"/direct-debit":""},f=function(){function t(e){r(this,t),this.options=e}return c(t,[{key:"getTransactions",value:function(t,e,n,a){(0,o.typeValidation)(arguments,p);var r=this.options.apiUrl+"/api/v1/transactions"+d(a);return l("GET "+r+" from="+e+" to="+n),(0,s["default"])({method:"GET",url:r,params:{from:e,to:n},headers:(0,i.defaultHeaders)(t)})}},{key:"getTransaction",value:function(t,e,n){(0,o.typeValidation)(arguments,v);var a=this.options.apiUrl+"/api/v1/transactions"+d(n)+"/"+e;return l("GET "+a),(0,s["default"])({method:"GET",url:a,headers:(0,i.defaultHeaders)(t)})}}]),t}(),p=[{name:"accessToken",validations:["required","string"]},{name:"fromDate",validations:["optional","string"]},{name:"toDate",validations:["optional","string"]},{name:"source",validations:["optional","string"]}],v=[{name:"accessToken",validations:["required","string"]},{name:"transactionId",validations:["required","string"]},{name:"source",validations:["optional","string"]}];t.exports=f})},{"../utils/http":10,"../utils/validator":11,axios:void 0,debug:void 0}],9:[function(e,n,i){!function(o,a){if("function"==typeof t&&t.amd)t(["module","./entities/customer","./entities/account","./entities/address","./entities/transaction","./entities/card","./entities/oauth","./entities/contact","./entities/mandate"],a);else if("undefined"!=typeof i)a(n,e("./entities/customer"),e("./entities/account"),e("./entities/address"),e("./entities/transaction"),e("./entities/card"),e("./entities/oauth"),e("./entities/contact"),e("./entities/mandate"));else{var r={exports:{}};a(r,o.customer,o.account,o.address,o.transaction,o.card,o.oauth,o.contact,o.mandate),o.starling=r.exports}}(this,function(t,e,n,i,o,a,r,s,u){"use strict";function c(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var d=c(e),f=c(n),p=c(i),v=c(o),h=c(a),g=c(r),y=c(s),m=c(u),b=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),T=function(){function t(e){l(this,t);var n={apiUrl:"https://api.starlingbank.com",oauthUrl:"https://oauth.starlingbank.com",clientId:"",clientSecret:""};this.config=Object.assign({},n,e),this.customer=new d["default"](this.config),this.account=new f["default"](this.config),this.address=new p["default"](this.config),this.transaction=new v["default"](this.config),this.mandate=new m["default"](this.config),this.contact=new y["default"](this.config),this.card=new h["default"](this.config),this.oAuth=new g["default"](this.config)}return b(t,[{key:"getCustomer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.customer.getCustomer(t)}},{key:"getAccount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getAccount(t)}},{key:"getBalance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.account.getBalance(t)}},{key:"getAddresses",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.address.getAddresses(t)}},{key:"getTransactions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments[2],i=arguments[3];return this.transaction.getTransactions(t,e,n,i)}},{key:"getTransaction",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments[2];return this.transaction.getTransaction(t,e,n)}},{key:"listMandates",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.mandate.listMandates(t)}},{key:"deleteMandate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1];return this.mandate.deleteMandate(t,e)}},{key:"getContacts",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.contact.getContacts(t)}},{key:"getContactAccount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1];return this.contact.getContactAccount(t,e)}},{key:"createContact",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken,e=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UK_ACCOUNT_AND_SORT_CODE",i=arguments[3],o=arguments[4],a=arguments[5];return this.contact.createContact(t,e,n,i,o,a)}},{key:"getCard",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.accessToken;return this.card.getCard(t)}},{key:"getAccessToken",value:function(t){return this.oAuth.getAccessToken(t)}},{key:"refreshAccessToken",value:function(t){return this.oAuth.refreshAccessToken(t)}}]),t}();t.exports=T})},{"./entities/account":1,"./entities/address":2,"./entities/card":3,"./entities/contact":4,"./entities/customer":5,"./entities/mandate":6,"./entities/oauth":7,"./entities/transaction":8}],10:[function(e,n,i){!function(e,n){if("function"==typeof t&&t.amd)t(["exports"],n);else if("undefined"!=typeof i)n(i);else{var o={exports:{}};n(o.exports),e.http=o.exports}}(this,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultHeaders=function(t){return{Accept:"application/json",Authorization:"Bearer "+t}}})},{}],11:[function(e,n,i){!function(e,n){if("function"==typeof t&&t.amd)t(["exports"],n);else if("undefined"!=typeof i)n(i);else{var o={exports:{}};n(o.exports),e.validator=o.exports}}(this,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t,n,i,o){var a="undefined"==typeof o?"undefined":e(o);if("optional"==i[0]&&o&&a!==i[1])return n+" parameter in position "+t+" is an optional "+i[1]+" but was "+a;if("required"==i[0]){if(o&&a!==i[1])return n+" parameter in position "+t+" is a required "+i[1]+" but was "+a;if(!o)return n+" parameter in position "+t+" is a required "+i[1]+" but was "+o}};t.typeValidation=function(t,e){for(var i=[],o=0;o<e.length;o++){var a=o,r=e[o].name,s=e[o].validations,u=o<=t.length?t[o]:void 0,c=n(a,r,s,u);c&&i.push(c)}if(i.length)throw i}})},{}]},{},[9])(9)}); | ||
//# sourceMappingURL=starling.min.js.map |
{ | ||
"name": "starling-developer-sdk", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Starling Bank Developer SDK", | ||
@@ -9,3 +9,3 @@ "main": "dist/components/starling.js", | ||
"build": "gulp build", | ||
"test": "mocha --opts test/mocha.opts test/*.spec.js test/entities/*spec.js", | ||
"test": "mocha --opts test/mocha.opts test/*.spec.js test/entities/*spec.js test/utils/*spec.js", | ||
"test-verbose": "DEBUG=starling* npm test", | ||
@@ -12,0 +12,0 @@ "lint": "gulp lint", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
728753
26.72%32
166.67%5023
31.08%0
-100%