Passed
Push — master ( ff7474...c002dd )
by Gabriel
05:50
created

ServerCompletePurchaseRequest::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Payu\Message;
4
5
use ByTIC\Omnipay\Payu\Message\ServerCompletePurchaseRequest as AbstractServerCompletePurchaseRequest;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\HasModelRequest;
7
use ByTIC\Payments\Gateways\Providers\Payu\Gateway;
8
use ByTIC\Payments\Models\Purchase\Traits\IsPurchasableModelTrait;
9
10
/**
11
 * Class ServerCompletePurchaseRequest
12
 * @package ByTIC\Omnipay\Payu\Message
13
 */
14
class ServerCompletePurchaseRequest extends AbstractServerCompletePurchaseRequest
15
{
16
    use Traits\CompletePurchaseRequestTrait;
0 ignored issues
show
introduced by
The trait ByTIC\Payments\Gateways\...etePurchaseRequestTrait requires some properties which are not provided by ByTIC\Payments\Gateways\...CompletePurchaseRequest: $query, $id
Loading history...
17
18
    /**
19
     * @inheritdoc
20
     */
21 5
    public function isValidNotification()
22
    {
23 5
        if ($this->hasPOST('REFNOEXT')) {
24 1
            if ($this->validateModel()) {
25 1
                $model = $this->getModel();
26 1
                $this->updateParametersFromPurchase($model);
27
28 1
                return parent::isValidNotification();
29
            }
30
        }
31
32 4
        return false;
33
    }
34
35
    /**
36
     * Returns ID if it has it
37
     * @return int
38
     */
39 1
    public function getModelIdFromRequest()
40
    {
41 1
        return $this->httpRequest->request->get('REFNOEXT');
42
    }
43
44
}
45