public function testPutIfNotNull()
 {
     $apiFacade = YandexMoney::getApiFacade();
     $testArray = array();
     $apiFacade->putIfNotNull("1", $testArray, "one");
     $this->assertArrayHasKey("one", $testArray);
     $this->assertEquals("1", $testArray["one"]);
     $testArray = array();
     $apiFacade->putIfNotNull(null, $testArray, "one");
     $this->assertCount(0, $testArray);
 }
 public function testGetApiFacade()
 {
     $apiFacade = YandexMoney::getApiFacade();
     $this->assertNotNull($apiFacade);
     $this->assertInstanceOf('YandexMoney\\Utils\\ApiFacade', $apiFacade);
 }
Example #3
0
        $externalProcessPaymentResponse = $apiFacade->processExternalPayment($processExternalPaymentRequest);
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    $response = array();
    if ($externalProcessPaymentResponse != null) {
        $response['result'] = $externalProcessPaymentResponse->isSuccess() ? $externalProcessPaymentResponse->getStatus() : $externalProcessPaymentResponse->getError();
    }
    return $app->json($response);
});
/**
 *  app route
 */
$app->get('/revoke-token', function (Request $request) use($app) {
    $token = $app['session']->get('token');
    $apiFacade = YandexMoney::getApiFacade();
    $apiFacade->setLogFile(__DIR__ . '/ym.log');
    $wasRevoked = false;
    try {
        $wasRevoked = $apiFacade->revokeOAuthToken($token);
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    $app['session']->set('token', null);
    return $app['twig']->render('revoke-token.twig', array('token_revoked' => $wasRevoked));
});
/**
 * Mode switcher
 */
if ($currentMode == APP_MODE) {
    $app->run();