Completed
Push — master ( 0f907a...866d23 )
by Andrii
02:30
created

AbstractRequest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 9
c 2
b 0
f 0
lcom 3
cbo 1
dl 0
loc 75
ccs 14
cts 14
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndpoint() 0 4 2
A getPurse() 0 4 1
A setPurse() 0 4 1
A getSecret() 0 4 1
A setSecret() 0 4 1
A getSum() 0 4 2
A setSum() 0 4 1
1
<?php
2
3
/*
4
 * PayPal driver for Omnipay PHP payment library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-paypal
7
 * @package   omnipay-paypal
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\PayPal\Message;
13
14
/**
15
 * PayPal Abstract Request.
16
 */
17
abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
18
{
19
    protected $zeroAmountAllowed = false;
20
21
    protected $mainEndpoint = 'https://www.paypal.com/cgi-bin/webscr';
22
    protected $testEndpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
23
24 2
    public function getEndpoint()
25
    {
26 2
        return $this->getTestMode() ? $this->testEndpoint : $this->mainEndpoint;
27
    }
28
29
    /**
30
     * Get the merchant purse.
31
     *
32
     * @return string merchant purse - email associated with the merchant account.
33
     */
34 6
    public function getPurse()
35
    {
36 6
        return $this->getParameter('purse');
37
    }
38
39
    /**
40
     * Set the purse.
41
     *
42
     * @param string $value merchant purse - email associated with the merchant account.
43
     * @return self
44
     */
45 14
    public function setPurse($value)
46
    {
47 14
        return $this->setParameter('purse', $value);
48
    }
49
50
    /**
51
     * Get the merchant secret. Actually not used.
52
     *
53
     * @return string merchant secret
54
     */
55 1
    public function getSecret()
56
    {
57 1
        return $this->getParameter('secret');
58
    }
59
60
    /**
61
     * Set the merchant secret. Actually not used.
62
     *
63
     * @param string $value merchant secret
64
     * @return self
65
     */
66 14
    public function setSecret($value)
67
    {
68 14
        return $this->setParameter('secret', $value);
69
    }
70
71
    /**
72
     * Get the sum excluding fee.
73
     *
74
     * @return string sum excluding fee
75
     */
76 3
    public function getSum()
77
    {
78 3
        return $this->getParameter('sum') ?: $this->getAmount();
79
    }
80
81
    /**
82
     * Set the sum excluding fee.
83
     *
84
     * @param string $value sum excluding fee
85
     * @return self
86
     */
87 2
    public function setSum($value)
88
    {
89 2
        return $this->setParameter('sum', $value);
90
    }
91
}
92