public function testGetMoneySource()
 {
     $this->assertEquals('1222233334444555', $this->processPaymentByCardRequest->getMoneySource());
 }
Beispiel #2
0
$app->get('/shop-payment', function (Request $request) use($app) {
    $token = $app['session']->get('token');
    $params = array();
    $params["pattern_id"] = "337";
    $params["property_1"] = "921";
    $params["property_2"] = "3020052";
    $params["sum"] = "2.00";
    $params["test_payment"] = "true";
    $params["test_result"] = "success";
    $apiFacade = YandexMoney::getApiFacade();
    $apiFacade->setLogFile(__DIR__ . '/ym.log');
    $response = null;
    try {
        $response = $apiFacade->requestPaymentShop($token, $params);
        $requestId = $response->getRequestId();
        $processPaymentByCardRequest = new ProcessPaymentByCardRequest();
        $processPaymentByCardRequest->setRequestId($requestId);
        $processPaymentByCardRequest->setMoneySource('1222233334444555');
        $processPaymentByCardRequest->setCsc('222');
        $processPaymentByCardRequest->setExtAuthSuccessUri('http://abracadabra.fafa.by/success');
        $processPaymentByCardRequest->setExtAuthFailUri('http://abracadabra.fafa.by/fail');
        $response = $apiFacade->processPaymentByCard($token, $processPaymentByCardRequest);
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    $result = 'Empty result';
    if ($response != null) {
        $result = $response->isSuccess() ? 'status=' . $response->getStatus() : 'error=' . $response->getError();
    }
    return new Response($result, 200);
});
Beispiel #3
0
 /**
  * @param string $accessToken
  * @param \YandexMoney\Request\ProcessPaymentByCardRequest $processPaymentByCardRequest
  * @internal param string $requestId
  * @internal param string $csc
  * @return \YandexMoney\Response\ProcessPaymentResponse
  */
 public function processPaymentByCard($accessToken, ProcessPaymentByCardRequest $processPaymentByCardRequest)
 {
     $paramArray = array();
     $paramArray[ApiKey::REQUEST_ID] = $processPaymentByCardRequest->getRequestId();
     $paramArray[ApiKey::MONEY_SOURCE] = $processPaymentByCardRequest->getMoneySource();
     $this->putIfNotNull($processPaymentByCardRequest->getCsc(), $paramArray, ApiKey::CSC);
     $this->putIfNotNull($processPaymentByCardRequest->getExtAuthSuccessUri(), $paramArray, ApiKey::EXT_AUTH_SUCCESS_URI);
     $this->putIfNotNull($processPaymentByCardRequest->getExtAuthFailUri(), $paramArray, ApiKey::EXT_AUTH_FAIL_URI);
     if ($processPaymentByCardRequest->getTestPayment() == true) {
         $paramArray[ApiKey::TEST_PAYMENT] = true;
         $paramArray[ApiKey::TEST_RESULT] = $processPaymentByCardRequest->getTestResult();
     }
     $params = http_build_query($paramArray);
     $apiNetworkClient = new ApiNetworkClient($accessToken, $this->logFile);
     $response = $apiNetworkClient->request($this->getApiUri(Uri::PROCESS_PAYMENT), $params);
     return new Responses\ProcessPaymentResponse($response->getBodyJsonDecoded());
 }