CompletePurchase::getHttpMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Omnipay\Myfatoorah\Message;
4
5
class CompletePurchase extends AbstractRequest {
6
7
    public function getPaymentId() {
8
        return isset($_GET['paymentId']) ? $_GET['paymentId'] : '';
9
    }
10
11
    public function getInvoiceId() {
12
        return isset($_GET['invoiceid']) ? $_GET['invoiceid'] : '';
13
    }
14
15
    public function setPaymentId($value) {
16
        return $this->setParameter('paymentId', $value);
17
    }
18
19
    public function getData() {
20
        if($this->getPaymentId()){
21
            $data['Key']     = $this->getPaymentId();
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
22
            $data['KeyType'] = "paymentId";
23
        }else{
24
            $data['Key']     = $this->getInvoiceId();
25
            $data['KeyType'] = "invoiceid";
26
        }
27
        return $data;
28
    }
29
30
    public function getHttpMethod() {
31
        return 'POST';
32
    }
33
34
    public function getEndpoint() {
35
        $endpoint = $this->getTestMode() ? $this->sandboxEndpoint : $this->productionEndpoint;
36
        return $endpoint . '/v2/getpaymentstatus';
37
    }
38
39
}
40