| Conditions | 7 |
| Paths | 13 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function do_refund(array $transaction, array $receivers = NULL, $chained = FALSE) |
||
| 18 | { |
||
| 19 | if (empty($transaction['payKey']) AND empty($transaction['trackingId'])) |
||
| 20 | throw new Exception('You must provide either "payKey" or "trackingId" to Refund API operation.'); |
||
| 21 | |||
| 22 | $data = array( |
||
| 23 | 'currencyCode' => $this->config('currency') |
||
| 24 | ); |
||
| 25 | |||
| 26 | if (isset($transaction['payKey'])) |
||
| 27 | { |
||
| 28 | $data['payKey'] = $transaction['payKey']; |
||
| 29 | } |
||
| 30 | elseif (isset($transaction['trackingId'])) |
||
| 31 | { |
||
| 32 | $data['trackingId'] = $transaction['trackingId']; |
||
| 33 | } |
||
| 34 | |||
| 35 | if (isset($transaction['transactionId'])) |
||
| 36 | { |
||
| 37 | $data['transactionId'] = $transaction['transactionId']; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($receivers) |
||
| 41 | { |
||
| 42 | $data['receiverList'] = Util::receiver_list($receivers, $chained); |
||
| 43 | |||
| 44 | $receiver_list = Util::array_to_nvp($data, 'receiverList', 'receiver'); |
||
| 45 | unset($data['receiverList']); |
||
| 46 | $data = array_merge_recursive($data, $receiver_list); |
||
| 47 | } |
||
| 48 | |||
| 49 | return $this->refund($data); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |