|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Omnipay\Myfatoorah\Message; |
|
4
|
|
|
|
|
5
|
|
|
use Guzzle\Http\Exception\ClientErrorResponseException; |
|
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest { |
|
8
|
|
|
|
|
9
|
|
|
protected $sandboxEndpoint = "https://apitest.myfatoorah.com"; |
|
10
|
|
|
protected $productionEndpoint = "https://api.myfatoorah.com"; |
|
11
|
|
|
|
|
12
|
|
|
public function getApiKey() { |
|
13
|
|
|
return $this->getParameter('apiKey'); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function setApiKey($value) { |
|
17
|
|
|
return $this->setParameter('apiKey', $value); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Get the gateway Test mode |
|
22
|
|
|
* |
|
23
|
|
|
* @return string |
|
24
|
|
|
*/ |
|
25
|
|
|
public function getTestMode() { |
|
26
|
|
|
return $this->getParameter('testMode'); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Set the gateway Test mode |
|
31
|
|
|
* |
|
32
|
|
|
* @param string $value |
|
33
|
|
|
* @return Gateway provides a fluent interface. |
|
|
|
|
|
|
34
|
|
|
*/ |
|
35
|
|
|
public function setTestMode($value) { |
|
36
|
|
|
return $this->setParameter('testMode', $value); |
|
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function getAmount() { |
|
40
|
|
|
return $this->getParameter('Amount'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function setAmount($value) { |
|
44
|
|
|
return $this->setParameter('Amount', $value); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function getCurrency() { |
|
48
|
|
|
return $this->getParameter('Currency'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function setCurrency($value) { |
|
52
|
|
|
return $this->setParameter('Currency', $value); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getCard() { |
|
56
|
|
|
return $this->getParameter('Card'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setCard($value) { |
|
60
|
|
|
return $this->setParameter('Card', $value); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getFirstName() { |
|
64
|
|
|
$card = $this->getCard(); |
|
65
|
|
|
return $card['firstName']; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setFirstName($value) { |
|
69
|
|
|
$card = $this->getCard(); |
|
70
|
|
|
return $card['firstName'] = $value; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getLastName() { |
|
74
|
|
|
$card = $this->getCard(); |
|
75
|
|
|
return $card['lastName']; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function setLastName($value) { |
|
79
|
|
|
$card = $this->getCard(); |
|
80
|
|
|
return $card['lastName'] = $value; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getEmail() { |
|
84
|
|
|
$card = $this->getCard(); |
|
85
|
|
|
return $card['email']; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function setEmail($value) { |
|
89
|
|
|
$card = $this->getCard(); |
|
90
|
|
|
return $card['email'] = $value; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getPhone() { |
|
94
|
|
|
$card = $this->getCard(); |
|
95
|
|
|
return $card['phone']; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function setPhone($value) { |
|
99
|
|
|
$card = $this->getCard(); |
|
100
|
|
|
return $card['phone'] = $value; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getCallBackUrl() { |
|
104
|
|
|
return $this->getParameter('returnUrl'); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function setCallBackUrl($value) { |
|
108
|
|
|
return $this->getParameter('returnUrl', $value); |
|
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
public function getOrderRef() { |
|
112
|
|
|
return $this->getParameter('OrderRef'); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function setOrderRef($value) { |
|
116
|
|
|
return $this->setParameter('OrderRef', $value); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function getHeaders() { |
|
120
|
|
|
$headers = []; |
|
121
|
|
|
|
|
122
|
|
|
return $headers; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function send() { |
|
126
|
|
|
$data = $this->getData(); |
|
127
|
|
|
$headers = array_merge( |
|
128
|
|
|
$this->getHeaders(), |
|
129
|
|
|
['Authorization' => 'Bearer ' . $this->getApiKey(), 'Content-Type' => ' application/json'] |
|
130
|
|
|
); |
|
131
|
|
|
|
|
132
|
|
|
return $this->sendData($data, $headers); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function sendData($data, array $headers = null) { |
|
136
|
|
|
if (sizeof($data) == 0) { |
|
137
|
|
|
$postFields = null; |
|
138
|
|
|
} else { |
|
139
|
|
|
$postFields = json_encode($data); |
|
140
|
|
|
} |
|
141
|
|
|
try { |
|
142
|
|
|
$httpResponse = $this->httpClient->request( |
|
143
|
|
|
$this->getHttpMethod(), |
|
144
|
|
|
$this->getEndpoint(), |
|
145
|
|
|
$headers, |
|
|
|
|
|
|
146
|
|
|
$postFields |
|
147
|
|
|
); |
|
148
|
|
|
} catch (ClientErrorResponseException $e) { |
|
149
|
|
|
$httpResponse = $e->getResponse(); |
|
150
|
|
|
} |
|
151
|
|
|
// print_r($httpResponse->getBody()->getContents()); die; |
|
152
|
|
|
|
|
153
|
|
|
return (new Response($this, $httpResponse)); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
public function getHttpMethod() { |
|
157
|
|
|
return 'POST'; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
abstract public function getEndpoint(); |
|
161
|
|
|
} |
|
162
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths