Skip to content

Commit 10fb42d

Browse files
authored
Merge pull request #20 from mindbox-moscow/MBM-33
add setWishList, clearWishList, clearCart
2 parents d8bf64b + e6ee65c commit 10fb42d

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

src/Helpers/ProductListHelper.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,76 @@ public function setProductList(
110110

111111
return $this->client->prepareRequest('POST', $operationName, $operation, '', [], false, $addDeviceUUID);
112112
}
113+
114+
/**
115+
* Выполняет вызов стандартной операции Website.SetWishList:
116+
*
117+
* @see https://developers.mindbox.ru/docs/prodlistactionxml
118+
*
119+
* @param ProductListItemRequestCollection $products Объект, содержащий данные списка продуктов для
120+
* запроса.
121+
* @param string $operationName Название операции.
122+
* @param CustomerIdentityRequestDTO|null $customerIdentity Объект, содержащий данные потребителя для запроса.
123+
* @param bool $addDeviceUUID Флаг, сообщающий о необходимости передать в запросе
124+
* DeviceUUID.
125+
*
126+
* @return \Mindbox\Clients\AbstractMindboxClient
127+
*/
128+
public function setWishList(
129+
ProductListItemRequestCollection $products,
130+
$operationName,
131+
CustomerIdentityRequestDTO $customerIdentity = null,
132+
$addDeviceUUID = true
133+
) {
134+
$operation = $this->createOperation();
135+
$operation->setProductList($products);
136+
if (isset($customerIdentity)) {
137+
$operation->setCustomer($customerIdentity);
138+
}
139+
140+
return $this->client->prepareRequest('POST', $operationName, $operation, '', [], false, $addDeviceUUID);
141+
}
142+
143+
/**
144+
* Выполняет вызов стандартной операции Website.ClearWishList:
145+
*
146+
* @see https://developers.mindbox.ru/docs/prodlistactionxml
147+
*
148+
* @param string $operationName Название операции.
149+
* @param CustomerIdentityRequestDTO|null $customerIdentity Объект, содержащий данные потребителя для запроса.
150+
* @param bool $addDeviceUUID Флаг, сообщающий о необходимости передать в запросе
151+
* DeviceUUID.
152+
*
153+
* @return \Mindbox\Clients\AbstractMindboxClient
154+
*/
155+
public function clearWishList(
156+
$operationName,
157+
CustomerIdentityRequestDTO $customerIdentity = null,
158+
$addDeviceUUID = true
159+
) {
160+
$operation = $this->createOperation();
161+
$operation->setField('executionDateTimeUtc', gmdate('d.m.Y H:i:s'));
162+
return $this->client->prepareRequest('POST', $operationName, $operation, '', [], false, $addDeviceUUID);
163+
}
164+
165+
/**
166+
* Выполняет вызов стандартной операции Website.ClearCart:
167+
*
168+
*
169+
* @param string $operationName Название операции.
170+
* @param CustomerIdentityRequestDTO|null $customerIdentity Объект, содержащий данные потребителя для запроса.
171+
* @param bool $addDeviceUUID Флаг, сообщающий о необходимости передать в запросе
172+
* DeviceUUID.
173+
*
174+
* @return \Mindbox\Clients\AbstractMindboxClient
175+
*/
176+
public function clearCart(
177+
$operationName,
178+
CustomerIdentityRequestDTO $customerIdentity = null,
179+
$addDeviceUUID = true
180+
) {
181+
$operation = $this->createOperation();
182+
$operation->setField('executionDateTimeUtc', gmdate('d.m.Y H:i:s'));
183+
return $this->client->prepareRequest('POST', $operationName, $operation, '', [], false, $addDeviceUUID);
184+
}
113185
}

0 commit comments

Comments
 (0)