AppPayTrans.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace addons\YunfastPay\common\services\trans\nocash;
  3. use addons\YunfastPay\common\services\trans\TransAbstract;
  4. /**
  5. * app支付
  6. * AppPayTrans class
  7. * @package addons\YunfastPay\common\services\trans\nocash
  8. * @see https://yunfastpay.com/#/interface/app
  9. */
  10. class AppPayTrans extends TransAbstract
  11. {
  12. /**
  13. * 实例化
  14. *
  15. * @param string $outOrderId
  16. * @param float $transAmt
  17. * @param string $outOrderTitle
  18. * @param string $outOrderDesc
  19. */
  20. public function __construct(
  21. string $outOrderId,
  22. float $transAmt,
  23. string $outOrderTitle,
  24. string $outOrderDesc = ''
  25. )
  26. {
  27. parent::__construct($outOrderId, $transAmt, $outOrderTitle, $outOrderDesc);
  28. }
  29. /**
  30. * 交易码
  31. *
  32. * @return string
  33. */
  34. public function getTrscode() :string
  35. {
  36. return 'TRANS0105';
  37. }
  38. /**
  39. * 聚合:tran
  40. *
  41. * @return string
  42. */
  43. public function getProCd() :string
  44. {
  45. return 'tran';
  46. }
  47. /**
  48. * 费率通道
  49. *
  50. * @return integer
  51. */
  52. public function getChanelType() :int
  53. {
  54. return 1;
  55. }
  56. public function getTransData(string $mchtCd) :array
  57. {
  58. $reqData['trscode'] = $this->getTrscode();
  59. $reqData['mchtCd'] = $mchtCd;
  60. $reqData['outOrderId'] = $this->outOrderId;
  61. $reqData['transAmt'] = $this->transAmt;
  62. $reqData['proCd'] = $this->getProCd();
  63. $reqData['chanelType'] = $this->getChanelType();
  64. $reqData['outOrderTitle'] = $this->outOrderTitle;
  65. $reqData['outOrderDesc'] = $this->outOrderDesc;
  66. $reqData['browser'] = $this->getBrowser();
  67. $reqData['frontUrl'] = "https://cash.yunfastpay.com/html/#/paysucc";
  68. $reqData['expireTime'] = $this->getExpireTime();
  69. $reqData['isSplitBill'] = $this->getIsSplitBill();
  70. // 分账信息
  71. $itemsList = $this->getSplitBill();
  72. $itemsList && $reqData['itemsList'] = $itemsList;
  73. return $reqData;
  74. }
  75. }