Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spagu opened this issue Jun 28, 2018 · 5 comments

Comments

@spagu
Copy link

spagu commented Jun 28, 2018

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.

@Nacoma
Copy link
Contributor

Nacoma commented Jul 3, 2018

This was fixed with #12.

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

@spagu
Copy link
Author

spagu commented Jul 4, 2018

updated. Now the problem is :

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

@Nacoma
Copy link
Contributor

Nacoma commented Jul 4, 2018

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?

@spagu
Copy link
Author

spagu commented Jul 4, 2018

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.

@Nacoma
Copy link
Contributor

Nacoma commented Jul 4, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants