minetro/mobilni-platby

This package is abandoned and no longer maintained. The author suggests using the contributte/mobilni-platby package instead.

Dispatcher for Mobile Payments (www.mobilniplatby.cz) for Nette Framework.

1.0.1 2015-03-07 11:36 UTC

This package is auto-updated.

Last update: 2022-01-03 20:22:56 UTC


README

68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f6769747465722f6379616e 68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f666f72756d2f79656c6c6f77 68747470733a2f2f62616467656e2e6e65742f62616467652f73706f6e736f722f646f6e6174696f6e732f463936383534

Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte

Disclaimer

Composer contributte/mobilni-platby
Version
PHP
License

Usage

composer require contributte/mobilni-platby

Versions

State Version Branch PHP
dev ^0.2 master >= 7.1
stable ^0.1 master >= 7.1

Usage

Custom dispatcher

<?php declare(strict_types = 1);

namespace Your\App;

use Contributte\MobilniPlatby\IDispatcher;
use Contributte\MobilniPlatby\Request\AbstractRequest;
use Contributte\MobilniPlatby\Response\AbstractResponse;
use Contributte\MobilniPlatby\Response\Response;

class TestDispatcher implements IDispatcher
{

	public function dispatch(AbstractRequest $request): AbstractResponse
	{
		return new Response('This is super!');
	}

}

Example presenter

<?php declare(strict_types = 1);

namespace Your\App\Presenters;

use Contributte\MobilniPlatby\Dispatcher\CallbackDispatcher;
use Contributte\MobilniPlatby\Request\ConfirmRequest;
use Contributte\MobilniPlatby\Request\RequestFactory;
use Contributte\MobilniPlatby\Request\SmsRequest;
use Contributte\MobilniPlatby\Response\AbstractResponse;
use Contributte\MobilniPlatby\Response\ConfirmResponse;
use Contributte\MobilniPlatby\Response\Response;
use Nette\Application\UI\Presenter;

class SmsPresenter extends Presenter
{

	public function actionSms1(): void
	{
		$requestFactory = new RequestFactory($this->getHttpRequest());

		$dispatcher = new TestDispatcher();

		$this->sendResponse($dispatcher->dispatch($requestFactory->create()));
	}

	public function actionSms2(): void
	{
		$requestFactory = new RequestFactory($this->getHttpRequest());

		$dispatcher = new CallbackDispatcher();

		$dispatcher->registerSmsCallback(function (SmsRequest $request, Response $response): AbstractResponse {
			return new Response('My response!');
		});

		$dispatcher->registerConfirmCallback(function (ConfirmRequest $request, ConfirmResponse $response) {
			return new ConfirmResponse();
		});
		$this->sendResponse($dispatcher->dispatch($requestFactory->create()));
	}

}

Development

This package was maintain by these authors.

538058?v=3&s=80

Consider to support contributte development team. Also thank you for using this package.