コード例 #1
0
 public function setUp()
 {
     $this->processExternalPaymentRequest = new ProcessExternalPaymentRequest();
     $this->processExternalPaymentRequest->setRequestId("request_id");
     $this->processExternalPaymentRequest->setInstanceId("instance_id");
     $this->processExternalPaymentRequest->setExtAuthSuccessUri("http://somewhere.com/success");
     $this->processExternalPaymentRequest->setExtAuthFailUri("http://somewhere.com/fail");
     $this->processExternalPaymentRequest->setCsc("000");
     $this->processExternalPaymentRequest->setRequestToken("request_token");
     $this->processExternalPaymentRequest->setMoneySourceToken("money_source_token");
 }
コード例 #2
0
ファイル: index.php プロジェクト: a-t/yandex-money-sdk-php
    $apiFacade = YandexMoney::getApiFacade();
    $apiFacade->setLogFile(__DIR__ . '/ym.log');
    $externalPaymentResponse = null;
    $externalProcessPaymentResponse = null;
    try {
        $instanceIdResponse = $apiFacade->getInstanceId(CLIENT_ID);
        $externalPaymentP2pRequest = new ExternalP2pPaymentRequest();
        $externalPaymentP2pRequest->setTo("410011161616877");
        $externalPaymentP2pRequest->setAmount("20.50");
        $externalPaymentP2pRequest->setMessage("Message");
        $externalPaymentResponse = $apiFacade->requestExternalPaymentP2p($instanceIdResponse->getInstanceId(), $externalPaymentP2pRequest);
        $processExternalPaymentRequest = new ProcessExternalPaymentRequest();
        $processExternalPaymentRequest->setRequestId($externalPaymentResponse->getRequestId());
        $processExternalPaymentRequest->setInstanceId($instanceIdResponse->getInstanceId());
        $processExternalPaymentRequest->setExtAuthSuccessUri("http://somewhere.com/success");
        $processExternalPaymentRequest->setExtAuthFailUri("http://somewhere.com/fail");
        $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');