Code Monkey home page Code Monkey logo

openpayu_php's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openpayu_php's Issues

Add missing release tags

Please tag git references with the version tag so packagist and composer know the stable versions

Request Timeout

Hello,
What can be the reason of: OpenPayU_Exception_ServerError: Request timeout?
The day before example script was working fine on my server, now its causing this error.

Problem z funkcjonalnością zwrotów

Próbuję dokonać zwrotu za pomocą OpenPayU w następujący sposób:
$refund = OpenPayU_Refund::create( "5", "zwrot" );

Zamówienie w momencie tworzenia miało przypisane
extOrderId= "5"

Otrzymuję błąd:

PHP Fatal error: Uncaught exception 'OpenPayU_Exception_Network' with message 'DATA_NOT_FOUND - > Could not find user order [orderId=null]'

Wygląda na to, że orderId nie jest w ogóle przekazywane.

Ponadto zauważyłem, że zgodnie z dokumentacją REST API (http://developers.payu.com/pl/restapi.html#refunds) URL do zwrotów powinien kończyć się na /refunds, a w klasie Refund $pathUrl jest budowany w następujący sposób:
$pathUrl = OpenPayU_Configuration::getServiceUrl().'orders/'. $refund['orderId'] . '/refund';
Brakuje "s" na końcu adresu.

Przekroczono maksymalną kwotę zamówienia dla wybranego kanału płatności

Kwota tej testowej płatności to 2000 zł, taki komunikat wyświetla się na górze po przejściu do strony PayU i wybraniu sposobu płatności PayU.

Komunikat taki się wyświetla i nie ma możliwości dokończenia płatności w żaden inny sposób, po manualnym wycofaniu się do strony sklepu nie przychodzą również notyfikacje, że coś poszło nie tak.

Jak reagować na tego typu błąd?

Błędna autentykacja

Witam. Staram się wdrożyć Państwa API w moim aktualnym projekcie. Napotkałem jednak problem.

$response = OpenPayU_Order::create($data);

Metoda zwraca błąd jeśli jako wartości pos_id oraz signature key (drugi klucz md5) podam dane swojego punktu płatności (Express Payment), zamiast wartości podanych w dokumentacji (145227 / 13a980d4f851f3d9a1cfc792fb1f5e50).

Przy podaniu moich danych zostaje zwrócony wyjątek:

OpenPayU_Http::throwHttpStatusException($httpStatus, $result);

argumenty:

integer 401
object OpenPayU_Result(9) {
    private status => string(0) ""
    private error => string(0) ""
    private success => integer 0
    private request => string(0) ""
    private response => string(0) ""
    private sessionId => string(0) ""
    private message => string(0) ""
    private countryCode => string(0) ""
    private reqId => string(0) ""
}

Problem występuje zarówno na moim serwerze testowym jak i localhoscie.

Sandbox Access Forbidden

Kiedy tworzę nowe zamówienie ,po wejściu na przekierowanie otrzymuję kod zwrotny 403 i informację o zabronionym dostępie. Sytuacja jest identyczna zarówno na kluczach publicznych jak i prywatnie stworzonym koncie.
Kod jest bardzo prosty, nie ma zbytnio czego pomylić.

       $order['continueUrl'] = 'localhost/kp/web/app_dev.php';
        $order['notifyUrl'] = 'localhost/kp/web/app_dev.php';
        $order['customerIp'] = $request->getClientIp();
        $order['merchantPosId'] = $this->configuration->getPosId();
        $order['description'] = 'New card order';
        $order['currencyCode'] = 'PLN';
        $order['totalAmount'] = $card->getAmount();
        $order['extOrderId'] = $card->getCode();

        $order['products'][0]['name'] = 'Card';
        $order['products'][0]['unitPrice'] = $card->getAmount();
        $order['products'][0]['quantity'] = 1;


        $order['buyer']['email'] = $card->getBuyerEmail();
        $order['buyer']['phone'] = '123123123';
        $order['buyer']['firstName'] = $card->getBuyer();
        $order['buyer']['lastName'] = $card->getBuyer();

       try {
            $response = OpenPayU_Order::create($order);

            return $response;
        } catch (OpenPayU_Exception $e) {
            throw $e;
        }

Ma ktoś pojęcie co jest nie tak ?

Mam problem z tworzeniem nowego zlecenia

dla danych:

$data= array(
                    "merchantPosId" => $pos_id,
            "notifyUrl" => $this->generateUrl('payu_thanks', array(), true),
            "completeUrl" => $this->generateUrl('payu_notify', array(), true),
            "customerIp" => "127.0.0.1",
            "description" => "Doładowanie XXX",
            "currencyCode" => "PLN",
            "totalAmount" => 1 * 100,
            "extOrderId" => 'ssssssasdas',
            "products" => array(
                'products' => array(
                    array(
                        "name" => 'Doładowanie w serwisie XXX',
                        "unitPrice" => 1 * 100,
                        "quantity" => 1
                    )
                )
            ),
            "buyer" => array(
                "email" => '[email protected]',
                "phone" => '123123123',
                "firstName" => 'sssss',
                "lastName" => 'adasd'
            )
        );

otrzymuję odpowiedź:

object(OpenPayU_Result)[692]
  private 'status' => string 'ERROR_SYNTAX' (length=12)
  private 'error' => string '' (length=0)
  private 'success' => int 0
  private 'request' => string '' (length=0)
  private 'response' => 
    object(stdClass)[699]
      public 'status' => 
        object(stdClass)[559]
          public 'statusCode' => string 'ERROR_SYNTAX' (length=12)
          public 'severity' => string 'ERROR' (length=5)
          public 'statusDesc' => string 'Could not read JSON: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: pl.payu.checkout.filter.PayloadLoggingFilter$ResettableStreamHttpServletRequest$ResettableServletInputStream@6239589d; line: 1, column: 368] (through reference chain: com.openpayu.entity.pub.v2_1.OrderCreateRequest["products"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: pl.payu'... (length=732)
  private 'sessionId' => string '' (length=0)
  private 'message' => string '' (length=0)
  private 'countryCode' => string '' (length=0)
  private 'reqId' => string '' (length=0)

setReqId

W OpenPayu::consumeNotification() brakuje wywołania funkcji $result -> setReqId( $reqId ); dzięki któremu można by je później w łatwy sposób pobierać za pomocą $result -> getReqId();

Problem z OrderNotify.php

Witam,
Dostaje taki wyjątek podczas odebrania odpowiedzi z payu w trybie testowym:
plik: OpenPayU/HttpCurl.php (linia: 69)
Wyjątek: GnuTLS recv error (-9): A TLS packet with unexpected length was received.

Pozdrawiam
Marcin Butlak

PayU Disable

Hello Friends

I am new for PayU Payment method, I successfully integrate this method but whenever i try to checkout it display PAyU method disable.

So how can i enable this method?
Please Help me..

Problem z NotifyUrl

Korzystając z przykładów w ramach OrderNotify otrzymuję błąd:
Trying to get property of non-object in w linii if ($result->getResponse()->order->orderId) {
Próbowałem zmienić order na Order i orderId na OrderId, ale to nie pomogło....

Co jest nie tak? Używałem testowych parametrów - tych zawartych w przykładach.

Brak zakończenia wysyłania do Notify

Mam problem.
Integruję swój system sprzedażowy za pomocą klas z repozytorium i mam problem z ciągłym odpowiadaniem od PayU.
Moja funkcja na notify:

public function notify()
{
    $this->autoRender = false;
    App::import('Lib', 'OpenPayU' . DS . 'OpenPayU_Exception');
    App::import('Lib', 'OpenPayU' . DS . 'OpenPayU_Order');
    $body = file_get_contents('php://input');
    $data = trim($body);
    CakeLog::warning('Data', 'orders');
    CakeLog::warning($data, 'orders');

    try {
        $response = OpenPayU_Order::consumeNotification($data);
        $r1 = $response->getResponse()->order->status; //NEW PENDING CANCELLED REJECTED COMPLETED WAITING_FOR_CONFIRMATION
        CakeLog::warning('Doszedlem', 'orders');
        CakeLog::warning($r1, 'orders');

    } catch (OpenPayU_Exception $e) {
        CakeLog::error($e->getMessage(), 'orders');
    }
    header("HTTP/1.1 200 OK");
}

Dodaję do log-a kolejne odpowiedzi od PayU. I wysyłane są one ciągle.
Wg. dokumentacji header("HTTP/1.1 200 OK") powinno zaprzestać wysyłania odpowiedzi. Plik log-a ciągle jednak rośnie.

Dodam, że działam na danych tesowych.

OpenPayu– Cross-Site Scripting (XSS)

Product: OpenPayu
Download: https://github.com/PayU/openpayu_php
Vunlerable Version: 2.2.3 and probably prior
Tested Version: 2.2.3
Author: ADLab of Venustech

Advisory Details:
A Cross-Site Scripting (XSS) was discovered in “OpenPayu 2.2.3”, which can be exploited to execute arbitrary code.
The vulnerability exists due to insufficient filtration of user-supplied data in the “orderId” HTTP POST parameter passed to the “openpayu_php-master/examples/v2/order/OrderRetrieve.php” URL. An attacker could execute arbitrary HTML and script code in a browser in the context of the vulnerable website.
The exploitation example below uses the "alert()" JavaScript function to see a pop-up messagebox:
Poc:
Post: orderId= " /><script>alert(1);</script><input type="text
To
http://localhost/.../openpayu_php-master/examples/v2/order/OrderRetrieve.php

Nieprawidłowa sygnatura

Korzystam z kredencjałów testowych, próbuje dokonać testowej płatności. Jednak podczas odbierania pinga na "notifyUrl" otrzymuję wyjątek:

[exception.OpenPayU_Exception_Authorization] exception 'OpenPayU_Exception_Authorization' with message 'Invalid signature - 30984387705472f33cd723cce74eba03'  in vendor/openpayu/openpayu/lib/OpenPayU/OpenPayU.php:237

przed chwilą pobrałem paczkę z biblioteką więc mam najnowszą wersję.

NotifyURL - uszkodzony JSON

Witam,

Jeśli klient na stronie PAYU wprowadzi dane do faktury i w nazwie użyje znaku " - JSON przychodzący na notifyUrl jest uszkodzony:

przykład z przed paru dni.

"buyer":{
"customerId":"guest",
"email":"[email protected]",
"phone":"601XXXXXX",
"firstName":"Piotr",
"lastName":"XXXXX",
"language":"pl",
"invoice":{
"recipientName":"PHU"PIOTR" Piotr Jurek","tin":"XXX-XX-XX-XXX","eInvoiceRequested":"FALSE","street":"XXXXXX 35","postalCode":"41-500","city":"Chorzów","countryCode":"PL"
}
},

Na email mogę dostarczyć kompletny JSON uszkodzonej wiadomości plus informację o ID transakcji etc.

Jak widać w recipientName znajdują się nie dozwolone znaki "

Poprawnie powinno być

"recipientName":"PHU\"PIOTR\" Piotr Jurek"

Retrieve order - data not found

I'm trying to retrieve order details using \OpenPayU_Order::retrieve() function.

I'm passing valid orderID (checked in the web panel - it exists) but always getting exception:

OpenPayU_Exception_Network in Http.php line 98:
DATA_NOT_FOUND - Could not find data for given criteria.
in Http.php line 98
at OpenPayU_Http::throwHttpStatusException(404, object(OpenPayU_Result)) in Order.php line 196
at OpenPayU_Order::verifyResponse(array('code' => 404, 'response' => '{"status":{"statusCode":"DATA_NOT_FOUND","severity":"INFO","statusDesc":"Could not find data for given criteria."}}'), 'OrderRetrieveResponse') in Order.php line 83
at OpenPayU_Order::retrieve('103_5950d83b95c03') in web.php line 117

How can I get the order details properly using orderId?

Hardcoded SenderName and Algorithm

I found that inside method OpenPayUBase::buildOpenPayUDocument() there are two hardcoded variables: SenderName and Algorithm - currently I have issues with PayU sending me multiple status notifications so I'm unsure if this is simply not important for building valid OrderNotifyResponse?

Also on side note - namespace url (http://www.openpayu.com/openpayu.xsd) is invalid.

Chnage Currency and site url

Hello,
I want to change the currency code to USD and it will redirect to payu with english language. How can I achieve this?

Using self closes the possibility of class extension.

By having all methods static, and using self, the possibility of extending functionality / replacing small parts disappears.

eg.

If I want to replace the following verifyResponse method to act differently, I can't, as the call will always be called on the self context (in the class used).

$result = self::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'RefundCreateResponse');

The self keyword can be replaces with the static keyword, which will use the static context of the object.

$result = static::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'RefundCreateResponse');

In this way, I can create a new class MyRefund which extends the refund functionality, but on verify response does something else.

niedocierające powiadomienia

Witam,
zgodnie z dokumentacją i samplami w repozytorium przesyłam zamówienie metodą OpenPayU_Order::create ,używam do tego testowych danych autoryzacyjnych podanych w dokumentacji. Struktura przed wywołaniem OpenPayU_Order::create wygląda następująco:

Array
(
    [notifyUrl] => https://t01.pl/payu-test
    [continueUrl] => http://127.0.0.1/tense/bodychief.pl/index.php/user_panel/history
    [customerIp] => 83.24.94.200
    [merchantPosId] => 145227
    [description] => Zamówienie
    [currencyCode] => PLN
    [products] => Array
        (
            [0] => Array
                (
                    [name] => STANDARD 500 KCAL
                    [unitPrice] => 510
                    [quantity] => 1
                )

        )

    [totalAmount] => 510
    [buyer] => Array
        (
            [email] => slawek+abc@******.pl
            [phone] => +48227777777
            [firstName] => imie
            [lastName] => nazwisko
        )

)

cały proces, łącznie z wysłaniem przez payu statusu zamówienia na email przebiega prawidłowo lecz adres notifyUrl nigdy nie zostaje wywołany

pod adresem podanym w notifyUrl mam następujący ( działający i sprawdzony zarówno dla GET jak i POST ) skrypt:

<?php
$fn = "./f/".time().".txt";
file_put_contents( $fn, file_get_contents("php://input"));
?>

w czym problem?

Prośba o uściślenie wielkości liter...

W Creating "Hosted Order" wszystkie zmienne w tabelkach zaczynają się z dużej litery.
W Creating "Transparent Order" ( BETA version ) wszystkie zmienne w tabelkach zaczynają się znowuż z małych liter.

Tak samo na stronie http://developers.payu.com/pl/restapi.html, requesty tworzone przez formularz mają zmiennne z dużych liter a te ,,programistycznie'' z małych.

Dałoby się to jakoś usystematyzować? (Z dużych liter są także wypisane paremetry w dziale 7.3).

Dokumentacja - odbieranie powiadomień

Witam serdecznie. Mam prośbę o uszczegółowienie dokumentacji, jako że kilka zagadnień mogło by być przedstawione w precyzyjniejszy / obszerniejszy sposób:

  1. Na jakim etapie zamówienie może być odrzucone przez sprzedawcę? Czy wykorzystanie do tego systemu powiadomień jest dobrym pomysłem? Czy mogę to zrobić wyłącznie dopóki status zamówienia ma wartość "pending"? Jak w takiej sytuacji powinna wyglądać odpowiedź dla usługi? Bieżący kod:
        try 
        {
            if (!empty($data)) 
            {
                $result = OpenPayU_Order::consumeNotification($data);
            }

            if ($result->getResponse()->order->orderId) 
            {
                /* Check if OrderId exists in Merchant Service, update Order data by OrderRetrieveRequest */
                $order = OpenPayU_Order::retrieve($result->getResponse()->order->orderId);
                $status_desc = OpenPayU_Util::statusDesc($order->getStatus());

                /* If exists return OrderNotifyResponse */
                $rsp = OpenPayU::buildOrderNotifyResponse($result->getResponse()->order->orderId);

                if (!empty($rsp)) 
                {
                    $this->response->headers('Content-type','application/json; charset='.Kohana::$charset);
                    $this->response->body($rsp);
                }
            }
        } 
        catch (OpenPayU_Exception $e) 
        {
            echo $e->getMessage();
        }
  1. Czy po przekierowaniu na podstronę "completeUrl" mogę pobrać szczegóły dotyczące przetwarzanego zamówienia? Niestety w POST, ani GET nie znalazłem żadnych danych mi to umożliwiających. W przykładach również tego brakuje.

Packagist repo

Hi,

I've created a packagist package some time ago - it reads directly from this repo.
Package url: https://packagist.org/packages/openpayu/openpayu

The problem is I need to update it manually. It would me great to add a package maintainer who is also responsible for this repository so he could add a service hook.

Please let me know if you are interested, and always up to date package would be great.

Order::consumeNotification

Odbieranie statusów - notyfikacji nie działa w tej wersji API, ponieważ odpowiedzi dla płatności TESTOWYCH (nie wiem czy dla prawdziwych też nie działa) zwracane są z podpisem z algorytmem MD5, który został już wykluczony w API 2.1, więc metoda OpenPayU_Order::consumeNotification($data) zawsze zwróci błąd o nieprawidłowym podpisie.

Problem z OrderNotify.php

Witam. Od kilku dni PayU nie wysyła powiadomień na OrderNotify.php. Ponieważ jestem w trakcie prac nad serwisem wrzuciłem całą nową paczkę openpayu_php na serwer w osobnej domenie.
Wyedytowałem plik examples/v2/order/OrderNotify.php i po
require_once realpath(dirname(FILE)) . '/../../../lib/openpayu.php';
require_once realpath(dirname(FILE)) . '/../../config.php';
dodałem:
$fpa = fopen(date("Ymd-His")."-".rand(100, 999).".test", "w");
fwrite($fpa, date("Y-m-d H:i:s") . "\xA");
fwrite($fpa, $_SERVER['REMOTE_ADDR']. "\xA");
fclose($fpa);

Gdy wywołam plik z przeglądarki skrypt tworzy plik (ex. 20150119-175252-414.test), natomiast jak użyję OrderForm.php lub OrderCreate.php plik nie jest tworzony - wygląda jakby PayU nie wysyłało powiadomieć o zmianie statusu stransakcji.
OrderForm.php zmodyfikowałem następująco:
$order['notifyUrl'] = 'http://domena.pl'.dirname($_SERVER['REQUEST_URI']).'/OrderNotify.php';
$order['continueUrl'] = 'http://domena.pl'.dirname($_SERVER['REQUEST_URI']).'/../../layout/success.php';

Płatność przechodzi jak należy, po "opłaceniu" transakcji PayU przekierowuje na success.php.
Czy robię coś źle, czy jest jakiś błąd po stronie PayU?

Piotr Małek

Api 2.1 a unikalność extOrderId

Witam,

Nowa werjsa bibloteki wprowadza unikalność parametru extOrderId względem POS. Moje pytanie brzmi jak pozwolić użytkownikowi zapłacić "ponownie" za zamówienie jeśli np płatnośc zostanie anulowana lub wystąpi jakiś błąd.

Do tej pory działaliśmy tak że w extOrderId przekazywaliśmy id zamówienia z naszego sklepu. Jeśli status płatności był np Anulowany pozwalaliśmy klientowi "zapłać ponownie". W nowym API jest to nie możliwe bo próba utworzenia nowej płatności z tym samym extOrderId kończy się błędem.

ERROR: OpenPayU_Result::__set_state(array( 'status' => 'ERROR_ORDER_NOT_UNIQUE', 'error' => '', 'success' => 0, 'request' => '', 'response' => stdClass::__set_state(array( 'orderId' => '7H1B6KQMBX140828GUEST000P01', 'extOrderId' => '11964', 'status' => stdClass::__set_state(array( 'statusCode' => 'ERROR_ORDER_NOT_UNIQUE', 'code' => '110', 'codeLiteral' => 'ORDER_NOT_UNIQUE', 'statusDesc' => 'Order with given extOrderId already exists', )), )), 'sessionId' => '', 'message' => '', 'countryCode' => '', 'reqId' => '', ))

Jak w takim przypadku pozwolić userowi zapłacić ponownie za to samo zamówienie lub dopłacić do zamówienia - w oby przypadkach pole extOrderId będzie takie same .. czyli będzie zawierać id zamówienia którego dotyczy płatność

PayU first send a new status to merchant site and then saves it by himself

When I get a notification I use the "Retrieve" method instead of "consumeNotification".
I noticed that PayU first send a new status to merchant site and then saves it by himself.
In request, the order status is COMPLETED but the "Retrieve" method still returns the previous status.
PayU expects HTTP status 200 and stops sending notifications.
As a result the payment is done but in my application the status is still "Pending".

Please update packagist

I would like to use the retrieve payment methods call and the 2.2.1 version still has not reached packagist, could you update it or even better create a hook from github to update packagist automatically every time a tag is created?

Thanks in advance!

Problem przy uzupełnianiu danych wysyłki

Witam, przy próbie uzupełnienia danych do wysyłki dostaję "Dostęp do strony zabroniony".

Formularz wygenerowany z hostedOrderForm, bez danych wysyłki działa dobrze. Czy ja czegoś nie widzę, czy jest gdzieś błąd? W formularzu na stronie jest miejsce np. na numer domu / numer mieszkania, a w API tylko ulica.

<form method="POST" action="https://secure.payu.com/api/v2_1/orders" id="payu-payment-form" class="">
<input type="hidden" name="notifyUrl" value="//sklep.pl/orders/notify" />
<input type="hidden" name="continueUrl" value="//sklep.pl/orders/ok" />
<input type="hidden" name="customerIp" value="123.123.123.123" />
<input type="hidden" name="merchantPosId" value="145227" />
<input type="hidden" name="description" value="Zamówienie na sklep.pl" />
<input type="hidden" name="currencyCode" value="PLN" />
<input type="hidden" name="totalAmount" value="200" />
<input type="hidden" name="extOrderId" value="c35c249bf2adf742ea00585fa982d53b" />
<input type="hidden" name="products[0].name" value="Guma turbo" />
<input type="hidden" name="products[0].unitPrice" value="200" />
<input type="hidden" name="products[0].quantity" value="1" />
<input type="hidden" name="buyer.email" value="[email protected]" />
<input type="hidden" name="buyer.firstName" value="Imię" />
<input type="hidden" name="buyer.lastName" value="Nazwisko" />
<input type="hidden" name="buyer.phone" value="725115841" />
<!-- Część generująca błąd -->
<input type="hidden" name="buyer.delivery.recipientName" value="Imię Nazwisko" />
<input type="hidden" name="buyer.delivery.recipientEmail" value="[email protected]" />
<input type="hidden" name="buyer.delivery.recipientPhone" value="725115841" />
<input type="hidden" name="buyer.delivery.street" value="ul. Ulica 34/8" />
<input type="hidden" name="buyer.delivery.postalBox" value="Miasto" />
<input type="hidden" name="buyer.delivery.postalCode" value="35-005" />
<input type="hidden" name="buyer.delivery.city" value="Miasto" />
<input type="hidden" name="buyer.delivery.state" value="Województwo" />
<input type="hidden" name="buyer.delivery.countryCode" value="PL" />
<!-- Koniec -->
<input type="hidden" name="shippingMethods[0].country" value="PL" />
<input type="hidden" name="shippingMethods[0].name" value="Odbiór osobisty" />
<input type="hidden" name="shippingMethods[0].price" value="0" />
<input type="hidden" name="OpenPayu-Signature" value="sender=145227;signature=6d52667f4bbb5ddd0c6ac273ea1241962af0022b;algorithm=SHA-1;content=DOCUMENT" /><button type="submit" formtarget="_blank" id="" class=""></button></form>

OpenPayU_Order::retrieve - Passing Url Instead of orderId

Found an issue whereby the OpenPayU_Order::retrieve method is busted. if you look on line 75 you see this call

$result = self::verifyResponse(OpenPayU_Http::get($pathUrl, $pathUrl), 'OrderRetrieveResponse');

There $pathUrl is passed twice the second parameter should be $orderId I think , i will test this and update but if I don't get time this has been logged. It took me quite a while to find this bug.

401 error not being handled properly

Hi, when in \OpenPayU_Order::create($order) I get 401 error, then instead of Exception, I get:
Notice: Trying to get property of non-object in /www/vendor/openpayu/openpayu/lib/OpenPayU/Http.php line 107

When an exception is thrown, the original message gets lost.

When a request towards PayU is made, if invalid, a proper http response message will be returned from payu specifying why the message failed.

The way the response if verified is by throwing an exception if an invalid http status is received.

OpenPayU_Http::throwHttpStatusException($httpStatus, $result);

If the issue was with the request data an OpenPayu_Exception will be thrown:

throw new OpenPayU_Exception($message->getStatus().' - '.$statusDesc, $statusCode);

But the OpenPayuException doesn't receive further the response message which may contain usefull data, therefore losing that data for the final user.

My proposal is that of a new type of exception:

class OpenPayU_Exception_Request extends OpenPayU_Exception
{
    private $response;

    public function __construct($response, $message = "", $code = 0, Throwable $previous = null)
   {
        $this->response = $response;
        parent::_construct($message, $code, $previous);
    }

    public function getResponse()
    {
          return $this->response;
    }
}

And when building the exception:

case 400:
    throw new OpenPayU_Exception_Request($message, $message->getStatus().' - '.$statusDesc, $statusCode);
    break;

This will also ensure backwards compatibility as the core of: OpenPayu_Exception($message->getStatus().' - '.$statusDesc, $statusCode) is stil built by the parent::__construct call

Mapping config.php with values from Admin Panel

I'm trying to understand how Admin panel values are mapped with config.php as try with different combination and results are different errors like
Error code: 0
Error message: Oauth error: [code=401], [message=invalid_client - Can't find oauthClient with clientId

OpenPayU_Configuration::setMerchantPosId('xxx'); -> POS ID (pos_id) from admin panel
OpenPayU_Configuration::setSignatureKey('xxx'); -> Second key (MD5) from Admin panel

OpenPayU_Configuration::setOauthClientId('xxx'); -> POS ID (pos_id) from admin panel
OpenPayU_Configuration::setOauthClientSecret('xxx');  -> Key (MD5) from admin panel

Can some can explain to me which parameter from admin panel should be mapped with parameters in config.php

When changing currency to COP I get ERROR_INCONSISTENT_CURRENCIES

Hi Dudes

Thanks for this awesome library. I've got a problem when changing this line
from:
$order['currencyCode'] = 'PLN';
to:
$order['currencyCode'] = 'COP';

I get the following error: ERROR_INCONSISTENT_CURRENCIES
What might be wrong ? I just want to change the currency code to COP (Code for Colombia) And BTW, can I also change the country to CO (Colombia)

Thanks a lot for your help
best regards

Different currencies.

Hi
I found bug (i think) in this library.
I can't set other currency than PLN.
When I set USD or AUD or USD i get :

Notice: Undefined property: stdClass::$redirectUri in my/script/path on line 45
class Payment {

    private $order

    public function __construct(ProductInterface $product, $orderHash)
    {
        OpenPayU_Configuration::setEnvironment('secure');
        OpenPayU_Configuration::setMerchantPosId('145227'); // POS ID (Checkout)
        OpenPayU_Configuration::setSignatureKey('13a980d4f851f3d9a1cfc792fb1f5e50'); //Second MD5 key. You will find it in admin panel.

        $this->order['continueUrl'] = 'http://'.$_SERVER['HTTP_HOST'].'/ticket.php?data='.$orderHash.'';
        $this->order['notifyUrl'] = '';
        $this->order['customerIp'] = $_SERVER['REMOTE_ADDR'];
        $this->order['merchantPosId'] = OpenPayU_Configuration::getMerchantPosId();
        $this->order['description'] = 'Zamowienie';
        $this->order['currencyCode'] = 'EUR';
        $this->order['totalAmount'] = 100;
        $this->order['extOrderId'] = rand(1, 100000000000);

        $this->order['products'][0]['name'] = 'title';
        $this->order['products'][0]['unitPrice'] = 100;
        $this->order['products'][0]['quantity'] = 1;

    }

    public function makePayment()
    {
        $response = OpenPayU_Order::create($this->order);

        header('Location:'.$response->getResponse()->redirectUri); //You must redirect your client to PayU payment summary page.
    }

} 

Is it bug (or feature:)) ? Can I set other currency in testing payu service?

Błąd autoryzacji

Witam, jako, że nie mogłem odpisać w poprzednim temacie tyczącym tego samego błędu, jestem zmuszony do napisania kolejnego.
Korzystam z najnowszej wersji SDK, mój MerchantPosId: 164771 .
Podczas uzytkowania Examples --> CreateOrder.php , wszystko działa jak należy, tworzona jest nowa płatność. Kiedy jednak zmieniam PosId na swoje, SignatureKey na podany w PayU, nowa płatność nie powstaje. Wyrzuca mi błąd:

string(550) "exception 'OpenPayU_Exception_Authorization' with message ' - ' in /vol/www/whitemobileteles/platnosci_test/lib/OpenPayU/Http.php:97
Stack trace:
#0 /vol/www/whitemobileteles/platnosci_test/lib/OpenPayU/v2/Order.php(178): OpenPayU_Http::throwHttpStatusException(401, Object(OpenPayU_Result))
#1 /vol/www/whitemobileteles/platnosci_test/lib/OpenPayU/v2/Order.php(50): OpenPayU_Order::verifyResponse(Array, 'OrderCreateResp...')
#2 /vol/www/**************/platnosci_test/platnosci/v2/order/OrderCreate.php(68): OpenPayU_Order::create(Array)
#3 {main}"

oraz:

Fatal error: Call to a member function getStatus() on a non-object in /vol/www/*************/platnosci_test/platnosci/v2/order/OrderCreate.php on line 99
```php

Proszę o pomoc.

OpenPayU_HttpCurl has hardcoded TLSv1 cipher which fails with NSS module: 'Unknown cipher in list: TLSv1'

The problem:

OpenPayU_HttpCurl has hard coded cipher list TLSv1 which causes curl to fail when you use PHP with NSS library instead of OpenSSL. We experienced this on multiple servers.

OpenPayU_HttpCurl line 65 is:
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');

This results with exception 'OpenPayU_Exception_Network' with message 'Unknown cipher in list: TLSv1'

Reason:

According to the curl libs documentation there is difference in ciphers list depending on whether you use OpenSSL or NSS module:
http://curl.haxx.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html

For OpenSSL and GnuTLS valid examples of cipher lists include 'RC4-SHA', ´SHA1+DES´, 'TLSv1' and 'DEFAULT'.

Source: http://www.openssl.org/docs/apps/ciphers.html

'For NSS, valid examples of cipher lists include 'rsa_rc4_128_md5', ´rsa_aes_128_sha´, etc.

Source: http://curl.haxx.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html

Solution:

With NSS module use proper cipher symbol, for example:
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'rsa_aes_256_sha');

Library modifications:

  1. Modify OpenPayU_Configuration so that it passes override params to the OpenPayU_HttpCurl
    OR
  2. Use dependency injection to change defaults in OpenPayU_HttpCurl

continueUrl ignorowane dla konta testowego

Dla konta testowego (podanego w konfiguracji domyślnej) parametr continueUrl dla OpenPayU_Order::create() jest ignorowany. Cokolwiek się robi, nie wracam na stronę w nim podaną przez co nawet nie można zobaczyć jak to wygląda wykonane przez server payu.

Rest Api returning 401 with non test account details

When using the Rest API version of the SDK i keep getting HTTP 401 unauthorised response back from PayU.

However when using the same non-test details with the payment form example it all works OK.

I have looked and the only thing i can think of the SDK is not doing is based on 7.2 in the Rest Documentation where it says the header must be base64 encoded before being sent. But i am not totally sure this is issue as I have tried this and had no joy.

Nieprawidłowy "flow" callbacków

W funkcji odbierającej callback ze statusem zlecenia zapłaty loguję komunikację, i zobaczyłem, że mam tam coś takiego:

2014/07/12 12:19:29 [info] [php] 2014-07-12 12:19:29.275228: PENDING
2014/07/12 12:19:55 [info] [php] 2014-07-12 12:19:55.762808: PENDING
2014/07/12 12:19:55 [info] [php] 2014-07-12 12:19:55.922902: COMPLETED
2014/07/12 12:19:56 [info] [php] 2014-07-12 12:19:56.175926: PENDING

Wszystko to dla jednego zlecenia. Czasami zdarza się, że zatrzymuje się na COMPLETED i potem już nic nie przysyła. Jednak najczęściej jest właśnie taki "flow". Czy jest to prawidłowe działanie? wynika z tego, że po zatwierdzeniu płatności zmienia ona znowu status na PENDING?

throwHttpStatusException - błędnie "przekazywany" komunikat błędu

W sytuacji kiedy niepoprawnie się autoryzujemy (przekazany pusty PosId) serwer PayU zwraca kod HTTP 403 z komunikatem "Permission denied for given action".
W takiej sytuacji metoda verifyResponse generuje wyjątek używając do jego konstrukcji metody OpenPayU_Http::throwHttpStatusException przekazując jej nastepujące argumenty: kod odpowiedzi (w tym wypadku 403) i obiekt typu OpenPayU_Result.
Problem polega na tym że OpenPayU_Http::throwHttpStatusException nie "dobiera się" poprawnie do danych zawartych w przekazanym obiekcie OpenPayU_Result.
Chcąc "wyłuskać" komunikat błędu, odwołuje się do:
$message->Status->StatusCode
$message->Status->StatusDesc
W efekcie czego generowany jest wyjątek z "pustym" komunikatem.
Czy prawidłowy dostęp do żądanych pól nie powinien być realizowany przy pomocy (?):
$message->getResponse()->status->statusCode
$message->getResponse()->status->statusDesc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.