Skip to content

Commit e11b5b8

Browse files
Add REST API endpoints for Channable orders and returns
Adds searchable REST API endpoints: - GET /V1/channable/orders with searchCriteria support - GET /V1/channable/returns with searchCriteria support Includes E2E tests for both endpoints covering filtered queries, unfiltered listing, DTO shape validation, and auth rejection.
1 parent db92568 commit e11b5b8

21 files changed

Lines changed: 983 additions & 6 deletions

Api/Order/Data/SearchResultsInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ interface SearchResultsInterface extends FrameworkSearchResultsInterface
2020
/**
2121
* Gets Code Items.
2222
*
23-
* @return ChannableOrderData[]
23+
* @return \Magmodules\Channable\Api\Order\Data\DataInterface[]
2424
*/
2525
public function getItems(): array;
2626

2727
/**
2828
* Sets Code Items.
2929
*
30-
* @param ChannableOrderData[] $items
30+
* @param \Magmodules\Channable\Api\Order\Data\DataInterface[] $items
3131
* @return $this
3232
*/
3333
public function setItems(array $items): self;

Api/Order/ItemInterface.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Order;
9+
10+
/**
11+
* Flat DTO for a single Channable order record (API-safe).
12+
*
13+
* @api
14+
*/
15+
interface ItemInterface
16+
{
17+
/**
18+
* @return int
19+
*/
20+
public function getEntityId(): int;
21+
22+
/**
23+
* @return int
24+
*/
25+
public function getChannableId(): int;
26+
27+
/**
28+
* @return string|null
29+
*/
30+
public function getChannelId(): ?string;
31+
32+
/**
33+
* @return string|null
34+
*/
35+
public function getChannelName(): ?string;
36+
37+
/**
38+
* @return string|null
39+
*/
40+
public function getChannelLabel(): ?string;
41+
42+
/**
43+
* @return int|null
44+
*/
45+
public function getMagentoOrderId(): ?int;
46+
47+
/**
48+
* @return string|null
49+
*/
50+
public function getMagentoIncrementId(): ?string;
51+
52+
/**
53+
* @return int
54+
*/
55+
public function getStoreId(): int;
56+
57+
/**
58+
* @return string|null
59+
*/
60+
public function getStatus(): ?string;
61+
62+
/**
63+
* @return string|null
64+
*/
65+
public function getChannableOrderStatus(): ?string;
66+
67+
/**
68+
* @return string|null
69+
*/
70+
public function getCreatedAt(): ?string;
71+
72+
/**
73+
* @return string|null
74+
*/
75+
public function getUpdatedAt(): ?string;
76+
}

Api/Order/SearchInterface.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Order;
9+
10+
use Magento\Framework\Api\SearchCriteriaInterface;
11+
12+
/**
13+
* REST API interface for searching Channable orders.
14+
*
15+
* @api
16+
*/
17+
interface SearchInterface
18+
{
19+
/**
20+
* Search Channable orders by criteria.
21+
*
22+
* Returns a flat list of order records with channel identifiers
23+
* and linked Magento order references.
24+
*
25+
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
26+
* @return \Magmodules\Channable\Api\Order\SearchResultInterface
27+
*/
28+
public function getList(SearchCriteriaInterface $searchCriteria): SearchResultInterface;
29+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Order;
9+
10+
/**
11+
* Search result for Channable orders API.
12+
*
13+
* @api
14+
*/
15+
interface SearchResultInterface
16+
{
17+
/**
18+
* @return \Magmodules\Channable\Api\Order\ItemInterface[]
19+
*/
20+
public function getItems(): array;
21+
22+
/**
23+
* @param \Magmodules\Channable\Api\Order\ItemInterface[] $items
24+
* @return $this
25+
*/
26+
public function setItems(array $items): self;
27+
28+
/**
29+
* @return int
30+
*/
31+
public function getTotalCount(): int;
32+
33+
/**
34+
* @param int $totalCount
35+
* @return $this
36+
*/
37+
public function setTotalCount(int $totalCount): self;
38+
39+
/**
40+
* @return \Magento\Framework\Api\SearchCriteriaInterface
41+
*/
42+
public function getSearchCriteria(): \Magento\Framework\Api\SearchCriteriaInterface;
43+
44+
/**
45+
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
46+
* @return $this
47+
*/
48+
public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria): self;
49+
}

Api/Returns/Data/SearchResultsInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ interface SearchResultsInterface extends FrameworkSearchResultsInterface
2020
/**
2121
* Gets Code Items.
2222
*
23-
* @return ChannableReturnsData[]
23+
* @return \Magmodules\Channable\Api\Returns\Data\DataInterface[]
2424
*/
2525
public function getItems(): array;
2626

2727
/**
2828
* Sets Code Items.
2929
*
30-
* @param ChannableReturnsData[] $items
30+
* @param \Magmodules\Channable\Api\Returns\Data\DataInterface[] $items
3131
*
3232
* @return $this
3333
*/

Api/Returns/ItemInterface.php

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Returns;
9+
10+
/**
11+
* Flat DTO for a single Channable return record (API-safe).
12+
*
13+
* @api
14+
*/
15+
interface ItemInterface
16+
{
17+
/**
18+
* @return int
19+
*/
20+
public function getEntityId(): int;
21+
22+
/**
23+
* @return int
24+
*/
25+
public function getChannableId(): int;
26+
27+
/**
28+
* @return string|null
29+
*/
30+
public function getChannelId(): ?string;
31+
32+
/**
33+
* @return string|null
34+
*/
35+
public function getChannelName(): ?string;
36+
37+
/**
38+
* @return string|null
39+
*/
40+
public function getChannelReturnId(): ?string;
41+
42+
/**
43+
* @return string|null
44+
*/
45+
public function getChannelOrderId(): ?string;
46+
47+
/**
48+
* @return string|null
49+
*/
50+
public function getChannelOrderIdInternal(): ?string;
51+
52+
/**
53+
* @return string|null
54+
*/
55+
public function getPlatformOrderId(): ?string;
56+
57+
/**
58+
* @return int|null
59+
*/
60+
public function getMagentoOrderId(): ?int;
61+
62+
/**
63+
* @return string|null
64+
*/
65+
public function getMagentoIncrementId(): ?string;
66+
67+
/**
68+
* @return int|null
69+
*/
70+
public function getMagentoCreditmemoId(): ?int;
71+
72+
/**
73+
* @return string|null
74+
*/
75+
public function getMagentoCreditmemoIncrementId(): ?string;
76+
77+
/**
78+
* @return string|null
79+
*/
80+
public function getCustomerName(): ?string;
81+
82+
/**
83+
* @return string|null
84+
*/
85+
public function getReason(): ?string;
86+
87+
/**
88+
* @return string|null
89+
*/
90+
public function getComment(): ?string;
91+
92+
/**
93+
* @return string|null
94+
*/
95+
public function getStatus(): ?string;
96+
97+
/**
98+
* @return int
99+
*/
100+
public function getStoreId(): int;
101+
102+
/**
103+
* @return string|null
104+
*/
105+
public function getCreatedAt(): ?string;
106+
107+
/**
108+
* @return string|null
109+
*/
110+
public function getUpdatedAt(): ?string;
111+
}

Api/Returns/SearchInterface.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Returns;
9+
10+
use Magento\Framework\Api\SearchCriteriaInterface;
11+
12+
/**
13+
* REST API interface for searching Channable returns.
14+
*
15+
* @api
16+
*/
17+
interface SearchInterface
18+
{
19+
/**
20+
* Search Channable returns by criteria.
21+
*
22+
* Returns a flat list of return records with channel identifiers
23+
* and linked Magento order/creditmemo references.
24+
*
25+
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
26+
* @return \Magmodules\Channable\Api\Returns\SearchResultInterface
27+
*/
28+
public function getList(SearchCriteriaInterface $searchCriteria): SearchResultInterface;
29+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magmodules.eu. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magmodules\Channable\Api\Returns;
9+
10+
/**
11+
* Search result for Channable returns API.
12+
*
13+
* @api
14+
*/
15+
interface SearchResultInterface
16+
{
17+
/**
18+
* @return \Magmodules\Channable\Api\Returns\ItemInterface[]
19+
*/
20+
public function getItems(): array;
21+
22+
/**
23+
* @param \Magmodules\Channable\Api\Returns\ItemInterface[] $items
24+
* @return $this
25+
*/
26+
public function setItems(array $items): self;
27+
28+
/**
29+
* @return int
30+
*/
31+
public function getTotalCount(): int;
32+
33+
/**
34+
* @param int $totalCount
35+
* @return $this
36+
*/
37+
public function setTotalCount(int $totalCount): self;
38+
39+
/**
40+
* @return \Magento\Framework\Api\SearchCriteriaInterface
41+
*/
42+
public function getSearchCriteria(): \Magento\Framework\Api\SearchCriteriaInterface;
43+
44+
/**
45+
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
46+
* @return $this
47+
*/
48+
public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria): self;
49+
}

0 commit comments

Comments
 (0)