Completed
Push — master ( fdca80...2de24b )
by Vladimir
08:54 queued 03:35
created

CompletePurchaseRequest::getRequestToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 8
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Omnipay\AcquiroPay\Message;
4
5
/**
6
 * Complete Purchase Request.
7
 *
8
 * @method Response send()
9
 */
10 View Code Duplication
class CompletePurchaseRequest extends AbstractRequest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * Get MD.
14
     *
15
     * @return string
16
     */
17 6
    public function getMD()
18
    {
19 6
        return $this->getParameter('MD');
20
    }
21
22
    /**
23
     * Set MD.
24
     *
25
     * @param string $value
26
     *
27
     * @return static|\Omnipay\Common\Message\AbstractRequest
28
     */
29 6
    public function setMD($value)
30
    {
31 6
        return $this->setParameter('MD', $value);
32
    }
33
34
    /**
35
     * Get PaRes.
36
     *
37
     * @return string
38
     */
39 6
    public function getPaRes()
40
    {
41 6
        return $this->getParameter('PaRes');
42
    }
43
44
    /**
45
     * Set PaRes.
46
     *
47
     * @param string $value
48
     *
49
     * @return static|\Omnipay\Common\Message\AbstractRequest
50
     */
51 6
    public function setPaRes($value)
52
    {
53 6
        return $this->setParameter('PaRes', $value);
54
    }
55
56
    /**
57
     * Get the raw data array for this message. The format of this varies from gateway to
58
     * gateway, but will usually be either an associative array, or a SimpleXMLElement.
59
     *
60
     * @return array
61
     */
62 6
    public function getData()
63
    {
64 6
        $this->validate('transactionReference', 'MD', 'PaRes');
65
66
        return array(
67 6
            'opcode'     => 3,
68 6
            'payment_id' => $this->getTransactionReference(),
69 6
            'PaRes'      => $this->getPaRes(),
70 6
            'MD'         => $this->getMD(),
71 6
            'token'      => $this->getRequestToken(),
72 6
        );
73
    }
74
75
    /**
76
     * Get a request token.
77
     *
78
     * @return string
79
     */
80 9
    public function getRequestToken()
81
    {
82 9
        return md5(
83 9
            $this->getMerchantId()
84 9
            .$this->getTransactionReference()
85 9
            .$this->getSecretWord()
86 9
        );
87
    }
88
}
89