Fixerio icon indicating copy to clipboard operation
Fixerio copied to clipboard

Wrong parameters for Fadion\Fixerio\Exceptions\ResponseException([string $message [, long $code [, Throwable $previous = NULL]]])

Open spagu opened this issue 6 years ago • 5 comments

I did upgrade to version to 2 also created a key but now I am facing this problem.

How to solve?

this is happening on first example from your manual.

spagu avatar Jun 28 '18 10:06 spagu

This was fixed with #12.

You may need to update your dependency version of this package to dev-master until a release is made.

Nacoma avatar Jul 03 '18 14:07 Nacoma

updated. Now the problem is :

Type: Fadion\Fixerio\Exceptions\ResponseException
Code: 105
File: /project/vendor/fadion/fixerio/src/Exchange.php
Line: 276

spagu avatar Jul 04 '18 16:07 spagu

According to their API docs a 105 is Your current subscription doesn’t support this endpoint. The response exception is supposed to be thrown in this case.

Is the corresponding error message not there?

Nacoma avatar Jul 04 '18 17:07 Nacoma

Yeah I think so. I was doing USD to GBP and EUR. So no more free service here. That's a problem for us, we would have to develop own lib for that.

spagu avatar Jul 04 '18 17:07 spagu

It's simple enough to convert to another base. You could do so using this well designed PHP money library or simply re-base the rates yourself using something like so:

$rates = [
     'USD' => .9,
     'EUR' => 1,
    // ...
];

$base = $rates['USD'];

$rebasedConversionRates = array_map(function (string $rate) use ($base) {
    return bcdiv($rate, (string) $base, 16);
}, $rates);

I'm currently working on an integration library for fixers API and the money lib but that's a few weeks out still.

Edit: fixed the snippet

Nacoma avatar Jul 04 '18 17:07 Nacoma