| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class FindRefundPlugin extends GeneralPlugin |
||
| 13 | { |
||
| 14 | protected function getUri(Rocket $rocket): string |
||
| 15 | { |
||
| 16 | throw new InvalidParamsException(Exception::SERVICE_NOT_FOUND_ERROR); |
||
| 17 | } |
||
| 18 | |||
| 19 | protected function getPartnerUri(Rocket $rocket): string |
||
| 20 | { |
||
| 21 | $payload = $rocket->getPayload(); |
||
| 22 | |||
| 23 | $config = get_wechat_config($rocket->getParams()); |
||
| 24 | |||
| 25 | $query = [ |
||
| 26 | 'sub_mchid' => $payload->get('sub_mchid', $config->get('sub_mch_id', '')), |
||
| 27 | ]; |
||
| 28 | |||
| 29 | if (!is_null($payload->get('refund_id'))) { |
||
| 30 | return 'v3/ecommerce/refunds/id/'.$payload->get('refund_id').'?'.http_build_query($query); |
||
| 31 | } elseif (!is_null($payload->get('out_refund_no'))) { |
||
| 32 | return 'v3/ecommerce/refunds/out-refund-no/'.$payload->get('out_refund_no').'?'.http_build_query($query); |
||
| 33 | } else { |
||
| 34 | throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function getMethod(): string |
||
| 41 | } |
||
| 42 | |||
| 43 | protected function doSomething(Rocket $rocket): void |
||
| 46 | } |
||
| 47 | } |
||
| 48 |