Skip to content

Commit

Permalink
Add dataApi helper
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam committed Sep 24, 2015
1 parent e966da3 commit 67a4913
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/DI/ThePayExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public function loadConfiguration()
$config = $this->createConfig();

$classesDefinition = [
'merchantConfig' => 'Tp\MerchantConfig',
'merchantConfig' => 'Tp\MerchantConfig',
'helper.dataApi' => 'Trejjam\ThePay\Helper\DataApi',
];

$factoriesDefinition = [
'paymentFactory' => 'Trejjam\ThePay\IPayment',
'permanentPaymentFactory' => 'Trejjam\ThePay\IPermanentPayment',
Expand Down
60 changes: 60 additions & 0 deletions src/Helper/DataApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Created by PhpStorm.
* User: jam
* Date: 24.9.15
* Time: 11:08
*/

namespace Trejjam\ThePay\Helper;

use Nette,
App,
Trejjam,
Tp;

class DataApi
{
protected $config;

function __construct(Tp\MerchantConfig $config)
{
$this->config = $config;
}

/**
* @param bool $onlyActive
* @return Tp\DataApi\GetPaymentMethodsResponse
*/
public function getPaymentMethods($onlyActive = TRUE)
{
return Tp\Helper\DataApi::getPaymentMethods($this->config, $onlyActive);
}

/**
* @param string $paymentId
* @return Tp\DataApi\GetPaymentResponse
*/
public function getPayment($paymentId)
{
return Tp\Helper\DataApi::getPayment($this->config, $paymentId);
}

/**
* @param string $paymentId
* @return Tp\DataApi\GetPaymentInstructionsResponse
*/
public function getPaymentInstructions($paymentId)
{
return Tp\Helper\DataApi::getPaymentInstructions($this->config, $paymentId);
}

/**
* @param string $paymentId
* @return Tp\DataApi\GetPaymentStateResponse
*/
public function getPaymentState($paymentId)
{
return Tp\Helper\DataApi::getPaymentState($this->config, $paymentId);
}
}

0 comments on commit 67a4913

Please sign in to comment.