Skip to content

Commit 67a4913

Browse files
committed
Add dataApi helper
1 parent e966da3 commit 67a4913

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

src/DI/ThePayExtension.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ public function loadConfiguration()
4444
$config = $this->createConfig();
4545

4646
$classesDefinition = [
47-
'merchantConfig' => 'Tp\MerchantConfig',
47+
'merchantConfig' => 'Tp\MerchantConfig',
48+
'helper.dataApi' => 'Trejjam\ThePay\Helper\DataApi',
4849
];
50+
4951
$factoriesDefinition = [
5052
'paymentFactory' => 'Trejjam\ThePay\IPayment',
5153
'permanentPaymentFactory' => 'Trejjam\ThePay\IPermanentPayment',

src/Helper/DataApi.php

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: jam
5+
* Date: 24.9.15
6+
* Time: 11:08
7+
*/
8+
9+
namespace Trejjam\ThePay\Helper;
10+
11+
use Nette,
12+
App,
13+
Trejjam,
14+
Tp;
15+
16+
class DataApi
17+
{
18+
protected $config;
19+
20+
function __construct(Tp\MerchantConfig $config)
21+
{
22+
$this->config = $config;
23+
}
24+
25+
/**
26+
* @param bool $onlyActive
27+
* @return Tp\DataApi\GetPaymentMethodsResponse
28+
*/
29+
public function getPaymentMethods($onlyActive = TRUE)
30+
{
31+
return Tp\Helper\DataApi::getPaymentMethods($this->config, $onlyActive);
32+
}
33+
34+
/**
35+
* @param string $paymentId
36+
* @return Tp\DataApi\GetPaymentResponse
37+
*/
38+
public function getPayment($paymentId)
39+
{
40+
return Tp\Helper\DataApi::getPayment($this->config, $paymentId);
41+
}
42+
43+
/**
44+
* @param string $paymentId
45+
* @return Tp\DataApi\GetPaymentInstructionsResponse
46+
*/
47+
public function getPaymentInstructions($paymentId)
48+
{
49+
return Tp\Helper\DataApi::getPaymentInstructions($this->config, $paymentId);
50+
}
51+
52+
/**
53+
* @param string $paymentId
54+
* @return Tp\DataApi\GetPaymentStateResponse
55+
*/
56+
public function getPaymentState($paymentId)
57+
{
58+
return Tp\Helper\DataApi::getPaymentState($this->config, $paymentId);
59+
}
60+
}

0 commit comments

Comments
 (0)