Skip to content

Commit

Permalink
Merge pull request #28 from krzysztof-gzocha/devel
Browse files Browse the repository at this point in the history
Improved compser.json
  • Loading branch information
krzysztof-gzocha committed Jan 24, 2015
2 parents 774c3ed 3aee1d3 commit 9e0776e
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 28 deletions.
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,4 1,16 @@
{
"name": "krzysztof-gzocha/payu",
"type": "library",
"description": "Integration with PayU",
"keywords": ["integration","payu","rest","api","money","transfer"],
"homepage": "https://github.com/krzysztof-gzocha/payu",
"license": "MIT",
"authors": [
{
"name": "Krzysztof Gzocha",
"role": "Developer"
}
],
"config": {
"bin-dir": "bin",
"vendor-dir": "vendor"
Expand All @@ -23,6 35,7 @@
"symfony/validator": "@stable",
"psr/log": "@stable",
"php": ">=5.4.0",
"ext-curl": "*",
"kriswallsmith/buzz": "0.13"
}
}
12 changes: 12 additions & 0 deletions src/Team3/Communication/Notification/NotificationInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@
<?php
/**
* @author Krzysztof Gzocha <[email protected]>
*/

namespace Team3\Communication\Notification;

use Team3\Serializer\SerializableInterface;

interface NotificationInterface extends SerializableInterface
{
}
3 changes: 1 addition & 2 deletions src/Team3/Communication/Notification/OrderNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 7,8 @@

use Team3\Order\Model\OrderInterface;
use JMS\Serializer\Annotation as JMS;
use Team3\Serializer\SerializableInterface;

class OrderNotification implements SerializableInterface
class OrderNotification implements NotificationInterface
{
/**
* @var OrderInterface
Expand Down
54 changes: 54 additions & 0 deletions src/Team3/Communication/Notification/RefundNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 1,54 @@
<?php
/**
* @author Krzysztof Gzocha <[email protected]>
*/

namespace Team3\Communication\Notification;

use Team3\Communication\Response\Model\RefundModelInterface;
use JMS\Serializer\Annotation as JMS;

class RefundNotification implements NotificationInterface
{
/**
* @var string
* @JMS\Type("string")
*/
private $orderId;

/**
* @var string
* @JMS\Type("string")
*/
private $extOrderId;

/**
* @var RefundModelInterface
* @JMS\Type("Team3\Communication\Response\Model\RefundModelInterface")
*/
private $refund;

/**
* @return string
*/
public function getOrderId()
{
return $this->orderId;
}

/**
* @return string
*/
public function getExtOrderId()
{
return $this->extOrderId;
}

/**
* @return RefundModelInterface
*/
public function getRefund()
{
return $this->refund;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,7 @@
use Team3\Serializer\SerializerInterface;
use Team3\SignatureCalculator\Validator\SignatureValidatorInterface;

class OrderNotificationProcess
class NotificationProcess
{
const ORDER_NOTIFICATION_CLASS = 'Team3\Communication\Notification\OrderNotification';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 14,16 @@
use Team3\SignatureCalculator\Validator\AlgorithmExtractor;
use Team3\SignatureCalculator\Validator\SignatureValidator;

class OrderNotificationProcessFactory implements OrderNotificationProcessFactoryInterface
class NotificationProcessFactory implements NotificationProcessFactoryInterface
{
/**
* @param LoggerInterface $logger
*
* @return OrderNotificationProcess
* @return NotificationProcess
*/
public function build(LoggerInterface $logger)
{
return new OrderNotificationProcess(
return new NotificationProcess(
$this->getSerializer($logger),
$this->getSignatureValidator($logger),
new AlgorithmsProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 6,12 @@

use Psr\Log\LoggerInterface;

interface OrderNotificationProcessFactoryInterface
interface NotificationProcessFactoryInterface
{
/**
* @param LoggerInterface $logger
*
* @return OrderNotificationProcess
* @return NotificationProcess
*/
public function build(LoggerInterface $logger);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,6 @@
use Buzz\Message\MessageInterface;
use Team3\Communication\Process\RequestProcessException;
use Team3\Communication\Request\PayURequestInterface;
use Team3\Communication\Response\EmptyResponse;
use Team3\Communication\Response\ResponseInterface;
use Team3\Serializer\SerializerException;
use Team3\Serializer\SerializerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 3,7 @@
* @author Krzysztof Gzocha <[email protected]>
*/

namespace Team3\Communication\Request;
namespace Team3\Communication\Request\Model;

use JMS\Serializer\Annotation as JMS;

Expand Down
4 changes: 2 additions & 2 deletions src/Team3/Communication/Response/OrderCreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@

use Team3\Communication\Request\OrderCreateRequest;
use Team3\Communication\Request\PayURequestInterface;
use Team3\Communication\Request\RequestStatus;
use Team3\Communication\Request\Model\RequestStatus;
use JMS\Serializer\Annotation as JMS;

/**
Expand Down Expand Up @@ -39,7 39,7 @@ class OrderCreateResponse implements ResponseInterface

/**
* @var RequestStatus
* @JMS\Type("Team3\Communication\Request\RequestStatus")
* @JMS\Type("Team3\Communication\Request\Model\RequestStatus")
* @JMS\SerializedName("status")
*/
private $requestStatus;
Expand Down
4 changes: 2 additions & 2 deletions src/Team3/Communication/Response/OrderStatusResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@

use Team3\Communication\Request\OrderStatusRequest;
use Team3\Communication\Request\PayURequestInterface;
use Team3\Communication\Request\RequestStatus;
use Team3\Communication\Request\Model\RequestStatus;
use Team3\Order\Model\OrderInterface;
use JMS\Serializer\Annotation as JMS;

Expand All @@ -22,7 22,7 @@ class OrderStatusResponse implements ResponseInterface

/**
* @var RequestStatus
* @JMS\Type("Team3\Communication\Request\RequestStatus")
* @JMS\Type("Team3\Communication\Request\Model\RequestStatus")
* @JMS\SerializedName("status")
*/
private $requestStatus;
Expand Down
4 changes: 2 additions & 2 deletions src/Team3/Communication/Response/RefundResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@

use Team3\Communication\Request\PayURequestInterface;
use Team3\Communication\Request\RefundRequest;
use Team3\Communication\Request\RequestStatus;
use Team3\Communication\Request\Model\RequestStatus;
use JMS\Serializer\Annotation as JMS;
use Team3\Communication\Response\Model\RefundModelInterface;

Expand All @@ -32,7 32,7 @@ class RefundResponse implements ResponseInterface

/**
* @var RequestStatus
* @JMS\Type("Team3\Communication\Request\RequestStatus")
* @JMS\Type("Team3\Communication\Request\Model\RequestStatus")
*/
private $status;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@

use Psr\Log\LoggerInterface;

class OrderNotificationProcessFactoryTest extends \Codeception\TestCase\Test
class NotificationProcessFactoryTest extends \Codeception\TestCase\Test
{
/**
* @var \UnitTester
Expand All @@ -13,10 13,10 @@ class OrderNotificationProcessFactoryTest extends \Codeception\TestCase\Test

public function testResult()
{
$factory = new OrderNotificationProcessFactory();
$factory = new NotificationProcessFactory();

$this->assertInstanceOf(
'\Team3\Communication\Process\NotificationProcess\OrderNotificationProcess',
'\Team3\Communication\Process\NotificationProcess\NotificationProcess',
$factory->build($this->getLogger())
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,7 @@
use Team3\Serializer\SerializerInterface;
use Team3\SignatureCalculator\Validator\SignatureValidatorInterface;

class OrderNotificationProcessTest extends \Codeception\TestCase\Test
class NotificationProcessTest extends \Codeception\TestCase\Test
{
/**
* @var \UnitTester
Expand All @@ -18,7 18,7 @@ class OrderNotificationProcessTest extends \Codeception\TestCase\Test

public function testCompletedStatus()
{
$factory = new OrderNotificationProcessFactory();
$factory = new NotificationProcessFactory();
$process = $factory->build($this->getMock('\Psr\Log\LoggerInterface'));
$notification = $process->process(new TestCredentials(), $this->getRealNotification());

Expand All @@ -39,7 39,7 @@ public function testCompletedStatus()

public function testPendingStatus()
{
$factory = new OrderNotificationProcessFactory();
$factory = new NotificationProcessFactory();
$process = $factory->build($this->getMock('\Psr\Log\LoggerInterface'));
$notification = $process->process(
new TestCredentials(),
Expand All @@ -63,7 63,7 @@ public function testPendingStatus()

public function testResult()
{
$process = new OrderNotificationProcess(
$process = new NotificationProcess(
$this->getSerializer(),
$this->getSignatureValidator(true)
);
Expand All @@ -81,7 81,7 @@ public function testResult()
*/
public function testValidationError()
{
$process = new OrderNotificationProcess(
$process = new NotificationProcess(
$this->getSerializer(),
$this->getSignatureValidator(false)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
<?php
namespace Team3\Communication\Request;
namespace Team3\Communication\Request\Model;

class RequestStatusTest extends \Codeception\TestCase\Test
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
<?php
namespace Team3\Communication\Response;

use Team3\Communication\Request\RequestStatus;
use Team3\Communication\Request\Model\RequestStatus;

class OrderCreateResponseTest extends \Codeception\TestCase\Test
{
Expand Down Expand Up @@ -37,7 37,7 @@ public function testParameters()
);

$this->assertInstanceOf(
'Team3\Communication\Request\RequestStatus',
'Team3\Communication\Request\Model\RequestStatus',
$response->getRequestStatus()
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
<?php
namespace Team3\Communication\Response;

use Team3\Communication\Request\RequestStatus;
use Team3\Communication\Request\Model\RequestStatus;
use Team3\Order\Model\Order;

/**
Expand Down

0 comments on commit 9e0776e

Please sign in to comment.