# sync-basalam/1.10.19/includes/Services/Ticket/CreateTicketItem.php

ووسلام – همگام سازی ووکامرس و باسلام, version 1.10.19. 32 lines.

- Page: https://pluginprobe.com/plugins/sync-basalam/1.10.19/code/includes/Services/Ticket/CreateTicketItem.php
- Raw: https://pluginprobe.com/plugins/sync-basalam/1.10.19/raw/includes/Services/Ticket/CreateTicketItem.php
- Modified: 2026-09-17T09:40:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sync-basalam/1.10.19/code/includes/Services/Ticket/CreateTicketItem.php#L10-L20`.

```php
<?php

namespace SyncBasalam\Services\Ticket;

use SyncBasalam\Config\Endpoints;
use SyncBasalam\Services\ApiServiceManager;

class CreateTicketItem
{
    private $url;

    public function __construct($ticket_id)
    {
        $this->url  = sprintf(Endpoints::TICKET_ITEMS, $ticket_id);
    }
    public function execute($hamsalamToken, $data)
    {
        $apiService = syncBasalamContainer()->get(ApiServiceManager::class);
        $header = ['Authorization' => 'Bearer ' . $hamsalamToken];

        try {
            return $apiService->post($this->url, $data, $header);
        } catch (\Exception $e) {
            return [
                'status_code' => $e->getCode() ?? 500,
                'body' => null,
                'error' => 'خطا در ثبت پاسخ تیکت: ' . $e->getMessage(),
            ];
        }
    }
}

```
