1 | <?php |
||||||
2 | /** |
||||||
3 | * Copyright © Getnet. All rights reserved. |
||||||
4 | * |
||||||
5 | * @author Bruno Elisei <[email protected]> |
||||||
6 | * See LICENSE for license details. |
||||||
7 | */ |
||||||
8 | |||||||
9 | namespace Getnet\SubSellerMagento\Model\Seller; |
||||||
10 | |||||||
11 | use Getnet\SubSellerMagento\Helper\Data as SubSellerHelper; |
||||||
12 | use Magento\Customer\Api\AddressRepositoryInterface; |
||||||
13 | use Magento\Customer\Api\CustomerRepositoryInterface; |
||||||
14 | use Magento\Framework\Api\AttributeValueFactory; |
||||||
15 | use Magento\Framework\Serialize\Serializer\Serialize; |
||||||
16 | |||||||
17 | /** |
||||||
18 | * Sub Seller Model. |
||||||
19 | * |
||||||
20 | * @SuppressWarnings(PHPMD) |
||||||
21 | */ |
||||||
22 | class SubSeller extends \Magento\Framework\Model\AbstractExtensibleModel implements |
||||||
23 | \Getnet\SubSellerMagento\Api\Data\SubSellerInterface |
||||||
24 | { |
||||||
25 | /**#@+ |
||||||
26 | * Constants defined for keys of array, makes typos less likely |
||||||
27 | */ |
||||||
28 | public const KEY_ID = 'id'; |
||||||
29 | public const LOAD_DATA_BY_CUSTOMER_ID = 'load_data_by_customer_id'; |
||||||
30 | public const KEY_CODE = 'code'; |
||||||
31 | public const MERCHANT_ID = 'merchant_id'; |
||||||
32 | public const ID_EXT = 'id_ext'; |
||||||
33 | public const EMAIL = 'email'; |
||||||
34 | public const LEGAL_DOCUMENT_NUMBER = 'legal_document_number'; |
||||||
35 | public const TYPE = 'type'; |
||||||
36 | public const LEGAL_NAME = 'legal_name'; |
||||||
37 | public const BIRTH_DATE = 'birth_date'; |
||||||
38 | public const MONTHLY_GROSS_INCOME = 'monthly_gross_income'; |
||||||
39 | public const GROSS_EQUITY = 'gross_equity'; |
||||||
40 | public const OCCUPATION = 'occupation'; |
||||||
41 | public const MAILING_ADDRESS_EQUALS = 'mailing_address_equals'; |
||||||
42 | public const ADDRESSES = 'addresses'; |
||||||
43 | public const BUSINESS_ADDRESS = 'business_address'; |
||||||
44 | public const MAILING_ADDRESS = 'mailing_address'; |
||||||
45 | public const TELEPHONE = 'telephone'; |
||||||
46 | public const BANK_ACCOUNTS = 'bank_accounts'; |
||||||
47 | public const BANK_ACCOUNTS_UNIQUE_ACCOUNT = 'unique_account'; |
||||||
48 | public const ACCEPTED_CONTRACT = 'accepted_contract'; |
||||||
49 | public const MARKETPLACE_STORE = 'marketplace_store'; |
||||||
50 | public const PAYMENT_PLAN = 'payment_plan'; |
||||||
51 | public const STATUS = 'status'; |
||||||
52 | public const STATUS_COMMENT = 'status_comment'; |
||||||
53 | /**#@-*/ |
||||||
54 | |||||||
55 | /** |
||||||
56 | * @var Serialize |
||||||
57 | */ |
||||||
58 | protected $serialize; |
||||||
59 | |||||||
60 | /** |
||||||
61 | * @var CustomerRepositoryInterface |
||||||
62 | */ |
||||||
63 | protected $customerRepository; |
||||||
64 | |||||||
65 | /** |
||||||
66 | * @var AddressRepositoryInterface |
||||||
67 | */ |
||||||
68 | protected $addressRepository; |
||||||
69 | |||||||
70 | /** |
||||||
71 | * @var SubSellerHelper |
||||||
72 | */ |
||||||
73 | protected $subSellerHelper; |
||||||
74 | |||||||
75 | /** |
||||||
76 | * @param \Magento\Framework\Model\Context $context |
||||||
77 | * @param \Magento\Framework\Registry $registry |
||||||
78 | * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory |
||||||
79 | * @param AttributeValueFactory $customAttributeFactory |
||||||
80 | * @param Serialize $serialize |
||||||
81 | * @param CustomerRepositoryInterface $customerRepository |
||||||
82 | * @param AddressRepositoryInterface $addressRepository |
||||||
83 | * @param SubSellerHelper $subSellerHelper |
||||||
84 | * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource |
||||||
85 | * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection |
||||||
86 | * @param array $data |
||||||
87 | * @SuppressWarnings(PHPMD.ExcessiveParameterList) |
||||||
88 | */ |
||||||
89 | public function __construct( |
||||||
90 | \Magento\Framework\Model\Context $context, |
||||||
91 | \Magento\Framework\Registry $registry, |
||||||
92 | \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, |
||||||
93 | AttributeValueFactory $customAttributeFactory, |
||||||
94 | Serialize $serialize, |
||||||
95 | CustomerRepositoryInterface $customerRepository, |
||||||
96 | AddressRepositoryInterface $addressRepository, |
||||||
97 | SubSellerHelper $subSellerHelper, |
||||||
98 | \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, |
||||||
99 | \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, |
||||||
100 | array $data = [] |
||||||
101 | ) { |
||||||
102 | $this->serialize = $serialize; |
||||||
103 | $this->customerRepository = $customerRepository; |
||||||
104 | $this->addressRepository = $addressRepository; |
||||||
105 | $this->subSellerHelper = $subSellerHelper; |
||||||
106 | parent::__construct( |
||||||
107 | $context, |
||||||
108 | $registry, |
||||||
109 | $extensionFactory, |
||||||
110 | $customAttributeFactory, |
||||||
111 | $resource, |
||||||
112 | $resourceCollection, |
||||||
113 | $data |
||||||
114 | ); |
||||||
115 | } |
||||||
116 | |||||||
117 | /** |
||||||
118 | * Magento model constructor. |
||||||
119 | * |
||||||
120 | * @return void |
||||||
121 | */ |
||||||
122 | protected function _construct() |
||||||
123 | { |
||||||
124 | $this->_init(\Getnet\SubSellerMagento\Model\ResourceModel\Seller\SubSeller::class); |
||||||
125 | } |
||||||
126 | |||||||
127 | /** |
||||||
128 | * Prepare location settings and sub seller postcode before save rate. |
||||||
129 | * |
||||||
130 | * @throws \Magento\Framework\Exception\LocalizedException |
||||||
131 | * |
||||||
132 | * @return \Getnet\SubSellerMagento\Model\Seller\SubSeller |
||||||
133 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||||||
134 | * @SuppressWarnings(PHPMD.NPathComplexity) |
||||||
135 | */ |
||||||
136 | public function beforeSave() |
||||||
137 | { |
||||||
138 | $this->_eventManager->dispatch('subseller_settings_change_before'); |
||||||
139 | parent::beforeSave(); |
||||||
140 | |||||||
141 | return $this; |
||||||
142 | } |
||||||
143 | |||||||
144 | /** |
||||||
145 | * Save sub seller. |
||||||
146 | * |
||||||
147 | * @return \Getnet\SubSellerMagento\Model\Seller\SubSeller |
||||||
148 | */ |
||||||
149 | public function afterSave() |
||||||
150 | { |
||||||
151 | $this->_eventManager->dispatch('subseller_settings_change_after'); |
||||||
152 | |||||||
153 | return parent::afterSave(); |
||||||
154 | } |
||||||
155 | |||||||
156 | /** |
||||||
157 | * Processing object before delete data. |
||||||
158 | * |
||||||
159 | * @throws \Magento\Framework\Exception\LocalizedException |
||||||
160 | * |
||||||
161 | * @return \Getnet\SubSellerMagento\Model\Seller\SubSeller |
||||||
162 | */ |
||||||
163 | public function beforeDelete() |
||||||
164 | { |
||||||
165 | $this->_eventManager->dispatch('subseller_settings_delete_before'); |
||||||
166 | |||||||
167 | return parent::beforeDelete(); |
||||||
168 | } |
||||||
169 | |||||||
170 | /** |
||||||
171 | * After rate delete. |
||||||
172 | * |
||||||
173 | * Redeclared for dispatch subseller_settings_change_after event |
||||||
174 | * |
||||||
175 | * @return \Getnet\SubSellerMagento\Model\Seller\SubSeller |
||||||
176 | */ |
||||||
177 | public function afterDelete() |
||||||
178 | { |
||||||
179 | $this->_eventManager->dispatch('subseller_settings_change_after'); |
||||||
180 | |||||||
181 | return parent::afterDelete(); |
||||||
182 | } |
||||||
183 | |||||||
184 | /** |
||||||
185 | * Load sub seller model by code. |
||||||
186 | * |
||||||
187 | * @param string $code |
||||||
188 | * |
||||||
189 | * @return \Getnet\SubSellerMagento\Model\Seller\SubSeller |
||||||
190 | */ |
||||||
191 | public function loadByCode($code) |
||||||
192 | { |
||||||
193 | $this->load($code, 'code'); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() The function
Magento\Framework\Model\AbstractModel::load() has been deprecated: 100.1.0 because entities must not be responsible for their own loading. Service contracts should persist entities. Use resource model "load" or collections to implement service contract model loading operations.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||||
194 | |||||||
195 | return $this; |
||||||
196 | } |
||||||
197 | |||||||
198 | /** |
||||||
199 | * Get Sub Seller Id. |
||||||
200 | * |
||||||
201 | * @return int |
||||||
202 | */ |
||||||
203 | public function getSubSellerId() |
||||||
204 | { |
||||||
205 | return $this->getData(self::KEY_ID); |
||||||
206 | } |
||||||
207 | |||||||
208 | /** |
||||||
209 | * Set Sub Seller Id. |
||||||
210 | * |
||||||
211 | * @param int $sellerId |
||||||
212 | * |
||||||
213 | * @return $this |
||||||
214 | */ |
||||||
215 | public function setSubSellerId($sellerId) |
||||||
216 | { |
||||||
217 | return $this->setData(self::KEY_ID, $sellerId); |
||||||
218 | } |
||||||
219 | |||||||
220 | /** |
||||||
221 | * Get Sub Seller by customer id. |
||||||
222 | * |
||||||
223 | * @return int |
||||||
224 | */ |
||||||
225 | public function getLoadDataByCustomerId() |
||||||
226 | { |
||||||
227 | return $this->getData(self::LOAD_DATA_BY_CUSTOMER_ID); |
||||||
228 | } |
||||||
229 | |||||||
230 | /** |
||||||
231 | * Set Sub Seller load data by customer id. |
||||||
232 | * |
||||||
233 | * @param int $customerId |
||||||
234 | * |
||||||
235 | * @return $this |
||||||
236 | */ |
||||||
237 | public function setLoadDataByCustomerId($customerId) |
||||||
238 | { |
||||||
239 | if ($customerId) { |
||||||
240 | $this->populateSubSellerDataByCustomerId($customerId); |
||||||
241 | } |
||||||
242 | |||||||
243 | return $this->setData(self::LOAD_DATA_BY_CUSTOMER_ID, $customerId); |
||||||
244 | } |
||||||
245 | |||||||
246 | /** |
||||||
247 | * Get Merchant Id. |
||||||
248 | * |
||||||
249 | * @return string; |
||||||
250 | */ |
||||||
251 | public function getMerchantId() |
||||||
252 | { |
||||||
253 | if (!$this->getData(self::MERCHANT_ID)) { |
||||||
254 | $merchantId = $this->subSellerHelper->getMerchantId(); |
||||||
255 | |||||||
256 | return $merchantId; |
||||||
257 | } |
||||||
258 | |||||||
259 | return $this->getData(self::MERCHANT_ID); |
||||||
260 | } |
||||||
261 | |||||||
262 | /** |
||||||
263 | * Set Merchant Id. |
||||||
264 | * |
||||||
265 | * @param string $merchantId |
||||||
266 | * |
||||||
267 | * @return $this |
||||||
268 | */ |
||||||
269 | public function setMerchantId($merchantId) |
||||||
270 | { |
||||||
271 | return $this->setData(self::MERCHANT_ID, $merchantId); |
||||||
272 | } |
||||||
273 | |||||||
274 | /** |
||||||
275 | * Get Code. |
||||||
276 | */ |
||||||
277 | public function getCode() |
||||||
278 | { |
||||||
279 | return $this->getData(self::KEY_CODE); |
||||||
280 | } |
||||||
281 | |||||||
282 | /** |
||||||
283 | * Get Code. |
||||||
284 | * |
||||||
285 | * @param string $code |
||||||
286 | * |
||||||
287 | * @return $this |
||||||
288 | */ |
||||||
289 | public function setCode($code) |
||||||
290 | { |
||||||
291 | return $this->setData(self::KEY_CODE, $code); |
||||||
292 | } |
||||||
293 | |||||||
294 | /** |
||||||
295 | * Get Id Ext. |
||||||
296 | * |
||||||
297 | * @return string; |
||||||
298 | */ |
||||||
299 | public function getIdExt() |
||||||
300 | { |
||||||
301 | return $this->getData(self::ID_EXT); |
||||||
302 | } |
||||||
303 | |||||||
304 | /** |
||||||
305 | * Set Id Ext. |
||||||
306 | * |
||||||
307 | * @param string $idExt |
||||||
308 | * |
||||||
309 | * @return $this |
||||||
310 | */ |
||||||
311 | public function setIdExt($idExt) |
||||||
312 | { |
||||||
313 | return $this->setData(self::ID_EXT, $idExt); |
||||||
314 | } |
||||||
315 | |||||||
316 | /** |
||||||
317 | * Get Sub Seller Email. |
||||||
318 | * |
||||||
319 | * @return string; |
||||||
320 | */ |
||||||
321 | public function getEmail() |
||||||
322 | { |
||||||
323 | return $this->getData(self::EMAIL); |
||||||
324 | } |
||||||
325 | |||||||
326 | /** |
||||||
327 | * Get Sub Seller Email. |
||||||
328 | * |
||||||
329 | * @param string $email |
||||||
330 | * |
||||||
331 | * @return $this |
||||||
332 | */ |
||||||
333 | public function setEmail($email) |
||||||
334 | { |
||||||
335 | return $this->setData(self::EMAIL, $email); |
||||||
336 | } |
||||||
337 | |||||||
338 | /** |
||||||
339 | * Get Sub Seller legal document number. |
||||||
340 | * |
||||||
341 | * @return string; |
||||||
342 | */ |
||||||
343 | public function getLegalDocumentNumber() |
||||||
344 | { |
||||||
345 | return $this->getData(self::LEGAL_DOCUMENT_NUMBER); |
||||||
346 | } |
||||||
347 | |||||||
348 | /** |
||||||
349 | * Get Sub Seller legal document number. |
||||||
350 | * |
||||||
351 | * @param string $legalDocumentNumber |
||||||
352 | * |
||||||
353 | * @return $this |
||||||
354 | */ |
||||||
355 | public function setLegalDocumentNumber($legalDocumentNumber) |
||||||
356 | { |
||||||
357 | return $this->setData(self::LEGAL_DOCUMENT_NUMBER, $legalDocumentNumber); |
||||||
358 | } |
||||||
359 | |||||||
360 | /** |
||||||
361 | * Get Sub Seller type. |
||||||
362 | * |
||||||
363 | * @return string; |
||||||
364 | */ |
||||||
365 | public function getType() |
||||||
366 | { |
||||||
367 | return $this->getData(self::TYPE); |
||||||
368 | } |
||||||
369 | |||||||
370 | /** |
||||||
371 | * Get Sub Seller type. |
||||||
372 | * |
||||||
373 | * @param string $type |
||||||
374 | * |
||||||
375 | * @return $this |
||||||
376 | */ |
||||||
377 | public function setType($type) |
||||||
378 | { |
||||||
379 | return $this->setData(self::TYPE, $type); |
||||||
380 | } |
||||||
381 | |||||||
382 | /** |
||||||
383 | * Get Sub Seller legal name. |
||||||
384 | * |
||||||
385 | * @return string; |
||||||
386 | */ |
||||||
387 | public function getLegalName() |
||||||
388 | { |
||||||
389 | return $this->getData(self::LEGAL_NAME); |
||||||
390 | } |
||||||
391 | |||||||
392 | /** |
||||||
393 | * Set Sub Seller legal name. |
||||||
394 | * |
||||||
395 | * @param string $legalName |
||||||
396 | * |
||||||
397 | * @return $this |
||||||
398 | */ |
||||||
399 | public function setLegalName($legalName) |
||||||
400 | { |
||||||
401 | return $this->setData(self::LEGAL_NAME, $legalName); |
||||||
402 | } |
||||||
403 | |||||||
404 | /** |
||||||
405 | * Get Sub Seller birth date. |
||||||
406 | * |
||||||
407 | * @return string; |
||||||
408 | */ |
||||||
409 | public function getBirthDate() |
||||||
410 | { |
||||||
411 | return $this->getData(self::BIRTH_DATE); |
||||||
412 | } |
||||||
413 | |||||||
414 | /** |
||||||
415 | * Set Sub Seller birth date. |
||||||
416 | * |
||||||
417 | * @param string $birthDate |
||||||
418 | * |
||||||
419 | * @return $this |
||||||
420 | */ |
||||||
421 | public function setBirthDate($birthDate) |
||||||
422 | { |
||||||
423 | return $this->setData(self::BIRTH_DATE, $birthDate); |
||||||
424 | } |
||||||
425 | |||||||
426 | /** |
||||||
427 | * Get Addresses. |
||||||
428 | * |
||||||
429 | * @return \Getnet\SubSellerMagento\Api\Data\AddressesInterface[]|null |
||||||
430 | */ |
||||||
431 | public function getAddresses() |
||||||
432 | { |
||||||
433 | if ($this->getData(self::ADDRESSES)) { |
||||||
434 | return $this->serialize->unserialize($this->getData(self::ADDRESSES)); |
||||||
435 | } |
||||||
436 | |||||||
437 | return $this->getData(self::ADDRESSES); |
||||||
438 | } |
||||||
439 | |||||||
440 | /** |
||||||
441 | * Set Addresses. |
||||||
442 | * |
||||||
443 | * @param \Getnet\SubSellerMagento\Api\Data\AddressesInterface[] $addresses |
||||||
444 | * |
||||||
445 | * @return \Getnet\SubSellerMagento\Api\Data\AddressesInterface |
||||||
446 | * |
||||||
447 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||||||
448 | * @SuppressWarnings(PHPMD.NPathComplexity) |
||||||
449 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||||||
450 | */ |
||||||
451 | public function setAddresses( |
||||||
452 | array $addresses = null |
||||||
453 | ) { |
||||||
454 | $addressesFormat = []; |
||||||
455 | foreach ($addresses as $key => $address) { |
||||||
456 | $regionName = isset($address['address_region']) ? $address['address_region'] : null; |
||||||
457 | $regionId = isset($address['address_region_id']) ? $address['address_region_id'] : null; |
||||||
458 | |||||||
459 | if ($regionId) { |
||||||
460 | $regionName = $this->subSellerHelper->getRegionNameByRegionId($regionId); |
||||||
461 | } |
||||||
462 | |||||||
463 | if ($regionName) { |
||||||
464 | $regionId = $this->subSellerHelper->getRegionIdByRegionName($regionName); |
||||||
465 | } |
||||||
466 | |||||||
467 | $complement = isset($address['address_street_complement']) ? $address['address_street_complement'] : null; |
||||||
468 | |||||||
469 | if ($key === 0) { |
||||||
470 | $addressesFormat[self::ADDRESSES][self::BUSINESS_ADDRESS] = [ |
||||||
471 | 'address_street' => $address['address_street'], |
||||||
472 | 'address_street_number' => $address['address_street_number'], |
||||||
473 | 'address_street_district' => $address['address_street_district'], |
||||||
474 | 'address_street_complement' => isset($complement) ? $complement : null, |
||||||
475 | 'address_city' => $address['address_city'], |
||||||
476 | 'address_region' => $regionName, |
||||||
477 | 'address_region_id' => $regionId, |
||||||
478 | 'address_postcode' => $address['address_postcode'], |
||||||
479 | 'address_country_id' => $address['address_country_id'], |
||||||
480 | ]; |
||||||
481 | } |
||||||
482 | if ($key === 1) { |
||||||
483 | $addressesFormat[self::ADDRESSES][self::MAILING_ADDRESS] = [ |
||||||
484 | 'address_street' => $address['address_street'], |
||||||
485 | 'address_street_number' => $address['address_street_number'], |
||||||
486 | 'address_street_district' => $address['address_street_district'], |
||||||
487 | 'address_street_complement' => isset($complement) ? $complement : null, |
||||||
488 | 'address_city' => $address['address_city'], |
||||||
489 | 'address_region' => isset($address['address_region']) ? $address['address_region'] : null, |
||||||
490 | 'address_region_id' => $address['address_region_id'], |
||||||
491 | 'address_postcode' => $address['address_postcode'], |
||||||
492 | 'address_country_id' => $address['address_country_id'], |
||||||
493 | ]; |
||||||
494 | } |
||||||
495 | } |
||||||
496 | |||||||
497 | return $this->setData(self::ADDRESSES, $this->serialize->serialize($addressesFormat)); |
||||||
0 ignored issues
–
show
|
|||||||
498 | } |
||||||
499 | |||||||
500 | /** |
||||||
501 | * Get Sub Seller telefone. |
||||||
502 | * |
||||||
503 | * @return string; |
||||||
504 | */ |
||||||
505 | public function getTelephone() |
||||||
506 | { |
||||||
507 | return $this->getData(self::TELEPHONE); |
||||||
508 | } |
||||||
509 | |||||||
510 | /** |
||||||
511 | * Set Sub Seller telefone. |
||||||
512 | * |
||||||
513 | * @param string $telefone |
||||||
514 | * |
||||||
515 | * @return $this |
||||||
516 | */ |
||||||
517 | public function setTelephone($telefone) |
||||||
518 | { |
||||||
519 | return $this->setData(self::TELEPHONE, $telefone); |
||||||
520 | } |
||||||
521 | |||||||
522 | /** |
||||||
523 | * Get Bank Accounts. |
||||||
524 | * |
||||||
525 | * @return \Getnet\SubSellerMagento\Api\Data\BankAccountsInterface[]|null |
||||||
526 | */ |
||||||
527 | public function getBankAccounts() |
||||||
528 | { |
||||||
529 | if ($this->getData(self::BANK_ACCOUNTS)) { |
||||||
530 | return $this->serialize->unserialize($this->getData(self::BANK_ACCOUNTS)); |
||||||
531 | } |
||||||
532 | |||||||
533 | return $this->getData(self::BANK_ACCOUNTS); |
||||||
534 | } |
||||||
535 | |||||||
536 | /** |
||||||
537 | * Set Bank Accounts. |
||||||
538 | * |
||||||
539 | * @param \Getnet\SubSellerMagento\Api\Data\BankAccountsInterface[] $bankAccounts |
||||||
540 | * |
||||||
541 | * @return \Getnet\SubSellerMagento\Api\Data\BankAccountsInterface |
||||||
542 | */ |
||||||
543 | public function setBankAccounts( |
||||||
544 | array $bankAccounts = null |
||||||
545 | ) { |
||||||
546 | $bankAccountsFormat = []; |
||||||
547 | foreach ($bankAccounts as $key => $account) { |
||||||
548 | if ($key === 0) { |
||||||
549 | $bankAccountsFormat[self::BANK_ACCOUNTS][self::BANK_ACCOUNTS_UNIQUE_ACCOUNT] = [ |
||||||
550 | 'account_type' => $account['account_type'], |
||||||
551 | 'bank' => $account['bank'], |
||||||
552 | 'agency' => $account['agency'], |
||||||
553 | 'agency_digit' => isset($account['agency_digit']) ? $account['agency_digit'] : null, |
||||||
554 | 'account' => $account['account'], |
||||||
555 | 'account_digit' => isset($account['account_digit']) ? $account['account_digit'] : null, |
||||||
556 | ]; |
||||||
557 | } |
||||||
558 | } |
||||||
559 | |||||||
560 | return $this->setData(self::BANK_ACCOUNTS, $this->serialize->serialize($bankAccountsFormat)); |
||||||
0 ignored issues
–
show
|
|||||||
561 | } |
||||||
562 | |||||||
563 | /** |
||||||
564 | * Get Sub Seller payment plan. |
||||||
565 | * |
||||||
566 | * @return int; |
||||||
567 | */ |
||||||
568 | public function getPaymentPlan() |
||||||
569 | { |
||||||
570 | return $this->getData(self::PAYMENT_PLAN); |
||||||
571 | } |
||||||
572 | |||||||
573 | /** |
||||||
574 | * Set Sub Seller payment plan. |
||||||
575 | * |
||||||
576 | * @param int $paymentPlan |
||||||
577 | * |
||||||
578 | * @return $this |
||||||
579 | */ |
||||||
580 | public function setPaymentPlan($paymentPlan) |
||||||
581 | { |
||||||
582 | return $this->setData(self::PAYMENT_PLAN, $paymentPlan); |
||||||
583 | } |
||||||
584 | |||||||
585 | /** |
||||||
586 | * Get Sub Seller accepted contract. |
||||||
587 | * |
||||||
588 | * @return bool; |
||||||
589 | */ |
||||||
590 | public function getAcceptedContract() |
||||||
591 | { |
||||||
592 | return $this->getData(self::ACCEPTED_CONTRACT); |
||||||
593 | } |
||||||
594 | |||||||
595 | /** |
||||||
596 | * Set Sub Seller accepted contract. |
||||||
597 | * |
||||||
598 | * @param bool $acceptedContract |
||||||
599 | * |
||||||
600 | * @return $this |
||||||
601 | */ |
||||||
602 | public function setAcceptedContract($acceptedContract) |
||||||
603 | { |
||||||
604 | return $this->setData(self::ACCEPTED_CONTRACT, $acceptedContract); |
||||||
605 | } |
||||||
606 | |||||||
607 | /** |
||||||
608 | * Get Sub Seller marketplace store. |
||||||
609 | * |
||||||
610 | * @return bool; |
||||||
611 | */ |
||||||
612 | public function getMarketplaceStore() |
||||||
613 | { |
||||||
614 | return $this->getData(self::MARKETPLACE_STORE); |
||||||
615 | } |
||||||
616 | |||||||
617 | /** |
||||||
618 | * Set Sub Seller marketplace store. |
||||||
619 | * |
||||||
620 | * @param bool $marketplaceStore |
||||||
621 | * |
||||||
622 | * @return $this |
||||||
623 | */ |
||||||
624 | public function setMarketplaceStore($marketplaceStore) |
||||||
625 | { |
||||||
626 | return $this->setData(self::MARKETPLACE_STORE, $marketplaceStore); |
||||||
627 | } |
||||||
628 | |||||||
629 | /** |
||||||
630 | * Get Sub Seller occupation. |
||||||
631 | * |
||||||
632 | * @return string; |
||||||
633 | */ |
||||||
634 | public function getOccupation() |
||||||
635 | { |
||||||
636 | if (!$this->getData(self::OCCUPATION)) { |
||||||
637 | return 'Diversos'; |
||||||
638 | } |
||||||
639 | |||||||
640 | return $this->getData(self::OCCUPATION); |
||||||
641 | } |
||||||
642 | |||||||
643 | /** |
||||||
644 | * Set Sub Seller occupation. |
||||||
645 | * |
||||||
646 | * @param string $ccupation |
||||||
647 | * |
||||||
648 | * @return $this |
||||||
649 | */ |
||||||
650 | public function setOccupation($ccupation) |
||||||
651 | { |
||||||
652 | return $this->setData(self::OCCUPATION, $ccupation); |
||||||
653 | } |
||||||
654 | |||||||
655 | /** |
||||||
656 | * Get Sub Seller monthly gross income. |
||||||
657 | * |
||||||
658 | * @return float; |
||||||
659 | */ |
||||||
660 | public function getMonthlyGrossIncome() |
||||||
661 | { |
||||||
662 | return $this->getData(self::MONTHLY_GROSS_INCOME); |
||||||
663 | } |
||||||
664 | |||||||
665 | /** |
||||||
666 | * Get Sub Seller monthly gross income. |
||||||
667 | * |
||||||
668 | * @param float $monthlyGrossIncome |
||||||
669 | * |
||||||
670 | * @return $this |
||||||
671 | */ |
||||||
672 | public function setMonthlyGrossIncome($monthlyGrossIncome) |
||||||
673 | { |
||||||
674 | return $this->setData(self::MONTHLY_GROSS_INCOME, $monthlyGrossIncome); |
||||||
675 | } |
||||||
676 | |||||||
677 | /** |
||||||
678 | * Get Sub Seller gross equity. |
||||||
679 | * |
||||||
680 | * @return float; |
||||||
681 | */ |
||||||
682 | public function getGrossEquity() |
||||||
683 | { |
||||||
684 | return $this->getData(self::GROSS_EQUITY); |
||||||
685 | } |
||||||
686 | |||||||
687 | /** |
||||||
688 | * Set Sub Seller gross equity. |
||||||
689 | * |
||||||
690 | * @param float $grossEquity |
||||||
691 | * |
||||||
692 | * @return $this |
||||||
693 | */ |
||||||
694 | public function setGrossEquity($grossEquity) |
||||||
695 | { |
||||||
696 | return $this->setData(self::GROSS_EQUITY, $grossEquity); |
||||||
697 | } |
||||||
698 | |||||||
699 | /** |
||||||
700 | * Get Sub Seller status. |
||||||
701 | * |
||||||
702 | * @return int; |
||||||
703 | */ |
||||||
704 | public function getStatus() |
||||||
705 | { |
||||||
706 | return $this->getData(self::STATUS); |
||||||
707 | } |
||||||
708 | |||||||
709 | /** |
||||||
710 | * Set Sub Seller status. |
||||||
711 | * |
||||||
712 | * @param int $status |
||||||
713 | * |
||||||
714 | * @return $this |
||||||
715 | */ |
||||||
716 | public function setStatus($status) |
||||||
717 | { |
||||||
718 | return $this->setData(self::STATUS, $status); |
||||||
719 | } |
||||||
720 | |||||||
721 | /** |
||||||
722 | * Get Sub Seller status comment. |
||||||
723 | * |
||||||
724 | * @return int; |
||||||
725 | */ |
||||||
726 | public function getStatusComment() |
||||||
727 | { |
||||||
728 | return $this->getData(self::STATUS_COMMENT); |
||||||
729 | } |
||||||
730 | |||||||
731 | /** |
||||||
732 | * Set Sub Seller status comment. |
||||||
733 | * |
||||||
734 | * @param string $statusComment |
||||||
735 | * |
||||||
736 | * @return $this |
||||||
737 | */ |
||||||
738 | public function setStatusComment($statusComment) |
||||||
739 | { |
||||||
740 | return $this->setData(self::STATUS_COMMENT, $statusComment); |
||||||
741 | } |
||||||
742 | |||||||
743 | /** |
||||||
744 | * @inheritdoc |
||||||
745 | * |
||||||
746 | * @return \Getnet\SubSellerMagento\Api\Data\SubSellerExtensionInterface|null |
||||||
0 ignored issues
–
show
The type
Getnet\SubSellerMagento\...ellerExtensionInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
747 | */ |
||||||
748 | public function getExtensionAttributes() |
||||||
749 | { |
||||||
750 | return $this->_getExtensionAttributes(); |
||||||
0 ignored issues
–
show
|
|||||||
751 | } |
||||||
752 | |||||||
753 | /** |
||||||
754 | * @inheritdoc |
||||||
755 | * |
||||||
756 | * @param \Getnet\SubSellerMagento\Api\Data\SubSellerExtensionInterface $extensionAttributes |
||||||
757 | * |
||||||
758 | * @return $this |
||||||
759 | */ |
||||||
760 | public function setExtensionAttributes( |
||||||
761 | \Getnet\SubSellerMagento\Api\Data\SubSellerExtensionInterface $extensionAttributes |
||||||
762 | ) { |
||||||
763 | return $this->_setExtensionAttributes($extensionAttributes); |
||||||
764 | } |
||||||
765 | |||||||
766 | /** |
||||||
767 | * Populate Sub Seller Data by Customer Id. |
||||||
768 | * |
||||||
769 | * @param int $customerId |
||||||
770 | * |
||||||
771 | * @return void; |
||||||
772 | */ |
||||||
773 | public function populateSubSellerDataByCustomerId($customerId) |
||||||
774 | { |
||||||
775 | $customer = $this->customerRepository->getById($customerId); |
||||||
776 | $this->setCode('seller_'.$customer->getId()); |
||||||
777 | $this->setEmail($customer->getEmail()); |
||||||
778 | $this->setLegalDocumentNumber($customer->getTaxvat()); |
||||||
779 | $this->setLegalName($customer->getFirstname().' '.$customer->getLastname()); |
||||||
780 | $this->setBirthDate($customer->getDob()); |
||||||
781 | $addressId = $customer->getDefaultBilling(); |
||||||
782 | |||||||
783 | if ($addressId) { |
||||||
784 | $addresses = []; |
||||||
785 | $address = $this->addressRepository->getById($addressId); |
||||||
0 ignored issues
–
show
$addressId of type string is incompatible with the type integer expected by parameter $addressId of Magento\Customer\Api\Add...oryInterface::getById() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
786 | $this->setMailingAddressEqualson(true); |
||||||
0 ignored issues
–
show
The method
setMailingAddressEqualson() does not exist on Getnet\SubSellerMagento\Model\Seller\SubSeller . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
787 | $streets = $address->getStreet(); |
||||||
788 | $addresses[0] = [ |
||||||
789 | 'address_street' => $streets[0], |
||||||
790 | 'address_street_number' => $streets[1], |
||||||
791 | 'address_street_district' => isset($streets[2]) ? $streets[2] : $streets[3], |
||||||
792 | 'address_street_complement' => isset($streets[3]) ? $streets[3] : null, |
||||||
793 | 'address_city' => $address->getCity(), |
||||||
794 | 'address_region' => $address->getRegion()->getRegionCode(), |
||||||
795 | 'address_region_id' => $address->getRegionId(), |
||||||
796 | 'address_postcode' => $address->getPostcode(), |
||||||
797 | 'address_country_id' => $address->getCountryId(), |
||||||
798 | ]; |
||||||
799 | $this->setAddresses($addresses); |
||||||
800 | $this->setTelephone($address->getTelephone()); |
||||||
801 | |||||||
802 | if ($address->getVatId()) { |
||||||
803 | $this->setLegalDocumentNumber($address->getVatId()); |
||||||
804 | } |
||||||
805 | } |
||||||
806 | } |
||||||
807 | } |
||||||
808 |