Passed
Push — master ( e06835...9e4381 )
by Andrey
03:50
created

checkPossibilityForRedirecting()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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