This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kaylyu\Alipay\F2fpay\Order; |
||
4 | |||
5 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradeCancelRequest; |
||
6 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradeCloseRequest; |
||
7 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradeCreateRequest; |
||
8 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradePayRequest; |
||
9 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradePrecreateRequest; |
||
10 | use Kaylyu\Alipay\F2fpay\Base\Aop\Request\AlipayTradeQueryRequest; |
||
11 | use Kaylyu\Alipay\F2fpay\Base\Model\Builder\AlipayTradeCancelContentBuilder; |
||
12 | use Kaylyu\Alipay\F2fpay\Base\Model\Builder\AlipayTradeCloseContentBuilder; |
||
13 | use Kaylyu\Alipay\F2fpay\Base\Model\Builder\AlipayTradePayContentBuilder; |
||
14 | use Kaylyu\Alipay\F2fpay\Base\Model\Builder\AlipayTradePrecreateContentBuilder; |
||
15 | use Kaylyu\Alipay\F2fpay\Base\Model\Builder\AlipayTradeQueryContentBuilder; |
||
16 | use Kaylyu\Alipay\F2fpay\Base\Model\Result\AlipayF2FPayResult; |
||
17 | use Kaylyu\Alipay\F2fpay\Kernel\BaseClient; |
||
18 | use function Kaylyu\Alipay\F2fpay\Kernel\Support\querySuccess; |
||
19 | use function Kaylyu\Alipay\F2fpay\Kernel\Support\tradeError; |
||
20 | use function Kaylyu\Alipay\F2fpay\Kernel\Support\tradeSuccess; |
||
21 | |||
22 | /** |
||
23 | * 订单 |
||
24 | * @author kaylv <[email protected]> |
||
25 | * @package Kaylyu\Alipay\F2fpay\Order |
||
26 | */ |
||
27 | class Client extends BaseClient |
||
28 | { |
||
29 | /** |
||
30 | * 统一收单交易支付接口(条码支付) |
||
31 | * |
||
32 | * 收银员使用扫码设备读取用户手机支付宝“付款码”/声波获取设备(如麦克风)读取用户手机支付宝的声波信息后,将二维码或条码信息/声波信息通过本接口上送至支付宝发起支付 |
||
33 | * |
||
34 | * @param AlipayTradePayContentBuilder $builder |
||
35 | * @author kaylv <[email protected]> |
||
36 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
37 | */ |
||
38 | View Code Duplication | public function barPay(AlipayTradePayContentBuilder $builder) |
|
0 ignored issues
–
show
|
|||
39 | { |
||
40 | //创建 |
||
41 | $request = new AlipayTradePayRequest(); |
||
42 | $request->setBizContent($builder->getBizContent()); |
||
43 | |||
44 | //请求 |
||
45 | $response = $this->httpPost($request, $builder->getAppAuthToken()); |
||
46 | |||
47 | //获取 |
||
48 | $data = $response->alipay_trade_pay_response; |
||
49 | $sign = $response->sign; |
||
50 | |||
51 | //组装返回数据 |
||
52 | $result = new AlipayF2FPayResult($data, $sign); |
||
53 | |||
54 | //处理 |
||
55 | if (tradeSuccess($data)) { |
||
56 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_SUCCESS); |
||
57 | } elseif (tradeError($data)) { |
||
58 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_UNKNOWN); |
||
59 | } else { |
||
60 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_FAILED); |
||
61 | } |
||
62 | |||
63 | return $this->formatResponseToType($result); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * 统一收单线下交易预创建(扫码支付) |
||
68 | * |
||
69 | * 收银员通过收银台或商户后台调用支付宝接口,生成二维码后,展示给用户,由用户扫描二维码完成订单支付 |
||
70 | * |
||
71 | * @param AlipayTradePrecreateContentBuilder $builder |
||
72 | * @author kaylv <[email protected]> |
||
73 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
74 | */ |
||
75 | public function qrPay(AlipayTradePrecreateContentBuilder $builder) |
||
76 | { |
||
77 | //获取当面付配置 |
||
78 | $f2fpay = $this->app->getF2fpay(); |
||
79 | |||
80 | //创建 |
||
81 | $request = new AlipayTradePrecreateRequest(); |
||
82 | $request->setBizContent($builder->getBizContent()); |
||
83 | $request->setNotifyUrl($f2fpay['notify_url']); |
||
84 | |||
85 | //请求 |
||
86 | $response = $this->httpPost($request, $builder->getAppAuthToken()); |
||
87 | |||
88 | //获取 |
||
89 | $data = $response->alipay_trade_precreate_response; |
||
90 | $sign = $response->sign; |
||
91 | |||
92 | //组装返回数据 |
||
93 | $result = new AlipayF2FPayResult($data, $sign); |
||
94 | |||
95 | //处理 |
||
96 | if (tradeSuccess($data)) { |
||
97 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_SUCCESS); |
||
98 | } elseif (tradeError($data)) { |
||
99 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_UNKNOWN); |
||
100 | } else { |
||
101 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_FAILED); |
||
102 | } |
||
103 | |||
104 | return $this->formatResponseToType($result); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * 统一收单线下交易查询 |
||
109 | * |
||
110 | * 该接口提供所有支付宝支付订单的查询,商户可以通过该接口主动查询订单状态,完成下一步的业务逻辑。 需要调用查询接口的情况: |
||
111 | * 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知; |
||
112 | * 调用支付接口后,返回系统错误或未知交易状态情况; |
||
113 | * 调用alipay.trade.pay,返回INPROCESS的状态; |
||
114 | * 调用alipay.trade.cancel之前,需确认支付状态 |
||
115 | * |
||
116 | * @param AlipayTradeQueryContentBuilder $builder |
||
117 | * @author kaylv <[email protected]> |
||
118 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
119 | */ |
||
120 | View Code Duplication | public function query(AlipayTradeQueryContentBuilder $builder) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
121 | { |
||
122 | //查询 |
||
123 | $request = new AlipayTradeQueryRequest(); |
||
124 | $request->setBizContent($builder->getBizContent()); |
||
125 | |||
126 | //请求 |
||
127 | $response = $this->httpPost($request, $builder->getAppAuthToken()); |
||
128 | |||
129 | //获取 |
||
130 | $data = $response->alipay_trade_query_response; |
||
131 | $sign = $response->sign; |
||
132 | |||
133 | //组装返回数据 |
||
134 | $result = new AlipayF2FPayResult($data, $sign); |
||
135 | |||
136 | //处理 |
||
137 | if (querySuccess($data)) { |
||
138 | // 查询返回该订单交易支付成功 |
||
139 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_SUCCESS); |
||
140 | } elseif (tradeError($data)) { |
||
141 | //查询发生异常或无返回,交易状态未知 |
||
142 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_UNKNOWN); |
||
143 | } else { |
||
144 | //其他情况均表明该订单号交易失败 |
||
145 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_FAILED); |
||
146 | } |
||
147 | |||
148 | return $this->formatResponseToType($result); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * 统一收单交易撤销接口 |
||
153 | * |
||
154 | * 支付交易返回失败或支付系统超时,调用该接口撤销交易。如果此订单用户支付失败,支付宝系统会将此订单关闭;如果用户支付成功,支付宝系统会将此订单资金退还给用户 |
||
155 | * 注意:只有发生支付系统超时或者支付结果未知时可调用撤销,其他正常支付的单如需实现相同功能请调用申请退款API |
||
156 | * 提交支付交易后调用【查询订单API】,没有明确的支付结果再调用【撤销订单API】 |
||
157 | * |
||
158 | * @param AlipayTradeCancelContentBuilder $builder |
||
159 | * @author kaylv <[email protected]> |
||
160 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
161 | */ |
||
162 | View Code Duplication | public function cancel(AlipayTradeCancelContentBuilder $builder) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
163 | { |
||
164 | $request = new AlipayTradeCancelRequest(); |
||
165 | $request->setBizContent($builder->getBizContent()); |
||
166 | |||
167 | //请求 |
||
168 | $response = $this->httpPost($request, $builder->getAppAuthToken()); |
||
169 | |||
170 | //获取 |
||
171 | $data = $response->alipay_trade_cancel_response; |
||
172 | $sign = $response->sign; |
||
173 | |||
174 | //组装返回数据 |
||
175 | $result = new AlipayF2FPayResult($data, $sign); |
||
176 | |||
177 | //处理 |
||
178 | if (tradeSuccess($data)) { |
||
179 | // 查询返回该订单交易支付成功 |
||
180 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_SUCCESS); |
||
181 | } elseif (tradeError($data)) { |
||
182 | //查询发生异常或无返回,交易状态未知 |
||
183 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_UNKNOWN); |
||
184 | } else { |
||
185 | //其他情况均表明该订单号交易失败 |
||
186 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_FAILED); |
||
187 | } |
||
188 | |||
189 | return $this->formatResponseToType($result); |
||
190 | } |
||
191 | |||
192 | /** |
||
193 | * 统一收单交易关闭接口 |
||
194 | * |
||
195 | * 用于交易创建后,用户在一定时间内未进行支付,可调用该接口直接将未付款的交易进行关闭 |
||
196 | * |
||
197 | * @param AlipayTradeCloseContentBuilder $builder |
||
198 | * @author kaylv <[email protected]> |
||
199 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
200 | */ |
||
201 | View Code Duplication | public function close(AlipayTradeCloseContentBuilder $builder) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
202 | { |
||
203 | $request = new AlipayTradeCloseRequest(); |
||
204 | $request->setBizContent($builder->getBizContent()); |
||
205 | |||
206 | //请求 |
||
207 | $response = $this->httpPost($request, $builder->getAppAuthToken()); |
||
208 | |||
209 | //获取 |
||
210 | $data = $response->alipay_trade_close_response; |
||
211 | $sign = $response->sign; |
||
212 | |||
213 | //组装返回数据 |
||
214 | $result = new AlipayF2FPayResult($data, $sign); |
||
215 | |||
216 | //处理 |
||
217 | if (tradeSuccess($data)) { |
||
218 | // 查询返回该订单交易支付成功 |
||
219 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_SUCCESS); |
||
220 | } elseif (tradeError($data)) { |
||
221 | //查询发生异常或无返回,交易状态未知 |
||
222 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_UNKNOWN); |
||
223 | } else { |
||
224 | //其他情况均表明该订单号交易失败 |
||
225 | $result->setTradeStatus(AlipayF2FPayResult::ALIPAY_F2FPAY_RESULT_FAILED); |
||
226 | } |
||
227 | |||
228 | return $this->formatResponseToType($result); |
||
229 | } |
||
230 | } |
||
231 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.