Skip to content

Commit

Permalink
Merge pull request #901 from dipaksarkar/master
Browse files Browse the repository at this point in the history
[Fix] Purchase Order CurrencyRate and Contact's PaymentTerms
  • Loading branch information
calcinai committed Nov 1, 2023
2 parents d7e2524 + 8f5d6c9 commit 29218c4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 9 deletions.
22 changes: 19 additions & 3 deletions src/XeroPHP/Models/Accounting/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Contact extends Remote\Model
/**
* The default payment terms for the contact – see Payment Terms.
*
* @property PaymentTerm[] PaymentTerms
* @property PaymentTerm PaymentTerms
*/

/**
Expand Down Expand Up @@ -960,7 +960,7 @@ public function setTrackingCategoryOption($value)
}

/**
* @return PaymentTerm[]|Remote\Collection
* @return PaymentTerm|Remote\Collection
*/
public function getPaymentTerms()
{
Expand All @@ -978,7 +978,23 @@ public function addPaymentTerm(PaymentTerm $value)
if (! isset($this->_data['PaymentTerms'])) {
$this->_data['PaymentTerms'] = new Remote\Collection();
}
$this->_data['PaymentTerms'][] = $value;
$this->_data['PaymentTerms'] = $value;

return $this;
}

/**
* @param PaymentTerm $value
*
* @return Contact
*/
public function setPaymentTerm(PaymentTerm $value)
{
$this->propertyUpdated('PaymentTerms', $value);
if (! isset($this->_data['PaymentTerms'])) {
$this->_data['PaymentTerms'] = new Remote\Collection();
}
$this->_data['PaymentTerms'] = $value;

return $this;
}
Expand Down
42 changes: 37 additions & 5 deletions src/XeroPHP/Models/Accounting/Organisation/PaymentTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class PaymentTerm extends Remote\Model
/**
* Default payment terms for bills (accounts payable) – see Payment Terms.
*
* @property Bill[] Bills
* @property Bill Bills
*/

/**
* Default payment terms for sales invoices(accounts receivable) – see Payment Terms.
*
* @property Sale[] Sales
* @property Sale Sales
*/
const DAYSAFTERBILLDATE = 'DAYSAFTERBILLDATE';

Expand All @@ -42,7 +42,7 @@ public static function getResourceURI()
*/
public static function getRootNodeName()
{
return 'PaymentTerm';
return 'PaymentTerms';
}

/**
Expand Down Expand Up @@ -116,7 +116,23 @@ public function addBill(Bill $value)
if (! isset($this->_data['Bills'])) {
$this->_data['Bills'] = new Remote\Collection();
}
$this->_data['Bills'][] = $value;
$this->_data['Bills'] = $value;

return $this;
}

/**
* @param Bill $value
*
* @return PaymentTerm
*/
public function setBill(Bill $value)
{
$this->propertyUpdated('Bills', $value);
if (!isset($this->_data['Bills'])) {
$this->_data['Bills'] = new Remote\Collection();
}
$this->_data['Bills'] = $value;

return $this;
}
Expand All @@ -140,7 +156,23 @@ public function addSale(Sale $value)
if (! isset($this->_data['Sales'])) {
$this->_data['Sales'] = new Remote\Collection();
}
$this->_data['Sales'][] = $value;
$this->_data['Sales'] = $value;

return $this;
}

/**
* @param Sale $value
*
* @return PaymentTerm
*/
public function setSale(Sale $value)
{
$this->propertyUpdated('Sales', $value);
if (!isset($this->_data['Sales'])) {
$this->_data['Sales'] = new Remote\Collection();
}
$this->_data['Sales'] = $value;

return $this;
}
Expand Down
15 changes: 14 additions & 1 deletion src/XeroPHP/Models/Accounting/PurchaseOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public static function getProperties()
'PurchaseOrderNumber' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'Reference' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'BrandingThemeID' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'CurrencyCode' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'Status' => [false, self::PROPERTY_TYPE_ENUM, null, false, false],
'SentToContact' => [false, self::PROPERTY_TYPE_BOOLEAN, null, false, false],
'DeliveryAddress' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
Expand All @@ -254,6 +253,7 @@ public static function getProperties()
'DeliveryInstructions' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'ExpectedArrivalDate' => [false, self::PROPERTY_TYPE_DATE, '\\DateTimeInterface', false, false],
'PurchaseOrderID' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'CurrencyCode' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
'CurrencyRate' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],
'SubTotal' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],
'TotalTax' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false],
Expand Down Expand Up @@ -637,6 +637,19 @@ public function getCurrencyRate()
return $this->_data['CurrencyRate'];
}

/**
* @param string $value
*
* @return PurchaseOrder
*/
public function setCurrencyRate($value)
{
$this->propertyUpdated('CurrencyRate', $value);
$this->_data['CurrencyRate'] = $value;

return $this;
}

/**
* @return float
*/
Expand Down

0 comments on commit 29218c4

Please sign in to comment.