Passed
Push — master ( 9e5b2d...16ae42 )
by Andrey
05:34
created

AdditionalService   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 64
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getReturnReasonsSubtypes() 0 6 2
A getReturnOrdersList() 0 6 1
A CheckPossibilityCreateReturn() 0 6 1
A getReturnReasons() 0 6 1
1
<?php
2
3
namespace Daaner\NovaPoshta\Models;
4
5
use Daaner\NovaPoshta\NovaPoshta;
6
7
8
class AdditionalService extends NovaPoshta
9
{
10
11
    protected $model = 'AdditionalService';
12
    protected $calledMethod;
13
    protected $methodProperties = [];
14
15
    /**
16
     * Проверка возможности создания заявки на возврат.
17
     *
18
     * @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a778f519-8512-11ec-8ced-005056b2dbe1
19
     *
20
     * @param string $ttn
21
     * @return array
22
     */
23
    public function CheckPossibilityCreateReturn(string $ttn): array
24
    {
25
        $this->calledMethod = 'CheckPossibilityCreateReturn';
26
        $this->methodProperties['Number'] = $ttn;
27
28
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties);
29
    }
30
31
    /**
32
     * Получение списка причин возврата.
33
     * @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7a6bacb-8512-11ec-8ced-005056b2dbe1
34
     *
35
     * @return array
36
     */
37
    public function getReturnReasons(): array
38
    {
39
        $this->calledMethod = 'getReturnReasons';
40
        $this->methodProperties = null;
41
42
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties);
43
    }
44
45
    /**
46
     * Получение списка подтипов причины возврата.
47
     * @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7cb69ee-8512-11ec-8ced-005056b2dbe1
48
     *
49
     * @param string|null $ref
50
     * @return array
51
     */
52
    public function getReturnReasonsSubtypes(?string $ref = null): array
53
    {
54
        $this->calledMethod = 'getReturnReasonsSubtypes';
55
        $this->methodProperties['ReasonRef'] = $ref ?: config('novaposhta.ref_return_reasons');
56
57
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties);
58
    }
59
60
    /**
61
     * Получение списка заявок на возврат.
62
     * @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7cb69ee-8512-11ec-8ced-005056b2dbe1
63
     *
64
     * @return array
65
     */
66
    public function getReturnOrdersList(): array
67
    {
68
        $this->calledMethod = 'getReturnOrdersList';
69
        $this->methodProperties = null;
70
71
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties);
72
    }
73
74
75
}
76