<?php
namespace Payment\Trans; use Payment\Common\Weixin\Data\TransferData; use Payment\Common\Weixin\WxBaseStrategy; use Payment\Config; use Payment\Utils\ArrayUtil; class WxTransfer extends WxBaseStrategy { protected $reqUrl = 'https://api.mch.weixin.qq.com/{debug}/mmpaymkttransfers/promotion/transfers'; public function getBuildDataClass() { return TransferData::class; } protected function retData(array $ret) { if ($this->config->returnRaw) { $ret['channel'] = Config::WX_TRANSFER; return $ret; } if ($ret['return_code'] != 'SUCCESS') { return $retData = [ 'is_success' => 'F', 'error' => $ret['return_msg'], 'channel' => Config::WX_TRANSFER, ]; } if ($ret['result_code'] != 'SUCCESS') { return $retData = [ 'is_success' => 'F', 'error' => $ret['err_code_des'], 'channel' => Config::WX_TRANSFER, ]; } return $this->createBackData($ret); } protected function createBackData(array $data) { $retData = [ 'is_success' => 'T', 'response' => [ 'trans_no' => $data['partner_trade_no'], 'transaction_id' => $data['payment_no'], 'pay_date' => $data['payment_time'], 'device_info' => ArrayUtil::get($data, 'device_info', 'WEB'), 'channel' => Config::WX_TRANSFER, ], ]; return $retData; } protected function verifySign(array $retData) { return true; } } 