AlipayTradeWapPayContentBuilder.php 3.3 KB

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