Skip to content

Commit

Permalink
Adds autobillItemVid to TransactionItem
Browse files Browse the repository at this point in the history
  • Loading branch information
ula committed Oct 31, 2022
1 parent e79b818 commit 7b79d85
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/TestFramework/DataFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ public function currency()
return $currencies[$this->intBetween(0, count($currencies) - 1)];
}

/**
* Return autobill item vid
*
* @return string
*/
public function autobillItemVid()
{
do {
$result = $this->randomCharacters(self::HEX_CHARACTERS, 40);
} while ($result == 0);
return $result;
}

/**
* Return a customer id
*
Expand Down Expand Up @@ -616,7 +629,8 @@ public function itemAsArray($currency)
'quantity' => $this->intBetween(1, 15),
'price' => $this->monetaryAmount($currency),
'sku' => $this->sku(),
'taxClassification' => $this->taxClassification()
'taxClassification' => $this->taxClassification(),
'autoBillItemVid' => $this->autobillItemVid()
);
}

Expand Down
20 changes: 20 additions & 0 deletions src/VindiciaItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ public function setTaxClassification($value)
return $this->setParameter('taxClassification', $value);
}

/**
* Get the item autobill item VID
*
* @return null|string
*/
public function getAutoBillItemVid()
{
return $this->getParameter('autoBillItemVid');
}

/**
* Set the item autobill item VID
*
* @return null|string
*/
public function setAutoBillItemVid($value)
{
return $this->setParameter('autoBillItemVid', $value);
}

/**
* @return void
*/
Expand Down
11 changes: 11 additions & 0 deletions tests/VindiciaItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ public function testTaxClassification()
$this->assertSame($taxClassification, $item->getTaxClassification());
}

/**
* @return void
*/
public function testAutoBillItemVid()
{
$item = new VindiciaItem();
$autobillItemVid = $this->faker->autobillItemVid();
$this->assertSame($item, $item->setAutoBillItemVid($autobillItemVid));
$this->assertSame($autobillItemVid, $item->getAutoBillItemVid());
}

/**
* @expectedException \Omnipay\Vindicia\Exception\InvalidItemException
* @expectedExceptionMessage Item is missing name.
Expand Down

0 comments on commit 7b79d85

Please sign in to comment.