/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/pingpp-html5@2.0.8/src/pingpp.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(){var e={}.hasOwnProperty,a=function(){},i="https://api.pingxx.com/notify/charges/",r="https://gateway.95516.com/gateway/api/frontTransReq.do",t="http://wappaygw.alipay.com/service/rest.htm",n="uppay://uppayservice/?style=token&paydata=",l="https://m.jdpay.com/wepay/web/pay",s="https://ok.yeepay.com/paymobile/api/pay/request",o="http://mobiletest.yeepay.com/paymobile/api/pay/request",c="http://sissi.pingxx.com/mock.php",_={alipay_wap:"alipay_wap",upmp_wap:"upmp_wap",upacp_wap:"upacp_wap",bfb_wap:"bfb_wap",wx_pub:"wx_pub",yeepay_wap:"yeepay_wap",jdpay_wap:"jdpay_wap"};function p(a,i,r){var t=document.createElement("form");for(var n in t.setAttribute("method",i),t.setAttribute("action",a),r)if(e.call(r,n)){var l=document.createElement("input");l.setAttribute("type","hidden"),l.setAttribute("name",n),l.setAttribute("value",r[n]),t.appendChild(l)}document.body.appendChild(t),t.submit()}function d(e,a,i){void 0===i&&(i=!1);var r=[];for(var t in e)"bfb_wap"==a&&"url"==t||"yeepay_wap"==a&&"mode"==t||r.push(t+"="+(i?encodeURIComponent(e[t]):e[t]));return r.join("&")}(a.prototype={version:"2.0.7",_resultCallback:void 0,_jsApiParameters:{},_debug:!1,_signature:void 0,createPayment:function(a,i,c,f){var u;if("function"==typeof i&&(this._resultCallback=i),void 0!==c&&(this._signature=c),"boolean"==typeof f&&(this._debug=f),"string"==typeof a)try{u=JSON.parse(a)}catch(e){return void this._innerCallback("fail",this._error("json_decode_fail"))}else u=a;if(void 0!==u)if(e.call(u,"id"))if(e.call(u,"channel")){var h=u.channel;if(e.call(u,"credential"))if(u.credential)if(e.call(_,h))if(e.call(u.credential,h))if(e.call(u,"livemode"))if(0!=u.livemode){var m=u.credential[h];if(h==_.upmp_wap)location.href=n+m.paydata;else if(h==_.upacp_wap)p(r,"post",m);else if(h==_.alipay_wap)if(m._input_charset="utf-8","undefined"!=typeof _AP){var y=d(m,h,!0);_AP.pay(t+"?"+y)}else p(t,"get",m);else if(h==_.bfb_wap){if(!e.call(m,"url"))return void this._innerCallback("fail",this._error("invalid_credential","missing_field:url"));location.href=m.url+"?"+d(m,h)}else if(h==_.yeepay_wap){for(var b=["merchantaccount","encryptkey","data"],g=0;g<b.length;g++)if(!e.call(m,b[g]))return void this._innerCallback("fail",this._error("invalid_credential","missing_field_"+b[g]));e.call(m,"mode")&&"test"==m.mode?location.href=o+"?"+d(m,h,!0):location.href=s+"?"+d(m,h,!0)}else if(h==_.wx_pub){for(b=["appId","timeStamp","nonceStr","package","signType","paySign"],g=0;g<b.length;g++)if(!e.call(m,b[g]))return void this._innerCallback("fail",this._error("invalid_credential","missing_field_"+b[g]));this._jsApiParameters=m,this._callpay()}else h==_.jdpay_wap&&p(l,"post",m)}else this._testModeNotify(u);else this._innerCallback("fail",this._error("invalid_charge","no_livemode"));else this._innerCallback("fail",this._error("invalid_credential","no_valid_channel_credential"));else this._innerCallback("fail",this._error("invalid_charge","no_such_channel:"+h));else this._innerCallback("fail",this._error("invalid_credential","credential_is_undefined"));else this._innerCallback("fail",this._error("invalid_charge","no_credential"))}else this._innerCallback("fail",this._error("invalid_charge","no_channel"));else this._innerCallback("fail",this._error("invalid_charge","no_charge_id"));else this._innerCallback("fail",this._error("json_decode_fail"))},_jsApiCall:function(){var e=this;e._jsApiParameters!={}&&WeixinJSBridge.invoke("getBrandWCPayRequest",e._jsApiParameters,(function(a){"get_brand_wcpay_request:ok"==a.err_msg?e._innerCallback("success"):"get_brand_wcpay_request:cancel"==a.err_msg?e._innerCallback("cancel"):e._innerCallback("fail",e._error("wx_result_fail",a.err_msg))}))},_callpay:function(){var e=this;if("undefined"!=typeof wx&&void 0!==e._signature){var a=!1;wx.config({debug:e._debug,appId:e._jsApiParameters.appId,timestamp:e._jsApiParameters.timeStamp,nonceStr:e._jsApiParameters.nonceStr,signature:e._signature,jsApiList:["chooseWXPay"]}),wx.ready((function(){a||wx.chooseWXPay({timestamp:e._jsApiParameters.timeStamp,nonceStr:e._jsApiParameters.nonceStr,package:e._jsApiParameters.package,signType:e._jsApiParameters.signType,paySign:e._jsApiParameters.paySign,success:function(a){"chooseWXPay:ok"==a.errMsg?e._innerCallback("success"):e._innerCallback("fail",e._error("wx_result_fail",a.errMsg))},cancel:function(a){e._innerCallback("cancel")},fail:function(a){e._innerCallback("fail",e._error("wx_result_fail",a.errMsg))}})})),wx.error((function(i){a=!0,e._innerCallback("fail",e._error("wx_config_error",i.errMsg))}))}else if("undefined"==typeof WeixinJSBridge){function i(){e._jsApiCall()}document.addEventListener?document.addEventListener("WeixinJSBridgeReady",i,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",i),document.attachEvent("onWeixinJSBridgeReady",i))}else this._jsApiCall()},_error:function(e,a){return{msg:e=void 0===e?"":e,extra:a=void 0===a?"":a}},_innerCallback:function(e,a){"function"==typeof this._resultCallback&&(void 0===a&&(a=this._error()),this._resultCallback(e,a))},_testModeNotify:function(a){var r=this;if(a.channel==_.wx_pub){if(confirm("模拟付款？")){var t=new XMLHttpRequest;t.open("GET",i+a.id+"?livemode=false",!0),t.onload=function(){if(t.status>=200&&t.status<400&&"success"==t.responseText)r._innerCallback("success");else{var e="http_code:"+t.status+";response:"+t.responseText;r._innerCallback("fail",r._error("testmode_notify_fail",e))}},t.onerror=function(){r._innerCallback("fail",r._error("network_err"))},t.send()}else r._innerCallback("cancel")}else{var n={ch_id:a.id,scheme:"http",channel:a.channel};e.call(a,"order_no")?n.order_no=a.order_no:e.call(a,"orderNo")&&(n.order_no=a.orderNo),e.call(a,"time_expire")?n.time_expire=a.time_expire:e.call(a,"timeExpire")&&(n.time_expire=a.timeExpire),e.call(a,"extra")&&(n.extra=encodeURIComponent(JSON.stringify(a.extra))),location.href=c+"?"+d(n)}}}).payment=a.prototype.createPayment,window.pingpp=new a,window.PINGPP_PAY_SDK=window.PINGPP_WX_PUB=window.pingpp}();
//# sourceMappingURL=/sm/5e8da42081af21c5f7b593d37461dd06807838ed0f1d22f824c271430168ab19.map