12345678 |
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AdaPay=t():e.AdaPay=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=7)}([function(e,t,n){"use strict";var r={};e.exports=r,r.channelConfig={alipay_qr:"alipay_qr",alipay_wap:"alipay_wap",wx_qr:"wx_qr",wx_pub:"wx_pub",alipay_lite:"alipay_lite"},r.chackMsg={orderError:"发起支付失败",channelError:"支付渠道参数错误",amountError:"支付金额参数错误",queryUrlError:"支付结果url参数未知"},r.payStatus={succeeded:"succeeded",failed:"failed",pending:"pending",timeout:"timeout",cancel:"unknown",unknown:"unknown",paramError:"paramError"},r.payResult={succeeded:{result_status:r.payStatus.succeeded,result_message:"订单支付成功",result_info:{}},failed:{result_status:r.payStatus.failed,result_message:"订单支付失败",result_info:{}},pending:{result_status:r.payStatus.pending,result_message:"订单支付中",result_info:{}},timeout:{result_status:r.payStatus.timeout,result_message:"订单支付超时",result_info:{}},cancel:{result_status:r.payStatus.cancel,result_message:"支付取消",result_info:{}},unknown:{result_status:r.payStatus.unknown,result_message:"订单结果未知",result_info:{}},paramError:{result_status:r.payStatus.paramError,result_message:"参数错误",result_info:{}}}},function(e,t,n){"use strict";e.exports={os:function(){var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),o=/(?:Firefox)/.test(e),i=(/(?:Chrome|CriOS)/.test(e),/(?:iPad|PlayBook)/.test(e)||r&&!/(?:Mobile)/.test(e)||o&&/(?:Tablet)/.test(e)),a=/(?:iPhone)/.test(e)&&!i;return{isTablet:i,isPhone:a,isAndroid:r,isPc:!a&&!r&&!n}}(),app:function(){var e=navigator.userAgent.toLowerCase();return"alipay"==e.match(/Alipay/i)?"alipay":"micromessenger"==e.match(/MicroMessenger/i)?"wechat":"other"}()}},function(e,t,n){"use strict";var r=n(0),o=n(6),i=n(4),a=n(8),s=n(5),u=n(1);o.defaults.timeout=6e4,o.defaults.headers={"Content-Type":"application/json",Accept:"application/json"},e.exports={doPay:function(e,t,n){var o=this.checkpayment(e);if(o)return r.payResult.paramError.result_message=o,void n(r.payResult.paramError);e.pay_channel===r.channelConfig.alipay_qr||e.pay_channel===r.channelConfig.wx_qr?this.handlePayResult(e.query_url,t).then(function(e){n(e)}):e.pay_channel===r.channelConfig.alipay_wap||e.pay_channel===r.channelConfig.alipay_lite?this.aliPay(e,t,function(e){n(e)}):e.pay_channel===r.channelConfig.wx_pub?this.wxPay(e,t,function(e){n(e)}):(r.payResult.paramError.result_message=r.chackMsg.channelError,n(r.payResult.paramError))},query:function(e,t){this.requestPayResult(e.query_url).then(function(e){t(e)})},aliPay:function(e,t,n){s.wapFunc(e),this.handlePayResult(e.query_url,t).then(function(e){n(e)})},wxPay:function(e,t,n){if("false"===e.prod_mode){var r=e.expend.pay_info+"?payment_id="+e.id+"&pay_channel="+e.pay_channel;u.os.isPc?window.open(r):window.location.href=r,this.handlePayResult(e.query_url,t).then(function(e){n(e)})}else{var o=JSON.parse(e.expend.pay_info);a.wxPay(o,function(e){n(e)})}},handlePayResult:function(e,t){var n=0,o=this,a=void 0,s={};return new i(function(i,u){a=setInterval(function(){n>t&&(clearInterval(a),r.payResult.timeout.result_info=s,i(r.payResult.timeout)),n+=1,o.requestPayResult(e).then(function(e){s=e.result_info,e.result_status!==r.payStatus.succeeded&&e.result_status!==r.payStatus.failed||(clearInterval(a),i(e))})},1e3)})},requestPayResult:function(e){return new i(function(t,n){o.get(e).then(function(e){var n=e.data;n.status===r.payStatus.succeeded?(r.payResult.succeeded.result_info=n,t(r.payResult.succeeded)):n.status===r.payStatus.pending?(r.payResult.pending.result_info=n,t(r.payResult.pending)):(r.payResult.unknown.result_info=n,t(r.payResult.unknown))}).catch(function(e){if(e&&e.response){var n=e.response.data;r.payResult.failed.result_info=n,t(r.payResult.failed)}else r.payResult.unknown.result_info={},t(r.payResult.unknown)})})},checkpayment:function(e){var t=Object.values(r.channelConfig);return"succeeded"!==e.status?r.chackMsg.orderError:t.indexOf(e.pay_channel)<0?r.chackMsg.channelError:void 0}}},function(e,t,n){"use strict";e.exports={v:"1.0.4"}},function(e,t,n){"use strict";function r(e){this.value,this.status="pending",this.resolveFunc=function(){},this.rejectFunc=function(){},e(this.resolve.bind(this),this.reject.bind(this))}r.prototype.resolve=function(e){var t=this;"pending"==this.status&&(this.status="resolved",this.value=e,setTimeout(function(){t.resolveFunc(t.value)},0))},r.prototype.reject=function(e){var t=this;"pending"==this.status&&(this.status="rejected",this.value=e,setTimeout(function(){t.rejectFunc(t.value)},0))},r.prototype.then=function(e,t){var n=this;return new r(function(r,o){function i(){var t=e(n.value);t&&"function"==typeof t.then?t.then(r,o):r(t)}function a(){var e=t(n.value);e&&"function"==typeof e.then?e.then(r,o):r(e)}n.resolveFunc=i,n.rejectFunc=a})},e.exports=r},function(e,t,n){"use strict";n(1),n(0);e.exports={wapFunc:function(e){var t="false"===e.prod_mode?e.expend.pay_info+"?payment_id="+e.id+"&pay_channel="+e.pay_channel:e.expend.pay_info;window.location.href="alipays://platformapi/startapp?saId=10000007&qrcode="+t},liteFunc:function(e,t){self=this,"undefined"!=typeof AlipayJSBridge?AlipayJSBridge.call("tradePay",{tradeNO:e},function(e){t(e)}):void 0!==this.ap?this.ap.tradePay({tradeNO:e},function(e){t(e)}):self.loadAlipay().then(function(e){e&&self.liteFunc()}).catch(function(e){console.error(e)})},loadAlipay:function(){return new Promise(function(e,t){var n=document.createElement("script");n.type="text/javascript",n.src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.0.0/alipayjsapi.inc.min.js",n.onload=function(){e(!0)},n.onerror=t,document.head.appendChild(n)})},handlePayResult:function(){return new Promise(function(e,t){setTimeout(function(){e("支付成功")},5e3)})}}},function(e,t,n){"use strict";(function(e,n){var r,o,i,a="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};!function(e,s){"object"===a(t)&&"object"===a(n)?n.exports=s():(o=[],r=s,void 0!==(i="function"==typeof r?r.apply(t,o):r)&&(n.exports=i))}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function r(e){var t=new a(e),n=i(a.prototype.request,t);return o.extend(n,a.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),a=n(5),s=n(22),u=n(11),c=r(u);c.Axios=a,c.create=function(e){return r(s(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(10),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){function r(e){return"[object Array]"===P.call(e)}function o(e){return"[object ArrayBuffer]"===P.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function c(e){return"number"==typeof e}function f(e){return void 0===e}function l(e){return null!==e&&"object"===(void 0===e?"undefined":a(e))}function p(e){return"[object Date]"===P.call(e)}function d(e){return"[object File]"===P.call(e)}function h(e){return"[object Blob]"===P.call(e)}function y(e){return"[object Function]"===P.call(e)}function m(e){return l(e)&&y(e.pipe)}function g(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function w(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function x(e,t){if(null!==e&&void 0!==e)if("object"!==(void 0===e?"undefined":a(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)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function _(){function e(e,n){"object"===a(t[n])&&"object"===(void 0===e?"undefined":a(e))?t[n]=_(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)x(arguments[n],e);return t}function b(){function e(e,n){"object"===a(t[n])&&"object"===(void 0===e?"undefined":a(e))?t[n]=b(t[n],e):"object"===(void 0===e?"undefined":a(e))?t[n]=b({},e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)x(arguments[n],e);return t}function R(e,t,n){return x(t,function(t,r){e[r]=n&&"function"==typeof t?S(t,n):t}),e}var S=n(3),E=n(4),P=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:o,isBuffer:E,isFormData:i,isArrayBufferView:s,isString:u,isNumber:c,isObject:l,isUndefined:f,isDate:p,isFile:d,isBlob:h,isFunction:y,isStream:m,isURLSearchParams:g,isStandardBrowserEnv:w,forEach:x,merge:_,deepMerge:b,extend:R,trim:v}},function(e,t){e.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)}}},function(e,t){/*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){function r(e){this.defaults=e,this.interceptors={request:new a,response:new a}}var o=n(2),i=n(6),a=n(7),s=n(8),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method=e.method?e.method.toLowerCase():"get";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},r.prototype.getUri=function(e){return e=u(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){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=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var a=[];o.forEach(t,function(e,t){null!==e&&void 0!==e&&(o.isArray(e)?t+="[]":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("&")}if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){function r(){this.handlers=[]}var o=n(2);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)})},e.exports=r},function(e,t,n){function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(9),a=n(10),s=n(11),u=n(20),c=n(21);e.exports=function(e){return r(e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(t,n,r){function o(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i=r(2),a=r(12),s={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:function(){var t;return void 0!==e&&"[object process]"===Object.prototype.toString.call(e)?t=r(13):"undefined"!=typeof XMLHttpRequest&&(t=r(13)),t}(),transformRequest:[function(e,t){return a(t,"Accept"),a(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(o(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){u.headers[e]={}}),i.forEach(["post","put","patch"],function(e){u.headers[e]=i.merge(s)}),t.exports=u},function(e,t,n){var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){var r=n(2),o=n(14),i=n(6),a=n(17),s=n(18),u=n(15);e.exports=function(e){return new Promise(function(t,c){var f=e.data,l=e.headers;r.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",h=e.auth.password||"";l.Authorization="Basic "+btoa(d+":"+h)}if(p.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in p?a(p.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?p.response:p.responseText,i={data:r,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,c,i),p=null}},p.onabort=function(){p&&(c(u("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){c(u("Network Error",e,null,p)),p=null},p.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var y=n(19),m=(e.withCredentials||s(e.url))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;m&&(l[e.xsrfHeaderName]=m)}if("setRequestHeader"in p&&r.forEach(l,function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete l[t]:p.setRequestHeader(t,e)}),e.withCredentials&&(p.withCredentials=!0),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){p&&(p.abort(),c(e),p=null)}),void 0===f&&(f=null),p.send(f)})}},function(e,t,n){var r=n(15);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){var r=n(16);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},function(e,t){e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,a={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}}),a):a}},function(e,t,n){var r=n(2);e.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}}()},function(e,t,n){var r=n(2);e.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),!0===a&&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(){}}}()},function(e,t){e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){var r=n(2);e.exports=function(e,t){t=t||{};var n={};return r.forEach(["url","method","params","data"],function(e){void 0!==t[e]&&(n[e]=t[e])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):void 0!==t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):void 0!==e[o]&&(n[o]=e[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}),n}},function(e,t){function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t){e.exports=function(e){return function(t){return e.apply(null,t)}}}])})}).call(t,n(9),n(10)(e))},function(e,t,n){"use strict";var r=n(2),o=n(3);e.exports={version:o.v,doPay:function(e,t){return r.doPay(e,120,t)}}},function(e,t,n){"use strict";var r=n(0);e.exports={wxPay:function(e,t){self=this,"undefined"!=typeof WeixinJSBridge?WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:e.appId,timeStamp:e.timeStamp,nonceStr:e.nonceStr,package:e.package,signType:e.signType,paySign:e.paySign},function(e){"get_brand_wcpay_request:ok"==e.err_msg?(r.payResult.succeeded.result_info=e,t(r.payResult.succeeded)):"get_brand_wcpay_request:cancel"==e.err_msg?(r.payResult.cancel.result_info=e,t(r.payResult.cancel)):(r.payResult.failed.result_info=e,t(r.payResult.failed))}):"undefined"!=typeof wx?wx.chooseWXPay({timestamp:e.timeStamp,nonceStr:e.nonceStr,package:e.package,signType:e.signType,paySign:e.paySign,success:function(e){r.payResult.succeeded.result_info=e,t(r.payResult.succeeded)},cancel:function(e){r.payResult.cancel.result_info=e,t(r.payResult.cancel)},fail:function(e){r.payResult.failed.result_info=e,t(r.payResult.failed)}}):self.loadWXPay().then(function(t){t&&self.wxPay(e)}).catch(function(e){console.error(e)})},loadWXPay:function(){return new Promise(function(e,t){var n=document.createElement("script");n.type="text/javascript",n.src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js",n.onload=function(){e(!0)},n.onerror=t,document.head.appendChild(n)})}}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!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 i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){y&&d&&(y=!1,d.length?h=d.concat(h):m=-1,h.length&&s())}function s(){if(!y){var e=o(a);y=!0;for(var t=h.length;t;){for(d=h,h=[];++m<t;)d&&d[m].run();m=-1,t=h.length}d=null,y=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var f,l,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,h=[],y=!1,m=-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];h.push(new u(e,t)),1!==h.length||y||o(s)},u.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=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},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}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}}])});
- //# sourceMappingURL=adaPay.min.js.map
|