Example #1
0
 public function getCustomerInfoFromOrder($order)
 {
     $billingAddress = $order->getBillingAddress();
     $address = new Varien_Object();
     $address->setStreet($billingAddress->getStreet(1));
     $address->setStreetNumber($billingAddress->getStreet(2));
     $address->setComplementary($billingAddress->getStreet(3));
     // optional
     $address->setNeighborhood($billingAddress->getStreet(4));
     $address->setZipcode(Zend_Filter::filterStatic($billingAddress->getPostcode(), 'Digits'));
     $customer = new Varien_Object();
     $customer->setName($order->getCustomerName());
     $customer->setDocumentNumber($order->getCustomerTaxvat());
     $customer->setEmail($order->getCustomerEmail());
     $customer->setPhone($this->splitTelephone($billingAddress->getTelephone()));
     $customer->setSex($this->formatGender($order->getCustomerGender()));
     // optional
     $customer->setBornAt($this->formatDob($order->getCustomerDob()));
     // optional
     $customer->setAddress($address);
     Mage::dispatchEvent('pagarme_get_customer_info_from_order_after', array('order' => $order, 'customer_info' => $customer));
     return $customer;
 }