1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Daaner\NovaPoshta\Models; |
4
|
|
|
|
5
|
|
|
use Daaner\NovaPoshta\NovaPoshta; |
6
|
|
|
use Daaner\NovaPoshta\Traits\AdditionalServiceProperty; |
7
|
|
|
use Daaner\NovaPoshta\Traits\InternetDocumentProperty; |
8
|
|
|
|
9
|
|
|
class AdditionalService extends NovaPoshta |
10
|
|
|
{ |
11
|
|
|
protected $model = 'AdditionalService'; |
12
|
|
|
protected $calledMethod; |
13
|
|
|
protected $methodProperties = []; |
14
|
|
|
|
15
|
|
|
use InternetDocumentProperty, AdditionalServiceProperty; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Проверка возможности создания заявки на возврат. |
19
|
|
|
* |
20
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a778f519-8512-11ec-8ced-005056b2dbe1 |
21
|
|
|
* |
22
|
|
|
* @param string $ttn |
23
|
|
|
* @return array |
24
|
|
|
*/ |
25
|
|
|
public function CheckPossibilityCreateReturn(string $ttn): array |
26
|
|
|
{ |
27
|
|
|
$this->calledMethod = 'CheckPossibilityCreateReturn'; |
28
|
|
|
$this->methodProperties['Number'] = $ttn; |
29
|
|
|
|
30
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Проверка возможности создания заявки на переадресацию отправки. |
35
|
|
|
* |
36
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a8d29fc2-8512-11ec-8ced-005056b2dbe1 |
37
|
|
|
* |
38
|
|
|
* @param string $ttn |
39
|
|
|
* @return array |
40
|
|
|
*/ |
41
|
|
|
public function checkPossibilityForRedirecting(string $ttn): array |
42
|
|
|
{ |
43
|
|
|
$this->calledMethod = 'checkPossibilityForRedirecting'; |
44
|
|
|
$this->methodProperties['Number'] = $ttn; |
45
|
|
|
|
46
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Получение списка причин возврата. |
51
|
|
|
* |
52
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7a6bacb-8512-11ec-8ced-005056b2dbe1 |
53
|
|
|
* |
54
|
|
|
* @return array |
55
|
|
|
*/ |
56
|
|
|
public function getReturnReasons(): array |
57
|
|
|
{ |
58
|
|
|
$this->calledMethod = 'getReturnReasons'; |
59
|
|
|
$this->methodProperties = null; |
60
|
|
|
|
61
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Получение списка подтипов причины возврата. |
66
|
|
|
* |
67
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7cb69ee-8512-11ec-8ced-005056b2dbe1 |
68
|
|
|
* |
69
|
|
|
* @param string|null $ref |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
|
|
public function getReturnReasonsSubtypes(?string $ref = null): array |
73
|
|
|
{ |
74
|
|
|
$this->calledMethod = 'getReturnReasonsSubtypes'; |
75
|
|
|
$this->methodProperties['ReasonRef'] = $ref ?: config('novaposhta.ref_return_reasons'); |
76
|
|
|
|
77
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Получение списка заявок на возврат. |
82
|
|
|
* |
83
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7cb69ee-8512-11ec-8ced-005056b2dbe1 |
84
|
|
|
* |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
|
|
public function getReturnOrdersList(): array |
88
|
|
|
{ |
89
|
|
|
$this->calledMethod = 'getReturnOrdersList'; |
90
|
|
|
$this->methodProperties = null; |
91
|
|
|
|
92
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Создание заявки на возврат. |
98
|
|
|
* |
99
|
|
|
* Возврат на адрес отправителя. |
100
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/a7fb4a3a-8512-11ec-8ced-005056b2dbe1 |
101
|
|
|
* |
102
|
|
|
* Возврат на новый адрес отделения. |
103
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/5a64f960-e7fa-11ec-a60f-48df37b921db |
104
|
|
|
* |
105
|
|
|
* Возврат на новый адрес по адресной доставке. |
106
|
|
|
* @see https://developers.novaposhta.ua/view/model/a7682c1a-8512-11ec-8ced-005056b2dbe1/method/175baec3-8f0d-11ec-8ced-005056b2dbe1 |
107
|
|
|
* |
108
|
|
|
* @param string $ttn |
109
|
|
|
* @param string|null $type |
110
|
|
|
* @return array |
111
|
|
|
*/ |
112
|
|
|
public function save(string $ttn, ?string $type = null): array |
|
|
|
|
113
|
|
|
{ |
114
|
|
|
$this->calledMethod = 'save'; |
115
|
|
|
|
116
|
|
|
$this->methodProperties['IntDocNumber'] = $ttn; |
117
|
|
|
$this->methodProperties['OrderType'] = 'orderCargoReturn'; |
118
|
|
|
$this->getPaymentMethod(); |
119
|
|
|
$this->getReason(); |
120
|
|
|
$this->getSubtypeReason(); |
121
|
|
|
$this->getNote(); |
122
|
|
|
|
123
|
|
|
if (! $this->Note) { |
124
|
|
|
$this->methodProperties['Note'] = config('novaposhta.return_note'); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Возврат на адрес отправления |
129
|
|
|
*/ |
130
|
|
|
$this->getReturnAddressRef(); |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Возврат на новый адрес отделения |
134
|
|
|
*/ |
135
|
|
|
$this->getRecipientWarehouse(); |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Возврат на новый адрес по адресной доставке |
139
|
|
|
*/ |
140
|
|
|
$this->getRecipientSettlement(); |
141
|
|
|
|
142
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.