UnifiedPayTrans.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace addons\YunfastPay\common\services\trans\nocash;
  3. use addons\YunfastPay\common\services\trans\TransAbstract;
  4. /**
  5. * 统一下单
  6. * UnifiedPayTrans class
  7. * @package addons\YunfastPay\common\services\trans\nocash
  8. * @see https://yunfastpay.com/#/interface/tyxd
  9. */
  10. class UnifiedPayTrans extends TransAbstract
  11. {
  12. /**
  13. * 微信openid
  14. *
  15. * @var string
  16. */
  17. protected $buyerCd;
  18. /**
  19. * 公众号appid
  20. *
  21. * @var string
  22. */
  23. protected $appid;
  24. /**
  25. * 实例化
  26. *
  27. * @param string $outOrderId
  28. * @param float $transAmt
  29. * @param string $appid
  30. * @param string $buyerCd
  31. * @param string $outOrderTitle
  32. * @param string $outOrderDesc
  33. */
  34. public function __construct(
  35. string $outOrderId,
  36. float $transAmt,
  37. string $appid,
  38. string $buyerCd,
  39. string $outOrderTitle,
  40. string $outOrderDesc = ''
  41. )
  42. {
  43. parent::__construct($outOrderId, $transAmt, $outOrderTitle, $outOrderDesc);
  44. $this->appid = $appid;
  45. $this->buyerCd = $buyerCd;
  46. }
  47. /**
  48. * 获取请求参数
  49. *
  50. * @return array
  51. */
  52. public function getTransData(string $mchtCd) :array
  53. {
  54. return [];
  55. }
  56. /**
  57. * 交易码
  58. *
  59. * @return string
  60. */
  61. public function getTrscode() :string
  62. {
  63. return 'TRANS1119';
  64. }
  65. /**
  66. * 产品编号
  67. *
  68. * @return string
  69. */
  70. public function getProCd() :string
  71. {
  72. return 'tran';
  73. }
  74. /**
  75. * 费率通道
  76. *
  77. * @return integer
  78. */
  79. public function getChanelType() :int
  80. {
  81. return 1;
  82. }
  83. }