Skip to content

Commit

Permalink
Merge pull request #29 from amcintosh/issue-28-lines-quantity-float
Browse files Browse the repository at this point in the history
🐛 Update quantity on invoice lines to float
  • Loading branch information
amcintosh committed Mar 5, 2022
2 parents dbafed9 + b2c27f1 commit 4b8260e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Support for items
- Support for tasks
- Change quantity field on invoice lines and items to float

## 0.3.0

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Item extends DataTransferObject implements DataModel
*/
#[MapFrom('qty')]
#[MapTo('qty')]
public ?int $quantity;
public ?float $quantity;

/**
* @var string Id for a specific item or product, used in inventory management.
Expand Down
2 changes: 1 addition & 1 deletion src/Model/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LineItem extends DataTransferObject implements DataModel
*/
#[MapFrom('qty')]
#[MapTo('qty')]
public ?int $quantity;
public ?float $quantity;

/**
* @var string First tax amount, in percentage, up to 3 decimal places.
Expand Down
10 changes: 5 additions & 5 deletions tests/Model/InvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function testInvoiceFromResponse(): void
$this->assertSame('Melmac melamine resin molded dinnerware', $line->description);
$this->assertSame(0, $line->expenseId);
$this->assertSame('Bowls', $line->name);
$this->assertSame(4, $line->quantity);
$this->assertSame(4.0, $line->quantity);
$this->assertSame('13', $line->taxAmount1);
$this->assertSame('0', $line->taxAmount2);
$this->assertSame('HST1', $line->taxName1);
Expand Down Expand Up @@ -317,7 +317,7 @@ public function testInvoiceGetContent(): void
'description' => 'Melmac melamine resin molded dinnerware',
'expenseid' => 0,
'name' => 'Bowls',
'qty' => 4,
'qty' => 4.0,
'taxAmount1' => '13',
'taxAmount2' => '0',
'taxName1' => 'HST1',
Expand All @@ -339,7 +339,7 @@ public function testInvoiceGetContent(): void
'description' => 'Melmac melamine resin molded mug',
'expenseid' => 0,
'name' => 'Mugs',
'qty' => 6,
'qty' => 6.0,
'taxAmount1' => '0',
'taxAmount2' => '0',
'taxName1' => '',
Expand Down Expand Up @@ -411,7 +411,7 @@ public function testInvoiceGetContentNew(): void
'description' => 'Melmac melamine resin molded dinnerware',
'expenseid' => 0,
'name' => 'Bowls',
'qty' => 4,
'qty' => 4.0,
'taxAmount1' => '13',
'taxAmount2' => '0',
'taxName1' => 'HST1',
Expand All @@ -433,7 +433,7 @@ public function testInvoiceGetContentNew(): void
'description' => 'Melmac melamine resin molded mug',
'expenseid' => 0,
'name' => 'Mugs',
'qty' => 6,
'qty' => 6.0,
'taxAmount1' => '0',
'taxAmount2' => '0',
'taxName1' => '',
Expand Down
4 changes: 2 additions & 2 deletions tests/Model/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testItemFromResponse(): void
$this->assertSame('Melmac melamine resin molded dinnerware', $item->description);
$this->assertSame('50', $item->inventory);
$this->assertSame('Bowls', $item->name);
$this->assertSame(4, $item->quantity);
$this->assertSame(4.0, $item->quantity);
$this->assertSame('SQ8608333', $item->sku);
$this->assertSame(2, $item->tax1);
$this->assertSame(0, $item->tax2);
Expand All @@ -62,7 +62,7 @@ public function testItemGetContent(): void
'description' => 'Melmac melamine resin molded dinnerware',
'inventory' => '50',
'name' => 'Bowls',
'qty' => 4,
'qty' => 4.0,
'sku' => 'SQ8608333',
'tax1' => 2,
'tax2' => 0,
Expand Down

0 comments on commit 4b8260e

Please sign in to comment.