Driver.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <?php
  2. /**
  3. * Basepay.php UTF-8
  4. * 基础支付
  5. *
  6. * @date : 2018/2/27 21:52
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\pay;
  13. abstract class Driver {
  14. protected $notify_url = '';
  15. protected $return_url = '';
  16. protected $show_url = '';
  17. protected $order_id = '';
  18. protected $product_id = '';
  19. protected $product_price = '0.00';
  20. protected $product_name = '';
  21. protected $product_desc = '';
  22. protected $real_amount = 0.00;
  23. protected $ip = '';
  24. protected $payway = 'alipay';
  25. protected $order_class = '';
  26. protected $func = '';
  27. protected $open_id = '';
  28. protected $mem_id = '';
  29. /* 时间戳 */
  30. protected $mem_reg_time = '';
  31. protected $mem_real_name = '';
  32. protected $mem_mobile = '';
  33. protected $use_protocol = false;
  34. /**
  35. * 移动APP支付函数
  36. *
  37. * @access public
  38. *
  39. */
  40. abstract public function clientPay();
  41. /**
  42. * 移动端支付函数
  43. *
  44. * @access public
  45. *
  46. *
  47. */
  48. abstract public function mobilePay();
  49. /**
  50. * PC端支付函数
  51. *
  52. * @access public
  53. *
  54. *
  55. */
  56. abstract public function pcPay();
  57. /**
  58. * 异步回调函数
  59. *
  60. * @access public
  61. *
  62. *
  63. */
  64. abstract public function notifyUrl();
  65. /**
  66. * 返回接收页面
  67. *
  68. * @access public
  69. *
  70. *
  71. */
  72. abstract public function returnUrl();
  73. /**
  74. * 查询订单
  75. *
  76. * @access public
  77. *
  78. * @param string $order_id 商户系统内部订单号
  79. * @param string $transaction_id 第三方支付的订单号
  80. * @param null $ext 扩展信息
  81. *
  82. */
  83. abstract public function orderQuery($order_id, $transaction_id, $ext = null);
  84. /**
  85. * http://doc.1tsdk.com/138?page_id=2955
  86. * @param string $payway 支付方式
  87. * @param string $token 支付token
  88. * @param int $status 1 表示未支付 2 表示支付成功
  89. * @param int $is_native 2 原生 1 非原生
  90. * @param int $cp_status 1 待通知 2 通知成功 3 通知失败
  91. *
  92. * @return bool array pay_type 支付方式名称* pay_type 支付方式名称
  93. * order_id 支付的订单ID
  94. * real_amount 实际支付金额
  95. * status 玩家支付状态
  96. * cp_status 玩家支付状态
  97. * is_native 是否跳转原生
  98. * token 跳转地址
  99. */
  100. public function clientAjax($payway, $token, $status = 1, $is_native = 1, $cp_status = 1, $btoken = '') {
  101. if (empty($token)) {
  102. return false;
  103. }
  104. $_rdata['pay_type'] = $payway;
  105. $_rdata['order_id'] = $this->order_id;
  106. $_rdata['product_price'] = $this->product_price;
  107. $_rdata['real_amount'] = $this->real_amount;
  108. $_rdata['token'] = $token;
  109. $_rdata['is_native'] = $is_native;
  110. $_rdata['status'] = $status;
  111. $_rdata['cp_status'] = $cp_status;
  112. $_rdata['btoken'] = $btoken; /*备用返回跳转链接*/
  113. return $_rdata;
  114. }
  115. /**
  116. * @return string
  117. */
  118. public function getNotifyUrl() {
  119. return $this->notify_url;
  120. }
  121. /**
  122. * @param string $notify_url
  123. */
  124. public function setNotifyUrl($notify_url) {
  125. $this->notify_url = $notify_url;
  126. }
  127. /**
  128. * @return string
  129. */
  130. public function getReturnUrl() {
  131. return $this->return_url;
  132. }
  133. /**
  134. * @param string $return_url
  135. */
  136. public function setReturnUrl($return_url) {
  137. $this->return_url = $return_url;
  138. }
  139. /**
  140. * @return string
  141. */
  142. public function getShowUrl() {
  143. return $this->show_url;
  144. }
  145. /**
  146. * @param string $show_url
  147. */
  148. public function setShowUrl($show_url) {
  149. $this->show_url = $show_url;
  150. }
  151. /**
  152. * @return string
  153. */
  154. public function getOrderId() {
  155. return $this->order_id;
  156. }
  157. /**
  158. * @param string $order_id
  159. */
  160. public function setOrderId($order_id) {
  161. $this->order_id = $order_id;
  162. }
  163. /**
  164. * @return string
  165. */
  166. public function getProductName() {
  167. return $this->product_name;
  168. }
  169. /**
  170. * @param string $product_name
  171. */
  172. public function setProductName($product_name) {
  173. $this->product_name = $product_name;
  174. }
  175. /**
  176. * @return string
  177. */
  178. public function getProductDesc() {
  179. return $this->product_desc;
  180. }
  181. /**
  182. * @param string $product_desc
  183. */
  184. public function setProductDesc($product_desc) {
  185. $this->product_desc = $product_desc;
  186. }
  187. /**
  188. * @return string
  189. */
  190. public function getRealAmount() {
  191. return $this->real_amount;
  192. }
  193. /**
  194. * @param float $real_amount
  195. */
  196. public function setRealAmount($real_amount) {
  197. $this->real_amount = $real_amount;
  198. }
  199. /**
  200. * @return string
  201. */
  202. public function getProductId() {
  203. return $this->product_id;
  204. }
  205. /**
  206. * @param string $product_id
  207. */
  208. public function setProductId($product_id) {
  209. $this->product_id = $product_id;
  210. }
  211. /**
  212. * @return string
  213. */
  214. public function getProductPrice() {
  215. return $this->product_price;
  216. }
  217. /**
  218. * @param string $product_price
  219. */
  220. public function setProductPrice($product_price) {
  221. $this->product_price = $product_price;
  222. }
  223. /**
  224. * @return string
  225. */
  226. public function getIp() {
  227. return $this->ip;
  228. }
  229. /**
  230. * @param string $ip
  231. */
  232. public function setIp($ip) {
  233. $this->ip = $ip;
  234. }
  235. /**
  236. * @return string
  237. */
  238. public function getPayway() {
  239. return $this->payway;
  240. }
  241. /**
  242. * @param string $payway
  243. */
  244. public function setPayway($payway) {
  245. $this->payway = $payway;
  246. }
  247. /**
  248. * @return string
  249. */
  250. public function getOrderClass() {
  251. return $this->order_class;
  252. }
  253. /**
  254. * @param string $order_class
  255. */
  256. public function setOrderClass($order_class) {
  257. $this->order_class = $order_class;
  258. }
  259. /**
  260. * @return string
  261. */
  262. public function getFunc() {
  263. return $this->func;
  264. }
  265. /**
  266. * @param string $func
  267. */
  268. public function setFunc($func) {
  269. $this->func = $func;
  270. }
  271. /**
  272. * @return string
  273. */
  274. public function getOpenId() {
  275. return $this->open_id;
  276. }
  277. /**
  278. * @param string $open_id
  279. */
  280. public function setOpenId($open_id) {
  281. $this->open_id = $open_id;
  282. }
  283. /**
  284. * @return string
  285. */
  286. public function getMemId() {
  287. return $this->mem_id;
  288. }
  289. /**
  290. * @param string $mem_id
  291. */
  292. public function setMemId($mem_id) {
  293. $this->mem_id = $mem_id;
  294. }
  295. /**
  296. * @return string
  297. */
  298. public function getMemRegTime() {
  299. return $this->mem_reg_time;
  300. }
  301. /**
  302. * @param string $mem_reg_time
  303. */
  304. public function setMemRegTime($mem_reg_time) {
  305. $this->mem_reg_time = $mem_reg_time;
  306. }
  307. /**
  308. * @return string
  309. */
  310. public function getMemRealName() {
  311. return $this->mem_real_name;
  312. }
  313. /**
  314. * @param string $mem_real_name
  315. */
  316. public function setMemRealName($mem_real_name) {
  317. $this->mem_real_name = $mem_real_name;
  318. }
  319. /**
  320. * @return string
  321. */
  322. public function getMemMobile() {
  323. return $this->mem_mobile;
  324. }
  325. /**
  326. * @param string $mem_mobile
  327. */
  328. public function setMemMobile($mem_mobile) {
  329. $this->mem_mobile = $mem_mobile;
  330. }
  331. /**
  332. * @return bool
  333. */
  334. public function getUseProtocol() {
  335. return $this->use_protocol;
  336. }
  337. /**
  338. * @param bool $use_protocol
  339. */
  340. public function setUseProtocol($use_protocol) {
  341. $this->use_protocol = $use_protocol;
  342. }
  343. }