Answer the question
In order to leave comments, you need to log in
First API server on Kohana - where to start?
Task:
Implement a payment gateway for various payment systems (in particular, for Yandex.Money and WebMoney so far). Payments must go through the gateway, data about them is stored in the database, and a response is sent to the application about the result of the payment. Subsequently, other projects will use this gateway.
In general, you should get something like your own little robokassa or interkassa: an API for working with another API.
I can't think clearly about the architecture of the future API server. I was looking for at least some material, everywhere it is described how, for example, to write a RESTful API application (server), that is, how to organize communication between the server and the client. But nowhere are there examples or manuals on how to write classes correctly, the methods themselves, how to determine which method to call on request taking into account the use of the mvc pattern, but not the point). It should be borne in mind that in the future it will be necessary to implement support for ever larger payment systems.
Can someone share their experience, or suggest a competent resource/material for in-depth study?
PS In PHP, and in programming in general, I am far from being a pro, I have not written large projects much, therefore, maybe I did not explain the problem quite clearly.
Answer the question
In order to leave comments, you need to log in
I will give a small example of the most primitive implementation.
Routing:
Controller:
class Controller_User extends Controller {
public function action_get_by_id()
{
$user_id = $this->request->post('user_id');
$user = DB::select()->from('users')->where('id','=',$user_id)->execute();
$this->response->body(json_encode($user));
}
}
See if you can make it easier. I probably didn't formulate the question correctly. But the problem has already almost solved itself. Thank you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question