-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem z NotifyUrl #12
Comments
Potwierdzam dany bug. U mnie również występuje. |
Jaki jest wynik metody var_dump($result) ? |
Zamówienie realizuję z konta testowego wymienionego w dokumentacji. Dane wejściowe konsumowane przez $result = OpenPayU_Order::consumeNotification($data); string(541) "{"OpenPayU":{"xmlns:ns2":"http://www.openpayu.com/public/20/openpayu","OrderNotifyRequest":{"Order":{"Status":"PENDING","NotifyUrl":"http://USUNALEM.XXX/platnosci/notify","Description":"Przykładowe zamówienie","ExtOrderId":"1000","Products":{"Product":{"Name":"Product1","Quantity":"1","UnitPrice":"100"}},"ValidityTime":"86400","MerchantPosId":"145227","OrderId":"C5DHQ8XGCX140618GUEST000P01","OrderCreateDate":"2014-06-18T08:24:43.578+02:00","TotalAmount":"100","CurrencyCode":"PLN","CustomerIp":"USUNALEM"}}}}" Wartość $result: object(OpenPayU_Result)#96 (9) {
["status":"OpenPayU_Result":private]=>
NULL
["error":"OpenPayU_Result":private]=>
string(0) ""
["success":"OpenPayU_Result":private]=>
int(0)
["request":"OpenPayU_Result":private]=>
string(0) ""
["response":"OpenPayU_Result":private]=>
object(stdClass)#98 (1) {
["OpenPayU"]=>
object(stdClass)#99 (2) {
["xmlns:ns2"]=>
string(42) "http://www.openpayu.com/public/20/openpayu"
["OrderNotifyRequest"]=>
object(stdClass)#100 (1) {
["Order"]=>
object(stdClass)#101 (12) {
["Status"]=>
string(7) "PENDING"
["NotifyUrl"]=>
string(59) "http://USUNALEM.XXX/platnosci/notify"
["Description"]=>
string(24) "Przykładowe zamówienie"
["ExtOrderId"]=>
string(4) "1000"
["Products"]=>
object(stdClass)#102 (1) {
["Product"]=>
object(stdClass)#103 (3) {
["Name"]=>
string(8) "Product1"
["Quantity"]=>
string(1) "1"
["UnitPrice"]=>
string(3) "100"
}
}
["ValidityTime"]=>
string(5) "86400"
["MerchantPosId"]=>
string(6) "145227"
["OrderId"]=>
string(27) "C5DHQ8XGCX140618GUEST000P01"
["OrderCreateDate"]=>
string(29) "2014-06-18T08:24:43.578+02:00"
["TotalAmount"]=>
string(3) "100"
["CurrencyCode"]=>
string(3) "PLN"
["CustomerIp"]=>
string(12) "89.71.244.83"
}
}
}
}
["sessionId":"OpenPayU_Result":private]=>
string(0) ""
["message":"OpenPayU_Result":private]=>
string(0) ""
["countryCode":"OpenPayU_Result":private]=>
string(0) ""
["reqId":"OpenPayU_Result":private]=>
string(0) ""
} Tak jak założyciel tematu próbowałem zmienić wielkość znaków przy $result->getResponse()->order->orderId, ale to nie pomogło. |
Czy używana jest najnowsza wersja biblioteki? |
Oczywiście. Korzystam z najnowszej wersji znajdującej się w repozytorium. Poniżej mój przykładowy kod dla odbierania powiadomienia: require_once Kohana::find_file('vendor', 'payu/openpayu');
OpenPayU_Configuration::setEnvironment('secure');
OpenPayU_Configuration::setMerchantPosId(Kohana::$config->load('payu.pos_id'));
OpenPayU_Configuration::setSignatureKey(Kohana::$config->load('payu.md5_second'));
$body = $this->request->body();
$data = trim($body);
try
{
$result = false;
if (!empty($data))
{
$result = OpenPayU_Order::consumeNotification($data);
}
ob_start();
var_dump($data);
$r1 = ob_get_clean();
ob_start();
var_dump($result);
$r2 = ob_get_clean();
Log::instance()->add(Log::NOTICE, $r1);
Log::instance()->add(Log::NOTICE, $r2);
if ($result and $result->getResponse()->order->orderId)
{
/* Check if OrderId exists in Merchant Service, update Order data by OrderRetrieveRequest */
$order = OpenPayU_Order::retrieve($result->getResponse()->order->orderId);
/* If exists return OrderNotifyResponse */
$rsp = OpenPayU::buildOrderNotifyResponse($result->getResponse()->order->orderId);
if (!empty($rsp))
{
header("Content-Type: application/json");
echo $rsp;
}
}
}
catch (OpenPayU_Exception $e)
{
echo $e->getMessage();
}
} W poprzedniej wiadomości podałem Panu wartości $r1, oraz $r2. |
A czy mógłby Pan pokazać na jaki url kierowane są zamówienia? Najlepiej podać wartość zmienniej $pathUrl z pliku Order.php (w funkcji create) |
Wychodzi na to, że metoda create z pliku OpenPayU/v2/Order.php w ogóle nie jest wykonywana. Dodałem kod: public static function create($order)
{
Log::instance()->add(Log::NOTICE, 'wazne');
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE;
Log::instance()->add(Log::NOTICE, $pathUrl);
$data = OpenPayU_Util::buildJsonFromArray($order);
Log::instance()->add(Log::NOTICE, $data);
if (empty($data)) {
throw new OpenPayU_Exception('Empty message OrderCreateRequest');
}
$result = self::verifyResponse(OpenPayU_Http::post($pathUrl, $data), 'OrderCreateResponse');
return $result;
} W logach natomiast nie pojawia się żadna ze wskazanych adnotacji. |
Wychodzi na to, że problem jest w funkcji: OpenPayU_Order::hostedOrderForm($order); Jeśli przygotuję formularz taką metodą: $response = OpenPayU_Order::create($order);
$this->redirect($response->getResponse()->redirectUri); Powiadomienie nie zwraca takiego błędu. |
Czy mógłby Pan w takim wypadku skorzystać z OpenPayU_Order::create($order)? Ta funkcja korzysta z najnowszej wersji API i działa poprawnie. Przy okazji dziękujemy za potwierdzenie buga w formularzu. |
Oczywiście. Dziękuję za pomoc. |
Problem wydaje się dosyć prosty - tutaj też występują w generowanym formularzu z hostedOrderForm |
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.
The text was updated successfully, but these errors were encountered: