getInfo(); $metrics->send('yoomoney', ['balance' => $info['balance']], ['account' => $info['account']]); if(!empty($_ENV['YOOMONEY_TRANSFER_TO_ACCESS_TOKEN'])) { $infoTransferTo = (new YooMoney($_ENV['YOOMONEY_TRANSFER_TO_ACCESS_TOKEN']))->getInfo(); $metrics->send('yoomoney', ['balance' => $infoTransferTo['balance']], ['account' => $infoTransferTo['account']]); } if($info['balance'] < 2 || $info['balance'] == floor($info['balance'])) { exit(); } $transferAmount = $info['balance'] - floor($info['balance']) + 2; if($transferAmount > $info['balance']) { exit(); } $response = $yooMoney->transfer($_ENV['YOOMONEY_TRANSFER_TO'], $transferAmount, 'Rounding from ' . $info['account'], 'Rounding', 'rounding'); $yooMoney->confirm($response['request_id']);