1 <?php
2 3 4
5 namespace Team3\PayU\Configuration;
6
7 use Team3\PayU\Configuration\Credentials\CredentialsInterface;
8
9 10 11 12
13 class Configuration implements ConfigurationInterface
14 {
15 16 17
18 protected $protocol;
19
20 21 22
23 protected $domain;
24
25 26 27
28 protected $path;
29
30 31 32
33 protected $version;
34
35 36 37
38 protected $credentials;
39
40 41 42 43 44 45 46
47 public function __construct(
48 CredentialsInterface $credentials,
49 $protocol = 'https',
50 $domain = 'secure.payu.com',
51 $path = 'api',
52 $version = 'v2_1'
53 ) {
54 $this->credentials = $credentials;
55 $this->protocol = $protocol;
56 $this->domain = $domain;
57 $this->path = $path;
58 $this->version = $version;
59 }
60
61 62 63
64 public function getAPIUrl()
65 {
66 return sprintf(
67 '%s://%s/%s/%s',
68 $this->getProtocol(),
69 $this->getDomain(),
70 $this->getPath(),
71 $this->getVersion()
72 );
73 }
74
75 76 77
78 public function getDomain()
79 {
80 return $this->domain;
81 }
82
83 84 85
86 public function getPath()
87 {
88 return $this->path;
89 }
90
91 92 93
94 public function getProtocol()
95 {
96 return $this->protocol;
97 }
98
99 100 101
102 public function getVersion()
103 {
104 return $this->version;
105 }
106
107 108 109
110 public function getCredentials()
111 {
112 return $this->credentials;
113 }
114 }
115