public function __construct($civility = null, $lastname = null, $firstname = null, $email_address = null) { parent::__construct(); $this->childNom($lastname, array('titre' => $civility)); $this->childPrenom($firstname); $this->childEmail($email_address); }
public function __construct($siteid, $refid, $montant, $ip, $timestamp, $devise = "EUR") { parent::__construct(); $this->childSiteid($siteid, array()); $this->childRefid($refid, array()); $this->childMontant($montant, array('devise' => $devise)); $this->childIp($ip, array('timestamp' => $timestamp)); }
public function __call($name, array $params) { //fonction returnItem : retourne la valeur de l'attribute Item si existant, null sinon if (preg_match('#^return.+$#', $name)) { $elementname = strtolower(preg_replace('#^return(.+)$#', '$1', $name)); return array_key_exists($elementname, $this->getAttributes()) ? $this->getAttribute($elementname) : null; } return parent::__call($name, $params); }
/** * build xml with customer's and order's data et send it to FIA-NET * * @param int $id_order * @return boolean */ public function sendXML($id_order) { $order = new Order($id_order); $montant = $order->total_paid; $date = $order->date_add; $customer = new Customer($order->id_customer); $lastname = $customer->lastname; $firstname = $customer->firstname; $id_currency = $order->id_currency; $currency = new Currency($id_currency); if (_PS_VERSION_ < '1.5') { $civility = $customer->id_gender; $accepted_civility = array("1", "2", "3"); if (!in_array($civility, $accepted_civility)) { $civility = '1'; } } else { $gender = new Gender($customer->id_gender); $id_lang = Language::getIdByIso($this->context->language->iso_code); $civility = $gender->name[$id_lang] == 'Mr.' ? 1 : 2; } //xml construction if (_PS_VERSION_ < '1.5') { $fianetsceau = new Sceau(); } else { $fianetsceau = new Sceau((int) $order->id_shop); } $utilisateur = new SceauXMLElement('<utilisateur></utilisateur>'); $nom = $utilisateur->childNom($customer->lastname); $nom->addAttribute('titre', $civility); $utilisateur->childPrenom($customer->firstname); $utilisateur->childEmail(strtolower($customer->email)); $infocommande = new SceauXMLElement('<infocommande></infocommande>'); $infocommande->childSiteid($fianetsceau->getSiteid()); $infocommande->childRefid($id_order); $montant = $infocommande->childMontant($order->total_paid); $montant->addAttribute('devise', $currency->iso_code); $ip = new SceauXMLElement('<ip>' . $this->getCustomerIP($id_order) . '</ip>'); $ip->addAttribute('timestamp', $order->date_add); $infocommande->childIp($ip); $paiement = new SceauXMLElement('<paiement></paiement>'); $paiement->childType($this->getPaymentFianetType($id_order)); $lang = Language::getIsoById($order->id_lang); $langue = $infocommande->childLangue($lang); $xml_order = new SceauControl(); $xml_order->childUtilisateur($utilisateur); $xml_order->childInfocommande($infocommande); $xml_order->childPaiement($paiement); $fianetsceau->addCrypt($xml_order); $result = $fianetsceau->sendSendrating($xml_order); if (!($result === false)) { $resxml = new SceauXMLElement($result); if ($resxml->getAttribute('type') != "OK") { //update fianetsceau_state 3:error $this->updateOrder($id_order, array('id_fianetsceau_state' => '3')); SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, 'Order ' . $id_order . ' XML Send error : ' . $resxml->getChildByName('detail')->getValue()); return false; } else { //update fianetsceau_state 2:sent $this->updateOrder($id_order, array('id_fianetsceau_state' => '2')); } return true; } else { //update fianetsceau_state 3:error $this->updateOrder($id_order, array('id_fianetsceau_state' => '3')); SceauLogger::insertLogSceau(__METHOD__ . " : " . __LINE__, 'Order ' . $id_order . ' XML Send error : ' . $resxml->getChildByName('detail')->getValue()); return false; } }
public function __construct() { parent::__construct('adresse'); }
public function __construct() { parent::__construct('infocommande'); }
/** * * @param string $name * @param array $params * @return mixed */ public function __call($name, array $params) { if (preg_match('#^get(.+)$#', $name, $out)) { return $this->__get(strtolower($out[1])); } if (preg_match('#^set(.+)$#', $name, $out)) { return $this->__set(strtolower($out[1]), $params[0]); } if (preg_match('#^child(.+)$#', $name, $out)) { $elementname = strtolower($out[1]); $empty_allowed = isset($params[2]) ? $params[2] : false; if (isset($params[0]) && SceauTools::isXMLElement($params[0])) { if ($params[0]->getName() != $elementname) { throw new Exception("Le nom de la balise ne correspond pas : {$elementname} attendu, " . $params[0]->getName() . " trouvé."); } if (!$params[0]->isEmpty() || $empty_allowed) { return $this->addChild($params[0]); } return false; } $child = new SceauXMLElement("<{$elementname}></{$elementname}>"); if (isset($params[1])) { foreach ($params[1] as $att => $value) { $child->addAttribute($att, $value); } } if (!isset($params[0]) || is_null($params[0])) { if ($empty_allowed) { return $this->addChild($child); } return false; } if (is_string($params[0]) or is_int($params[0])) { if (SceauTools::isXMLstring($params[0])) { $granchild = $this->createChild($params[0]); $child->addChild($granchild); } else { $child->setValue($params[0]); } } if (!$child->isEmpty() || $empty_allowed) { return $this->addChild($child); } return false; } }
public function __construct($type = null) { parent::__construct(); $this->childType($type); }
public function __construct() { parent::__construct('utilisateur'); }
public function __construct() { parent::__construct('produit'); }
/** * return true if order already have a crypt * * @param SceauXMLElement $order * @return boolean */ public function findCrypt(SceauXMLElement $order) { $cryptelement = $order->getChildrenByName('crypt'); return count($cryptelement) > 0; }
public function __construct() { parent::__construct("<control fianetmodule='api_php_prestashop' version='2.2'></control>"); }