Completed
Pull Request — master (#2)
by
unknown
02:20
created

Zanox::getStats()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace Padosoft\AffiliateNetwork\Networks;
4
5
use Padosoft\AffiliateNetwork\DealsResultset;
6
use Padosoft\AffiliateNetwork\Product;
7
use Padosoft\AffiliateNetwork\ProductsResultset;
8
use Padosoft\AffiliateNetwork\Transaction;
9
use Padosoft\AffiliateNetwork\Merchant;
10
use Padosoft\AffiliateNetwork\Stat;
11
use Padosoft\AffiliateNetwork\Deal;
12
use Padosoft\AffiliateNetwork\AbstractNetwork;
13
use Padosoft\AffiliateNetwork\NetworkInterface;
14
use Padosoft\AffiliateNetwork\ZanoxEx;
15
16
// require "../vendor/fubralimited/php-oara/Oara/Network/Publisher/Zanox/Zapi/ApiClient.php";
17
18
/**
19
 * Class Zanox
20
 * @package Padosoft\AffiliateNetwork\Networks
21
 */
22
class Zanox extends AbstractNetwork implements NetworkInterface
23
{
24
    /**
25
     * @var object
26
     */
27
    private $_network   = null;
28
    protected $_apiClient = null;
29
    private $_username  = '';
30
    private $_password  = '';
31
    private $_logged    = false;
32
    protected $_tracking_parameter    = 'zpar0';
33
34
35
    /**
36
     * @method __construct
37
     */
38
    public function __construct(string $username, string $password,string $idSite='')
0 ignored issues
show
Unused Code introduced by
The parameter $idSite is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        $this->_network = new ZanoxEx;
41
        $this->_username = $username;
42
        $this->_password = $password;
43
        $this->login( $this->_username, $this->_password );
44
45
    }
46
47
    public function login(string $username, string $password,string $idSite=''): bool
0 ignored issues
show
Unused Code introduced by
The parameter $idSite is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        $this->_logged = false;
50
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
51
52
            return false;
53
        }
54
        $this->_username = $username;
55
        $this->_password = $password;
56
        $credentials = array();
57
        $credentials["connectid"] = $this->_username;
58
        $credentials["secretkey"] = $this->_password;
59
        $this->_network->login( $credentials );
60
        $this->_apiClient = $this->_network->getApiClient();
61
        if ($this->_network->checkConnection()) {
62
            $this->_logged = true;
63
64
        }
65
66
        return $this->_logged;
67
    }
68
69
    /**
70
     * @return bool
71
     */
72
    public function checkLogin(): bool
73
    {
74
        return $this->_logged;
75
    }
76
77
    /**
78
     * @return array of Merchants
79
     */
80 View Code Duplication
    public function getMerchants(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
81
    {
82
        if (!$this->checkLogin()) {
83
            return array();
84
        }
85
        $arrResult = array();
86
        $merchantList = $this->_network->getMerchantList();
87
        foreach ($merchantList as $merchant) {
88
            $Merchant = Merchant::createInstance();
89
            $Merchant->merchant_ID = $merchant['cid'];
90
            $Merchant->name = $merchant['name'];
91
            $arrResult[] = $Merchant;
92
        }
93
94
        return $arrResult;
95
    }
96
97
    /**
98
     * @param int|null $merchantID
99
     * @param int $page
100
     * @param int $items_per_page
101
     *
102
     * @return DealsResultset
103
     */
104
    public function getDeals($merchantID=NULL,int $page=0,int $items_per_page=10 ): DealsResultset
105
    {
106
        if (!isIntegerPositive($items_per_page)){
107
            $items_per_page=10;
108
        }
109
        $result=DealsResultset::createInstance();
110
        if (!$this->checkLogin()) {
111
            return $result;
112
        }
113
        /*$this->_apiClient->setConnectId( $this->_username );
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
114
        $this->_apiClient->setSecretKey( $this->_password );*/
115
        $adSpaces=$this->_apiClient->getAdspaces(0,100);
116
        if (!is_object($adSpaces)){
117
            $adSpaces=json_encode($adSpaces);
118
        }
119
        if ($adSpaces->items<1){
120
            return $result;
121
        }
122
123
        $adSpaceId=$adSpaces->adspaceItems->adspaceItem[0]->id;
124
        if (!isIntegerPositive($merchantID)){
125
            $merchantID=NULL;
126
        }
127
128
        $Response = $this->_apiClient->searchIncentives($merchantID,$adSpaceId,'coupons',NULL,$page,$items_per_page);
129
        
130
        if (!is_object($Response)){
131
            $Response=json_decode($Response);
132
        }
133
        $result->page=$Response->page;
134
        $result->items=$Response->items;
135
        $result->total=$Response->total;
136
        ($Response->total>0)?$result->num_pages=(int)ceil($Response->total/$items_per_page):$result->num_pages=0;
0 ignored issues
show
Bug introduced by
The property num_pages does not seem to exist in Padosoft\AffiliateNetwork\DealsResultset.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
137
        $arrAdmediumItems = $Response->incentiveItems->incentiveItem;
138
139
        foreach ($arrAdmediumItems as $admediumItems) {
140
            $Deal = Deal::createInstance();
141
            $Deal->id = (int)$admediumItems->id;
0 ignored issues
show
Bug introduced by
The property id does not seem to exist in Padosoft\AffiliateNetwork\Deal.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
142
            $Deal->created_at =$admediumItems->createDate;
0 ignored issues
show
Bug introduced by
The property created_at does not seem to exist in Padosoft\AffiliateNetwork\Deal.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
143
            $Deal->startDate = $admediumItems->startDate;
144
            isset($admediumItems->endDate)?$Deal->endDate = $admediumItems->endDate:$Deal->endDate = '';
0 ignored issues
show
Documentation Bug introduced by
It seems like '' of type string is incompatible with the declared type object<DateTime> of property $endDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
145
            $Deal->name = $admediumItems->name;
146
            $Deal->code = $admediumItems->couponCode;
147
            $Deal->description = $admediumItems->info4customer;
148
            $Deal->note = $admediumItems->info4publisher.' '.$admediumItems->restrictions;
0 ignored issues
show
Bug introduced by
The property note does not seem to exist in Padosoft\AffiliateNetwork\Deal.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
149
            $Deal->is_percent = 0;
0 ignored issues
show
Bug introduced by
The property is_percent does not seem to exist. Did you mean is_percentage?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
150
            $Deal->value=0;
0 ignored issues
show
Bug introduced by
The property value does not seem to exist in Padosoft\AffiliateNetwork\Deal.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
151
            $Deal->currency='';
0 ignored issues
show
Bug introduced by
The property currency does not seem to exist. Did you mean currency_initial?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
152
            //dd($admediumItems->percentage);
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
153
            if (isset($admediumItems->percentage) && isIntegerPositive($admediumItems->percentage)){
154
                $Deal->is_percent = 1;
0 ignored issues
show
Bug introduced by
The property is_percent does not seem to exist. Did you mean is_percentage?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
155
                $Deal->value=$admediumItems->percentage;
156
            }elseif (isset($admediumItems->total)){
157
158
                $Deal->value=$admediumItems->total;
159
                $Deal->currency=$admediumItems->currency;
0 ignored issues
show
Bug introduced by
The property currency does not seem to exist. Did you mean currency_initial?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
160
            }
161
            //$Deal->deal_type = $admediumItems['admediumType'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
162
            $Deal->merchant_ID = (int)$admediumItems->program->id;
163
            
164
            $Deal->merchant_name = $admediumItems->program->_;
165
            $Deal->ppv = $admediumItems->admedia->admediumItem[0]->trackingLinks->trackingLink[0]->ppv;
166
            $Deal->ppc = $admediumItems->admedia->admediumItem[0]->trackingLinks->trackingLink[0]->ppc;
167
            $result->deals[]=$Deal;
168
            /*if ($merchantID > 0) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
169
                if ($merchantID == $admediumItems['program']['@id']) {
170
                    $arrResult[] = $Deal;
171
                }
172
            } else {
173
                $arrResult[] = $Deal;
174
            }*/
175
        }
176
        //dd($result);
177
        return $result;
178
    }
179
180
181
    /**
182
     * @param \DateTime $dateFrom
183
     * @param \DateTime $dateTo
184
     * @param int $merchantID
0 ignored issues
show
Documentation introduced by
There is no parameter named $merchantID. Did you maybe mean $arrMerchantID?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
185
     *
186
     * @return array of Transaction
187
     */
188
    public function getSales(\DateTime $dateFrom, \DateTime $dateTo, array $arrMerchantID = array()): array
189
    {
190
        if (!$this->checkLogin()) {
191
            return array();
192
        }
193
        $dateFrom2=new \DateTime($dateFrom->format('Y-m-d'));
194
        if ($dateTo->format('Y-m-d')==$dateFrom2->format('Y-m-d')){
195
            $dateFrom2->sub(new \DateInterval('P1D'));
196
        }
197
198
        $arrResult = array();
199 View Code Duplication
        if (count( $arrMerchantID ) < 1) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
200
            $merchants = $this->getMerchants();
201
            foreach ($merchants as $merchant) {
202
                $arrMerchantID[$merchant->merchant_ID] = ['cid' => $merchant->merchant_ID, 'name' => $merchant->name];
203
            }
204
        }
205
        $transcationList = $this->_network->getTransactionList( $arrMerchantID, $dateFrom2, $dateTo );
206 View Code Duplication
        foreach ($transcationList as $transaction) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
207
            $Transaction = Transaction::createInstance();
208
            array_key_exists_safe( $transaction,
209
                'currency' ) ? $Transaction->currency = $transaction['currency'] : $Transaction->currency = '';
210
            array_key_exists_safe( $transaction,
211
                'status' ) ? $Transaction->status = $transaction['status'] : $Transaction->status = '';
212
            array_key_exists_safe( $transaction,
213
                'amount' ) ? $Transaction->amount = $transaction['amount'] : $Transaction->amount = '';
0 ignored issues
show
Documentation Bug introduced by
The property $amount was declared of type double, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
214
            array_key_exists_safe( $transaction,
215
                'custom_id' ) ? $Transaction->custom_ID = $transaction['custom_id'] : $Transaction->custom_ID = '';
216
            array_key_exists_safe( $transaction,
217
                'title' ) ? $Transaction->title = $transaction['title'] : $Transaction->title = '';
218
            array_key_exists_safe( $transaction,
219
                'unique_id' ) ? $Transaction->unique_ID = $transaction['unique_id'] : $Transaction->unique_ID = '';
220
            array_key_exists_safe( $transaction,
221
                'commission' ) ? $Transaction->commission = $transaction['commission'] : $Transaction->commission = '';
0 ignored issues
show
Documentation Bug introduced by
The property $commission was declared of type double, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
222
            $date = new \DateTime( $transaction['date'] );
223
            $Transaction->date = $date; // $date->format('Y-m-d H:i:s');
0 ignored issues
show
Documentation Bug introduced by
It seems like $date of type object<DateTime> is incompatible with the declared type string of property $date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
224
            array_key_exists_safe( $transaction,
225
                'merchantId' ) ? $Transaction->merchant_ID = $transaction['merchantId'] : $Transaction->merchant_ID = '';
0 ignored issues
show
Documentation Bug introduced by
The property $merchant_ID was declared of type integer, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
226
            array_key_exists_safe( $transaction,
227
                'approved' ) ? $Transaction->approved = $transaction['approved'] : $Transaction->approved = '';
0 ignored issues
show
Documentation Bug introduced by
The property $approved was declared of type boolean, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
228
            $arrResult[] = $Transaction;
229
        }
230
231
        return $arrResult;
232
    }
233
234
    /**
235
     * @param \DateTime $dateFrom
236
     * @param \DateTime $dateTo
237
     * @param int $merchantID
238
     *
239
     * @return array of Stat
240
     */
241
    public function getStats(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0): array
242
    {
243
        return array();
244
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
245
        $this->_apiClient->setConnectId($this->_username);
246
        $this->_apiClient->setSecretKey($this->_password);
247
        $dateFromIsoEngFormat = $dateFrom->format('Y-m-d');
248
        $dateToIsoEngFormat = $dateTo->format('Y-m-d');
249
        $response = $this->_apiClient->getReportBasic($dateFromIsoEngFormat, $dateToIsoEngFormat);
250
        $arrResponse = json_decode($response, true);
251
        $reportItems = $arrResponse['reportItems'];
252
        $Stat = Stat::createInstance();
253
        $Stat->reportItems = $reportItems;
254
255
        return array($Stat);
256
        */
257
    }
258
259
    /**
260
     * @param  array $params  this array can contains these keys
261
     *                        string      query          search string
262
     *                        string      searchType     search type (optional) (contextual or phrase)
263
     *                        string      region         limit search to region (optional)
264
     *                        int         categoryId     limit search to categorys (optional)
265
     *                        array       programId      limit search to program list of programs (optional)
266
     *                        boolean     hasImages      products with images (optional)
267
     *                        float       minPrice       minimum price (optional)
268
     *                        float       maxPrice       maximum price (optional)
269
     *                        int         adspaceId      adspace id (optional)
270
     *                        int         page           page of result set (optional)
271
     *                        int         items          items per page (optional)
272
     *
273
     * @return ProductsResultset
274
     */
275
    public function getProducts(array $params = []): ProductsResultset
276
    {
277
        $_params = array_merge([
278
            'query' => null,
279
            'searchType' => null,
280
            'query' => null,
281
            'searchType' => null,
282
            'region' => null,
283
            'categoryId' => null,
284
            'programId' => null,
285
            'hasImages' => null,
286
            'minPrice' => null,
287
            'maxPrice' => null,
288
            'adspaceId' => null,
289
            'page' => 0,
290
            'items' => 10
291
        ], $params);
292
        $products =  $this->_network->getProducts($_params);
293
        $set = ProductsResultset::createInstance();
294
        if (!property_exists($products, 'productItems') || !property_exists($products->productItems, 'productItem'))
295
        {
296
            return ProductsResultset::createInstance();
297
        }
298
299
        $set->page = $products->page;
300
        $set->items = $products->items;
301
        $set->total = $products->total;
302
303
        foreach ($products->productItems->productItem as $productItem) {
304
            $Product = Product::createInstance();
305
            if (property_exists($productItem, 'name')) {
306
                $Product->name = $productItem->name;//'Danava',
307
            }
308
            if (property_exists($productItem, 'modified')) {
309
                $Product->modified = $productItem->modified; //'2016-11-24T11:52:03Z',
310
            }
311
            if (property_exists($productItem, 'program')) {
312
                $Product->merchant_ID = $productItem->program->id; //'Twelve Thirteen DE'
313
                $Product->merchant_name = $productItem->program->_; //17434,
314
            }
315
            if (property_exists($productItem, 'price'))
316
                $Product->price = $productItem->price; //129.0
317
            if (property_exists($productItem, 'currency'))
318
                $Product->currency = $productItem->currency; //'EUR'
319
            if (property_exists($productItem, 'trackingLinks') && property_exists($productItem->trackingLinks, 'trackingLink')) {
320
                $Product->ppv = $productItem->trackingLinks->trackingLink[0]->ppv;
321
                $Product->ppc = $productItem->trackingLinks->trackingLink[0]->ppc;
322
                $Product->adspaceId = $productItem->trackingLinks->trackingLink[0]->adspaceId;
0 ignored issues
show
Bug introduced by
The property adspaceId does not seem to exist in Padosoft\AffiliateNetwork\Product.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
323
            }
324
            if (property_exists($productItem, 'description'))
325
                $Product->description = $productItem->description; //'Rosegold trifft auf puristisches Schwarz ? aufwendige und traditionelle Makramee Technik trifft auf Eleganz. Das neue Danava Buddha Armband besteht aus schwarzem Onyx, dieser Edelstein wird sehr gerne als Schmuckstein verwendet und viel lieber getragen. Der feingearbeitete rosegoldene Buddha verleiht diesem Armband einen fernöstlichen Stil. Es lässt sich wunderbar zu allen Anlässen Tragen und zu vielen Outfits kombinieren, da es Eleganz ausstrahlt. Das Symbol des Buddhas ist besonders in dieser Saison sehr gefragt.',
326
            if (property_exists($productItem, 'manufacturer'))
327
                $Product->manufacturer = $productItem->manufacturer; //'Twelve Thirteen Jewelry'
328
            if (property_exists($productItem, 'ean'))
329
                $Product->ean = $productItem->ean; //'0796716271505'
330
            if (property_exists($productItem, 'deliveryTime'))
331
                $Product->deliveryTime = $productItem->deliveryTime; //'1-3 Tage'
332
            if (property_exists($productItem, 'priceOld'))
333
                $Product->priceOld = $productItem->priceOld; //0.0
334
            if (property_exists($productItem, 'shippingCosts'))
335
                $Product->shippingCosts = $productItem->shippingCosts; //'0.0'
336
            if (property_exists($productItem, 'shipping'))
337
                $Product->shipping = $productItem->shipping; // '0.0'
338
            if (property_exists($productItem, 'merchantCategory'))
339
                $Product->merchantCategory = $productItem->merchantCategory; //'Damen / Damen Armbänder / Buddha Armbänder'
340
            if (property_exists($productItem, 'merchantProductId'))
341
                $Product->merchantProductId = $productItem->merchantProductId; //'BR018.M'
342
            if (property_exists($productItem, 'id'))
343
                $Product->id = $productItem->id; //'1ed7c3b4ab79cdbbf127cb78ec2aaff4'
344
            if (property_exists($productItem, 'image') && property_exists($productItem->image, 'large')) {
345
                $Product->image = $productItem->image->large;
346
            }
347
            $set->products[] = $Product;
348
        }
349
350
        return $set;
351
    }
352
353
    public function getTrackingParameter(){
354
        return $this->_tracking_parameter;
355
    }
356
}
357