<?php
namespace Payment\Charge\Ali; use Payment\Common\Ali\AliBaseStrategy; use Payment\Common\Ali\Data\Charge\QrChargeData; use Payment\Common\AliConfig; use Payment\Common\PayException; class AliQrCharge extends AliBaseStrategy { protected $method = 'alipay.trade.precreate'; public function getBuildDataClass() { $this->config->method = $this->method; return QrChargeData::class; } protected function retData(array $ret) { $url = parent::retData($ret); try { $data = $this->sendReq($url); } catch (PayException $e) { throw $e; } if ($data['code'] !== '10000') { throw new PayException($data['sub_msg']); } return $data['qr_code']; } } 