Skip to content

Commit

Permalink
Update for Over/Prepayments March 17th release.
Browse files Browse the repository at this point in the history
  • Loading branch information
calcinai committed Mar 20, 2015
1 parent 8601370 commit 8c67bff
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/XeroPHP/Models/Accounting/Overpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use XeroPHP\Remote;

use XeroPHP\Models\Accounting\BankTransaction\LineItem;
use XeroPHP\Models\Accounting\CreditNote\Allocation;
use XeroPHP\Models\Accounting\Overpayment\Allocation;

class Overpayment extends Remote\Object {

Expand Down Expand Up @@ -172,7 +172,8 @@ public static function getAPIStem(){
*/
public static function getSupportedMethods(){
return array(
Remote\Request::METHOD_GET
Remote\Request::METHOD_GET,
Remote\Request::METHOD_PUT
);
}

Expand Down Expand Up @@ -204,7 +205,7 @@ public static function getProperties(){
'OverpaymentID' => array (false, self::PROPERTY_TYPE_STRING, null, false),
'CurrencyRate' => array (false, self::PROPERTY_TYPE_FLOAT, null, false),
'RemainingCredit' => array (false, self::PROPERTY_TYPE_STRING, null, false),
'Allocations' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\CreditNote\\Allocation', true),
'Allocations' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\Overpayment\\Allocation', true),
'HasAttachments' => array (false, self::PROPERTY_TYPE_BOOLEAN, null, false)
);
}
Expand Down
151 changes: 151 additions & 0 deletions src/XeroPHP/Models/Accounting/Overpayment/Allocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

namespace XeroPHP\Models\Accounting\Overpayment;

use XeroPHP\Remote;

use XeroPHP\Models\Accounting\Invoice;

class Allocation extends Remote\Object {

/**
* the invoice the overpayment is being allocated against
*
* @property Invoice Invoice
*/

/**
* the amount being applied to the invoice
*
* @property float AppliedAmount
*/

/**
* the date the overpayment is applied YYYY-MM-DD (read-only). This will be the latter of the invoice
* date and the overpayment date.
*
* @property \DateTime Date
*/



/*
* Get the resource uri of the class (Contacts) etc
*
* @return string
*/
public static function getResourceURI(){
return null;
}


/*
* Get the root node name. Just the unqualified classname
*
* @return string
*/
public static function getRootNodeName(){
return 'Allocation';
}


/*
* Get the guid property
*
* @return string
*/
public static function getGUIDProperty(){
return '';
}


/**
* Get the stem of the API (core.xro) etc
*
* @return string|null
*/
public static function getAPIStem(){
return Remote\URL::API_CORE;
}


/*
* Get the supported methods
*/
public static function getSupportedMethods(){
return array(
);
}

/**
*
* Get the properties of the object. Indexed by constants
* [0] - Mandatory
* [1] - Type
* [2] - PHP type
* [3] - Is an Array
*
* @return array
*/
public static function getProperties(){
return array(
'Invoice' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\Invoice', false),
'AppliedAmount' => array (false, self::PROPERTY_TYPE_FLOAT, null, false),
'Date' => array (false, self::PROPERTY_TYPE_DATE, '\\DateTime', false)
);
}


/**
* @return Invoice
*/
public function getInvoice(){
return $this->_data['Invoice'];
}

/**
* @param Invoice $value
* @return Allocation
*/
public function setInvoice(Invoice $value){
$this->propertyUpdated('Invoice', $value);
$this->_data['Invoice'] = $value;
return $this;
}

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

/**
* @param float $value
* @return Allocation
*/
public function setAppliedAmount($value){
$this->propertyUpdated('AppliedAmount', $value);
$this->_data['AppliedAmount'] = $value;
return $this;
}

/**
* @return \DateTime
*/
public function getDate(){
return $this->_data['Date'];
}

/**
* @param \DateTime $value
* @return Allocation
*/
public function setDate(\DateTime $value){
$this->propertyUpdated('Date', $value);
$this->_data['Date'] = $value;
return $this;
}


}
7 changes: 4 additions & 3 deletions src/XeroPHP/Models/Accounting/Prepayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use XeroPHP\Remote;

use XeroPHP\Models\Accounting\BankTransaction\LineItem;
use XeroPHP\Models\Accounting\CreditNote\Allocation;
use XeroPHP\Models\Accounting\Prepayment\Allocation;

class Prepayment extends Remote\Object {

Expand Down Expand Up @@ -172,7 +172,8 @@ public static function getAPIStem(){
*/
public static function getSupportedMethods(){
return array(
Remote\Request::METHOD_GET
Remote\Request::METHOD_GET,
Remote\Request::METHOD_PUT
);
}

Expand Down Expand Up @@ -204,7 +205,7 @@ public static function getProperties(){
'PrepaymentID' => array (false, self::PROPERTY_TYPE_STRING, null, false),
'CurrencyRate' => array (false, self::PROPERTY_TYPE_FLOAT, null, false),
'RemainingCredit' => array (false, self::PROPERTY_TYPE_STRING, null, false),
'Allocations' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\CreditNote\\Allocation', true),
'Allocations' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\Prepayment\\Allocation', true),
'HasAttachments' => array (false, self::PROPERTY_TYPE_BOOLEAN, null, false)
);
}
Expand Down
151 changes: 151 additions & 0 deletions src/XeroPHP/Models/Accounting/Prepayment/Allocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

namespace XeroPHP\Models\Accounting\Prepayment;

use XeroPHP\Remote;

use XeroPHP\Models\Accounting\Invoice;

class Allocation extends Remote\Object {

/**
* the invoice the prepayment is being allocated against
*
* @property Invoice Invoice
*/

/**
* the amount being applied to the invoice
*
* @property float AppliedAmount
*/

/**
* the date the prepayment is applied YYYY-MM-DD (read-only). This will be the latter of the invoice
* date and the prepayment date.
*
* @property \DateTime Date
*/



/*
* Get the resource uri of the class (Contacts) etc
*
* @return string
*/
public static function getResourceURI(){
return null;
}


/*
* Get the root node name. Just the unqualified classname
*
* @return string
*/
public static function getRootNodeName(){
return 'Allocation';
}


/*
* Get the guid property
*
* @return string
*/
public static function getGUIDProperty(){
return '';
}


/**
* Get the stem of the API (core.xro) etc
*
* @return string|null
*/
public static function getAPIStem(){
return Remote\URL::API_CORE;
}


/*
* Get the supported methods
*/
public static function getSupportedMethods(){
return array(
);
}

/**
*
* Get the properties of the object. Indexed by constants
* [0] - Mandatory
* [1] - Type
* [2] - PHP type
* [3] - Is an Array
*
* @return array
*/
public static function getProperties(){
return array(
'Invoice' => array (false, self::PROPERTY_TYPE_OBJECT, 'Accounting\\Invoice', false),
'AppliedAmount' => array (false, self::PROPERTY_TYPE_FLOAT, null, false),
'Date' => array (false, self::PROPERTY_TYPE_DATE, '\\DateTime', false)
);
}


/**
* @return Invoice
*/
public function getInvoice(){
return $this->_data['Invoice'];
}

/**
* @param Invoice $value
* @return Allocation
*/
public function setInvoice(Invoice $value){
$this->propertyUpdated('Invoice', $value);
$this->_data['Invoice'] = $value;
return $this;
}

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

/**
* @param float $value
* @return Allocation
*/
public function setAppliedAmount($value){
$this->propertyUpdated('AppliedAmount', $value);
$this->_data['AppliedAmount'] = $value;
return $this;
}

/**
* @return \DateTime
*/
public function getDate(){
return $this->_data['Date'];
}

/**
* @param \DateTime $value
* @return Allocation
*/
public function setDate(\DateTime $value){
$this->propertyUpdated('Date', $value);
$this->_data['Date'] = $value;
return $this;
}


}

0 comments on commit 8c67bff

Please sign in to comment.