diff --git a/src/Resources/AffiliateSeller.php b/src/Resources/AffiliateSeller.php index 48b5d49..cb3f6d6 100644 --- a/src/Resources/AffiliateSeller.php +++ b/src/Resources/AffiliateSeller.php @@ -93,4 +93,107 @@ public function searchCreatorOnMarketplace($query = [], $body = []) RequestOptions::JSON => $body, ], 202406); } + + public function generateAffiliateProductPromotionLink($product_id) + { + return $this->call('POST', 'products/'.$product_id.'/promotion_link/generate'); + } + + public function searchSampleApplicationsFulfillments($application_id, $body = []) + { + return $this->call('POST', 'sample_applications/'.$application_id.'/fulfillments/search', [ + RequestOptions::JSON => $body, + ], 202409); + } + + public function reviewSampleApplications($application_id, $review_result, $reject_reason = '') + { + return $this->call('POST', 'sample_applications/'.$application_id.'/review', [ + RequestOptions::JSON => [ + 'review_result' => $review_result, + 'reject_reason' => $reject_reason, + ], + ], 202409); + } + + public function getOpenCollaborationSampleRules($product_ids) + { + return $this->call('GET', 'open_collaborations/sample_rules', [ + RequestOptions::QUERY => [ + 'product_ids' => static::dataTypeCast('array', $product_ids), + ], + ], 202410); + } + + public function searchSampleApplications($query = [], $body = []) + { + $query = array_merge([ + 'page_size' => 20, + ], $query); + + return $this->call('POST', 'sample_applications/search', [ + RequestOptions::QUERY => $query, + RequestOptions::JSON => $body, + ], 202409); + } + + public function editOpenCollaborationSampleRule($body = []) + { + return $this->call('POST', 'open_collaborations/sample_rules', [ + RequestOptions::JSON => $body, + ], 202410); + } + + public function removeTargetCollaboration($target_collaboration_id) + { + return $this->call('DELETE', 'target_collaborations/'.$target_collaboration_id, + [], 202409); + } + + public function queryTargetCollaborationDetail($target_collaboration_id) + { + return $this->call('GET', 'target_collaborations/'.$target_collaboration_id, + [], 202409); + } + + public function searchTargetCollaborations($query = [], $body = []) + { + $query = array_merge([ + 'page_size' => 20, + ], $query); + + return $this->call('POST', 'target_collaborations/search', [ + RequestOptions::QUERY => $query, + RequestOptions::JSON => $body, + ], 202409); + } + + public function updateTargetCollaboration($target_collaboration_id, $body) + { + return $this->call('PUT', 'target_collaborations/'.$target_collaboration_id, [ + RequestOptions::JSON => $body, + ], 202409); + } + + public function searchOpenCollaboration($query = [], $body = []) + { + $query = array_merge([ + 'page_size' => 20, + ], $query); + + return $this->call('POST', 'open_collaborations/search', [ + RequestOptions::QUERY => $query, + RequestOptions::JSON => $body, + ], 202409); + } + + public function getOpenCollaborationSettings() + { + return $this->call('GET', 'open_collaboration_settings', [], 202409); + } + + public function removeOpenCollaboration($product_id) + { + return $this->call('DELETE', 'open_collaborations/products/'.$product_id, [], 202409); + } } diff --git a/src/Resources/Fulfillment.php b/src/Resources/Fulfillment.php index e6afb8c..efdf49c 100644 --- a/src/Resources/Fulfillment.php +++ b/src/Resources/Fulfillment.php @@ -153,7 +153,7 @@ public function splitOrders($order_id, $splittable_groups) return $this->call('POST', 'orders/'.$order_id.'/split', [ RequestOptions::JSON => [ 'order_id' => $order_id, - 'splittable_groups' => static::dataTypeCast('array', $splittable_groups), + 'splittable_groups' => $splittable_groups, ], ]); } diff --git a/tests/Resources/AffiliateSellerTest.php b/tests/Resources/AffiliateSellerTest.php index e42e94f..b093378 100644 --- a/tests/Resources/AffiliateSellerTest.php +++ b/tests/Resources/AffiliateSellerTest.php @@ -67,4 +67,82 @@ public function testSearchCreatorOnMarketplace() $this->caller->searchCreatorOnMarketplace(); $this->assertPreviousRequest('POST', 'affiliate_seller/202406/marketplace_creators/search'); } + + public function testGenerateAffiliateProductPromotionLink() + { + $this->caller->generateAffiliateProductPromotionLink(1); + $this->assertPreviousRequest('POST', 'affiliate_seller/'.self::TEST_API_VERSION.'/products/1/promotion_link/generate'); + } + + public function testSearchSampleApplicationsFulfillments() + { + $this->caller->searchSampleApplicationsFulfillments(1); + $this->assertPreviousRequest('POST', 'affiliate_seller/202409/sample_applications/1/fulfillments/search'); + } + + public function testReviewSampleApplications() + { + $this->caller->reviewSampleApplications(1, '', ''); + $this->assertPreviousRequest('POST', 'affiliate_seller/202409/sample_applications/1/review'); + } + + public function testGetOpenCollaborationSampleRules() + { + $this->caller->getOpenCollaborationSampleRules([]); + $this->assertPreviousRequest('GET', 'affiliate_seller/202410/open_collaborations/sample_rules'); + } + + public function testSearchSampleApplications() + { + $this->caller->searchSampleApplications(); + $this->assertPreviousRequest('POST', 'affiliate_seller/202409/sample_applications/search'); + } + + public function testEditOpenCollaborationSampleRule() + { + $this->caller->editOpenCollaborationSampleRule([]); + $this->assertPreviousRequest('POST', 'affiliate_seller/202410/open_collaborations/sample_rules'); + } + + public function testRemoveTargetCollaboration() + { + $this->caller->removeTargetCollaboration(1); + $this->assertPreviousRequest('DELETE', 'affiliate_seller/202409/target_collaborations/1'); + } + + public function testQueryTargetCollaborationDetail() + { + $this->caller->queryTargetCollaborationDetail(1); + $this->assertPreviousRequest('GET', 'affiliate_seller/202409/target_collaborations/1'); + } + + public function testSearchTargetCollaborations() + { + $this->caller->searchTargetCollaborations(); + $this->assertPreviousRequest('POST', 'affiliate_seller/202409/target_collaborations/search'); + } + + public function testUpdateTargetCollaboration() + { + $this->caller->updateTargetCollaboration(1, []); + $this->assertPreviousRequest('PUT', 'affiliate_seller/202409/target_collaborations/1'); + } + + public function testSearchOpenCollaboration() + { + $this->caller->searchOpenCollaboration(); + $this->assertPreviousRequest('POST', 'affiliate_seller/202409/open_collaborations/search'); + } + + public function testGetOpenCollaborationSettings() + { + $this->caller->getOpenCollaborationSettings(); + $this->assertPreviousRequest('GET', 'affiliate_seller/202409/open_collaboration_settings'); + } + + public function testRemoveOpenCollaboration() + { + $this->caller->removeOpenCollaboration(1); + $this->assertPreviousRequest('DELETE', 'affiliate_seller/202409/open_collaborations/products/1'); + } }