コード例 #1
0
 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);
 }
コード例 #2
0
 public function testGetApiFacade()
 {
     $apiFacade = YandexMoney::getApiFacade();
     $this->assertNotNull($apiFacade);
     $this->assertInstanceOf('YandexMoney\\Utils\\ApiFacade', $apiFacade);
 }
コード例 #3
0
ファイル: index.php プロジェクト: a-t/yandex-money-sdk-php
        $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();