|
35 | 35 | class CreateEndpoint extends Action
|
36 | 36 | {
|
37 | 37 | const ADMIN_RESOURCE = 'Magento_Config::config';
|
38 |
| - |
| 38 | + |
39 | 39 | /**
|
40 | 40 | * @var Http
|
41 | 41 | */
|
@@ -110,16 +110,16 @@ public function execute()
|
110 | 110 | $clone,
|
111 | 111 | $this->getRequest()->getParam('condition_name'),
|
112 | 112 | $this->getRequest()->getParam('apply_if'),
|
113 |
| - $this->getRequest()->getParam('condition_priority'), |
114 |
| - $this->getRequest()->getParam('response_condition') |
| 113 | + $this->getRequest()->getParam('condition_priority') |
115 | 114 | );
|
116 | 115 |
|
117 | 116 | $params = array_merge(
|
118 | 117 | $this->getRequest()->getParam('log_endpoint'),
|
119 | 118 | ['response_condition' => $condition]
|
120 | 119 | );
|
| 120 | + $params = array_filter($params); |
121 | 121 |
|
122 |
| - $endpoint = $this->api->createLogEndpoint($clone->number, $endpointType, array_filter($params)); |
| 122 | + $endpoint = $this->api->createLogEndpoint($clone->number, $endpointType, $params); |
123 | 123 |
|
124 | 124 | if (!$endpoint) {
|
125 | 125 | return $result->setData([
|
@@ -156,23 +156,21 @@ public function execute()
|
156 | 156 | * @param $conditionName
|
157 | 157 | * @param $applyIf
|
158 | 158 | * @param $conditionPriority
|
159 |
| - * @param $selCondition |
160 |
| - * @return mixed |
| 159 | + * @return string|null |
161 | 160 | * @throws \Magento\Framework\Exception\LocalizedException
|
162 | 161 | */
|
163 |
| - private function createCondition($clone, $conditionName, $applyIf, $conditionPriority, $selCondition) |
| 162 | + private function createCondition($clone, $conditionName, $applyIf, $conditionPriority) |
164 | 163 | {
|
165 |
| - if ($conditionName == $selCondition && !empty($selCondition) && |
166 |
| - !$this->api->getCondition($clone->number, $conditionName)) { |
167 |
| - $condition = [ |
168 |
| - 'name' => $conditionName, |
169 |
| - 'statement' => $applyIf, |
170 |
| - 'type' => 'RESPONSE', |
171 |
| - 'priority' => $conditionPriority |
172 |
| - ]; |
173 |
| - $createCondition = $this->api->createCondition($clone->number, $condition); |
174 |
| - return $createCondition->name; |
| 164 | + if (!$conditionName || !$applyIf || !$conditionPriority) { |
| 165 | + return null; |
175 | 166 | }
|
176 |
| - return $selCondition; |
| 167 | + $condition = [ |
| 168 | + 'name' => $conditionName, |
| 169 | + 'statement' => $applyIf, |
| 170 | + 'type' => 'RESPONSE', |
| 171 | + 'priority' => $conditionPriority |
| 172 | + ]; |
| 173 | + $createCondition = $this->api->createCondition($clone->number, $condition); |
| 174 | + return $createCondition->name; |
177 | 175 | }
|
178 | 176 | }
|
0 commit comments