Coinpayment Laravel 集成。除以零异常

Coinpayment Laravel integration. Division by zero Exception

我正在尝试整合 coinpayment. By using this - https://github.com/hexters/CoinPayment

但我收到错误提示:

exception: "ErrorException"
file: "C:\xampp\htdocs\coinpayment\vendor\hexters\coinpayment\src\Http\Controllers\CoinPaymentController.php"
line: 45
message: "Division by zero"

请参考作者在 git 存储库中更新包时的新提交 https://github.com/hexters/CoinPayment/commit/cf7de99e18948fe385e75dfa8ded0fb378c33ad4

如果 link 无法正常工作,请转到您的应用程序路径,然后转到供应商文件夹并遵循路径 vendor/hexters/coinpayment/src/Http/Controllers 并更新 CoinPaymentController.php 文件的 public 函数 ajax_rates() 函数与下面给定的代码

public function ajax_rates(Request $req, $usd){
  $coins = [];
  $aliases = [];
  $rates = CoinPayment::api_call('rates', [
    'accepted' => 1
  ])['result'];
  $rateBtc = $rates['BTC']['rate_btc'];
  $rateUsd = $rates[config('coinpayment.default_currency')]['rate_btc'];
  $rateAmount = $rateUsd * $usd;
  $fiat = [];
  $coins_accept = [];
  foreach($rates as $i => $coin){
    if((FLOAT) $rates[$i]['rate_btc'] > 0) {
      if((INT) $coin['is_fiat'] === 0){
        $rate = ($rateAmount / $rates[$i]['rate_btc']);
        $coins[] = [
          'name' => $coin['name'],
          'rate' => number_format($rate,8,'.',''),
          'iso' => $i,
          'icon' => 'https://www.coinpayments.net/images/coins/' . $i . '.png',
          'selected' => $i == 'BTC' ? true : false,
          'accepted' => $coin['accepted']
        ];

        $aliases[$i] = $coin['name'];
      }

      if((INT) $coin['is_fiat'] === 0 && $coin['accepted'] == 1){
        $rate = ($rateAmount / $rates[$i]['rate_btc']);
        $coins_accept[] = [
          'name' => $coin['name'],
          'rate' => number_format($rate,8,'.',''),
          'iso' => $i,
          'icon' => 'https://www.coinpayments.net/images/coins/' . $i . '.png',
          'selected' => $i == 'BTC' ? true : false,
          'accepted' => $coin['accepted']
        ];
      }


      if((INT) $coin['is_fiat'] === 1){
        $fiat[$i] = $coin;
      }
    }
  }
  return response()->json([
    'coins' => $coins,
    'coins_accept' => $coins_accept,
    'aliases' => $aliases,
    'fiats' =>$fiat
  ]);
}