Completed
Pull Request — master (#7)
by
unknown
05:40
created

PurchaseRequest::getData()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 6.7441

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 14
ccs 4
cts 9
cp 0.4444
rs 9.2
cc 4
eloc 7
nc 2
nop 0
crap 6.7441
1
<?php
2
/**
3
 * w-vision
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the MIT License
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that are distributed with this source code.
10
 *
11
 * @copyright  Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12
 * @license    MIT License
13
 */
14
15
namespace Omnipay\Datatrans\Message;
16
17
class PurchaseRequest extends AbstractRedirectRequest
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $optionalParams = array(
23
        'useAlias',
24
        'uppReturnMaskedCC'
25
    );
26
27
    /**
28
     * @return array
29
     */
30 2
    public function getData()
31
    {
32 2
        $data = parent::getData();
33
34
        //set customer details if set
35 2
        if (($customerDetails = $this->getParameter('uppCustomerDetails')) && is_array($customerDetails)) {
36
            $data['uppCustomerDetails'] = 'yes';
37
            foreach ($customerDetails as $key => $value) {
38
                $data[$key] = $value;
39
            }
40
        }
41
42 2
        return $data;
43
    }
44
45
    /**
46
      * @param $value
47
      * @return \Omnipay\Common\Message\AbstractRequest
48
      */
49 1
    public function setUppReturnMaskedCC($value)
50
    {
51 1
        return $this->setParameter('uppReturnMaskedCC', $value);
52
    }
53
54
    /**
55
     * @param $value
56
     * @return \Omnipay\Common\Message\AbstractRequest
57
     */
58 1
    public function setUseAlias($value)
59
    {
60 1
        return $this->setParameter('useAlias', $value);
61
    }
62
63
    /**
64
     * @param $value
65
     * @return \Omnipay\Common\Message\AbstractRequest
66
     */
67
    public function setUppCustomerDetails($value)
68
    {
69
        return $this->setParameter('uppCustomerDetails', $value);
70
    }
71
}
72