Code Duplication    Length = 29-33 lines in 3 locations

src/Message/CaptureRequest.php 1 location

@@ 10-42 (lines=33) @@
7
 *
8
 * @method Response send()
9
 */
10
class CaptureRequest extends AbstractRequest
11
{
12
    /**
13
     * Get the raw data array for this message. The format of this varies from gateway to
14
     * gateway, but will usually be either an associative array, or a SimpleXMLElement.
15
     *
16
     * @return mixed
17
     */
18
    public function getData()
19
    {
20
        $this->validate('transactionReference');
21
22
        return [
23
            'opcode'     => 13,
24
            'payment_id' => $this->getTransactionReference(),
25
            'token'      => $this->getRequestToken(),
26
        ];
27
    }
28
29
    /**
30
     * Get a request token.
31
     *
32
     * @return string
33
     */
34
    public function getRequestToken()
35
    {
36
        return md5(
37
            $this->getMerchantId()
38
            .$this->getTransactionReference()
39
            .$this->getSecretWord()
40
        );
41
    }
42
}
43

src/Message/VoidRequest.php 1 location

@@ 10-38 (lines=29) @@
7
 *
8
 * @method Response send()
9
 */
10
class VoidRequest extends AbstractRequest
11
{
12
    /**
13
     * Get the raw data array for this message. The format of this varies from gateway to
14
     * gateway, but will usually be either an associative array, or a SimpleXMLElement.
15
     *
16
     * @return mixed
17
     */
18
    public function getData()
19
    {
20
        $this->validate('transactionReference');
21
22
        return [
23
            'opcode'     => 1,
24
            'payment_id' => $this->getTransactionReference(),
25
            'token'      => $this->getRequestToken(),
26
        ];
27
    }
28
29
    /**
30
     * Get a request token.
31
     *
32
     * @return string
33
     */
34
    public function getRequestToken()
35
    {
36
        return md5($this->getMerchantId().$this->getTransactionReference().$this->getAmount().$this->getSecretWord());
37
    }
38
}
39

src/Message/StatusRequest.php 1 location

@@ 10-38 (lines=29) @@
7
 *
8
 * @method Response send()
9
 */
10
class StatusRequest extends AbstractRequest
11
{
12
    /**
13
     * Get the raw data array for this message. The format of this varies from gateway to
14
     * gateway, but will usually be either an associative array, or a SimpleXMLElement.
15
     *
16
     * @return mixed
17
     */
18
    public function getData()
19
    {
20
        $this->validate('transactionReference');
21
22
        return [
23
            'opcode'     => 2,
24
            'payment_id' => $this->getTransactionReference(),
25
            'token'      => $this->getRequestToken(),
26
        ];
27
    }
28
29
    /**
30
     * Get a request token.
31
     *
32
     * @return string
33
     */
34
    public function getRequestToken()
35
    {
36
        return md5($this->getMerchantId().$this->getTransactionReference().$this->getSecretWord());
37
    }
38
}
39