diff --git a/src/Model/Request/OrderNotifyRequest.php b/src/Model/Request/OrderNotifyRequest.php new file mode 100644 index 0000000..0f4d6a0 --- /dev/null +++ b/src/Model/Request/OrderNotifyRequest.php @@ -0,0 +1,54 @@ +_order; + } + + /** + * @param Order $order + * @return OrderNotifyResponse + */ + public function setOrder($order) + { + if (is_array($order)) { + $order = new Order($order); + } + + $this->_order = $order; + return $this; + } + + /** + * @return array xml DOM map + */ + protected function _getDomMap() + { + $parentMap = parent::_getDomMap()[0]; + + return [ + 'OrderNotifyRequest' => array_merge($parentMap, [ + 'Order' => 'order', + ]), + ]; + } +} \ No newline at end of file diff --git a/src/Model/Response/OrderNotifyResponse.php b/src/Model/Response/OrderNotifyResponse.php new file mode 100644 index 0000000..d568af0 --- /dev/null +++ b/src/Model/Response/OrderNotifyResponse.php @@ -0,0 +1,23 @@ + [] + ]; + } +} diff --git a/src/Service/Client.php b/src/Service/Client.php index 00dd778..2aa8d2b 100644 --- a/src/Service/Client.php +++ b/src/Service/Client.php @@ -239,4 +239,23 @@ public function orderGetRequest($request) return $responseObj->fromXml($response); } + /** + * Parse incoming data from payment notify callback. + + * @return Response\OrderNotifyResponse response + * @throws \Exception + */ + public function notifyParseRequest() { + $postData = file_get_contents("php://input"); + $requestObj = new Request\OrderNotifyRequest(); + return $requestObj->fromXml($postData); + } + + /** + * Send OK response for payment notify callback and exit. + */ + public function notifySendOkAndExit() { + $responseObj = new Response\OrderNotifyResponse(); + die($responseObj->toXML()); + } }