Exemplo n.º 1
0
        $processPaymentByWalletRequest->setTestResult("illegal_param_amount_due");
        $response = $apiFacade->processPaymentByWallet($token, $processPaymentByWalletRequest);
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    return new Response(http_build_query($response->getDefinedParams()), 200);
});
/**
 *  app route
 */
$app->get('/p2p-payment', function (Request $request) use($app) {
    $token = $app['session']->get('token');
    $p2pPaymentRequest = new P2pPaymentRequest();
    $p2pPaymentRequest->setTo("410011161616877");
    $p2pPaymentRequest->setAmount("0.05");
    $p2pPaymentRequest->setComment("Comment");
    $p2pPaymentRequest->setMessage("Message");
    $p2pPaymentRequest->setTestPayment(true);
    $p2pPaymentRequest->setTestResult('success');
    $response = null;
    try {
        $apiFacade = YandexMoney::getApiFacade();
        $apiFacade->setLogFile(__DIR__ . '/ym.log');
        $response = $apiFacade->requestPaymentP2P($token, $p2pPaymentRequest);
        $processPaymentByWalletRequest = new ProcessPaymentByWalletRequest();
        $processPaymentByWalletRequest->setRequestId($response->getRequestId());
        $response = $apiFacade->processPaymentByWallet($token, $processPaymentByWalletRequest);
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    $result = 'Empty result';
 public function setUp()
 {
     $this->p2pPaymentRequest = new P2pPaymentRequest();
     $this->p2pPaymentRequest->setLabel("Label");
     $this->p2pPaymentRequest->setComment("Comment");
 }