| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace addons\YunfastPay\common\services\trans\nocash;
- use addons\YunfastPay\common\services\trans\TransAbstract;
- /**
- * h5支付
- * H5PayTrans class
- * @package addons\YunfastPay\common\services\trans\nocash
- * @see https://yunfastpay.com/#/interface/tyxd
- */
- class H5PayTrans extends TransAbstract
- {
- /**
- * @var string
- */
- protected $appid;
- /**
- * 实例化
- *
- * @param string $outOrderId
- * @param float $transAmt
- * @param string $appid
- * @param string $outOrderTitle
- * @param string $outOrderDesc
- */
- public function __construct(
- string $outOrderId,
- float $transAmt,
- string $appid,
- string $outOrderTitle,
- string $outOrderDesc = ''
- )
- {
- parent::__construct($outOrderId, $transAmt, $outOrderTitle, $outOrderDesc);
- $this->appid = $appid;
- }
- /**
- * 交易码
- *
- * @return string
- */
- public function getTrscode() :string
- {
- return 'TRANS1119';
- }
- /**
- * 聚合:tran
- *
- * @return string
- */
- public function getProCd() :string
- {
- return 'tran';
- }
- /**
- * 费率通道
- *
- * @return integer
- */
- public function getChanelType() :int
- {
- return 2;
- }
- public function getTransData(string $mchtCd) :array
- {
- $reqData['orgCd'] = $this->config['org_cd'];
- $reqData['trscode'] = $this->getTrscode();
- $reqData['mchtCd'] = $mchtCd;
- $reqData['outOrderId'] = $this->outOrderId;
- $reqData['transAmt'] = $this->transAmt;
- $reqData['appid'] = $this->appid;
- $reqData['proCd'] = $this->getProCd();
- $reqData['chanelType'] = $this->getChanelType();
- $reqData['outOrderTitle'] = $this->outOrderTitle;
- $reqData['outOrderDesc'] = $this->outOrderDesc;
- $reqData['browser'] = $this->getBrowser();
- $reqData['expireTime'] = $this->getExpireTime();
- $reqData['isSplitBill'] = $this->getIsSplitBill();
- // 分账信息
- $itemsList = $this->getSplitBill();
- $itemsList && $reqData['itemsList'] = $itemsList;
- return $reqData;
- }
- }
|