public function testGetRightsConfigurator() { $rightsConfigurator = YandexMoney::getRightsConfigurator(); $this->assertNotNull($rightsConfigurator); $this->assertInstanceOf('YandexMoney\\Utils\\RightsConfigurator', $rightsConfigurator); }
use YandexMoney\Request\OperationHistoryRequest; use YandexMoney\Request\P2pPaymentRequest; use YandexMoney\Request\ProcessExternalPaymentRequest; use YandexMoney\Request\ProcessPaymentByCardRequest; use YandexMoney\Request\ProcessPaymentByWalletRequest; use YandexMoney\YandexMoney; $loader = (require __DIR__ . '/vendor/autoload.php'); $loader->add('YandexMoney', __DIR__ . '/../lib/'); $app = new Silex\Application(); $app->register(new Silex\Provider\SessionServiceProvider()); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/views')); /** * app route */ $app->get('/', function () use($app) { $rightsConfigurator = YandexMoney::getRightsConfigurator(); $rightsConfigurator->addRight(Rights::ACCOUNT_INFO); $rightsConfigurator->addRight(Rights::OPERATION_HISTORY); $rightsConfigurator->addRight(Rights::OPERATION_DETAILS); $rightsConfigurator->paymentToAccount("410011161616877", PaymentIdentifier::ACCOUNT, 0, 30); $rightsConfigurator->paymentToPattern("337", 0, 30); $rightsConfigurator->setMoneySource(MoneySource::CARD); $authRequestBuilder = YandexMoney::getAuthRequestBuilder(); $authRequestBuilder->setClientId(CLIENT_ID); $authRequestBuilder->setRedirectUri(REDIRECT_URI); $authRequestBuilder->setRights($rightsConfigurator->toString()); $apiFacade = YandexMoney::getApiFacade(); $apiFacade->setLogFile(__DIR__ . '/ym.log'); $originalServerResponse = null; try { $originalServerResponse = $apiFacade->authorizeApplication($authRequestBuilder);