PaymentCompleteRequest::getHttpMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Omnipay\PaypalRest\Message;
4
5
/**
6
 * @author    Ivan Kerin <[email protected]>
7
 * @copyright 2014, Clippings Ltd.
8
 * @license   http://spdx.org/licenses/BSD-3-Clause
9
 */
10
class PaymentCompleteRequest extends AbstractPaypalRequest
11
{
12
    /**
13
     * @return string
14
     */
15
    public function getEndpoint()
16
    {
17
        $this->validate('transactionReference');
18
19
        return "/payments/payment/{$this->getTransactionReference()}/execute";
20
    }
21
22
    /**
23
     * @return string
24
     */
25
    public function getHttpMethod()
26
    {
27
        return 'POST';
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getPayerId()
34
    {
35
        return $this->getParameter('payerId');
36
    }
37
38
    /**
39
     * @param string $value
40
     */
41
    public function setPayerId($value)
42
    {
43
        return $this->setParameter('payerId', $value);
44
    }
45
46
    /**
47
     * @param  mixed           $data
48
     * @return PaymentResponse
49
     */
50
    public function sendData($data)
51
    {
52
        $httpResponse = $this->sendHttpRequest($data);
53
54
        return $this->response = new PaymentResponse(
55
            $this,
56
            $httpResponse->json(),
57
            $httpResponse->getStatusCode()
58
        );
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getData()
65
    {
66
        $this->validate('payerId');
67
68
        return array(
69
            'payer_id' => $this->getPayerId(),
70
        );
71
    }
72
}
73