Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Purchase Order CurrencyRate and Contact's PaymentTerms #901

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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