Skip to content

Commit 108e646

Browse files
authored
Merge pull request #42 from mindbox-moscow/MBM-259
rework sdk
2 parents 935e464 + 4cfd940 commit 108e646

21 files changed

Lines changed: 582 additions & 27 deletions

src/DTO/ResultDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace Mindbox\DTO;
55

6-
use Mindbox\DTO\V2\Responses\OrderResponseCollection;
7-
use Mindbox\DTO\V2\Responses\OrderResponseDTO;
6+
use Mindbox\DTO\V3\Responses\OrderResponseCollection;
7+
use Mindbox\DTO\V3\Responses\OrderResponseDTO;
88
use Mindbox\DTO\V3\Responses\BalanceResponseCollection;
99
use Mindbox\DTO\V3\Responses\CustomerActionResponseCollection;
1010
use Mindbox\DTO\V3\Responses\CustomerIdentityResponseCollection;

src/DTO/V3/Requests/CustomerRequestDTO.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* @property AreaRequestDTO $area
1515
* @property SubscriptionRequestCollection $subscriptions
1616
* @property string $authenticationTicket
17+
* @property string $isAuthorized
1718
**/
1819
class CustomerRequestDTO extends CustomerIdentityRequestDTO
1920
{
@@ -171,4 +172,20 @@ public function setDiscountCard($discountCard)
171172
{
172173
$this->setField('discountCard', $discountCard);
173174
}
175+
176+
/**
177+
* @return string
178+
*/
179+
public function getIsAuthorized()
180+
{
181+
return $this->getField('isAuthorized');
182+
}
183+
184+
/**
185+
* @param mixed $isAuthorized
186+
*/
187+
public function setIsAuthorized($isAuthorized)
188+
{
189+
$this->setField('isAuthorized', $isAuthorized);
190+
}
174191
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTOCollection;
7+
8+
/**
9+
* Class AppliedDiscountResponseCollection
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
*/
13+
class AppliedDiscountResponseCollection extends DTOCollection
14+
{
15+
/**
16+
* @var string Название элементов коллекции для корректной генерации xml.
17+
*/
18+
protected static $collectionItemsName = AppliedDiscountResponseDTO::class;
19+
20+
/**
21+
* @var string Название элемента для корректной генерации xml.
22+
*/
23+
protected static $xmlName = 'appliedDiscounts';
24+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTO;
7+
8+
/**
9+
* Class AppliedDiscountResponseDTO
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
* @property string $type
13+
* @property string $id
14+
* @property string $amount
15+
* @property PromoActionResponseDTO $promoAction
16+
* @property BalanceTypeResponseDTO $balanceType
17+
*/
18+
class AppliedDiscountResponseDTO extends DTO
19+
{
20+
/**
21+
* @var string Название элемента для корректной генерации xml.
22+
*/
23+
protected static $xmlName = 'appliedDiscount';
24+
25+
/**
26+
* @var array Мэппинг преобразрования полей в объекты DTO.
27+
*/
28+
protected static $DTOMap = [
29+
'promoAction' => PromoActionResponseDTO::class,
30+
'balanceType' => BalanceTypeResponseDTO::class,
31+
];
32+
33+
/**
34+
* @return string
35+
*/
36+
public function getType()
37+
{
38+
return $this->getField('type');
39+
}
40+
41+
/**
42+
* @return string
43+
*/
44+
public function getId()
45+
{
46+
return $this->getField('id');
47+
}
48+
49+
/**
50+
* @return string
51+
*/
52+
public function getAmount()
53+
{
54+
return $this->getField('amount');
55+
}
56+
57+
/**
58+
* @return PromoActionResponseDTO
59+
*/
60+
public function getPromoAction()
61+
{
62+
return $this->getField('promoAction');
63+
}
64+
65+
/**
66+
* @return BalanceTypeResponseDTO
67+
*/
68+
public function getBalanceType()
69+
{
70+
return $this->getField('balanceType');
71+
}
72+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTOCollection;
7+
8+
/**
9+
* Class ContentItemResponseCollection
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
*/
13+
class ContentItemResponseCollection extends DTOCollection
14+
{
15+
/**
16+
* @var string Название элементов коллекции для корректной генерации xml.
17+
*/
18+
protected static $collectionItemsName = ContentItemResponseDTO::class;
19+
20+
/**
21+
* @var string Название элемента для корректной генерации xml.
22+
*/
23+
protected static $xmlName = 'content';
24+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTO;
7+
8+
/**
9+
* Class ContentItemResponseDTO
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
* @property string $type
13+
* @property string $promoActionId
14+
* @property string $value
15+
**/
16+
class ContentItemResponseDTO extends DTO
17+
{
18+
/**
19+
* @var string Название элемента для корректной генерации xml.
20+
*/
21+
protected static $xmlName = 'contentItem';
22+
23+
/**
24+
* @return string
25+
*/
26+
public function getType()
27+
{
28+
return $this->getField('type');
29+
}
30+
31+
/**
32+
* @return string
33+
*/
34+
public function getPromoActionId()
35+
{
36+
return $this->getField('promoActionId');
37+
}
38+
39+
/**
40+
* @return mixed
41+
*/
42+
public function getValue()
43+
{
44+
return $this->getField('value');
45+
}
46+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTOCollection;
7+
8+
/**
9+
* Class DiscountInfoResponseCollection
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
*/
13+
class DiscountInfoResponseCollection extends DTOCollection
14+
{
15+
/**
16+
* @var string Название элементов коллекции для корректной генерации xml.
17+
*/
18+
protected static $collectionItemsName = DiscountInfoResponseDTO::class;
19+
20+
/**
21+
* @var string Название элемента для корректной генерации xml.
22+
*/
23+
protected static $xmlName = 'discountsInfo';
24+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTO;
7+
8+
/**
9+
* Class DiscountInfoResponseDTO
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
* @property string $type
13+
* @property string $availableAmountForCurrentOrder
14+
**/
15+
class DiscountInfoResponseDTO extends DTO
16+
{
17+
/**
18+
* @var string Название элемента для корректной генерации xml.
19+
*/
20+
protected static $xmlName = 'discountInfo';
21+
22+
/**
23+
* @return string
24+
*/
25+
public function getType()
26+
{
27+
return $this->getField('type');
28+
}
29+
30+
/**
31+
* @return string
32+
*/
33+
public function getAvailableAmountForCurrentOrder()
34+
{
35+
return $this->getField('availableAmountForCurrentOrder');
36+
}
37+
}

src/DTO/V3/Responses/LineResponseDTO.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @property AppliedPromotionResponseCollection $appliedPromotions
1717
* @property GiftCardResponseDTO $giftCard
1818
* @property string $lineId
19+
* @property string $discountedPriceOfLine
1920
**/
2021
class LineResponseDTO extends LineDTO
2122
{
@@ -84,4 +85,12 @@ public function getLineId()
8485
{
8586
return $this->getField('lineId');
8687
}
88+
89+
/**
90+
* @return string
91+
*/
92+
public function getDiscountedPrice()
93+
{
94+
return $this->getField('discountedPriceOfLine');
95+
}
8796
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
4+
namespace Mindbox\DTO\V3\Responses;
5+
6+
use Mindbox\DTO\DTOCollection;
7+
8+
/**
9+
* Class OrderResponseCollection
10+
*
11+
* @package Mindbox\DTO\V3\Responses
12+
*/
13+
class OrderResponseCollection extends DTOCollection
14+
{
15+
/**
16+
* @var string Название элементов коллекции для корректной генерации xml.
17+
*/
18+
protected static $collectionItemsName = OrderResponseDTO::class;
19+
20+
/**
21+
* @var string Название элемента для корректной генерации xml.
22+
*/
23+
protected static $xmlName = 'orders';
24+
}

0 commit comments

Comments
 (0)