AlipayTradeRefundContentBuilder.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* *
  3. * 功能:支付宝手机网站退款接口(alipay.trade.refund)接口业务参数封装
  4. * 版本:2.0
  5. * 修改日期:2016-11-01
  6. * 说明:
  7. * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
  8. */
  9. class AlipayTradeRefundContentBuilder
  10. {
  11. // 商户订单号.
  12. private $outTradeNo;
  13. // 支付宝交易号
  14. private $tradeNo;
  15. // 退款的金额
  16. private $refundAmount;
  17. // 退款原因说明
  18. private $refundReason;
  19. // 标识一次退款请求号,同一笔交易多次退款保证唯一,部分退款此参数必填
  20. private $outRequestNo;
  21. private $bizContentarr = array();
  22. private $bizContent = NULL;
  23. public function getBizContent()
  24. {
  25. if(!empty($this->bizContentarr)){
  26. $this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
  27. }
  28. return $this->bizContent;
  29. }
  30. public function getTradeNo()
  31. {
  32. return $this->tradeNo;
  33. }
  34. public function setTradeNo($tradeNo)
  35. {
  36. $this->tradeNo = $tradeNo;
  37. $this->bizContentarr['trade_no'] = $tradeNo;
  38. }
  39. public function getOutTradeNo()
  40. {
  41. return $this->outTradeNo;
  42. }
  43. public function setOutTradeNo($outTradeNo)
  44. {
  45. $this->outTradeNo = $outTradeNo;
  46. $this->bizContentarr['out_trade_no'] = $outTradeNo;
  47. }
  48. public function getRefundAmount()
  49. {
  50. return $this->refundAmount;
  51. }
  52. public function setRefundAmount($refundAmount)
  53. {
  54. $this->refundAmount = $refundAmount;
  55. $this->bizContentarr['refund_amount'] = $refundAmount;
  56. }
  57. public function getRefundReason()
  58. {
  59. return $this->refundReason;
  60. }
  61. public function setRefundReason($refundReason)
  62. {
  63. $this->refundReason = $refundReason;
  64. $this->bizContentarr['refund_reason'] = $refundReason;
  65. }
  66. public function getOutRequestNo()
  67. {
  68. return $this->outRequestNo;
  69. }
  70. public function setOutRequestNo($outRequestNo)
  71. {
  72. $this->outRequestNo = $outRequestNo;
  73. $this->bizContentarr['out_request_no'] = $outRequestNo;
  74. }
  75. }
  76. ?>