Skip to content

Commit

Permalink
Merge pull request #681 from NickMolloy/add_line_item_discount_amount
Browse files Browse the repository at this point in the history
Add discount amount to invoice line item model
  • Loading branch information
calcinai authored Feb 6, 2020
2 parents 9b248a1 + 71f9bd3 commit 3f08234
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/XeroPHP/Models/Accounting/Invoice/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class LineItem extends Remote\Model
* @property string DiscountRate
*/

/**
* Discount amount being applied to a line item (only supported on ACCREC invoices – ACC PAY
* invoices and credit notes in Xero do not support discounts.
*
* @property float DiscountAmount
*/

/**
* Get the resource uri of the class (Contacts) etc.
*
Expand Down Expand Up @@ -154,6 +161,7 @@ public static function getProperties()
'LineAmount' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],
'Tracking' => [false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\TrackingCategory', true, false],
'DiscountRate' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'DiscountAmount' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],
];
}

Expand Down Expand Up @@ -395,4 +403,25 @@ public function setDiscountRate($value)

return $this;
}

/**
* @return float
*/
public function getDiscountAmount()
{
return $this->_data['DiscountAmount'];
}

/**
* @param float $value
*
* @return LineItem
*/
public function setDiscountAmount($value)
{
$this->propertyUpdated('DiscountAmount', $value);
$this->_data['DiscountAmount'] = $value;

return $this;
}
}

0 comments on commit 3f08234

Please sign in to comment.