Code Duplication    Length = 39-47 lines in 2 locations

src/Message/WebAuthorizeRequest.php 1 location

@@ 9-55 (lines=47) @@
6
 *
7
 * @method WebAuthorizeResponse send()
8
 */
9
class WebAuthorizeRequest extends AbstractRequest
10
{
11
    /**
12
     * @return boolean
13
     */
14
    public function getMethod()
15
    {
16
        return 'doWebPayment';
17
    }
18
19
    public function getData()
20
    {
21
        $data['payment'] = [
22
            'amount' => $this->getAmountInteger(),
23
            'currency' => $this->getCurrencyNumeric(),
24
            'action' => 100,
25
            'mode' => 'CPT',
26
        ];
27
28
        if($this->getContractNumber())
29
        {
30
            $data['payment']['contractNumber'] = $this->getContractNumber();
31
        }
32
33
        $data['order'] = [
34
            'ref' => $this->getTransactionReference(),
35
            'amount' => $this->getAmountInteger(),
36
            'currency' => $this->getCurrencyNumeric(),
37
            'date' => (new \DateTime())->format('d/m/Y H:i')
38
        ];
39
40
        $data['returnURL'] = $this->getReturnUrl();
41
        $data['cancelURL'] = $this->getCancelUrl();
42
        $data['notificationURL'] = $this->getNotifyUrl();
43
44
        return array_replace_recursive($this->getBaseData(), $data);
45
    }
46
47
    /**
48
     * @param \stdClass $data
49
     * @return WebAuthorizeResponse
50
     */
51
    protected function createResponse($data)
52
    {
53
        return $this->response = new WebAuthorizeResponse($this, $data);
54
    }
55
}
56

src/Message/WebCaptureRequest.php 1 location

@@ 9-47 (lines=39) @@
6
 *
7
 * @method WebAuthorizeResponse send()
8
 */
9
class WebCaptureRequest extends WebAuthorizeRequest
10
{
11
    public function getData()
12
    {
13
        $data['payment'] = [
14
            'amount' => $this->getAmountInteger(),
15
            'currency' => $this->getCurrencyNumeric(),
16
            'action' => 101,
17
            'mode' => 'CPT',
18
        ];
19
20
        if($this->getContractNumber())
21
        {
22
            $data['payment']['contractNumber'] = $this->getContractNumber();
23
        }
24
25
        $data['order'] = [
26
            'ref' => $this->getTransactionReference(),
27
            'amount' => $this->getAmountInteger(),
28
            'currency' => $this->getCurrencyNumeric(),
29
            'date' => (new \DateTime())->format('d/m/Y H:i')
30
        ];
31
32
        $data['returnURL'] = $this->getReturnUrl();
33
        $data['cancelURL'] = $this->getCancelUrl();
34
        $data['notificationURL'] = $this->getNotifyUrl();
35
36
        return array_replace_recursive($this->getBaseData(), $data);
37
    }
38
39
    /**
40
     * @param \stdClass $data
41
     * @return WebAuthorizeResponse
42
     */
43
    protected function createResponse($data)
44
    {
45
        return $this->response = new WebCaptureResponse($this, $data);
46
    }
47
}
48