1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Onurkacmaz\LaravelN11\Models; |
4
|
|
|
|
5
|
|
|
use Onurkacmaz\LaravelN11\Exceptions\N11Exception; |
6
|
|
|
use Onurkacmaz\LaravelN11\Interfaces\TicketInterface; |
7
|
|
|
use Onurkacmaz\LaravelN11\Service; |
8
|
|
|
use SoapClient; |
9
|
|
|
|
10
|
|
|
class Ticket extends Service implements TicketInterface |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var SoapClient|null |
15
|
|
|
*/ |
16
|
|
|
private $_client; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Category constructor |
20
|
|
|
* endPoint set edildi. |
21
|
|
|
* @throws N11Exception|\SoapFault |
22
|
|
|
*/ |
23
|
|
|
public function __construct() |
24
|
|
|
{ |
25
|
|
|
parent::__construct(); |
26
|
|
|
$this->_client = $this->setEndPoint(self::END_POINT); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param int $sellerId |
31
|
|
|
* @param int $startValue |
32
|
|
|
* @param int $pageSize |
33
|
|
|
* @return object |
34
|
|
|
*/ |
35
|
|
View Code Duplication |
public function ticketListingAssignedToSeller(int $sellerId, int $startValue = 1, int $pageSize = 1): object { |
|
|
|
|
36
|
|
|
$this->_parameters["sellerId"] = $sellerId; |
37
|
|
|
$this->_parameters["first"] = $startValue; |
38
|
|
|
$this->_parameters["pageSize"] = $pageSize; |
39
|
|
|
return $this->_client->TicketListingAssignedToSeller($this->_parameters); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param int $sellerId |
44
|
|
|
* @param int $startValue |
45
|
|
|
* @param int $pageSize |
46
|
|
|
* @return object |
47
|
|
|
*/ |
48
|
|
View Code Duplication |
public function ticketListingBelongsToSeller(int $sellerId, int $startValue = 1, int $pageSize = 1): object { |
|
|
|
|
49
|
|
|
$this->_parameters["sellerId"] = $sellerId; |
50
|
|
|
$this->_parameters["first"] = $startValue; |
51
|
|
|
$this->_parameters["pageSize"] = $pageSize; |
52
|
|
|
return $this->_client->TicketListingBelongsToSeller($this->_parameters); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param int $sellerId |
57
|
|
|
* @param int $ticketId |
58
|
|
|
* @param string $content |
59
|
|
|
* @return object |
60
|
|
|
*/ |
61
|
|
View Code Duplication |
public function ticketAnswer(int $sellerId, int $ticketId, string $content): object { |
|
|
|
|
62
|
|
|
$this->_parameters["sellerId"] = $sellerId; |
63
|
|
|
$this->_parameters["ticketId"] = $ticketId; |
64
|
|
|
$this->_parameters["content"] = $content; |
65
|
|
|
return $this->_client->TicketAnswer($this->_parameters); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param int $reasonId |
70
|
|
|
* @param int $sellerId |
71
|
|
|
* @param string $header |
72
|
|
|
* @param string $content |
73
|
|
|
* @return object |
74
|
|
|
*/ |
75
|
|
View Code Duplication |
public function create(int $reasonId, int $sellerId, string $header, string $content): object { |
|
|
|
|
76
|
|
|
$this->_parameters["reasonId"] = $reasonId; |
77
|
|
|
$this->_parameters["sellerId"] = $sellerId; |
78
|
|
|
$this->_parameters["header"] = $header; |
79
|
|
|
$this->_parameters["content"] = $content; |
80
|
|
|
return $this->_client->TicketCreate($this->_parameters); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return object |
85
|
|
|
*/ |
86
|
|
|
public function ticketReasons(): object { |
87
|
|
|
return $this->_client->TicketReasons($this->_parameters); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param int $ticketId |
92
|
|
|
* @param int $sellerId |
93
|
|
|
* @return object |
94
|
|
|
*/ |
95
|
|
|
public function markAsRead(int $ticketId, int $sellerId): object { |
96
|
|
|
$this->_parameters["ticketId"] = $ticketId; |
97
|
|
|
$this->_parameters["sellerId"] = $sellerId; |
98
|
|
|
return $this->_client->TicketRead($this->_parameters); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.