123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- <?php
- /**
- * Basepay.php UTF-8
- * 基础支付
- *
- * @date : 2018/2/27 21:52
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huolib\pay;
- abstract class Driver {
- protected $notify_url = '';
- protected $return_url = '';
- protected $show_url = '';
- protected $order_id = '';
- protected $product_id = '';
- protected $product_price = '0.00';
- protected $product_name = '';
- protected $product_desc = '';
- protected $real_amount = 0.00;
- protected $ip = '';
- protected $payway = 'alipay';
- protected $order_class = '';
- protected $func = '';
- protected $open_id = '';
- protected $mem_id = '';
- /* 时间戳 */
- protected $mem_reg_time = '';
- protected $mem_real_name = '';
- protected $mem_mobile = '';
- protected $use_protocol = false;
- /**
- * 移动APP支付函数
- *
- * @access public
- *
- */
- abstract public function clientPay();
- /**
- * 移动端支付函数
- *
- * @access public
- *
- *
- */
- abstract public function mobilePay();
- /**
- * PC端支付函数
- *
- * @access public
- *
- *
- */
- abstract public function pcPay();
- /**
- * 异步回调函数
- *
- * @access public
- *
- *
- */
- abstract public function notifyUrl();
- /**
- * 返回接收页面
- *
- * @access public
- *
- *
- */
- abstract public function returnUrl();
- /**
- * 查询订单
- *
- * @access public
- *
- * @param string $order_id 商户系统内部订单号
- * @param string $transaction_id 第三方支付的订单号
- * @param null $ext 扩展信息
- *
- */
- abstract public function orderQuery($order_id, $transaction_id, $ext = null);
- /**
- * http://doc.1tsdk.com/138?page_id=2955
- * @param string $payway 支付方式
- * @param string $token 支付token
- * @param int $status 1 表示未支付 2 表示支付成功
- * @param int $is_native 2 原生 1 非原生
- * @param int $cp_status 1 待通知 2 通知成功 3 通知失败
- *
- * @return bool array pay_type 支付方式名称* pay_type 支付方式名称
- * order_id 支付的订单ID
- * real_amount 实际支付金额
- * status 玩家支付状态
- * cp_status 玩家支付状态
- * is_native 是否跳转原生
- * token 跳转地址
- */
- public function clientAjax($payway, $token, $status = 1, $is_native = 1, $cp_status = 1, $btoken = '') {
- if (empty($token)) {
- return false;
- }
- $_rdata['pay_type'] = $payway;
- $_rdata['order_id'] = $this->order_id;
- $_rdata['product_price'] = $this->product_price;
- $_rdata['real_amount'] = $this->real_amount;
- $_rdata['token'] = $token;
- $_rdata['is_native'] = $is_native;
- $_rdata['status'] = $status;
- $_rdata['cp_status'] = $cp_status;
- $_rdata['btoken'] = $btoken; /*备用返回跳转链接*/
- return $_rdata;
- }
- /**
- * @return string
- */
- public function getNotifyUrl() {
- return $this->notify_url;
- }
- /**
- * @param string $notify_url
- */
- public function setNotifyUrl($notify_url) {
- $this->notify_url = $notify_url;
- }
- /**
- * @return string
- */
- public function getReturnUrl() {
- return $this->return_url;
- }
- /**
- * @param string $return_url
- */
- public function setReturnUrl($return_url) {
- $this->return_url = $return_url;
- }
- /**
- * @return string
- */
- public function getShowUrl() {
- return $this->show_url;
- }
- /**
- * @param string $show_url
- */
- public function setShowUrl($show_url) {
- $this->show_url = $show_url;
- }
- /**
- * @return string
- */
- public function getOrderId() {
- return $this->order_id;
- }
- /**
- * @param string $order_id
- */
- public function setOrderId($order_id) {
- $this->order_id = $order_id;
- }
- /**
- * @return string
- */
- public function getProductName() {
- return $this->product_name;
- }
- /**
- * @param string $product_name
- */
- public function setProductName($product_name) {
- $this->product_name = $product_name;
- }
- /**
- * @return string
- */
- public function getProductDesc() {
- return $this->product_desc;
- }
- /**
- * @param string $product_desc
- */
- public function setProductDesc($product_desc) {
- $this->product_desc = $product_desc;
- }
- /**
- * @return string
- */
- public function getRealAmount() {
- return $this->real_amount;
- }
- /**
- * @param float $real_amount
- */
- public function setRealAmount($real_amount) {
- $this->real_amount = $real_amount;
- }
- /**
- * @return string
- */
- public function getProductId() {
- return $this->product_id;
- }
- /**
- * @param string $product_id
- */
- public function setProductId($product_id) {
- $this->product_id = $product_id;
- }
- /**
- * @return string
- */
- public function getProductPrice() {
- return $this->product_price;
- }
- /**
- * @param string $product_price
- */
- public function setProductPrice($product_price) {
- $this->product_price = $product_price;
- }
- /**
- * @return string
- */
- public function getIp() {
- return $this->ip;
- }
- /**
- * @param string $ip
- */
- public function setIp($ip) {
- $this->ip = $ip;
- }
- /**
- * @return string
- */
- public function getPayway() {
- return $this->payway;
- }
- /**
- * @param string $payway
- */
- public function setPayway($payway) {
- $this->payway = $payway;
- }
- /**
- * @return string
- */
- public function getOrderClass() {
- return $this->order_class;
- }
- /**
- * @param string $order_class
- */
- public function setOrderClass($order_class) {
- $this->order_class = $order_class;
- }
- /**
- * @return string
- */
- public function getFunc() {
- return $this->func;
- }
- /**
- * @param string $func
- */
- public function setFunc($func) {
- $this->func = $func;
- }
- /**
- * @return string
- */
- public function getOpenId() {
- return $this->open_id;
- }
- /**
- * @param string $open_id
- */
- public function setOpenId($open_id) {
- $this->open_id = $open_id;
- }
- /**
- * @return string
- */
- public function getMemId() {
- return $this->mem_id;
- }
- /**
- * @param string $mem_id
- */
- public function setMemId($mem_id) {
- $this->mem_id = $mem_id;
- }
- /**
- * @return string
- */
- public function getMemRegTime() {
- return $this->mem_reg_time;
- }
- /**
- * @param string $mem_reg_time
- */
- public function setMemRegTime($mem_reg_time) {
- $this->mem_reg_time = $mem_reg_time;
- }
- /**
- * @return string
- */
- public function getMemRealName() {
- return $this->mem_real_name;
- }
- /**
- * @param string $mem_real_name
- */
- public function setMemRealName($mem_real_name) {
- $this->mem_real_name = $mem_real_name;
- }
- /**
- * @return string
- */
- public function getMemMobile() {
- return $this->mem_mobile;
- }
- /**
- * @param string $mem_mobile
- */
- public function setMemMobile($mem_mobile) {
- $this->mem_mobile = $mem_mobile;
- }
- /**
- * @return bool
- */
- public function getUseProtocol() {
- return $this->use_protocol;
- }
- /**
- * @param bool $use_protocol
- */
- public function setUseProtocol($use_protocol) {
- $this->use_protocol = $use_protocol;
- }
- }
|