CompletePurchaseRequest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 41
ccs 0
cts 12
cp 0
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getModelIdFromRequest() 0 5 1
A getData() 0 9 2
A parseNotification() 0 8 2
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