diff --git a/WePayV3/Transfers.php b/WePayV3/Transfers.php index 7e3939b..d32289b 100644 --- a/WePayV3/Transfers.php +++ b/WePayV3/Transfers.php @@ -42,12 +42,12 @@ class Transfers extends BasicWePay foreach ($body['transfer_detail_list'] as &$item) if (isset($item['user_name'])) { $item['user_name'] = $this->rsaEncode($item['user_name']); } - } - if (empty($body['total_num'])) { - $body['total_num'] = count($body['transfer_detail_list']); - } - if (empty($body['total_amount'])) { - $body['total_amount'] = array_sum(array_column($body['transfer_detail_list'], 'transfer_amount')); + if (empty($body['total_num'])) { + $body['total_num'] = count($body['transfer_detail_list']); + } + if (empty($body['total_amount'])) { + $body['total_amount'] = array_sum(array_column($body['transfer_detail_list'], 'transfer_amount')); + } } return $this->doRequest('POST', '/v3/transfer/batches', json_encode($body, JSON_UNESCAPED_UNICODE), true); }