anilahir /
omnipay-moneris
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Omnipay\Moneris\Message; |
||
| 4 | |||
| 5 | abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest |
||
| 6 | { |
||
| 7 | public $testEndpoint = 'https://esqa.moneris.com:443/gateway2/servlet/MpgRequest'; |
||
| 8 | public $liveEndpoint = 'https://www3.moneris.com:443/gateway2/servlet/MpgRequest'; |
||
| 9 | |||
| 10 | 39 | public function getEndpoint() |
|
| 11 | { |
||
| 12 | 39 | return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint; |
|
| 13 | } |
||
| 14 | |||
| 15 | 60 | public function getMerchantId() |
|
| 16 | { |
||
| 17 | 60 | return $this->getParameter('merchantId'); |
|
| 18 | } |
||
| 19 | |||
| 20 | 78 | public function setMerchantId($value) |
|
| 21 | { |
||
| 22 | 78 | return $this->setParameter('merchantId', $value); |
|
| 23 | } |
||
| 24 | |||
| 25 | 60 | public function getMerchantKey() |
|
| 26 | { |
||
| 27 | 60 | return $this->getParameter('merchantKey'); |
|
| 28 | } |
||
| 29 | |||
| 30 | 78 | public function setMerchantKey($value) |
|
| 31 | { |
||
| 32 | 78 | return $this->setParameter('merchantKey', $value); |
|
| 33 | } |
||
| 34 | |||
| 35 | 18 | public function getPaymentMethod() |
|
| 36 | { |
||
| 37 | 18 | return $this->getParameter('paymentMethod'); |
|
| 38 | } |
||
| 39 | |||
| 40 | 18 | public function setPaymentMethod($value) |
|
| 41 | { |
||
| 42 | 18 | return $this->setParameter('paymentMethod', $value); |
|
| 43 | } |
||
| 44 | |||
| 45 | 3 | public function getPaymentProfile() |
|
| 46 | { |
||
| 47 | 3 | return $this->getParameter('paymentProfile'); |
|
| 48 | } |
||
| 49 | |||
| 50 | 3 | public function setPaymentProfile($value) |
|
| 51 | { |
||
| 52 | 3 | return $this->setParameter('paymentProfile', $value); |
|
| 53 | } |
||
| 54 | |||
| 55 | 15 | public function getOrderNumber() |
|
| 56 | { |
||
| 57 | 15 | return $this->getParameter('orderNumber'); |
|
| 58 | } |
||
| 59 | |||
| 60 | 21 | public function setOrderNumber($value) |
|
| 61 | { |
||
| 62 | 21 | return $this->setParameter('orderNumber', $value); |
|
| 63 | } |
||
| 64 | |||
| 65 | 39 | protected function getHttpMethod() |
|
| 66 | { |
||
| 67 | 39 | return 'POST'; |
|
| 68 | } |
||
| 69 | |||
| 70 | 39 | public function sendData($data) |
|
| 71 | { |
||
| 72 | $headers = [ |
||
| 73 | 39 | 'Content-Type' => 'application/xml', |
|
| 74 | ]; |
||
| 75 | |||
| 76 | 39 | $httpResponse = $this->httpClient->request($this->getHttpMethod(), $this->getEndpoint(), $headers, $data); |
|
| 77 | |||
| 78 | try { |
||
| 79 | 39 | $xmlResponse = simplexml_load_string($httpResponse->getBody()->getContents()); |
|
| 80 | 3 | } catch (\Exception $e) { |
|
| 81 | 3 | $xmlResponse = (string) $httpResponse->getBody(true); |
|
|
0 ignored issues
–
show
|
|||
| 82 | } |
||
| 83 | |||
| 84 | 39 | return $this->response = new Response($this, $xmlResponse); |
|
| 85 | } |
||
| 86 | } |
||
| 87 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.