CompletePurchaseRequest::getData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 4
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 9
ccs 0
cts 4
cp 0
crap 6
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Romcard\Message;
4
5
use Paytic\Omnipay\Romcard\Message\CompletePurchaseRequest as AbstractCompletePurchaseRequest;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasGatewayRequestTrait;
7
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasModelRequest;
8
use ByTIC\Payments\Gateways\Providers\Romcard\Message\Traits\CompletePurchaseTrait;
9
10
/**
11
 * Class PurchaseResponse
12
 * @package ByTIC\Payments\Gateways\Providers\Romcard\Message
13
 */
14
class CompletePurchaseRequest extends AbstractCompletePurchaseRequest
15
{
16
    use HasModelRequest;
0 ignored issues
show
introduced by
The trait ByTIC\Payments\Gateways\...\Traits\HasModelRequest requires some properties which are not provided by ByTIC\Payments\Gateways\...CompletePurchaseRequest: $query, $id
Loading history...
17
    use CompletePurchaseTrait;
18
    use HasGatewayRequestTrait;
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function getData()
24
    {
25
        $return = parent::getData();
26
        // Add model only if has data
27
        if (count($return)) {
28
            $return['model'] = $this->getModel();
29
        }
30
31
        return $return;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getModelIdFromRequest()
38
    {
39
        $modelId = $this->getHttpRequestBag()->get('ORDER');
40
41
        return $modelId;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    protected function parseNotification()
48
    {
49
        if ($this->validateModel()) {
50
            $model = $this->getModel();
51
            $this->updateParametersFromPurchase($model);
52
        }
53
54
        return parent::parseNotification();
55
    }
56
}
57