Completed
Branch master (eebe0d)
by Gregorio
02:31 queued 50s
created

CreatePaymentMethodRequest::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Omnipay\Spreedly\Message;
4
5
use Omnipay\Spreedly\Concerns\HasOwnerData;
6
use Omnipay\Spreedly\Message\Concerns\HasPaymentMethodData;
7
8
/**
9
 * @method Response send()
10
 */
11
class CreatePaymentMethodRequest extends AbstractPaymentMethodRequest
12
{
13
    use HasOwnerData, HasPaymentMethodData;
14
15
    /**
16
     * @return array
17
     * @throws \Omnipay\Common\Exception\InvalidCreditCardException
18
     * @throws \Omnipay\Common\Exception\InvalidRequestException
19
     * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException
20
     */
21 6
    public function getData()
22
    {
23 6
        $data = $this->validateAndGetPaymentMethodData();
24
25 6
        $data = $this->fillExistingParameters($data, array(
26 6
            'email' => 'email',
27 6
            'retained' => 'retained',
28 6
            'allow_blank_name' => 'allow_blank_name',
29 6
            'allow_expired_date' => 'allow_expired_date',
30 6
            'allow_blank_date' => 'allow_blank_date',
31 6
            'data' => 'extra',
32 6
        ));
33
34 6
        return array('payment_method' => $data);
35
    }
36
37
    /**
38
     * @return string
39
     */
40 6
    public function getEndpoint()
41
    {
42 6
        return $this->endpoint . 'payment_methods';
43
    }
44
45 6
    public function getRetained()
46
    {
47 6
        return $this->getParameter('retained');
48
    }
49
50 3
    public function setRetained($value)
51
    {
52 3
        return $this->setParameter('retained', $value);
53
    }
54
}
55