| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- namespace addons\YunfastPay\common\services\trans\nocash;
- use addons\YunfastPay\common\services\trans\TransAbstract;
- /**
- * 代付
- * AgentTrans class
- * @package addons\YunfastPay\common\services\trans\nocash
- * @see https://yunfastpay.com/#/interface/qb
- */
- class AgentTrans extends TransAbstract
- {
- /**
- * 是否默认审核 1:自动审核,目前固定1
- *
- * @var int
- */
- protected $checkStatus = 1;
- /**
- * 收款卡号
- *
- * @var string
- */
- protected $settleAcct;
- /**
- * 收款户名
- *
- * @var string
- */
- protected $settleAcctNm;
-
- /**
- * 账户类型 1:对私,2:对公
- *
- * @var integer
- */
- protected $acctType = 1;
- /**
- * 代付用途类型
- *
- * @var int
- */
- protected $adddata1;
- /**
- * 交易码
- *
- * @return string
- */
- public function getTrscode(): string
- {
- return 'TRANS0108';
- }
- /**
- * 费率通道
- *
- * @return integer
- */
- public function getChanelType(): int
- {
- return 1;
- }
- /**
- * 产品编号
- *
- * @return string
- */
- public function getProCd(): string
- {
- return 'agent';
- }
- /**
- * 代付
- *
- * @param string $outOrderId 外部订单号
- * @param float $transAmt 交易金额
- * @param string $settleAcct 收款卡号
- * @param string $settleAcctNm 收款户名
- */
- public function __construct(
- string $outOrderId,
- float $transAmt,
- string $settleAcct,
- string $settleAcctNm,
- string $outOrderDesc = ''
- )
- {
- $this->outOrderId = $outOrderId;
- $this->transAmt = $transAmt;
- $this->settleAcct = $settleAcct;
- $this->settleAcctNm = $settleAcctNm;
- $outOrderDesc && $this->outOrderDesc = $outOrderDesc;
- }
- /**
- * 设置账户类型
- *
- * @param integer $acctType
- * @return void
- */
- public function setAcctType(int $acctType)
- {
- $this->acctType = in_array($acctType, [1, 2])
- ? $acctType
- : $this->acctType;
- }
- /**
- * 账户类型
- *
- * @return int
- */
- public function getAcctType()
- {
- return $this->acctType;
- }
- /**
- * 是否默认审核
- *
- * @return int
- */
- public function getCheckStatus()
- {
- return $this->checkStatus;
- }
-
- /**
- * 返回回调处理类型 ['pay', 'agent'] 默认pay 代付agent
- *
- * @return string
- */
- public function getNotifyType()
- {
- return 'agent';
- }
- /**
- * 获取请求参数
- *
- * @param string $mchtCd
- * @return array
- */
- public function getTransData(string $mchtCd): array
- {
- $reqData['acctType'] = $this->getAcctType();
- $reqData['trscode'] = $this->getTrscode();
- $reqData['mchtCd'] = $mchtCd;
- $reqData['checkStatus'] = $this->getCheckStatus();
- $reqData['outOrderId'] = $this->outOrderId;
- $reqData['transAmt'] = $this->transAmt;
- $reqData['proCd'] = $this->getProCd();
- $reqData['chanelType'] = $this->getChanelType();
- $reqData['settleAcct'] = $this->settleAcct;
- $reqData['settleAcctNm'] = $this->settleAcctNm;
- $this->outOrderDesc && $reqData['outOrderDesc'] = $this->outOrderDesc;
- $this->adddata1 && $reqData['adddata1'] = $this->adddata1;
- return $reqData;
- }
- }
|