Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Novalnet-Technic committed Nov 11, 2021
0 parents commit bfddaaf
Show file tree
Hide file tree
Showing 210 changed files with 13,351 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Client/Gateway.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Novalnet\Bundle\NovalnetBundle\Client;

use Guzzle\Http\ClientInterface;

/**
* Handle Novalnet payport API request and response
*/
class Gateway implements GatewayInterface
{
/** @var ClientInterface */
protected $httpClient;

/**
* @param ClientInterface $httpClient
*/
public function __construct(ClientInterface $httpClient)
{
$this->httpClient = $httpClient;
}

/** {@inheritdoc} */
public function send($hostAddress = '', $config = '', array $parameters = [])
{
$hostAddress = !empty($hostAddress) ? $hostAddress : 'https://paygate.novalnet.de/paygate.jsp';

$response = $this->httpClient
->post($hostAddress, [], $parameters, $this->getRequestOptions($config))
->send();

return $response->getBody(true);
}

/**
* @param object $config
* @return array
*/
protected function getRequestOptions($config)
{
$requestOptions = [
'timeout' => (!empty($config) && $config->getGatewayTimeout()) ? $config->getGatewayTimeout() : '240',
];

return $requestOptions;
}
}
16 changes: 16 additions & 0 deletions Client/GatewayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Novalnet\Bundle\NovalnetBundle\Client;

/**
* Interface for Handle Novalnet payport API request and response
*/
interface GatewayInterface
{
/**
* @param string $hostAddress
* @param object $config
* @param array $parameters
*/
public function send($hostAddress, $config, array $parameters = []);
}
37 changes: 37 additions & 0 deletions DependencyInjection/NovalnetExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Novalnet\Bundle\NovalnetBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Class NovalnetExtension
* @package Novalnet\Bundle\NovalnetBundle\DependencyInjection
*/
class NovalnetExtension extends Extension
{
const ALIAS = 'novalnet';

/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$loader->load('method.yml');
$loader->load('callbacks.yml');
$loader->load('form_types.yml');
}

/**
* {@inheritDoc}
*/
public function getAlias()
{
return self::ALIAS;
}
}
154 changes: 154 additions & 0 deletions Entity/NovalnetCallbackHistory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?php

namespace Novalnet\Bundle\NovalnetBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Novalnet callback script history Entity
* @ORM\Table(name="nn_callback_history")
* @ORM\Entity
*/
class NovalnetCallbackHistory
{
/**
* @var int
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;

/**
* @var int
* @ORM\Column(name="date", type="datetime", nullable=true)
*/
protected $date;

/**
* @var string
* @ORM\Column(name="callback_amount", type="integer", length=11, nullable=true)
*/
protected $callbackAmount;

/**
* @var string
* @ORM\Column(name="order_no", type="string", length=30, nullable=true)
*/
protected $orderNo;

/**
* @var int
* @ORM\Column(name="org_tid", type="bigint", length=20, nullable=true)
*/
protected $orgTid;

/**
* @var int
* @ORM\Column(name="callback_tid", type="bigint", length=20, nullable=true)
*/
protected $callbackTid;

/**
* @return int
*/
public function getId()
{
return $this->id;
}

/**
* @return int
*/
public function getCallbackAmount()
{
return $this->callbackAmount;
}

/**
* @param int $callbackAmount
* @return NovalnetCallbackHistory
*/
public function setCallbackAmount($callbackAmount)
{
$this->callbackAmount = (int)$callbackAmount;

return $this;
}

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

/**
* @param string $orderNo
* @return NovalnetCallbackHistory
*/
public function setOrderNo($orderNo)
{
$this->orderNo = $orderNo;

return $this;
}

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

/**
* @param string $orgTid
* @return NovalnetCallbackHistory
*/
public function setOrgTid($orgTid)
{
$this->orgTid = $orgTid;

return $this;
}

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

/**
* @param string $callbackTid
* @return NovalnetCallbackHistory
*/
public function setCallbackTid($callbackTid)
{
$this->callbackTid = $callbackTid;

return $this;
}

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

/**
* @param \DateTime $date
* @return NovalnetCallbackHistory
*/
public function setDate(\DateTime $date)
{
$this->date = $date;

return $this;
}
}
Loading

0 comments on commit bfddaaf

Please sign in to comment.