-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add some new types * Code style * Stop being strict about covers annotation * Add tests for the new classes
- Loading branch information
Showing
7 changed files
with
202 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdType; | ||
use eiriksm\FinnTransfer\Traits\ModelPropertyTrait; | ||
use eiriksm\FinnTransfer\Traits\MotorPriceTrait; | ||
|
||
class McXml extends AdType | ||
{ | ||
use ModelPropertyTrait; | ||
use MotorPriceTrait { | ||
setMotorPrice as protected setMotorPriceTrait; | ||
createMotorPriceElements as protected createMotorPriceElementsTrait; | ||
} | ||
|
||
protected $dtd = 'http://www.finn.no/dtd/IADIF-mc76.dtd'; | ||
|
||
protected $documentType = 'IAD.IF.MC'; | ||
|
||
protected $adBodyTag = 'MC'; | ||
|
||
public function __construct($partner_id, $provider) | ||
{ | ||
parent::__construct($partner_id, $provider); | ||
$this->MC_CONDITION = ''; | ||
$this->createModelProperty('MC_MODEL'); | ||
$this->adBody->appendChild($this->modelOuterBody); | ||
$this->MC_MAIN_CATEGORY = ''; | ||
$this->MC_CATEGORY = ''; | ||
$this->YEAR_MODEL = ''; | ||
$this->MILEAGE = ''; | ||
$this->createMotorPriceElements(); | ||
$this->EXTERIOR_COLOUR = ''; | ||
$this->MC_EQUIPMENT = ''; | ||
$this->createEngineElements(); | ||
$this->WEIGHT = ''; | ||
$this->DESCRIPTION = ''; | ||
$this->createMoreInfoElements(); | ||
$this->NO_OF_OWNERS = ''; | ||
$this->REGNO = ''; | ||
$this->MC_WARRANTY = ''; | ||
$this->WARRANTY_DURATION = ''; | ||
$this->WARRANTY_DISTANCE = ''; | ||
$this->MC_CONDITION_REPORT = ''; | ||
$this->VIDEO_URL = ''; | ||
$this->initializeContact(); | ||
$this->contactBody->removeAttribute('PHONESALESRESERVATION'); | ||
$this->contactBody->removeChild($this->contactFaxBody); | ||
$this->contactBody->removeChild($this->contactURLBody); | ||
} | ||
|
||
public function setContactFax($fax) | ||
{ | ||
} | ||
|
||
public function setContactUrl($url) | ||
{ | ||
} | ||
|
||
public function setSegment($value) | ||
{ | ||
$this->MC_MAIN_CATEGORY = $value; | ||
} | ||
|
||
public function createMotorPriceElements($vat_attribute = false) | ||
{ | ||
$this->createMotorPriceElementsTrait($vat_attribute); | ||
$this->priceBody->removeChild($this->priceCurrencyBody); | ||
} | ||
|
||
public function setAdType($type) | ||
{ | ||
$this->CAR_SALESFORM = $type; | ||
} | ||
|
||
public function setRegistrationNumber($number) | ||
{ | ||
$this->REGNO = $number; | ||
} | ||
|
||
public function setPhoneSalesReservation($reservation = true) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdType; | ||
use eiriksm\FinnTransfer\Traits\ModelPropertyTrait; | ||
use eiriksm\FinnTransfer\Traits\MotorPriceTrait; | ||
|
||
class TorgetXml extends AdType | ||
{ | ||
|
||
protected $dtd = 'https://www.finn.no/dtd/IADIF-BitsandPieces62.dtd'; | ||
|
||
protected $documentType = 'IAD.IF.BITSPIECES'; | ||
|
||
protected $adBodyTag = 'SALESOBJECT'; | ||
|
||
/** | ||
* @var \DOMElement | ||
*/ | ||
protected $categoryBody; | ||
|
||
/** | ||
* @var \DOMElement | ||
*/ | ||
protected $productCategory; | ||
|
||
/** | ||
* @var \DOMElement | ||
*/ | ||
protected $anonContactBody; | ||
protected $anonReference; | ||
protected $anonInfo; | ||
|
||
public function __construct($partner_id, $provider) | ||
{ | ||
parent::__construct($partner_id, $provider); | ||
$this->categoryBody = $this->dom->createElement('CATEGORY'); | ||
$this->productCategory = $this->dom->createElement('PRODUCTCATEGORY'); | ||
$this->categoryBody->appendChild($this->productCategory); | ||
$this->adBody->appendChild($this->categoryBody); | ||
$this->GENERIC_ATTRIBUTE = ''; | ||
$this->customTags['GENERIC_ATTRIBUTE']->setAttribute('XMLNAME', ''); | ||
$this->DESCRIPTION = ''; | ||
$this->ITEM_CONDITION = ''; | ||
$this->createMoreInfoElements(); | ||
$this->PRICE = ''; | ||
$this->initializeContact(); | ||
$this->TRANSPORT_TERMS = ''; | ||
$this->PAYMENT_TERMS = ''; | ||
$this->anonContactBody = $this->dom->createElement('ANONYMOUS_CONTACT'); | ||
$this->anonReference = $this->dom->createElement('REFERENCE'); | ||
$this->anonContactBody->appendChild($this->anonReference); | ||
$this->anonInfo = $this->dom->createElement('INFO'); | ||
$this->anonContactBody->appendChild($this->anonInfo); | ||
} | ||
|
||
public function setProductCategory($category) | ||
{ | ||
$this->productCategory->nodeValue = $category; | ||
} | ||
|
||
public function setMotorPrice($number, $currency = 'NOK') | ||
{ | ||
} | ||
|
||
public function setIncludingMva($includes) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\Tests\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdTypes\McXml; | ||
|
||
class McXmlTest extends AdTypeTestBase | ||
{ | ||
|
||
protected $className = McXml::class; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\Tests\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdTypes\TorgetXml; | ||
|
||
class TorgetXmlTest extends AdTypeTestBase | ||
{ | ||
|
||
protected $className = TorgetXml::class; | ||
} |