/** * Založení opakovane platby * * @param float $parentPaymentSessionId - identifikator rodicovske platby * @param int $recurrentPaymentOrderNumber - identifikator objednavky * @param int $recurrentPaymentTotalPriceInCents - castka * @param string $recurrentPaymentCurrency - mena (CZK) * @param string $recurrentPaymentProductName - popis objednavky * @param float $targetGoId - identifikator prijemnce - GoId * @param string $secureKey - kryptovaci klic prideleny GoPay * @return string * @throws \Exception */ public static function performRecurrence($parentPaymentSessionId, $recurrentPaymentOrderNumber, $recurrentPaymentTotalPriceInCents, $recurrentPaymentCurrency, $recurrentPaymentProductName, $targetGoId, $secureKey) { try { //inicializace WS ini_set("soap.wsdl_cache_enabled", "0"); $go_client = GopayConfig::createSoapClient(); $encryptedSignature = GopayHelper::encrypt(GopayHelper::hash(GopayHelper::concatRecurrenceRequest((double) $parentPaymentSessionId, (int) $recurrentPaymentOrderNumber, (int) $recurrentPaymentTotalPriceInCents, (double) $targetGoId, $secureKey)), $secureKey); $recurrenceRequest = array("parentPaymentSessionId" => (double) $parentPaymentSessionId, "orderNumber" => (int) $recurrentPaymentOrderNumber, "totalPrice" => (int) $recurrentPaymentTotalPriceInCents, "targetGoId" => (double) $targetGoId, "encryptedSignature" => $encryptedSignature); $status = $go_client->__call('createRecurrentPayment', array('recurrenceRequest' => $recurrenceRequest)); if ($status->result == GopayHelper::CALL_COMPLETED) { GopayHelper::checkPaymentStatus($status, GopayHelper::CREATED, (double) $targetGoId, (int) $recurrentPaymentOrderNumber, (int) $recurrentPaymentTotalPriceInCents, $recurrentPaymentCurrency, $recurrentPaymentProductName, $secureKey); return $status->paymentSessionId; } else { throw new \Exception("Bad payment status"); } } catch (\SoapFault $f) { /* * Chyba v komunikaci s GoPay serverem */ throw new \Exception("SOAP error"); } }