1 | <?php |
||
31 | class Payment |
||
32 | { |
||
33 | /** |
||
34 | * Scheme base path. |
||
35 | */ |
||
36 | const SCHEME_PATH = 'weixin://wxpay/bizpayurl'; |
||
37 | |||
38 | /** |
||
39 | * @var API |
||
40 | */ |
||
41 | protected $api; |
||
42 | |||
43 | /** |
||
44 | * Merchant instance. |
||
45 | * |
||
46 | * @var \EasyWeChat\Payment\Merchant |
||
47 | */ |
||
48 | protected $merchant; |
||
49 | |||
50 | /** |
||
51 | * Constructor. |
||
52 | * |
||
53 | * @param Merchant $merchant |
||
54 | */ |
||
55 | 4 | public function __construct(Merchant $merchant) |
|
59 | |||
60 | /** |
||
61 | * Build payment scheme for product. |
||
62 | * |
||
63 | * @param string $productId |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public function scheme($productId) |
|
81 | |||
82 | /** |
||
83 | * Handle payment notify. |
||
84 | * |
||
85 | * @param callable $callback |
||
86 | * |
||
87 | * @return Response |
||
88 | */ |
||
89 | 2 | public function handleNotify(callable $callback) |
|
116 | |||
117 | /** |
||
118 | * Gernerate js config for payment. |
||
119 | * |
||
120 | * @param string $prepayId |
||
121 | * @param bool $json |
||
122 | * |
||
123 | * @return string|array |
||
124 | */ |
||
125 | public function configForPayment($prepayId, $json = true) |
||
139 | |||
140 | /** |
||
141 | * Generate js config for share user address. |
||
142 | * |
||
143 | * @param string $accessToken |
||
144 | * @param bool $json |
||
145 | * |
||
146 | * @return string|array |
||
147 | */ |
||
148 | public function configForShareAddress($accessToken, $json = true) |
||
170 | |||
171 | /** |
||
172 | * Merchant setter. |
||
173 | * |
||
174 | * @param Merchant $merchant |
||
175 | */ |
||
176 | 1 | public function setMerchant(Merchant $merchant) |
|
180 | |||
181 | /** |
||
182 | * Merchant getter. |
||
183 | * |
||
184 | * @return Merchant |
||
185 | */ |
||
186 | 1 | public function getMerchant() |
|
190 | |||
191 | /** |
||
192 | * Return Notify instance. |
||
193 | * |
||
194 | * @return \EasyWeChat\Payment\Notify |
||
195 | */ |
||
196 | public function getNotify() |
||
200 | |||
201 | /** |
||
202 | * API setter. |
||
203 | * |
||
204 | * @param API $api |
||
205 | */ |
||
206 | 1 | public function setAPI(API $api) |
|
210 | |||
211 | /** |
||
212 | * Return API instance. |
||
213 | * |
||
214 | * @return API |
||
215 | */ |
||
216 | 1 | public function getAPI() |
|
220 | |||
221 | /** |
||
222 | * Magic call. |
||
223 | * |
||
224 | * @param string $method |
||
225 | * @param array $args |
||
226 | * |
||
227 | * @return mixed |
||
228 | * |
||
229 | * @codeCoverageIgnore |
||
230 | */ |
||
231 | public function __call($method, $args) |
||
237 | } |
||
238 |