-
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.
(#10): Added few new ad types and updated few existing ones
- Loading branch information
Ivan Ruzak
committed
Dec 6, 2021
1 parent
c680676
commit 2e91435
Showing
9 changed files
with
271 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdType; | ||
use eiriksm\FinnTransfer\Traits\PriceTrait; | ||
|
||
class BoatMotorXml extends AdType | ||
{ | ||
use PriceTrait; | ||
|
||
protected $dtd = 'https://www.iad.no/dtd/IADIF-boat_motor23.dtd'; | ||
|
||
protected $documentType = 'IAD.IF.BOAT_MOTOR'; | ||
|
||
protected $adBodyTag = 'BOAT_MOTOR'; | ||
|
||
public function __construct($partner_id, $provider) | ||
{ | ||
parent::__construct($partner_id, $provider); | ||
$this->BOATMOTOR_CATEGORY = ''; | ||
$this->MOTORTYPE = ''; | ||
$this->MOTORMAKE = ''; | ||
$this->MOTORSIZE = ''; | ||
|
||
// Price. | ||
$this->createPriceElements(); | ||
$this->priceBody->removeChild($this->priceCurrencyBody); | ||
|
||
// Other fields. | ||
$this->DESCRIPTION = ''; | ||
$this->VIDEO_URL = ''; | ||
|
||
// More info. | ||
$this->createMoreInfoElements(); | ||
|
||
// Contact. | ||
$this->initializeContact(); | ||
$this->contactBody->removeAttribute('PHONESALESRESERVATION'); | ||
$this->contactBody->removeChild($this->contactFaxBody); | ||
} | ||
|
||
public function setSegment($segment) | ||
{ | ||
$this->BOATMOTOR_CATEGORY = $segment; | ||
} | ||
|
||
public function setMake($make) | ||
{ | ||
$this->MOTORTYPE = $make; | ||
} | ||
|
||
public function setPhoneSalesReservation($reservation = true) | ||
{ | ||
} | ||
|
||
public function setContactFax($fax) | ||
{ | ||
} | ||
} |
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
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,107 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdType; | ||
use eiriksm\FinnTransfer\Traits\ModelPropertyTrait; | ||
use eiriksm\FinnTransfer\Traits\MotorPriceTrait; | ||
|
||
class MobileHomeXml extends AdType | ||
{ | ||
use ModelPropertyTrait; | ||
use MotorPriceTrait { | ||
setMotorPrice as protected setMotorPriceTrait; | ||
createMotorPriceElements as protected createMotorPriceElementsTrait; | ||
} | ||
|
||
protected $dtd = 'https://www.iad.no/dtd/IADIF-mobilehome-11.dtd'; | ||
|
||
protected $documentType = 'IAD.IF.MOBILE_HOME'; | ||
|
||
protected $adBodyTag = 'MOBILE_HOME'; | ||
|
||
protected $weightBody; | ||
protected $weightNet; | ||
protected $weightTot; | ||
|
||
public function __construct($partner_id, $provider) | ||
{ | ||
parent::__construct($partner_id, $provider); | ||
|
||
$this->CARAVAN_SALESFORM = ''; | ||
$this->MOBILE_HOME_SEGMENT = ''; | ||
$this->MOBILE_HOME_CHASSIS = ''; | ||
|
||
// Model. | ||
$this->createModelProperty('CARAVAN_MODEL'); | ||
$this->adBody->appendChild($this->modelOuterBody); | ||
|
||
// Other fields. | ||
$this->YEAR_MODEL = ''; | ||
$this->MILEAGE = ''; | ||
$this->NO_OF_BERTHS = ''; | ||
$this->BED = ''; | ||
$this->WIDTH_CM = ''; | ||
$this->LENGTH_CM = ''; | ||
|
||
// Weight. | ||
$this->weightBody = $this->dom->createElement('CARAVAN_WEIGHT'); | ||
$this->weightNet = $this->dom->createElement('WEIGHT_NET'); | ||
$this->weightTot = $this->dom->createElement('WEIGHT_TOT'); | ||
$this->weightBody->appendChild($this->weightNet); | ||
$this->weightBody->appendChild($this->weightTot); | ||
$this->adBody->appendChild($this->weightBody); | ||
|
||
// Motor and price elements. | ||
$this->createMotorPriceElements(); | ||
|
||
// Registration. | ||
$reg_el = $this->dom->createElement('REGISTRATION', '0'); | ||
$this->priceBody->appendChild($reg_el); | ||
|
||
// Other fields. | ||
$this->MOBILE_HOME_EQUIPMENT = ''; | ||
$this->DESCRIPTION = ''; | ||
$this->CARAVAN_CONDITION_REPORT = ''; | ||
$this->CAR_CONDITION_DOC = ''; | ||
$this->createMoreInfoElements(); | ||
|
||
// Contact. | ||
$this->initializeContact(); | ||
$this->contactBody->removeAttribute('PHONESALESRESERVATION'); | ||
|
||
// Other fields. | ||
$this->MOBILE_HOME_LOCATION = ''; | ||
$this->NO_OF_SEATS = ''; | ||
|
||
// Engine. | ||
$this->createEngineElements(); | ||
$this->engineBody->removeChild($this->engineFuelBody); | ||
|
||
// Other fields. | ||
$this->TRANSMISSION = ''; | ||
$this->WHEEL_DRIVE = ''; | ||
$this->MOBILE_HOME_CONDITION = ''; | ||
$this->MOBILE_HOME_WARRANTY = ''; | ||
$this->WARRANTY_DISTANCE = ''; | ||
$this->REGNO = ''; | ||
$this->NO_OF_OWNERS = ''; | ||
$this->REGISTRATION_FIRST = ''; | ||
$this->VIDEO_URL = ''; | ||
} | ||
|
||
public function createMotorPriceElements($vat_attribute = false) | ||
{ | ||
$this->createMotorPriceElementsTrait($vat_attribute); | ||
$this->priceBody->removeChild($this->priceCurrencyBody); | ||
} | ||
|
||
public function setSegment($segment) | ||
{ | ||
$this->MOBILE_HOME_SEGMENT = $segment; | ||
} | ||
|
||
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,39 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\AdTypes; | ||
|
||
use eiriksm\FinnTransfer\AdType; | ||
use eiriksm\FinnTransfer\Traits\PriceTrait; | ||
|
||
class MotorMiscXml extends AdType | ||
{ | ||
use PriceTrait; | ||
|
||
protected $dtd = 'https://www.iad.no/dtd/IADIF-motor_misc51.dtd'; | ||
|
||
protected $documentType = 'IAD.IF.MOTORMISC'; | ||
|
||
protected $adBodyTag = 'MOTORMISC'; | ||
|
||
public function __construct($partner_id, $provider) | ||
{ | ||
parent::__construct($partner_id, $provider); | ||
|
||
$this->MOTORMISC_CATEGORY = ''; | ||
$this->DESCRIPTION = ''; | ||
|
||
// More info. | ||
$this->createMoreInfoElements(); | ||
|
||
// Price. | ||
$this->createPriceElements(); | ||
|
||
// Contact. | ||
$this->initializeContact(); | ||
} | ||
|
||
public function setSegment($segment) | ||
{ | ||
$this->MOTORMISC_CATEGORY = $segment; | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
namespace eiriksm\FinnTransfer\Traits; | ||
|
||
trait PriceTrait | ||
{ | ||
|
||
/** | ||
* @var \DOMElement | ||
*/ | ||
protected $priceBody; | ||
|
||
protected $priceAmountBody; | ||
|
||
protected $priceCurrencyBody; | ||
|
||
|
||
public function setPrice($number, $currency = 'NOK') | ||
{ | ||
if (!isset($this->priceBody)) { | ||
$this->createPriceElements(); | ||
} | ||
$this->priceAmountBody->nodeValue = $number; | ||
$this->priceCurrencyBody->nodeValue = $currency; | ||
} | ||
|
||
protected function createPriceElements() | ||
{ | ||
if (!isset($this->priceBody)) { | ||
$this->priceBody = $this->dom->createElement('PRICE'); | ||
$this->priceAmountBody = $this->dom->createElement('AMOUNT'); | ||
$this->priceBody->appendChild($this->priceAmountBody); | ||
$this->priceCurrencyBody = $this->dom->createElement('CURRENCY'); | ||
$this->priceBody->appendChild($this->priceCurrencyBody); | ||
$this->adBody->appendChild($this->priceBody); | ||
} | ||
} | ||
} |