TransMicropayRequest.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?php
  2. /**
  3. * 被扫交易 请求字段
  4. * TransMicropayRequest
  5. * PHP version 7.4
  6. *
  7. * @category Class
  8. * @package Lakala\OpenAPISDK\V3\Model
  9. * @author lucongyu
  10. * @link https://o.lakala.com
  11. */
  12. namespace SixShop\Lakala\OpenAPISDK\V3\Model;
  13. class TransMicropayRequest extends ModelRequest implements \JsonSerializable
  14. {
  15. // 商户号 M String(32) 拉卡拉分配的商户号
  16. protected $merchantNo;
  17. // 终端号 M String(32) 拉卡拉分配的业务终端号
  18. protected $termNo;
  19. // 商户交易流水号 M String(32) 商户系统唯一,不可重复
  20. protected $outTradeNo;
  21. /**
  22. * 支付授权码 M String(32) 扫码支付授权码,设备读取用户APP中的条码或者二维码信息,用户付款码条形码规则见说明
  23. *
  24. * 属性 说明 备注
  25. * 微信 WECHAT 付款码10 11 12 13 14 15开头
  26. * 支付宝 ALIPAY 付款码25 26 27 28 29 30开头
  27. * 银联 UQRCODEPAY 付款码62开头
  28. * 数币人民币 DCPAY 付款码01开头
  29. * 翼支付 BESTPAY 付款码51开头
  30. * 苏宁 SUNING 付款码83开头
  31. */
  32. protected $authCode;
  33. // 金额 M String(12) 单位分,整数型字符
  34. protected $totalAmount;
  35. /**
  36. * 地址位置信息 M Object 地址位置信息,风控要求必送
  37. *
  38. * request_ip 请求方IP地址 M String(64) 请求方的IP地址,存在必填,格式如36.45.36.95
  39. * base_station 基站信息 C String(128) 客户端设备的基站信息(主扫时基站信息使用该字段)
  40. * location 纬度,经度 C String(32) 商户终端的地理位置,整体格式:纬度,经度,+表示北纬、东经,-表示南纬、 西经。
  41. * 经度格式:1位正负号+3位整数+1位小数点+5位小数;
  42. * 纬度格式:1位正负号+2位整数+1位小数点+6位小数;
  43. * 举例:+31.221345,+121.12345
  44. */
  45. protected $locationInfo;
  46. // 业务模式 C String(8) 业务模式: ACQ-收单 不填,默认为“ACQ-收单”
  47. protected $busiMode;
  48. // 订单标题 C String(42) 标题,用于简单描述订单或商品(账户端控制,实际最多42个字符),微信支付必送。
  49. protected $subject;
  50. // 拉卡拉支付业务订单号 C String(64) 拉卡拉订单系统订单号,以拉卡拉支付业务订单号为驱动的支付行为,需上传该字段。 订单交易下单,交易时上送订单系统订单号,交易流程中会校验有效性、判重
  51. protected $payOrderNo;
  52. // 商户通知地址 C String(128) 商户通知地址,如上传,且 pay_order_no 不存在情况下,且支付响应报文是交易中状态的场景下,则按此地址通知商户
  53. protected $notifyUrl;
  54. // 结算类型 C String(1) “0”或者空,常规结算方式;
  55. protected $settleType;
  56. // 备注 C String(128)
  57. protected $remark;
  58. // 扫码类型 C String(1) 0或不填:扫码支付 1:支付宝刷脸支付;2: 微信刷脸支付
  59. protected $scanType;
  60. // 营销信息 C String(1024) 拉卡拉优惠相关信息,JSON格式。暂不支持
  61. protected $promoInfo;
  62. // 账户端业务信息域 C Object 参见以下acc_busi_fields字段详细说明,不同类型的auth_code对应不同的账户端,需要填写不同的信息
  63. protected $accBusiFields;
  64. // 商户订单号 C String(32) 商品订单号,如动态码关联的某个商品订单号,每个外部订单来源下的外部商户订单号不可重复
  65. protected $outOrderNo;
  66. // 服务商机构标识码 C String(11) 银联分配的服务商机构标识码
  67. protected $pnrInsIdCd;
  68. public function __construct()
  69. {
  70. parent::__construct();
  71. $this->busiMode = 'ACQ';
  72. }
  73. public function setMerchantNo($merchantNo)
  74. {
  75. $this->merchantNo = $merchantNo;
  76. return $this;
  77. }
  78. public function getMerchantNo()
  79. {
  80. return $this->merchantNo;
  81. }
  82. public function setTermNo($termNo)
  83. {
  84. $this->termNo = $termNo;
  85. return $this;
  86. }
  87. public function getTermNo()
  88. {
  89. return $this->termNo;
  90. }
  91. public function setOutTradeNo($outTradeNo)
  92. {
  93. $this->outTradeNo = $outTradeNo;
  94. return $this;
  95. }
  96. public function getOutTradeNo()
  97. {
  98. return $this->outTradeNo;
  99. }
  100. public function setAuthCode($authCode)
  101. {
  102. $this->authCode = $authCode;
  103. return $this;
  104. }
  105. public function getAuthCode()
  106. {
  107. return $this->authCode;
  108. }
  109. public function setTotalAmount($totalAmount)
  110. {
  111. $this->totalAmount = $totalAmount;
  112. return $this;
  113. }
  114. public function getTotalAmount()
  115. {
  116. return $this->totalAmount;
  117. }
  118. public function setLocationInfo($locationInfo)
  119. {
  120. $this->locationInfo = $locationInfo;
  121. return $this;
  122. }
  123. public function getLocationInfo()
  124. {
  125. return $this->locationInfo;
  126. }
  127. public function setBusiMode($busiMode)
  128. {
  129. $this->busiMode = $busiMode;
  130. return $this;
  131. }
  132. public function getBusiMode()
  133. {
  134. return $this->busiMode;
  135. }
  136. public function setSubject($subject)
  137. {
  138. $this->subject = $subject;
  139. return $this;
  140. }
  141. public function getSubject()
  142. {
  143. return $this->subject;
  144. }
  145. public function setPayOrderNo($payOrderNo)
  146. {
  147. $this->payOrderNo = $payOrderNo;
  148. return $this;
  149. }
  150. public function getPayOrderNo()
  151. {
  152. return $this->payOrderNo;
  153. }
  154. public function setNotifyUrl($notifyUrl)
  155. {
  156. $this->notifyUrl = $notifyUrl;
  157. return $this;
  158. }
  159. public function getNotifyUrl()
  160. {
  161. return $this->notifyUrl;
  162. }
  163. public function setSettleType($settleType)
  164. {
  165. $this->settleType = $settleType;
  166. return $this;
  167. }
  168. public function getSettleType()
  169. {
  170. return $this->settleType;
  171. }
  172. public function setRemark($remark)
  173. {
  174. $this->remark = $remark;
  175. return $this;
  176. }
  177. public function getRemark()
  178. {
  179. return $this->remark;
  180. }
  181. public function setScanType($scanType)
  182. {
  183. $this->scanType = $scanType;
  184. return $this;
  185. }
  186. public function getScanType()
  187. {
  188. return $this->scanType;
  189. }
  190. public function setPromoInfo($promoInfo)
  191. {
  192. $this->promoInfo = $promoInfo;
  193. return $this;
  194. }
  195. public function getPromoInfo()
  196. {
  197. return $this->promoInfo;
  198. }
  199. public function setAccBusiFields($accBusiFields)
  200. {
  201. $this->accBusiFields = $accBusiFields;
  202. return $this;
  203. }
  204. public function getAccBusiFields()
  205. {
  206. return $this->accBusiFields;
  207. }
  208. public function setOutOrderNo($outOrderNo)
  209. {
  210. $this->outOrderNo = $outOrderNo;
  211. return $this;
  212. }
  213. public function getOutOrderNo()
  214. {
  215. return $this->outOrderNo;
  216. }
  217. public function setPnrInsIdCd($pnrInsIdCd)
  218. {
  219. $this->pnrInsIdCd = $pnrInsIdCd;
  220. return $this;
  221. }
  222. public function getPnrInsIdCd()
  223. {
  224. return $this->pnrInsIdCd;
  225. }
  226. /**
  227. * Show all the invalid properties with reasons.
  228. *
  229. * @return array invalid properties with reasons
  230. */
  231. public function listInvalidProperties()
  232. {
  233. $invalidProperties = [];
  234. if (strlen($this->merchantNo) === 0) {
  235. $invalidProperties[] = '商户号不能为空';
  236. }
  237. if (strlen($this->termNo) === 0) {
  238. $invalidProperties[] = '终端号不能为空';
  239. }
  240. if (strlen($this->outTradeNo) === 0) {
  241. $invalidProperties[] = '商户交易流水号不能为空';
  242. }
  243. if (strlen($this->authCode) === 0) {
  244. $invalidProperties[] = '支付授权码不能为空';
  245. }
  246. if (strlen($this->totalAmount) === 0) {
  247. $invalidProperties[] = '金额不能为空';
  248. }
  249. if ($this->locationInfo == null) {
  250. $invalidProperties[] = '地址位置信息不能为空';
  251. }
  252. return $invalidProperties;
  253. }
  254. public function jsonSerialize()
  255. {
  256. $this->setReqData([
  257. 'merchant_no' => $this->merchantNo,
  258. 'term_no' => $this->termNo,
  259. 'out_trade_no' => $this->outTradeNo,
  260. 'auth_code' => $this->authCode,
  261. 'total_amount' => $this->totalAmount,
  262. 'location_info' => $this->locationInfo === null ? $this->locationInfo : $this->locationInfo->jsonSerialize(),
  263. 'busi_mode' => $this->busiMode,
  264. 'subject' => $this->subject,
  265. 'pay_order_no' => $this->payOrderNo,
  266. 'notify_url' => $this->notifyUrl,
  267. 'settle_type' => $this->settleType,
  268. 'remark' => $this->remark,
  269. 'scan_type' => $this->scanType,
  270. 'promo_info' => $this->promoInfo,
  271. 'acc_busi_fields' => $this->accBusiFields === null ? $this->accBusiFields : $this->accBusiFields->jsonSerialize(),
  272. 'out_order_no' => $this->outOrderNo,
  273. 'pnr_ins_id_cd' => $this->pnrInsIdCd,
  274. ]);
  275. return parent::jsonSerialize();
  276. }
  277. }