/** * Castecne vraceni platby * * @param float $paymentSessionId - identifikator platby * @param float $amount - castka na vraceni * @param String $currency - mena * @param String $description - popis vraceni platby * @param float $targetGoId - identifikator prijemnce - GoId * @param string $secureKey - kryptovaci klic prideleny GoPay * @return string * @throws \Exception */ public static function refundPaymentPartially($paymentSessionId, $amount, $currency, $description, $targetGoId, $secureKey) { try { //inicializace WS ini_set("soap.wsdl_cache_enabled", "0"); $go_client = GopayConfig::createSoapClient(); $sessionEncryptedSignature = GopayHelper::encrypt(GopayHelper::hash(GopayHelper::concatRefundRequest((double) $targetGoId, (double) $paymentSessionId, $amount, $currency, $description, $secureKey)), $secureKey); $refundRequest = array("targetGoId" => (double) $targetGoId, "paymentSessionId" => (double) $paymentSessionId, "amount" => $amount, "currency" => $currency, "description" => $description, "encryptedSignature" => $sessionEncryptedSignature); $paymentResult = $go_client->__call("partiallyRefundPayment", array("refundRequest" => $refundRequest)); if ($paymentResult->result == GopayHelper::CALL_RESULT_FAILED) { throw new \Exception("payment not refunded [" . $paymentResult->resultDescription . "]"); } else { if ($paymentResult->result == GopayHelper::CALL_RESULT_ACCEPTED) { //vraceni platby bylo zarazeno ke zpracovani throw new \Exception(GopayHelper::CALL_RESULT_ACCEPTED); } } return $paymentResult->paymentSessionId; } catch (\SoapFault $f) { /* * Chyba v komunikaci s GoPay serverem */ throw new \Exception("SOAP error"); } }