Passed
Push — master ( a99763...fbfe14 )
by Andrey
03:27
created

LoyaltyUser::getLoyaltyCardTurnoverByApiKey()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 4
nop 2
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Daaner\NovaPoshta\Models;
4
5
use Daaner\NovaPoshta\NovaPoshta;
6
use Daaner\NovaPoshta\Traits\Limit;
7
8
class LoyaltyUser extends NovaPoshta
9
{
10
    use Limit;
11
12
    protected $model = 'LoyaltyUser';
13
    protected $calledMethod;
14
    protected $methodProperties = null;
15
16
    /***
17
     * Получение данных по бонусной карте.
18
     *
19
     * @see https://daaner.github.io/NovaPoshta/#/LoyaltyUser?id=getloyaltyinfobyapikey НЕ ДОКУМЕНТИРОВАНО
20
     * @since 2022-11-06
21
     *
22
     * @return array
23
     */
24
    public function getLoyaltyInfoByApiKey(): array
25
    {
26
        $this->calledMethod = 'getLoyaltyInfoByApiKey';
27
28
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
29
    }
30
31
    /**
32
     * Получение данных о входящих посылках.
33
     *
34
     * @since 2022-11-05
35
     *
36
     * @param string|null $Year Год (в формате YYYY)
37
     * @param string|null $Month Месяц (в формате m)
38
     * @return array
39
     */
40
    public function getLoyaltyCardTurnoverByApiKey(?string $Year = null, ?string $Month = null): array
41
    {
42
        $this->calledMethod = 'getLoyaltyCardTurnoverByApiKey';
43
44
        if($Year) {
45
            $this->methodProperties['Year'] = $Year;
46
        }
47
48
        if($Month) {
49
            $this->methodProperties['Month'] = $Month;
50
        }
51
52
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
53
    }
54
55
56
    /**
57
     * Получение активных промокодов прикрепленных к телефону контрагента.
58
     *
59
     * @since 2022-11-06
60
     *
61
     * @param string $Phone Телефон контрагента
62
     * @return array
63
     */
64
    public function getPromocodeByPhone(string $Phone): array
65
    {
66
        $this->calledMethod = 'getPromocodeByPhone';
67
68
        $this->methodProperties['Phone'] = $Phone;
69
70
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
71
    }
72
73
74
    /**
75
     * Список по бонусной программе контрагента.
76
     *
77
     * @since 2022-11-06
78
     *
79
     * @param string $CounterpartyRef Ref контрагента
80
     * @return array
81
     */
82
    public function getStandartCardsList(string $CounterpartyRef): array
83
    {
84
        $this->calledMethod = 'getStandartCardsList';
85
86
        $this->methodProperties['CounterpartyRef'] = $CounterpartyRef;
87
88
        $this->getLimit();
89
        $this->getPage();
90
91
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
92
    }
93
}
94