@@ -47,12 +47,21 @@ public function __construct(
4747 * @param int $pageSize
4848 * @param int $sinceId
4949 * @param string|null $storeId
50+ * @param string|null $lastUpdatedFrom
51+ * @param string|null $lastUpdatedTo
5052 *
5153 * @return RefundsApiResponseInterface
5254 * @throws WebApiException
5355 */
54- public function get (int $ page , int $ pageSize , int $ sinceId = 0 , string $ storeId = null ): RefundsApiResponseInterface
55- {
56+ public function get (
57+ int $ page ,
58+ int $ pageSize ,
59+ int $ sinceId = 0 ,
60+ string $ storeId = null ,
61+ string $ lastUpdatedFrom = null ,
62+ string $ lastUpdatedTo = null
63+ ): RefundsApiResponseInterface {
64+
5665 if (empty ($ storeId )) {
5766 throw new WebApiException (__ ('Store ID is required ' ));
5867 }
@@ -61,6 +70,7 @@ public function get(int $page, int $pageSize, int $sinceId = 0, string $storeId
6170 ->initCollection ()
6271 ->filterStore ($ storeId )
6372 ->filterSinceId ($ sinceId )
73+ ->filterLastUpdated ($ lastUpdatedFrom , $ lastUpdatedTo )
6474 ->setPage ($ page , $ pageSize );
6575
6676 return $ this ->responseFactory
@@ -119,6 +129,27 @@ private function filterSinceId(int $sinceId = 0): RefundsApi
119129 return $ this ;
120130 }
121131
132+ /**
133+ * Filter last updated at
134+ *
135+ * @param string|null $lastUpdatedFrom
136+ * @param string|null $lastUpdatedTo
137+ *
138+ * @return RefundsApi
139+ */
140+ private function filterLastUpdated (?string $ lastUpdatedFrom = null , ?string $ lastUpdatedTo = null ): RefundsApi
141+ {
142+ if ($ lastUpdatedFrom ) {
143+ $ this ->creditmemoCollection ->addFieldToFilter ('updated_at ' , ['gteq ' => $ lastUpdatedFrom ]);
144+ }
145+
146+ if ($ lastUpdatedTo ) {
147+ $ this ->creditmemoCollection ->addFieldToFilter ('updated_at ' , ['lteq ' => $ lastUpdatedTo ]);
148+ }
149+
150+ return $ this ;
151+ }
152+
122153 /**
123154 * SetPage
124155 *
0 commit comments