コード例 #1
0
 /**
  * @see AdditionalValuesEntity::toArray()
  */
 public function testToArray()
 {
     $this->object->addTax(AdditionalValuesEntity::TX_VALUE, 'USD', 1000);
     $this->object->addTax(AdditionalValuesEntity::TX_TAX, 'USD', 1000);
     $this->object->addTax(AdditionalValuesEntity::TX_TAX_RETURN_BASE, 'USD', 1000);
     $this->object->addTax(AdditionalValuesEntity::TX_ADDITIONAL_VALUE, 'USD', 1000);
     $rs = $this->object->toArray();
     $this->assertInternalType('array', $rs);
     $this->assertEquals(4, count($rs));
     foreach ($rs as $entry) {
         $this->assertInternalType('array', $entry);
         $this->assertEquals(2, count($entry));
         $this->assertArrayHasKey('string', $entry);
         $this->assertArrayHasKey('additionalValue', $entry);
         $this->assertInternalType('array', $entry['additionalValue']);
         $this->assertEquals(2, count($entry['additionalValue']));
         $this->assertArrayHasKey('currency', $entry['additionalValue']);
         $this->assertArrayHasKey('value', $entry['additionalValue']);
     }
 }
コード例 #2
0
 /**
  * @see OrderEntity::setAdditionalValues()
  */
 public function testSetAdditionalValues()
 {
     $additionalValues = new AdditionalValuesEntity();
     $additionalValues->addTax(AdditionalValuesEntity::TX_VALUE, 'BRL', 'BRL', 1000);
     $additionalValues->addTax(AdditionalValuesEntity::TX_TAX, 'BRL', 'BRL', 1000);
     $additionalValues->addTax(AdditionalValuesEntity::TX_TAX_RETURN_BASE, 'BRL', 1000);
     $additionalValues->addTax(AdditionalValuesEntity::TX_ADDITIONAL_VALUE, 'BRL', 1000);
     $rs = $this->object->setAdditionalValues($additionalValues);
     $this->assertInstanceOf('\\PayU\\Entity\\Transaction\\Order\\OrderEntity', $rs);
 }
コード例 #3
0
ファイル: OrderEntity.php プロジェクト: leonardothibes/payu
 /**
  * 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;
 }