1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- require_once PLUGINS_PATH . '/payments/wxpay_native/lib/WxPay.Api.php';
- class NativePay
- {
-
- public function GetPrePayUrl($productId)
- {
- $biz = new WxPayBizPayUrl();
- $biz->SetProduct_id($productId);
- $values = WxpayApi::bizpayurl($biz);
- $url = "weixin://wxpay/bizpayurl?" . $this->ToUrlParams($values);
- return $url;
- }
-
-
- private function ToUrlParams($urlObj)
- {
- $buff = "";
- foreach ($urlObj as $k => $v)
- {
- $buff .= $k . "=" . $v . "&";
- }
-
- $buff = trim($buff, "&");
- return $buff;
- }
-
-
- public function GetPayUrl($input)
- {
- if($input->GetTrade_type() == "NATIVE")
- {
- $result = WxPayApi::unifiedOrder($input);
- return $result;
- }
- }
- }
|