link0 / bunq

API client in PHP for bunq
MIT License
8 stars 13 forks source link

Implementing api action #7

Closed dstollie closed 7 years ago

dstollie commented 7 years ago

Currently this library does not implement the different api endpoint. Is this on purpose or is this something you are thinking to implement in the future?

dennisdegreef commented 7 years ago

What do you mean exactly when you say 'the different api endpoint'? That not all functionality is imlemented? or are you talking about the production environment?

For the first, I've released this library when it was still a work in progress (kind of still is, I haven't tagged a stable release yet). I intend to add more functionality over time, but feel free to help out by sending in a pull request ;-)

If the latter, you can instantiate Link0\Bunq\Environment\Production instead of Sandbox and that will communicate with the production environment. See #8

Does this answer your question? :)

dstollie commented 7 years ago

After rereading my question I felt the same as you did "What is this guy asking :)".

First of all thanks for the explanation of working with different environments. I already had a feeling that replacing new Sandbox for new Production should hook me into the production environment of bunq.

Though my question was ment to be more focussed on al the endpoints of bunq. bunq has lots of endpoints. Currently this library does only abstract away the endpoints for registering an installation, the device server and the session server. Are you planning to abstract away (all) the other endpoints bunq has.

Super simple code example:

// After this, you can use the client with all other services as followed
$client = new Client(
    $environment,
    $keypair,
    new PublicKey(file_get_contents('server-public-key.txt')),
    file_get_contents('session-token.txt')
);

$users = $client->getUsers();
$user = $client->getUser();
$client->postPayment(arguments)

Thanks for your work in this library. It helped me alot with getting the idea of the workings of the bunq api.

Have a nice day!

Dennis

dennisdegreef commented 7 years ago

I have already implemented some. You can find them here: https://github.com/link0/bunq/tree/master/src/Service

They take the Client as argument in the constructor, since they abstract away the literal calls. These calls should be documented in the README.md but that is still to be done.

For example:

$monetaryAccountService = new MonetaryAccountService($client);
$monetaryAccounts = $monetaryAccountService->listByUser($user);
$reason = "I don't need this anymore";
$monetaryAccountService->closeAccount($monetaryAccount[1], $reason);

Do you have any calls you'd like to see implemented?