Exemplo n.º 1
0
 /**
  * @see BuyerEntity::toArray()
  */
 public function testToArray()
 {
     $address = array('street1' => 'street1_' . rand(1, 1000), 'street2' => 'street2_' . rand(1, 1000), 'city' => 'city_' . rand(1, 1000), 'state' => 'state_' . rand(1, 1000), 'country' => 'country_' . rand(1, 1000), 'postalCode' => 'postalCode_' . rand(1, 1000), 'phone' => 'phone_' . rand(1, 1000));
     $shippingAddress = new ShippingAddressEntity();
     $shippingAddress->setStreet1($address['street1'])->setStreet2($address['street2'])->setCity($address['city'])->setState($address['state'])->setCountry($address['country'])->setPostalCode($address['postalCode'])->setPhone($address['phone']);
     $this->object->setShippingAddress($shippingAddress);
     $buyer = array('fullName' => 'person name ' . rand(1, 9) . rand(1, 9) . rand(1, 9), 'emailAddress' => 'email' . rand(1, 9) . rand(1, 9) . rand(1, 9) . '@foo-bar.com', 'dniNumber' => Cpf::random(), 'shippingAddress' => $address);
     $this->object->setFullName($buyer['fullName'])->setEmailAddress($buyer['emailAddress'])->setDniNumber($buyer['dniNumber']);
     $rs = $this->object->toArray();
     $this->assertSame($buyer, $rs);
 }
Exemplo n.º 2
0
 /**
  * Generate array order.
  * @return array
  */
 public function toArray()
 {
     $return = array('accountId' => $this->accountId, 'referenceCode' => $this->referenceCode, 'description' => $this->description, 'language' => $this->language, 'notifyUrl' => $this->notifyUrl, 'signature' => $this->signature, 'buyer' => $this->buyer->toArray(), 'additionalValues' => $this->additionalValues->toArray());
     if (!$this->getShippingAddress()->isEmpty()) {
         $return = array_merge($return, array('shippingAddress' => $this->shippingAddress->toArray()));
     }
     return $return;
 }