Completed
Push — master ( 620307...8ff95d )
by Dominik
03:16
created

TokenizeRequest::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
/**
3
 * w-vision
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the GNU General Public License version 3 (GPLv3)
8
 * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9
 * files that are distributed with this source code.
10
 *
11
 * @copyright  Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12
 * @license    GNU General Public License version 3 (GPLv3)
13
 */
14
15
namespace Omnipay\Datatrans\Message;
16
17
/**
18
 * Class TokenizeRequest
19
 *
20
 * @package Omnipay\Datatrans\Message
21
 */
22
class TokenizeRequest extends AbstractRedirectRequest
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $apiEndpoint = 'upStart.jsp';
28
29
    /**
30
     * @return array
31
     */
32
    public function getData()
33
    {
34
        $this->validate('merchantId', 'transactionId', 'sign', 'returnUrl', 'errorUrl', 'cancelUrl');
35
36
        $data = array(
37
            'merchantId' => $this->getMerchantId(),
38
            'refno'      => $this->getTransactionId(),
39
            'amount'     => 0,
40
            'currency'   => $this->getCurrency(),
41
            'sign'       => $this->getSign(),
42
            'useAlias'   => 'yes'
43
        );
44
45
        $data['successUrl'] = $this->getReturnUrl();
46
        $data['cancelUrl'] = $this->getCancelUrl();
47
        $data['errorUrl'] = $this->getErrorUrl();
48
        $data['cancelUrl'] = $this->getCancelUrl();
49
50
        return $data;
51
    }
52
53
    /**
54
     * @param mixed $data
55
     *
56
     * @return TokenizeRequest
57
     */
58
    public function sendData($data)
59
    {
60
        return $this->response = new TokenizeResponse($this, $data);
61
    }
62
}
63