This commit is contained in:
parent
dd8faaea95
commit
7235bfdece
@ -16,6 +16,10 @@ class ExportHiltesSubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ViewEvent $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function onPatchOrder(ViewEvent $event): void
|
public function onPatchOrder(ViewEvent $event): void
|
||||||
{
|
{
|
||||||
$method = $event->getRequest()->getMethod();
|
$method = $event->getRequest()->getMethod();
|
||||||
|
@ -40,7 +40,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$slack = new Client($this->slackWebhookUrl, [
|
$slack = new Client($this->slackWebhookUrl, [
|
||||||
'username' => 'CDS-Notify',
|
'username' => 'CDS-Notify',
|
||||||
'channel' => '#general',
|
'channel' => '#online-verkäufe',
|
||||||
'link_names' => true,
|
'link_names' => true,
|
||||||
'icon' => ':robot_face:',
|
'icon' => ':robot_face:',
|
||||||
'allow_markdown' => true,
|
'allow_markdown' => true,
|
||||||
@ -56,7 +56,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
$msg = "Bestellung {$order->getOrderId()}: \n";
|
$msg = "Bestellung {$order->getOrderId()}: \n";
|
||||||
|
|
||||||
foreach ($order->getData() as $item) {
|
foreach ($order->getData()[0]['positions'] as $item) {
|
||||||
if ($item['menge'] > 0 && strlen($item['sku']) > 0) {
|
if ($item['menge'] > 0 && strlen($item['sku']) > 0) {
|
||||||
$msg .= $item['name'];
|
$msg .= $item['name'];
|
||||||
$msg .= ' ' . $item['sku'];
|
$msg .= ' ' . $item['sku'];
|
||||||
|
@ -241,23 +241,16 @@ class Hiltes
|
|||||||
|
|
||||||
public function sendToHiltes($url, $param, $auth = false)
|
public function sendToHiltes($url, $param, $auth = false)
|
||||||
{
|
{
|
||||||
if ($auth) {
|
|
||||||
#var_export($this->hiltesApiHash);
|
|
||||||
#var_export($url);
|
|
||||||
#var_export($param);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$authorization = "Authorization: Bearer " . $this->hiltesApiHash;
|
$authorization = "Authorization: Bearer " . $this->hiltesApiHash;
|
||||||
} else {
|
} else {
|
||||||
$authorization = false;
|
$authorization = false;
|
||||||
}
|
}
|
||||||
#dump($param);
|
|
||||||
# Setup request to send json via POST.
|
# Setup request to send json via POST.
|
||||||
$payload = json_encode($param);
|
$payload = json_encode($param);
|
||||||
#dump($payload);
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', $authorization));
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', $authorization));
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||||
# Return response instead of printing.
|
# Return response instead of printing.
|
||||||
@ -355,6 +348,10 @@ class Hiltes
|
|||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function sendOrderToHiltes($data)
|
public function sendOrderToHiltes($data)
|
||||||
{
|
{
|
||||||
$url = $this->hiltesApiUrl . '/api/WebSale/import';
|
$url = $this->hiltesApiUrl . '/api/WebSale/import';
|
||||||
|
Loading…
Reference in New Issue
Block a user