AlipayTradeWapPayContentBuilder.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /* *
  3. * 功能:支付宝手机网站支付接口(alipay.trade.wap.pay)接口业务参数封装
  4. * 版本:2.0
  5. * 修改日期:2016-11-01
  6. * 说明:
  7. * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
  8. */
  9. class AlipayTradeWapPayContentBuilder
  10. {
  11. // 订单描述,可以对交易或商品进行一个详细地描述,比如填写"购买商品2件共15.00元"
  12. private $body;
  13. // 订单标题,粗略描述用户的支付目的。
  14. private $subject;
  15. // 商户订单号.
  16. private $outTradeNo;
  17. // (推荐使用,相对时间) 支付超时时间,5m 5分钟
  18. private $timeExpress;
  19. // 订单总金额,整形,此处单位为元,精确到小数点后2位,不能超过1亿元
  20. private $totalAmount;
  21. // 如果该字段为空,则默认为与支付宝签约的商户的PID,也就是appid对应的PID
  22. private $sellerId;
  23. // 产品标示码,固定值:QUICK_WAP_PAY
  24. private $productCode;
  25. private $bizContentarr = array();
  26. private $bizContent = NULL;
  27. public function getBizContent()
  28. {
  29. if(!empty($this->bizContentarr)){
  30. $this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
  31. }
  32. return $this->bizContent;
  33. }
  34. public function __construct()
  35. {
  36. $this->bizContentarr['productCode'] = "QUICK_WAP_PAY";
  37. }
  38. public function AlipayTradeWapPayContentBuilder()
  39. {
  40. $this->__construct();
  41. }
  42. public function getBody()
  43. {
  44. return $this->body;
  45. }
  46. public function setBody($body)
  47. {
  48. $this->body = $body;
  49. $this->bizContentarr['body'] = $body;
  50. }
  51. public function setSubject($subject)
  52. {
  53. $this->subject = $subject;
  54. $this->bizContentarr['subject'] = $subject;
  55. }
  56. public function getSubject()
  57. {
  58. return $this->subject;
  59. }
  60. public function getOutTradeNo()
  61. {
  62. return $this->outTradeNo;
  63. }
  64. public function setOutTradeNo($outTradeNo)
  65. {
  66. $this->outTradeNo = $outTradeNo;
  67. $this->bizContentarr['out_trade_no'] = $outTradeNo;
  68. }
  69. public function setTimeExpress($timeExpress)
  70. {
  71. $this->timeExpress = $timeExpress;
  72. $this->bizContentarr['timeout_express'] = $timeExpress;
  73. }
  74. public function getTimeExpress()
  75. {
  76. return $this->timeExpress;
  77. }
  78. public function setTotalAmount($totalAmount)
  79. {
  80. $this->totalAmount = $totalAmount;
  81. $this->bizContentarr['total_amount'] = $totalAmount;
  82. }
  83. public function getTotalAmount()
  84. {
  85. return $this->totalAmount;
  86. }
  87. public function setSellerId($sellerId)
  88. {
  89. $this->sellerId = $sellerId;
  90. $this->bizContentarr['seller_id'] = $sellerId;
  91. }
  92. public function getSellerId()
  93. {
  94. return $this->sellerId;
  95. }
  96. }
  97. ?>