1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Onurkacmaz\LaravelN11\Models; |
4
|
|
|
|
5
|
|
|
use Onurkacmaz\LaravelN11\Exceptions\N11Exception; |
6
|
|
|
use Onurkacmaz\LaravelN11\Interfaces\SettlementInterface; |
7
|
|
|
use Onurkacmaz\LaravelN11\Service; |
8
|
|
|
use SoapClient; |
9
|
|
|
|
10
|
|
|
class Settlement extends Service implements SettlementInterface |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var SoapClient|null |
15
|
|
|
*/ |
16
|
|
|
private $_client; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* City constructor |
20
|
|
|
* @throws N11Exception|\SoapFault |
21
|
|
|
*/ |
22
|
|
|
public function __construct() |
23
|
|
|
{ |
24
|
|
|
parent::__construct(); |
25
|
|
|
$this->_client = $this->setEndPoint(self::END_POINT); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param string $startDate |
30
|
|
|
* @param int $endDate |
31
|
|
|
* @param int $currentPage |
32
|
|
|
* @param int $pageSize |
33
|
|
|
* @return object |
34
|
|
|
* @description Seçilen tarih aralığına göre ödeme bilgilerini listeleyen servis. |
35
|
|
|
*/ |
36
|
|
View Code Duplication |
public function getSettlementList(string $startDate, int $endDate, int $currentPage = 1, int $pageSize = 100): object { |
|
|
|
|
37
|
|
|
$this->_parameters["startDate"] = $startDate; |
38
|
|
|
$this->_parameters["endDate"] = $endDate; |
39
|
|
|
$this->_parameters["pagingData"] = [ |
40
|
|
|
"currentPage" => $currentPage, |
41
|
|
|
"pageSize" => $pageSize, |
42
|
|
|
]; |
43
|
|
|
return $this->_client->GetSettlementList($this->_parameters); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param string $date |
48
|
|
|
* @param int $currentPage |
49
|
|
|
* @param int $pageSize |
50
|
|
|
* @return object |
51
|
|
|
* @description GetSettlementList metodu ile listelenen ödemelere ait ayrıntıları gösteren metod. Belirli bir gün seçilerek, o güne ait satış/uzlaşma detayları getirilir. |
52
|
|
|
*/ |
53
|
|
View Code Duplication |
public function getSettlementDetail(string $date, int $currentPage = 1, int $pageSize = 100): object { |
|
|
|
|
54
|
|
|
$this->_parameters["date"] = $date; |
55
|
|
|
$this->_parameters["pagingData"] = [ |
56
|
|
|
"currentPage" => $currentPage, |
57
|
|
|
"pageSize" => $pageSize, |
58
|
|
|
]; |
59
|
|
|
return $this->_client->GetSettlementDetail($this->_parameters); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
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.