Beispiel #1
0
 /**
  * Stazeni vypisu pohybu na uctu
  *
  * Ve vypisu jsou pohyby vytvorene mezi datem dateFrom do data dateTo, vcetne techto datumu
  *
  * @param String $dateFrom - datum, od ktereho se vypis generuje
  * @param String $dateTo - datum, do ktereho se vypis generuje
  * @param float $targetGoId - identifikator prijemnce - GoId
  * @param String $currency - mena uctu, ze ktereho se vypis pohybu ziskava
  * @param string $contentType - format vypisu - podporovane typt - TYPE_CSV, TYPE_XLS, TYPE_ABO, implicitni je hodnota TYPE_CSV
  * @param string $secureKey - kryptovaci klic prideleny GoPay
  * @return string
  */
 public function getAccountStatement($dateFrom, $dateTo, $targetGoId, $currency, $secureKey, $contentType)
 {
     $encryptedSignature = GopayHelper::encrypt(GopayHelper::hash(GopayHelper::concatStatementRequest($dateFrom, $dateTo, $targetGoId, $currency, $secureKey)), $secureKey);
     $filename = GopayConfig::getAccountStatementURL();
     $filename .= "?statementRequest.dateFrom=" . $dateFrom;
     $filename .= "&statementRequest.dateTo=" . $dateTo;
     $filename .= "&statementRequest.targetGoId=" . $targetGoId;
     $filename .= "&statementRequest.currency=" . $currency;
     $filename .= "&statementRequest.contentType=" . $contentType;
     $filename .= "&statementRequest.encryptedSignature=" . $encryptedSignature;
     echo $filename;
     $handle = fopen($filename, "r");
     $contents = "";
     if (!empty($handle)) {
         while (!feof($handle)) {
             $contents .= fread($handle, 8192);
         }
         fclose($handle);
     }
     return $contents;
 }
Beispiel #2
0
 /**
  * Sestaveni platebniho tlacitka formou odkazu pro jednoduchou integraci
  *
  * @param float $targetGoId - identifikace prijemce - GoId pridelene GoPay
  * @param string $productName - nazev objednavky / zbozi
  * @param int $totalPrice - cena objednavky v halerich
  * @param string $currency - identifikator meny
  * @param string $orderNumber - identifikace objednavky u prijemce
  * @param string $successURL - URL, kam se ma prejit po uspesnem zaplaceni
  * @param string $failedURL - URL, kam se ma prejit po neuspesnem zaplaceni
  * @param array $paymentChannels - pole plat. metod, ktere se zobrazi na brane
  * @param array $defaultPaymentChannel - vychozi platebni metoda
  * @param string $secureKey - kryptovaci klic prideleny prijemci, urceny k podepisovani komunikace
  *
  * @param boolean $preAuthorization - jedna-li se o predautorizovanou platbu
  * @param boolean $recurrentPayment - jedna-li se o opakovanou platbu
  * @param string $recurrenceDateTo - do kdy se ma opakovana platba provadet
  * @param string $recurrenceCycle - frekvence opakovresultane platby - mesic/tyden/den
  * @param int $recurrencePeriod - pocet plateb v cyklu $recurrenceCycle - kolikrat v mesici/... se opakovana platba provede
  *
  * Informace o zakaznikovi
  * @param string $firstName - Jmeno zakaznika
  * @param string $lastName - Prijmeni
  *
  * Adresa
  * @param string $city - Mesto
  * @param string $street - Ulice
  * @param string $postalCode - PSC
  * @param string $countryCode - Kod zeme. Validni kody jsou uvedeny ve tride CountryCode
  * @param string $email - Email zakaznika
  * @param string $phoneNumber - Tel. cislo
  *
  * @param string $p1 - volitelne parametry, ketre budou po navratu z platebni brany predany e-shopu
  * @param string $p2 - volitelne parametry, ketre budou po navratu z platebni brany predany e-shopu
  * @param string $p3 - volitelne parametry, ketre budou po navratu z platebni brany predany e-shopu
  * @param string $p4 - volitelne parametry, ketre budou po navratu z platebni brany predany e-shopu
  *
  * @param string $lang - jazyk platebni brany
  *
  * @return string HTML kod platebniho tlacitka
  */
 public static function createPaymentHref($targetGoId, $productName, $totalPrice, $currency, $orderNumber, $successURL, $failedURL, $preAuthorization, $recurrentPayment, $recurrenceDateTo, $recurrenceCycle, $recurrencePeriod, $paymentChannels, $defaultPaymentChannel, $secureKey, $firstName, $lastName, $city, $street, $postalCode, $countryCode, $email, $phoneNumber, $p1, $p2, $p3, $p4, $lang)
 {
     $paymentChannelsString = !empty($paymentChannels) ? join($paymentChannels, ",") : "";
     $encryptedSignature = GopayHelper::encrypt(GopayHelper::hash(GopayHelper::concatPaymentCommand((double) $targetGoId, $productName, (int) $totalPrice, $currency, $orderNumber, $failedURL, $successURL, $preAuthorization, $recurrentPayment, $recurrenceDateTo, $recurrenceCycle, $recurrencePeriod, $paymentChannelsString, $secureKey)), $secureKey);
     $params = "";
     $params .= "paymentCommand.targetGoId=" . $targetGoId;
     $params .= "&paymentCommand.productName=" . urlencode($productName);
     $params .= "&paymentCommand.totalPrice=" . $totalPrice;
     $params .= "&paymentCommand.currency=" . $currency;
     $params .= "&paymentCommand.orderNumber=" . urlencode($orderNumber);
     $params .= "&paymentCommand.successURL=" . urlencode($successURL);
     $params .= "&paymentCommand.failedURL=" . urlencode($failedURL);
     $params .= "&paymentCommand.paymentChannels=" . urlencode($paymentChannelsString);
     $params .= "&paymentCommand.defaultPaymentChannel=" . urlencode($defaultPaymentChannel);
     $params .= "&paymentCommand.encryptedSignature=" . urlencode($encryptedSignature);
     $params .= "&paymentCommand.preAuthorization=" . GopayHelper::castBoolean2String($preAuthorization);
     $params .= "&paymentCommand.recurrentPayment=" . GopayHelper::castBoolean2String($recurrentPayment);
     $params .= "&paymentCommand.recurrenceDateTo=" . urlencode($recurrenceDateTo);
     $params .= "&paymentCommand.recurrenceCycle=" . urlencode($recurrenceCycle);
     $params .= "&paymentCommand.recurrencePeriod=" . $recurrencePeriod;
     $params .= "&paymentCommand.customerData.firstName=" . urlencode($firstName);
     $params .= "&paymentCommand.customerData.lastName=" . urlencode($lastName);
     $params .= "&paymentCommand.customerData.city=" . urlencode($city);
     $params .= "&paymentCommand.customerData.street=" . urlencode($street);
     $params .= "&paymentCommand.customerData.postalCode=" . urlencode($postalCode);
     $params .= "&paymentCommand.customerData.countryCode=" . urlencode($countryCode);
     $params .= "&paymentCommand.customerData.email=" . urlencode($email);
     $params .= "&paymentCommand.customerData.phoneNumber=" . urlencode($phoneNumber);
     $params .= "&paymentCommand.p1=" . urlencode($p1);
     $params .= "&paymentCommand.p2=" . urlencode($p2);
     $params .= "&paymentCommand.p3=" . urlencode($p3);
     $params .= "&paymentCommand.p4=" . urlencode($p4);
     $params .= "&paymentCommand.lang=" . $lang;
     $output = "";
     $output .= "<a target='_blank' href='" . GopayConfig::baseIntegrationURL() . "?" . $params . "'>";
     $output .= " Zaplatit ";
     $output .= "</a>";
     return $output;
 }
 public static function paymentMethodList()
 {
     try {
         //inicializace WS
         ini_set("soap.wsdl_cache_enabled", "0");
         $go_client = new SoapClient(GopayConfig::ws(), array());
         $paymentMethodsWS = $go_client->__call("paymentMethodList", array());
         $paymentMethods = new PaymentMethods();
         $paymentMethods->adapt($paymentMethodsWS);
         return $paymentMethods->paymentMethods;
     } catch (SoapFault $f) {
         dpm($f, 'paymentMethodList - SoapFault');
         /*
          * Chyba v komunikaci s GoPay serverem
          */
         return null;
     }
 }
Beispiel #4
0
 /**
  * Sestaveni platebniho tlacitka jako odkazu
  * 
  *
  * @param float $buyerGoId - identifikace uzivatele - GoId uzivatele pridelene GoPay
  * @param int $totalPrice - cena objednavky v halerich
  * @param string $productName - nazev objednvky / zbozi
  * @param string $variableSymbol - identifikace akt. objednavky
  * @param string $successURL - URL, kam se ma prejit po uspesnem zaplaceni
  * @param string $failedURL - URL, kam se ma prejit po neuspesnem zaplaceni
  * @param string $secret - kryptovaci heslo pridelene uzivateli, urcene k podepisovani komunikace
  * @param string $iconUrl - URL ikony tlacitka - viz konstanty tridy 
  * 
  * @return HTML kod platebniho tlacitka
  */
 public static function createBuyerHref($buyerGoId, $totalPrice, $productName, $variableSymbol, $successURL, $failedURL, $secret, $iconUrl)
 {
     $encryptedSignature = GopayHelper::encrypt(GopayHelper::hash(GopayHelper::concatPaymentCommand((double) $buyerGoId, $productName, (int) $totalPrice, $variableSymbol, $failedURL, $successURL, $secret)), $secret);
     $params = "";
     $params .= "paymentCommand.buyerGoId=" . $buyerGoId;
     $params .= "&paymentCommand.productName=" . urlencode($productName);
     $params .= "&paymentCommand.totalPrice=" . $totalPrice;
     $params .= "&paymentCommand.variableSymbol=" . urlencode($variableSymbol);
     $params .= "&paymentCommand.successURL=" . urlencode($successURL);
     $params .= "&paymentCommand.failedURL=" . urlencode($failedURL);
     $params .= "&paymentCommand.encryptedSignature=" . urlencode($encryptedSignature);
     $formBuffer = "";
     $formBuffer .= "<a target='_blank' href='" . GopayConfig::buyerBaseIntegrationURL() . "?" . $params . "' >";
     if (empty($iconUrl)) {
         $formBuffer .= " Zaplatit ";
     } else {
         $formBuffer .= " <img src='" . $iconUrl . "' border='0' style='border:none;'/> ";
     }
     $formBuffer .= "</a>";
     return $formBuffer;
 }
 /**
  * Nastaveni testovaciho ci provozniho prostredi prostrednictvim parametru
  *
  * @param $new_version
  * TEST - Testovaci prostredi
  * PROD - Provozni prostredi
  *
  */
 public static function init($new_version)
 {
     self::$version = $new_version;
 }
Beispiel #6
0
 /**
  * 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");
     }
 }