Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Ysa\Core\Block;
- use Magento\Framework\View\Element\Template as Template;
- use Ysa\Core\Model\Api as RequestApi;
- use Magento\Framework\View\Element\Template\Context;
- use Ysa\Core\Model\ModelRentacarFinal;
- class RentacarFinal extends Template
- {
- protected $requestApi;
- protected $modelRentacarFinal;
- protected $_rentacarLocationContentFactory;
- public function __construct(
- RequestApi $requestApi,
- Context $context,
- ModelRentacarFinal $modelRentacarFinal,
- \Ysa\Core\Model\ResourceModel\RentacarLocationContent\CollectionFactory $rentacarLocationContentFactory,
- array $data = []
- )
- {
- $this->requestApi = $requestApi;
- $this->modelRentacarFinal = $modelRentacarFinal;
- parent::__construct($context,$data);
- $this->_rentacarLocationContentFactory = $rentacarLocationContentFactory;
- }
- public function getRentaCarFinal()
- {
- $planCode = $this->getRequest()->getParam('planCode');
- $firstname = $this->getRequest()->getParam('first_name_driver');
- $lastname = $this->getRequest()->getParam('last_name_driver');
- $telefone = $this->getRequest()->getParam('telefone');
- $dob = $this->getRequest()->getParam('nascimentoMotorista');
- $document = $this->getRequest()->getParam('docMotorista');
- $email = $this->getRequest()->getParam('email');
- $pais = $this->getRequest()->getParam('pais');
- $city = $this->getRequest()->getParam('city');
- $cep = $this->getRequest()->getParam('cep');
- $responseXml = simplexml_load_string($this->modelRentacarFinal->getBookingTransaction($planCode, $firstname, $lastname, $telefone, $dob, $document, $email, $pais, $city, $cep));
- $response = $responseXml->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children();
- if($response->count())
- {
- $this->modelRentacarFinal->createProductAndAddCart($response);
- return $response;
- } else {
- return false;
- }
- }
- public function getRentacarLocationByCode($rentacarLocationCode){
- $rentacarLocationContentCollection = $this->_rentacarLocationContentFactory->create();
- $rentacarLocationContentCollection->addFieldToFilter('code', ['eq' => $rentacarLocationCode]);
- $rentacarLocationContentCollection->setPageSize(10);
- $rentacarLocationContentCollection->getSelect()->__toString();
- return $rentacarLocationContentCollection->toArray();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement