diff --git a/src/Client/TradeTrackerClient.php b/src/Client/TradeTrackerClient.php index e77e579..55ebe36 100644 --- a/src/Client/TradeTrackerClient.php +++ b/src/Client/TradeTrackerClient.php @@ -3,44 +3,9 @@ namespace Hypeit\TradeTracker\Client; use Hypeit\TradeTracker\Exception\AuthenticationException; -use Hypeit\TradeTracker\Filter\AffiliateSiteFilter; -use Hypeit\TradeTracker\Filter\CampaignFilter; -use Hypeit\TradeTracker\Filter\CampaignNewsItemFilter; -use Hypeit\TradeTracker\Filter\ClickTransactionFilter; -use Hypeit\TradeTracker\Filter\ConversionTransactionFilter; -use Hypeit\TradeTracker\Filter\FeedFilter; -use Hypeit\TradeTracker\Filter\ReportAffiliateSiteFilter; -use Hypeit\TradeTracker\Filter\ReportCampaignFilter; -use Hypeit\TradeTracker\Filter\ReportReferenceFilter; -use Hypeit\TradeTracker\Mapper\AffiliateSiteCategoryMapper; -use Hypeit\TradeTracker\Mapper\AffiliateSiteTypeMapper; -use Hypeit\TradeTracker\Mapper\CampaignCategoryMapper; -use Hypeit\TradeTracker\Mapper\CampaignCommissionExtendedMapper; -use Hypeit\TradeTracker\Mapper\CampaignMapper; -use Hypeit\TradeTracker\Mapper\CampaignNewsItemMapper; -use Hypeit\TradeTracker\Mapper\ClickTransactionMapper; -use Hypeit\TradeTracker\Mapper\ConversionTransactionMapper; -use Hypeit\TradeTracker\Mapper\FeedMapper; -use Hypeit\TradeTracker\Mapper\MapperInterface; -use Hypeit\TradeTracker\Mapper\AffiliateSiteMapper; -use Hypeit\TradeTracker\Mapper\ReportCampaignMapper; -use Hypeit\TradeTracker\Mapper\ReportDataMapper; -use Hypeit\TradeTracker\Mapper\ReportReferenceMapper; -use Hypeit\TradeTracker\Model\AffiliateSite; -use Hypeit\TradeTracker\Model\AffiliateSiteCategory; -use Hypeit\TradeTracker\Model\AffiliateSiteType; -use Hypeit\TradeTracker\Model\Authenticate; -use Hypeit\TradeTracker\Model\Campaign; -use Hypeit\TradeTracker\Model\CampaignCategory; -use Hypeit\TradeTracker\Model\CampaignCommissionExtended; -use Hypeit\TradeTracker\Model\CampaignNewsItem; -use Hypeit\TradeTracker\Model\CampaignSubscriptionAction; -use Hypeit\TradeTracker\Model\ClickTransaction; -use Hypeit\TradeTracker\Model\ConversionTransaction; -use Hypeit\TradeTracker\Model\Feed; -use Hypeit\TradeTracker\Model\ReportCampaign; -use Hypeit\TradeTracker\Model\ReportData; -use Hypeit\TradeTracker\Model\ReportReference; +use Hypeit\TradeTracker\Filter; +use Hypeit\TradeTracker\Mapper; +use Hypeit\TradeTracker\Model; class TradeTrackerClient { @@ -52,13 +17,13 @@ class TradeTrackerClient /** * TradeTrackerClient constructor. * - * @param string $wsdl - * @param Authenticate $authenticate - * @param array|null $options + * @param string $wsdl The wsdl url of the service. + * @param Model\Authenticate $authenticate The model used to authenticate. + * @param array|null $options The options used for the client. * * @throws AuthenticationException */ - public function __construct(string $wsdl, Authenticate $authenticate, array $options = null) + public function __construct(string $wsdl, Model\Authenticate $authenticate, array $options = null) { if (null === $options) { $options = array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP); @@ -71,11 +36,11 @@ public function __construct(string $wsdl, Authenticate $authenticate, array $opt /** * Connect and authenticate to initialize the client. * - * @param Authenticate $authenticate + * @param Model\Authenticate $authenticate * * @throws AuthenticationException */ - private function connect(Authenticate $authenticate) + private function connect(Model\Authenticate $authenticate) { try { $this->client->authenticate( @@ -86,11 +51,22 @@ private function connect(Authenticate $authenticate) $authenticate->isDemo() ); } catch (\Exception $exception) { - throw new AuthenticationException('Failed to authenticate.'); + throw new AuthenticationException( + sprintf('Failed to authenticate with message "%s".', $exception->getMessage()) + ); } } - private function execute($method, MapperInterface $mapper, array $arguments = array()) + /** + * Executes the api method call. + * + * @param string $method The api method to call. + * @param Mapper\MapperInterface $mapper The mapper required to map the values. + * @param array $arguments The arguments used with the method call. + * + * @return array + */ + private function execute($method, Mapper\MapperInterface $mapper, array $arguments = array()) { $data = []; $items = call_user_func_array(array($this->client, $method), $arguments); @@ -107,64 +83,76 @@ private function execute($method, MapperInterface $mapper, array $arguments = ar } /** - * @param AffiliateSiteFilter|null $filter + * Returns a list of available affiliate sites linked to your account. * - * @return AffiliateSite[] + * @param Filter\AffiliateSiteFilter|null $filter To filter the results. + * + * @return Model\AffiliateSite[] */ - public function getAffiliateSites(AffiliateSiteFilter $filter = null) + public function getAffiliateSites(Filter\AffiliateSiteFilter $filter = null) { - return $this->execute(__FUNCTION__, new AffiliateSiteMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\AffiliateSiteMapper(), [ $filter, ]); } /** - * @return AffiliateSiteType[] + * Returns a list of affiliate site types. + * + * @return Model\AffiliateSiteType[] */ public function getAffiliateSiteTypes() { - return $this->execute(__FUNCTION__, new AffiliateSiteTypeMapper()); + return $this->execute(__FUNCTION__, new Mapper\AffiliateSiteTypeMapper()); } /** - * @return AffiliateSiteCategory[] + * Returns a list of affiliate site categories. + * + * @return Model\AffiliateSiteCategory[] */ public function getAffiliateSiteCategories() { - return $this->execute(__FUNCTION__, new AffiliateSiteCategoryMapper()); + return $this->execute(__FUNCTION__, new Mapper\AffiliateSiteCategoryMapper()); } /** - * @param int $affiliateSiteId - * @param CampaignFilter|null $filter + * Returns a list of available campaigns for the given affiliate site. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\CampaignFilter|null $filter To filter the results. * - * @return Campaign[] + * @return Model\Campaign[] */ - public function getCampaigns(int $affiliateSiteId, CampaignFilter $filter = null) + public function getCampaigns(int $affiliateSiteId, Filter\CampaignFilter $filter = null) { - return $this->execute(__FUNCTION__, new CampaignMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\CampaignMapper(), [ $affiliateSiteId, $filter, ]); } /** - * @return CampaignCategory[] + * Returns the available campaign categories. + * + * @return Model\CampaignCategory[] */ public function getCampaignCategories() { - return $this->execute(__FUNCTION__, new CampaignCategoryMapper()); + return $this->execute(__FUNCTION__, new Mapper\CampaignCategoryMapper()); } /** - * @param int $affiliateSiteId - * @param int $campaignId + * Returns a extended commission information for the given campaign. + * + * @param int $affiliateSiteId The affiliate site. + * @param int $campaignId The campaign. * - * @return CampaignCommissionExtended + * @return Model\CampaignCommissionExtended */ public function getCampaignCommissionExtended(int $affiliateSiteId, int $campaignId) { - $data = $this->execute(__FUNCTION__, new CampaignCommissionExtendedMapper(), [ + $data = $this->execute(__FUNCTION__, new Mapper\CampaignCommissionExtendedMapper(), [ $affiliateSiteId, $campaignId, ]); @@ -173,73 +161,103 @@ public function getCampaignCommissionExtended(int $affiliateSiteId, int $campaig } /** - * @param int $affiliateSiteId - * @param int $campaignId - * @param string $action + * Change the campaign subscription. + * + * @param int $affiliateSiteId The affiliate site. + * @param int $campaignId The campaign. + * @param string $action The subscription action + * + * @see CampaignSubscriptionAction * * @return void */ public function changeCampaignSubscription( int $affiliateSiteId, int $campaignId, - string $action = CampaignSubscriptionAction::SUBSCRIBE + string $action = Model\CampaignSubscriptionAction::SUBSCRIBE ) { $this->client->changeCampaignSubscription( $affiliateSiteId, $campaignId, - new CampaignSubscriptionAction($action) + new Model\CampaignSubscriptionAction($action) ); } /** - * @param CampaignNewsItemFilter|null $filter + * Return the campaign news items. + * + * @param Filter\CampaignNewsItemFilter|null $filter To filter the results. * - * @return CampaignNewsItem[] + * @return Model\CampaignNewsItem[] */ - public function getCampaignNewsItems(CampaignNewsItemFilter $filter = null) + public function getCampaignNewsItems(Filter\CampaignNewsItemFilter $filter = null) { - return $this->execute(__FUNCTION__, new CampaignNewsItemMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\CampaignNewsItemMapper(), [ $filter, ]); } /** - * @param int $affiliateSiteId - * @param ClickTransactionFilter $filter + * Returns the click transactions for the affiliate site. * - * @return ClickTransaction[] + * @param int $affiliateSiteId The affiliate site. + * @param Filter\ClickTransactionFilter $filter To filter the results. + * + * @return Model\ClickTransaction[] */ - public function getClickTransactions(int $affiliateSiteId, ClickTransactionFilter $filter = null) + public function getClickTransactions(int $affiliateSiteId, Filter\ClickTransactionFilter $filter = null) { - return $this->execute(__FUNCTION__, new ClickTransactionMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\ClickTransactionMapper(), [ $affiliateSiteId, $filter, ]); } /** - * @param int $affiliateSiteId - * @param ConversionTransactionFilter|null $filter + * Returns the conversion transactions for the affiliate site. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\ConversionTransactionFilter|null $filter To filter the results. * - * @return ConversionTransaction[] + * @return Model\ConversionTransaction[] */ - public function getConversionTransactions(int $affiliateSiteId, ConversionTransactionFilter $filter = null) + public function getConversionTransactions(int $affiliateSiteId, Filter\ConversionTransactionFilter $filter = null) { - return $this->execute(__FUNCTION__, new ConversionTransactionMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\ConversionTransactionMapper(), [ $affiliateSiteId, $filter, ]); } /** - * @param int $affiliateSiteId - * @param ReportAffiliateSiteFilter|null $filter + * Creates a conversion transaction for the affiliate site. + * Permissions needed to execute this call. + * + * @param Model\TransactionType $transactionType The transaction type. + * @param int $affiliateSiteId The affiliate site. + * @param Model\CreateConversionTransactionOptions $options Transaction options. + * + * @return int + */ + public function createConversionTransaction( + Model\TransactionType $transactionType, + int $affiliateSiteId, + Model\CreateConversionTransactionOptions $options + ) { + return $this->client->createConversionTransaction($transactionType->getType(), $affiliateSiteId, $options); + } + + /** + * Returns a report for the given affiliate site. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\ReportAffiliateSiteFilter|null $filter To filter the results. * - * @return ReportData + * @return Model\ReportData */ - public function getReportAffiliateSite(int $affiliateSiteId, ReportAffiliateSiteFilter $filter = null) + public function getReportAffiliateSite(int $affiliateSiteId, Filter\ReportAffiliateSiteFilter $filter = null) { - $data = $this->execute(__FUNCTION__, new ReportDataMapper(), [ + $data = $this->execute(__FUNCTION__, new Mapper\ReportDataMapper(), [ $affiliateSiteId, $filter, ]); @@ -248,14 +266,16 @@ public function getReportAffiliateSite(int $affiliateSiteId, ReportAffiliateSite } /** - * @param int $affiliateSiteId - * @param ReportCampaignFilter $filter + * Returns a report for the given campaign. * - * @return ReportCampaign + * @param int $affiliateSiteId The affiliate site. + * @param Filter\ReportCampaignFilter $filter To filter the results. + * + * @return Model\ReportCampaign */ - public function getReportCampaign(int $affiliateSiteId, ReportCampaignFilter $filter) + public function getReportCampaign(int $affiliateSiteId, Filter\ReportCampaignFilter $filter) { - $data = $this->execute(__FUNCTION__, new ReportCampaignMapper(), [ + $data = $this->execute(__FUNCTION__, new Mapper\ReportCampaignMapper(), [ $affiliateSiteId, $filter, ]); @@ -264,14 +284,16 @@ public function getReportCampaign(int $affiliateSiteId, ReportCampaignFilter $fi } /** - * @param int $affiliateSiteId - * @param ReportReferenceFilter $filter + * Returns a report reference. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\ReportReferenceFilter $filter To filter the results. * - * @return ReportReference + * @return Model\ReportReference */ - public function getReportReference(int $affiliateSiteId, ReportReferenceFilter $filter) + public function getReportReference(int $affiliateSiteId, Filter\ReportReferenceFilter $filter) { - $data = $this->execute(__FUNCTION__, new ReportReferenceMapper(), [ + $data = $this->execute(__FUNCTION__, new Mapper\ReportReferenceMapper(), [ $affiliateSiteId, $filter ]); @@ -280,16 +302,92 @@ public function getReportReference(int $affiliateSiteId, ReportReferenceFilter $ } /** - * @param int $affiliateSiteId - * @param FeedFilter|null $filter + * Returns the available feeds. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\FeedFilter|null $filter To filter the results. + * + * @return Model\Feed[] + */ + public function getFeeds(int $affiliateSiteId, Filter\FeedFilter $filter = null) + { + return $this->execute(__FUNCTION__, new Mapper\FeedMapper(), [ + $affiliateSiteId, + $filter, + ]); + } + + /** + * Returns the available feed categories. + * + * @param int $affiliateSiteId The affiliate site. + * @param int $feedId The feed id. + * + * @return Model\FeedCategory[] + */ + public function getFeedProductCategories(int $affiliateSiteId, int $feedId) + { + return $this->execute(__FUNCTION__, new Mapper\FeedCategoryMapper(), [ + $affiliateSiteId, + $feedId, + ]); + } + + /** + * Returns the available feed products. + * + * @param int $affiliateSiteId The affiliate site. + * @param Filter\FeedProductFilter|null $filter To filter the results. * - * @return Feed[] + * @return Model\FeedProduct[] */ - public function getFeeds(int $affiliateSiteId, FeedFilter $filter = null) + public function getFeedProducts(int $affiliateSiteId, Filter\FeedProductFilter $filter = null) { - return $this->execute(__FUNCTION__, new FeedMapper(), [ + return $this->execute(__FUNCTION__, new Mapper\FeedProductMapper(), [ $affiliateSiteId, $filter, ]); } -} \ No newline at end of file + + /** + * Returns a list of payments linked to your account. + * + * @param Filter\PaymentFilter|null $filter To filter the results. + * + * @return Model\Payment[] + */ + public function getPayments(Filter\PaymentFilter $filter = null) + { + return $this->execute(__FUNCTION__, new Mapper\PaymentMapper(), [ + $filter, + ]); + } + + /** + * Returns a list of attributions per affiliate site. + * + * @param int $conversionTransactionId The conversion transaction id. + * + * @return Model\Attribution[] + */ + public function getAttributions(int $conversionTransactionId) + { + return $this->execute(__FUNCTION__, new Mapper\AttributionMapper(), [ + $conversionTransactionId, + ]); + } + + /** + * Returns a list of touch points. + * + * @param int $conversionTransactionId The conversion transaction id. + * + * @return Model\Touchpoint[] + */ + public function getTouchpoints(int $conversionTransactionId) + { + return $this->execute(__FUNCTION__, new Mapper\TouchpointMapper(), [ + $conversionTransactionId, + ]); + } +} diff --git a/src/Exception/AuthenticationException.php b/src/Exception/AuthenticationException.php index fd7de9d..afed3f5 100644 --- a/src/Exception/AuthenticationException.php +++ b/src/Exception/AuthenticationException.php @@ -5,4 +5,4 @@ class AuthenticationException extends \Exception { -} \ No newline at end of file +} diff --git a/src/Filter/AffiliateSiteFilter.php b/src/Filter/AffiliateSiteFilter.php index 205d8d8..afd72c7 100644 --- a/src/Filter/AffiliateSiteFilter.php +++ b/src/Filter/AffiliateSiteFilter.php @@ -217,4 +217,4 @@ public function setExcludeInfo(bool $excludeInfo) { $this->excludeInfo = $excludeInfo; } -} \ No newline at end of file +} diff --git a/src/Filter/CampaignFilter.php b/src/Filter/CampaignFilter.php index fc6e45b..4f2812b 100644 --- a/src/Filter/CampaignFilter.php +++ b/src/Filter/CampaignFilter.php @@ -282,4 +282,4 @@ public function setExcludeInfo(bool $excludeInfo) { $this->excludeInfo = $excludeInfo; } -} \ No newline at end of file +} diff --git a/src/Filter/CampaignNewsItemFilter.php b/src/Filter/CampaignNewsItemFilter.php index 4e898f3..59c5c8f 100644 --- a/src/Filter/CampaignNewsItemFilter.php +++ b/src/Filter/CampaignNewsItemFilter.php @@ -131,4 +131,4 @@ public function setOffset($offset) { $this->offset = $offset; } -} \ No newline at end of file +} diff --git a/src/Filter/ClickTransactionFilter.php b/src/Filter/ClickTransactionFilter.php index 4727130..c23de96 100644 --- a/src/Filter/ClickTransactionFilter.php +++ b/src/Filter/ClickTransactionFilter.php @@ -152,4 +152,4 @@ public function setOffset($offset) { $this->offset = $offset; } -} \ No newline at end of file +} diff --git a/src/Filter/FeedFilter.php b/src/Filter/FeedFilter.php index a0d3a91..21b1bfb 100644 --- a/src/Filter/FeedFilter.php +++ b/src/Filter/FeedFilter.php @@ -83,7 +83,7 @@ public function getAssignmentStatus() /** * @param string $assignmentStatus */ - public function setAssignmentStatus$assignmentStatus) + public function setAssignmentStatus($assignmentStatus) { $this->assignmentStatus = $assignmentStatus; } diff --git a/src/Filter/FeedProductFilter.php b/src/Filter/FeedProductFilter.php new file mode 100644 index 0000000..e22cd1c --- /dev/null +++ b/src/Filter/FeedProductFilter.php @@ -0,0 +1,195 @@ +feedID; + } + + /** + * @param $feedID + */ + public function setFeedId($feedID) + { + $this->feedID = $feedID; + } + + /** + * @return string + */ + public function getFeedCategoryName() + { + return $this->feedCategoryName; + } + + /** + * @param $feedCategoryName + */ + public function setFeedCategoryName($feedCategoryName) + { + $this->feedCategoryName = $feedCategoryName; + } + + /** + * @return int + */ + public function getCampaignId() + { + return $this->campaignID; + } + + /** + * @param $campaignID + */ + public function setCampaignId($campaignID) + { + $this->campaignID = $campaignID; + } + + /** + * @return int + */ + public function getCampaignCategoryId() + { + return $this->campaignCategoryID; + } + + /** + * @param $campaignCategoryID + */ + public function setCampaignCategoryId($campaignCategoryID) + { + $this->campaignCategoryID = $campaignCategoryID; + } + + /** + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * @param $query + */ + public function setQuery($query) + { + $this->query = $query; + } + + /** + * @return float + */ + public function getPriceFrom() + { + return $this->priceFrom; + } + + /** + * @param $priceFrom + */ + public function setPriceFrom($priceFrom) + { + $this->priceFrom = $priceFrom; + } + + /** + * @return float + */ + public function getPriceTo() + { + return $this->priceTo; + } + + /** + * @param $priceTo + */ + public function setPriceTo($priceTo) + { + $this->priceTo = $priceTo; + } + + /** + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * @param $limit + */ + public function setLimit($limit) + { + $this->limit = $limit; + } + + /** + * @return int + */ + public function getOffset() + { + return $this->offset; + } + + /** + * @param $offset + */ + public function setOffset($offset) + { + $this->offset = $offset; + } +} diff --git a/src/Filter/PaymentFilter.php b/src/Filter/PaymentFilter.php new file mode 100644 index 0000000..a53b77e --- /dev/null +++ b/src/Filter/PaymentFilter.php @@ -0,0 +1,48 @@ +billDateFrom; + } + + /** + * @param string $billDateFrom + */ + public function setBillDateFrom($billDateFrom) + { + $this->billDateFrom = $billDateFrom; + } + + /** + * @return string + */ + public function getBillDateTo() + { + return $this->billDateTo; + } + + /** + * @param string $billDateTo + */ + public function setBillDateTo($billDateTo) + { + $this->billDateTo = $billDateTo; + } +} diff --git a/src/Filter/ReportAffiliateSiteFilter.php b/src/Filter/ReportAffiliateSiteFilter.php index b9e5cf4..8c83d11 100644 --- a/src/Filter/ReportAffiliateSiteFilter.php +++ b/src/Filter/ReportAffiliateSiteFilter.php @@ -45,4 +45,4 @@ public function setDateTo($dateTo) { $this->dateTo = $dateTo; } -} \ No newline at end of file +} diff --git a/src/Mapper/AffiliateSiteCategoryMapper.php b/src/Mapper/AffiliateSiteCategoryMapper.php index 4d6d338..7deab19 100644 --- a/src/Mapper/AffiliateSiteCategoryMapper.php +++ b/src/Mapper/AffiliateSiteCategoryMapper.php @@ -19,4 +19,4 @@ public function hydrate($value) return $affiliateSiteCategory; } -} \ No newline at end of file +} diff --git a/src/Mapper/AffiliateSiteInfoMapper.php b/src/Mapper/AffiliateSiteInfoMapper.php index 36fb372..6b442a1 100644 --- a/src/Mapper/AffiliateSiteInfoMapper.php +++ b/src/Mapper/AffiliateSiteInfoMapper.php @@ -22,4 +22,4 @@ public function hydrate($value) return $affiliateSiteInfo; } -} \ No newline at end of file +} diff --git a/src/Mapper/AffiliateSiteMapper.php b/src/Mapper/AffiliateSiteMapper.php index 7d42d27..c6ef5a6 100644 --- a/src/Mapper/AffiliateSiteMapper.php +++ b/src/Mapper/AffiliateSiteMapper.php @@ -17,8 +17,11 @@ public function hydrate($value) $affiliateSite->setId($value->ID); $affiliateSite->setName($value->name); $affiliateSite->setUrl($value->URL); - $affiliateSite->setInfo((new AffiliateSiteInfoMapper())->hydrate($value->info)); + + if (null !== $value->info) { + $affiliateSite->setInfo((new AffiliateSiteInfoMapper())->hydrate($value->info)); + } return $affiliateSite; } -} \ No newline at end of file +} diff --git a/src/Mapper/AffiliateSiteStatusMapper.php b/src/Mapper/AffiliateSiteStatusMapper.php index cca11af..b60642c 100644 --- a/src/Mapper/AffiliateSiteStatusMapper.php +++ b/src/Mapper/AffiliateSiteStatusMapper.php @@ -18,4 +18,4 @@ public function hydrate($value) return $affiliateSiteStatus; } -} \ No newline at end of file +} diff --git a/src/Mapper/AffiliateSiteTypeMapper.php b/src/Mapper/AffiliateSiteTypeMapper.php index a9d7a98..16491e6 100644 --- a/src/Mapper/AffiliateSiteTypeMapper.php +++ b/src/Mapper/AffiliateSiteTypeMapper.php @@ -19,4 +19,4 @@ public function hydrate($value) return $affiliateSiteType; } -} \ No newline at end of file +} diff --git a/src/Mapper/AttributedAffiliateSiteMapper.php b/src/Mapper/AttributedAffiliateSiteMapper.php new file mode 100644 index 0000000..9178c32 --- /dev/null +++ b/src/Mapper/AttributedAffiliateSiteMapper.php @@ -0,0 +1,30 @@ +setAffiliateSiteId($value->affiliateSiteID); + $attributedAffiliateSite->setCommission($value->commission); + $attributedAffiliateSite->setPosition($value->position); + $attributedAffiliateSite->setIp($value->IP); + $attributedAffiliateSite->setTransactionType((new TransactionTypeMapper())->hydrate($value->transactionType)); + $attributedAffiliateSite->setTransactionStatus( + (new TransactionStatusMapper())->hydrate($value->transactionStatus) + ); + $attributedAffiliateSite->setReference($value->reference); + $attributedAffiliateSite->setRegistrationDate(new \DateTime($value->registrationDate)); + + return $attributedAffiliateSite; + } +} diff --git a/src/Mapper/AttributionMapper.php b/src/Mapper/AttributionMapper.php new file mode 100644 index 0000000..2967b44 --- /dev/null +++ b/src/Mapper/AttributionMapper.php @@ -0,0 +1,29 @@ +affiliateSites as $affiliateSite) { + $data[] = $attributedAffiliateSiteMapper->hydrate($affiliateSite); + } + + $attribution->setAffiliateSites($data); + + return $attribution; + } +} diff --git a/src/Mapper/CampaignAffiliatePolicyStatusMapper.php b/src/Mapper/CampaignAffiliatePolicyStatusMapper.php index 895da45..62efd2b 100644 --- a/src/Mapper/CampaignAffiliatePolicyStatusMapper.php +++ b/src/Mapper/CampaignAffiliatePolicyStatusMapper.php @@ -18,4 +18,4 @@ public function hydrate($value) return $campaignAffiliatePolicyStatus; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignAssignmentStatusMapper.php b/src/Mapper/CampaignAssignmentStatusMapper.php index cff7a3e..9f5db86 100644 --- a/src/Mapper/CampaignAssignmentStatusMapper.php +++ b/src/Mapper/CampaignAssignmentStatusMapper.php @@ -18,4 +18,4 @@ public function hydrate($value) return $campaignAssignmentStatus; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignAttributionModelMapper.php b/src/Mapper/CampaignAttributionModelMapper.php index 8107f6d..4f63adf 100644 --- a/src/Mapper/CampaignAttributionModelMapper.php +++ b/src/Mapper/CampaignAttributionModelMapper.php @@ -18,4 +18,4 @@ public function hydrate($value) return $campaignAttributionModel; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignCategoryMapper.php b/src/Mapper/CampaignCategoryMapper.php index 9170a6c..2467e6b 100644 --- a/src/Mapper/CampaignCategoryMapper.php +++ b/src/Mapper/CampaignCategoryMapper.php @@ -29,4 +29,4 @@ public function hydrate($value) return $campaignCategory; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignCommissionMapper.php b/src/Mapper/CampaignCommissionMapper.php index d252345..fd43c57 100644 --- a/src/Mapper/CampaignCommissionMapper.php +++ b/src/Mapper/CampaignCommissionMapper.php @@ -26,4 +26,4 @@ public function hydrate($value) return $campaignCommission; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignInfoMapper.php b/src/Mapper/CampaignInfoMapper.php index 978d3a2..d7186c2 100644 --- a/src/Mapper/CampaignInfoMapper.php +++ b/src/Mapper/CampaignInfoMapper.php @@ -77,4 +77,4 @@ public function hydrate($value) return $campaignInfo; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignMapper.php b/src/Mapper/CampaignMapper.php index de615f4..db05ac5 100644 --- a/src/Mapper/CampaignMapper.php +++ b/src/Mapper/CampaignMapper.php @@ -25,4 +25,4 @@ public function hydrate($value) return $campaign; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignNewsItemMapper.php b/src/Mapper/CampaignNewsItemMapper.php index c494611..2e89de7 100644 --- a/src/Mapper/CampaignNewsItemMapper.php +++ b/src/Mapper/CampaignNewsItemMapper.php @@ -25,4 +25,4 @@ public function hydrate($value) return $campaignNewsItem; } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignNewsTypeMapper.php b/src/Mapper/CampaignNewsTypeMapper.php index c3a9a05..6522250 100644 --- a/src/Mapper/CampaignNewsTypeMapper.php +++ b/src/Mapper/CampaignNewsTypeMapper.php @@ -15,4 +15,4 @@ public function hydrate($value) { return new CampaignNewsType($value); } -} \ No newline at end of file +} diff --git a/src/Mapper/CampaignSubCategoryMapper.php b/src/Mapper/CampaignSubCategoryMapper.php index f866695..58094f4 100644 --- a/src/Mapper/CampaignSubCategoryMapper.php +++ b/src/Mapper/CampaignSubCategoryMapper.php @@ -19,4 +19,4 @@ public function hydrate($value) return $campaignSubCategory; } -} \ No newline at end of file +} diff --git a/src/Mapper/ClickTransactionMapper.php b/src/Mapper/ClickTransactionMapper.php index 51f3683..f2625ed 100644 --- a/src/Mapper/ClickTransactionMapper.php +++ b/src/Mapper/ClickTransactionMapper.php @@ -28,4 +28,4 @@ public function hydrate($value) return $clickTransaction; } -} \ No newline at end of file +} diff --git a/src/Mapper/ConversionTransactionMapper.php b/src/Mapper/ConversionTransactionMapper.php index 398e345..97dfb3c 100644 --- a/src/Mapper/ConversionTransactionMapper.php +++ b/src/Mapper/ConversionTransactionMapper.php @@ -49,4 +49,4 @@ public function hydrate($value) return $conversionTransaction; } -} \ No newline at end of file +} diff --git a/src/Mapper/FeedCategoryMapper.php b/src/Mapper/FeedCategoryMapper.php new file mode 100644 index 0000000..7a4b192 --- /dev/null +++ b/src/Mapper/FeedCategoryMapper.php @@ -0,0 +1,22 @@ +setName($value->name); + $feedCategory->setProductCount($value->productCount); + + return $feedCategory; + } +} diff --git a/src/Mapper/FeedProductAdditionalMapper.php b/src/Mapper/FeedProductAdditionalMapper.php new file mode 100644 index 0000000..d575c18 --- /dev/null +++ b/src/Mapper/FeedProductAdditionalMapper.php @@ -0,0 +1,22 @@ +setName($value->name); + $feedProductAdditional->setValue($value->value); + + return $feedProductAdditional; + } +} diff --git a/src/Mapper/FeedProductMapper.php b/src/Mapper/FeedProductMapper.php new file mode 100644 index 0000000..7efe83f --- /dev/null +++ b/src/Mapper/FeedProductMapper.php @@ -0,0 +1,38 @@ +setIdentifier($value->identifier); + $feedProduct->setName($value->name); + $feedProduct->setProductCategoryName($value->productCategoryName); + $feedProduct->setDescription($value->description); + $feedProduct->setPrice($value->price); + $feedProduct->setProductUrl($value->productURL); + $feedProduct->setImageUrl($value->imageURL); + + if (is_array($value->additional)) { + $data = []; + $feedProductAdditionalMapper = new FeedProductAdditionalMapper(); + + foreach ($value->additional as $additional) { + $data[] = $feedProductAdditionalMapper->hydrate($additional); + } + + $feedProduct->setAdditional($data); + } + + return $feedProduct; + } +} diff --git a/src/Mapper/MapperInterface.php b/src/Mapper/MapperInterface.php index 292d101..84714bc 100644 --- a/src/Mapper/MapperInterface.php +++ b/src/Mapper/MapperInterface.php @@ -12,4 +12,4 @@ interface MapperInterface * @return object */ public function hydrate($value); -} \ No newline at end of file +} diff --git a/src/Mapper/PaymentMapper.php b/src/Mapper/PaymentMapper.php new file mode 100644 index 0000000..ead0d7c --- /dev/null +++ b/src/Mapper/PaymentMapper.php @@ -0,0 +1,27 @@ +setInvoiceNumber($value->invoiceNumber); + $payment->setCurrency($value->currency); + $payment->setSubTotal($value->subTotal); + $payment->setVAT($value->VAT); + $payment->setEndTotal($value->endTotal); + $payment->setBillDate(new \DateTime($value->billDate)); + $payment->setPayDate(new \DateTime($value->payDate)); + + return $payment; + } +} diff --git a/src/Mapper/ReportDataMapper.php b/src/Mapper/ReportDataMapper.php index 2f3d7e9..b89709e 100644 --- a/src/Mapper/ReportDataMapper.php +++ b/src/Mapper/ReportDataMapper.php @@ -34,4 +34,4 @@ public function hydrate($value) return $reportData; } -} \ No newline at end of file +} diff --git a/src/Mapper/TouchpointMapper.php b/src/Mapper/TouchpointMapper.php new file mode 100644 index 0000000..36592aa --- /dev/null +++ b/src/Mapper/TouchpointMapper.php @@ -0,0 +1,29 @@ +setAffiliateSiteId($value->affiliateSiteID); + $touchpoint->setSiteType($value->siteType); + $touchpoint->setRegistrationDate($value->registrationDate); + $touchpoint->setNumImpressions($value->numImpressions); + $touchpoint->setNumClicks($value->numClicks); + $touchpoint->setIsAttributed($value->isAttributed); + $touchpoint->setCommission($value->commission); + $touchpoint->setPosition($value->position); + $touchpoint->setReference($value->reference); + + return $touchpoint; + } +} diff --git a/src/Mapper/TransactionRejectionReasonMapper.php b/src/Mapper/TransactionRejectionReasonMapper.php index db4c009..d5079ef 100644 --- a/src/Mapper/TransactionRejectionReasonMapper.php +++ b/src/Mapper/TransactionRejectionReasonMapper.php @@ -15,4 +15,4 @@ public function hydrate($value) { return new TransactionRejectionReason($value); } -} \ No newline at end of file +} diff --git a/src/Model/AttributedAffiliateSite.php b/src/Model/AttributedAffiliateSite.php new file mode 100644 index 0000000..241589f --- /dev/null +++ b/src/Model/AttributedAffiliateSite.php @@ -0,0 +1,174 @@ +affiliateSiteId; + } + + /** + * @param int $affiliateSiteId + */ + public function setAffiliateSiteId($affiliateSiteId) + { + $this->affiliateSiteId = $affiliateSiteId; + } + + /** + * @return float + */ + public function getCommission() + { + return $this->commission; + } + + /** + * @param float $commission + */ + public function setCommission($commission) + { + $this->commission = $commission; + } + + /** + * @return string + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param string $position + */ + public function setPosition($position) + { + $this->position = $position; + } + + /** + * @return string + */ + public function getIp() + { + return $this->ip; + } + + /** + * @param string $ip + */ + public function setIp($ip) + { + $this->ip = $ip; + } + + /** + * @return TransactionType + */ + public function getTransactionType(): TransactionType + { + return $this->transactionType; + } + + /** + * @param TransactionType $transactionType + */ + public function setTransactionType(TransactionType $transactionType) + { + $this->transactionType = $transactionType; + } + + /** + * @return TransactionStatus + */ + public function getTransactionStatus(): TransactionStatus + { + return $this->transactionStatus; + } + + /** + * @param TransactionStatus $transactionStatus + */ + public function setTransactionStatus(TransactionStatus $transactionStatus) + { + $this->transactionStatus = $transactionStatus; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + */ + public function setReference($reference) + { + $this->reference = $reference; + } + + /** + * @return \DateTime + */ + public function getRegistrationDate() + { + return $this->registrationDate; + } + + /** + * @param \DateTime $registrationDate + */ + public function setRegistrationDate($registrationDate) + { + $this->registrationDate = $registrationDate; + } +} diff --git a/src/Model/Attribution.php b/src/Model/Attribution.php new file mode 100644 index 0000000..63771a5 --- /dev/null +++ b/src/Model/Attribution.php @@ -0,0 +1,27 @@ +affiliateSites; + } + + /** + * @param AttributedAffiliateSite[] $affiliateSites + */ + public function setAffiliateSites(array $affiliateSites) + { + $this->affiliateSites = $affiliateSites; + } +} diff --git a/src/Model/CreateConversionTransactionOptions.php b/src/Model/CreateConversionTransactionOptions.php new file mode 100644 index 0000000..52b26ca --- /dev/null +++ b/src/Model/CreateConversionTransactionOptions.php @@ -0,0 +1,132 @@ +campaignID; + } + + /** + * @param int $campaignID + */ + public function setCampaignId(int $campaignID) + { + $this->campaignID = $campaignID; + } + + /** + * @return int + */ + public function getCampaignProductId(): int + { + return $this->campaignProductID; + } + + /** + * @param int $campaignProductID + */ + public function setCampaignProductId(int $campaignProductID) + { + $this->campaignProductID = $campaignProductID; + } + + /** + * @return string + */ + public function getCharacteristic(): string + { + return $this->characteristic; + } + + /** + * @param string $characteristic + */ + public function setCharacteristic(string $characteristic) + { + $this->characteristic = $characteristic; + } + + /** + * @return string + */ + public function getRemarks(): string + { + return $this->remarks; + } + + /** + * @param string $remarks + */ + public function setRemarks(string $remarks) + { + $this->remarks = $remarks; + } + + /** + * @return string + */ + public function getReference(): string + { + return $this->reference; + } + + /** + * @param string $reference + */ + public function setReference(string $reference) + { + $this->reference = $reference; + } + + /** + * @return float + */ + public function getTransactionAmount(): float + { + return $this->transactionAmount; + } + + /** + * @param float $transactionAmount + */ + public function setTransactionAmount(float $transactionAmount) + { + $this->transactionAmount = $transactionAmount; + } +} diff --git a/src/Model/FeedCategory.php b/src/Model/FeedCategory.php new file mode 100644 index 0000000..bd58d39 --- /dev/null +++ b/src/Model/FeedCategory.php @@ -0,0 +1,48 @@ +name; + } + + /** + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return int + */ + public function getProductCount() + { + return $this->productCount; + } + + /** + * @param int $productCount + */ + public function setProductCount($productCount) + { + $this->productCount = $productCount; + } +} diff --git a/src/Model/FeedProduct.php b/src/Model/FeedProduct.php new file mode 100644 index 0000000..2cfde81 --- /dev/null +++ b/src/Model/FeedProduct.php @@ -0,0 +1,174 @@ +identifier; + } + + /** + * @param $identifier + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getProductCategoryName() + { + return $this->productCategoryName; + } + + /** + * @param $productCategoryName + */ + public function setProductCategoryName($productCategoryName) + { + $this->productCategoryName = $productCategoryName; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return float + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param $price + */ + public function setPrice($price) + { + $this->price = $price; + } + + /** + * @return string + */ + public function getProductUrl() + { + return $this->productUrl; + } + + /** + * @param $productUrl + */ + public function setProductUrl($productUrl) + { + $this->productUrl = $productUrl; + } + + /** + * @return string + */ + public function getImageUrl() + { + return $this->imageUrl; + } + + /** + * @param $imageUrl + */ + public function setImageUrl($imageUrl) + { + $this->imageUrl = $imageUrl; + } + + /** + * @return FeedProductAdditional[] + */ + public function getAdditional(): array + { + return $this->additional; + } + + /** + * @param FeedProductAdditional[] $additional + */ + public function setAdditional(array $additional) + { + $this->additional = $additional; + } +} diff --git a/src/Model/FeedProductAdditional.php b/src/Model/FeedProductAdditional.php new file mode 100644 index 0000000..44bca52 --- /dev/null +++ b/src/Model/FeedProductAdditional.php @@ -0,0 +1,48 @@ +name; + } + + /** + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + */ + public function setValue($value) + { + $this->value = $value; + } +} diff --git a/src/Model/Payment.php b/src/Model/Payment.php new file mode 100644 index 0000000..014878a --- /dev/null +++ b/src/Model/Payment.php @@ -0,0 +1,153 @@ +invoiceNumber; + } + + /** + * @param $invoiceNumber + */ + public function setInvoiceNumber($invoiceNumber) + { + $this->invoiceNumber = $invoiceNumber; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param $currency + */ + public function setCurrency($currency) + { + $this->currency = $currency; + } + + /** + * @return float + */ + public function getSubTotal() + { + return $this->subTotal; + } + + /** + * @param $subTotal + */ + public function setSubTotal($subTotal) + { + $this->subTotal = $subTotal; + } + + /** + * @return float + */ + public function getVAT() + { + return $this->VAT; + } + + /** + * @param $VAT + */ + public function setVAT($VAT) + { + $this->VAT = $VAT; + } + + /** + * @return float + */ + public function getEndTotal() + { + return $this->endTotal; + } + + /** + * @param $endTotal + */ + public function setEndTotal($endTotal) + { + $this->endTotal = $endTotal; + } + + /** + * @return \DateTime + */ + public function getBillDate() + { + return $this->billDate; + } + + /** + * @param $billDate + */ + public function setBillDate($billDate) + { + $this->billDate = $billDate; + } + + /** + * @return \DateTime + */ + public function getPayDate() + { + return $this->payDate; + } + + /** + * @param $payDate + */ + public function setPayDate($payDate) + { + $this->payDate = $payDate; + } +} diff --git a/src/Model/Touchpoint.php b/src/Model/Touchpoint.php new file mode 100644 index 0000000..f83f086 --- /dev/null +++ b/src/Model/Touchpoint.php @@ -0,0 +1,195 @@ +affiliateSiteId; + } + + /** + * @param int $affiliateSiteId + */ + public function setAffiliateSiteId($affiliateSiteId) + { + $this->affiliateSiteId = $affiliateSiteId; + } + + /** + * @return string + */ + public function getSiteType() + { + return $this->siteType; + } + + /** + * @param string $siteType + */ + public function setSiteType($siteType) + { + $this->siteType = $siteType; + } + + /** + * @return \DateTime + */ + public function getRegistrationDate() + { + return $this->registrationDate; + } + + /** + * @param \DateTime $registrationDate + */ + public function setRegistrationDate($registrationDate) + { + $this->registrationDate = $registrationDate; + } + + /** + * @return int + */ + public function getNumImpressions() + { + return $this->numImpressions; + } + + /** + * @param int $numImpressions + */ + public function setNumImpressions($numImpressions) + { + $this->numImpressions = $numImpressions; + } + + /** + * @return int + */ + public function getNumClicks() + { + return $this->numClicks; + } + + /** + * @param int $numClicks + */ + public function setNumClicks($numClicks) + { + $this->numClicks = $numClicks; + } + + /** + * @return bool + */ + public function isAttributed() + { + return $this->isAttributed; + } + + /** + * @param bool $isAttributed + */ + public function setIsAttributed($isAttributed) + { + $this->isAttributed = $isAttributed; + } + + /** + * @return float + */ + public function getCommission() + { + return $this->commission; + } + + /** + * @param float $commission + */ + public function setCommission($commission) + { + $this->commission = $commission; + } + + /** + * @return string + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param string $position + */ + public function setPosition($position) + { + $this->position = $position; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + */ + public function setReference($reference) + { + $this->reference = $reference; + } +}