1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the PayBreak/basket package. |
4
|
|
|
* |
5
|
|
|
* (c) PayBreak <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace PayBreak\Sdk\Gateways; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class DocumentGateway |
15
|
|
|
* |
16
|
|
|
* @author GK |
17
|
|
|
* @package PayBreak\Sdk\Gateways |
18
|
|
|
*/ |
19
|
|
|
class DocumentGateway extends AbstractGateway |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @author GK |
23
|
|
|
* @param string $token |
24
|
|
|
* @param string $installation |
25
|
|
|
* @param int $application |
26
|
|
|
* @return array |
27
|
|
|
*/ |
28
|
2 |
|
public function getAvailableDocuments($token, $installation, $application) |
29
|
|
|
{ |
30
|
2 |
|
return $this->fetchDocument( |
31
|
2 |
|
'/v4/installations/' . $installation . '/applications/' . $application . '/documents', |
32
|
2 |
|
$token, |
33
|
|
|
'Documents' |
34
|
2 |
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @author GK |
39
|
|
|
* @param string $token |
40
|
|
|
* @param string $installation |
41
|
|
|
* @param int $application |
42
|
|
|
* @return array |
43
|
|
|
*/ |
44
|
2 |
View Code Duplication |
public function getAgreementPdf($token, $installation, $application) |
|
|
|
|
45
|
|
|
{ |
46
|
2 |
|
$document = $this->fetchDocument( |
47
|
2 |
|
'/v4/installations/' . $installation . '/applications/' . $application . '/agreement', |
48
|
2 |
|
$token, |
49
|
|
|
'Agreement Pdf' |
50
|
2 |
|
); |
51
|
|
|
|
52
|
2 |
|
return $document['pdf']; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @author GK |
57
|
|
|
* @param string $token |
58
|
|
|
* @param string $installation |
59
|
|
|
* @param int $application |
60
|
|
|
* @return array |
61
|
|
|
*/ |
62
|
2 |
View Code Duplication |
public function getPreAgreementPdf($token, $installation, $application) |
|
|
|
|
63
|
|
|
{ |
64
|
2 |
|
$document = $this->fetchDocument( |
65
|
2 |
|
'/v4/installations/' . $installation . '/applications/' . $application . '/pre-agreement', |
66
|
2 |
|
$token, |
67
|
|
|
'Pre-agreement Pdf' |
68
|
2 |
|
); |
69
|
|
|
|
70
|
2 |
|
return $document['pdf']; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @author GK |
75
|
|
|
* @param string $token |
76
|
|
|
* @param string $installation |
77
|
|
|
* @param int $application |
78
|
|
|
* @return array |
79
|
|
|
*/ |
80
|
2 |
View Code Duplication |
public function getAdequateExplanation($token, $installation, $application) |
|
|
|
|
81
|
|
|
{ |
82
|
2 |
|
$document = $this->fetchDocument( |
83
|
2 |
|
'/v4/installations/' . $installation . '/applications/' . $application . '/adequate-explanation', |
84
|
2 |
|
$token, |
85
|
|
|
'Adequate Explanation Pdf' |
86
|
2 |
|
); |
87
|
|
|
|
88
|
2 |
|
return $document['pdf']; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.