Skip to content

Commit

Permalink
Added and updated document classes to support version 1.2 of the Ecom…
Browse files Browse the repository at this point in the history
…merce Standards Documents library
  • Loading branch information
Rowan Drew committed Nov 26, 2017
1 parent f6bbfb1 commit 4cf207b
Show file tree
Hide file tree
Showing 40 changed files with 5,531 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Its aims are to provide an open, easy, and efficient way of allowing different s
The Ecommerce Standards Document PHP library provides an implementation of the standards that allows the library to be embedded into PHP software, and utilised by the software to store and transfer Ecommerce Standards Documents using the classes provided.
To get a basic understanding of how to library in PHP applications it is recommended to read through the documentation available at [https://www.squizz.com/esd/index.html](https://www.squizz.com/esd/index.html)

Note that currently this PHP libary only contains a small subset of the classes available in the Ecommerce Standards Documents library. We will be looking to add more classes over time to get it up to speed with the [.NET](https://github.com/squizzdotcom/ecommerce-standards-documents-dotnet-library) and [Java](https://github.com/squizzdotcom/ecommerce-standards-documents-java-library) libraries of the standards.
Note that currently this PHP libary only contains a smaller subset of the classes available in the Ecommerce Standards Documents library. We will be looking to add more classes over time to get it up to speed with the [.NET](https://github.com/squizzdotcom/ecommerce-standards-documents-dotnet-library) and [Java](https://github.com/squizzdotcom/ecommerce-standards-documents-java-library) libraries of the standards.

- [Documentation](https://www.squizz.com/esd/index.html)
- [License](LICENSE)
- Current Library Version 1.1
- Current Library Version 1.2
140 changes: 140 additions & 0 deletions src/EcommerceStandardsDocuments/ESDRecordAccountPaymentSurcharge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?php
/**
* Copyright (C) 2018 Squizz PTY LTD
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
*/
namespace EcommerceStandardsDocuments;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Details of a surcharge assigned to an customer/supplier account payment record within a Ecommerce Standards Document
*/
class ESDRecordAccountPaymentSurcharge
{
/**
* @var ESDRecordAccountPaymentSurchargeTax[] List of tax records applied to the surcharge.
*/
public $taxes = array();

/**
* @var string Key of the surcharge record that the payment surcharge record is linked to.
*/
public $keySurchargeID = "";

/**
* @var string Code of the surcharge. May or may not be a unique identifier
*/
public $surchargeCode = "";

/**
* @var string Label of the surcharge
*/
public $surchargeLabel = "";

/**
* @var string Text description of the surcharge
*/
public $surchargeDescription = "";

/**
* @var string Language that the descriptive text of the line is set in. Set it to a constant prefixed with LANG_ in the ESDocumentConstants class
*/
public $language = "";

/**
* @var double Monetary price of the surcharge, excluding tax.
*/
public $priceExTax = 0.0;

/**
* @var double Monetary price of the surcharge, including tax.
*/
public $priceIncTax = 0.0;

/**
* @var double Monetary price of the tax applied to the surcharge
*/
public $priceTax = 0.0;

/**
* @var double Monetary price of the surcharge before any discounting was applied, exclusive of tax.
*/
public $priceUndiscountedExTax = 0.0;

/**
* @var double Monetary price of the surcharge before any discounting was applied, inclusive of tax.
*/
public $priceUndiscountedIncTax = 0.0;

/**
* @var double Monetary price of tax applied the surcharge before any discounting was applied.
*/
public $priceUndiscountedTax = 0.0;

/**
* @var int Data Record OPeration. Denotes an operation that may need to be performed on the record when it is being processed.
* Set null, or set it to one of the ESD_RECORD_OPERATION constants in the ESDocumentConstants class to allow the record to be inserted, updated, deleted, or ignored.
*/
public $drop = ESDocumentConstants::ESD_RECORD_OPERATION_NA;

/**
* @var string Stores an identifier that is relevant only to the system referencing and storing the record for its own needs.
*/
public $internalID = "";

/**
* sets default values for members that have no values
*/
public function setDefaultValuesForNullMembers()
{
if ($this->values== null)
{
$this->values = array();
}
else
{
foreach($this->taxes as &$tax)
{
$tax->setDefaultValuesForNullMembers();
}
}

if ($this->keySurchargeID == null)
{
$this->keySurchargeID = "";
}

if ($this->surchargeCode == null)
{
$this->surchargeCode = "";
}

if ($this->surchargeLabel == null)
{
$this->surchargeLabel = "";
}

if ($this->surchargeDescription == null)
{
$this->surchargeDescription = "";
}

if ($this->surchargeDescription == null)
{
$this->surchargeDescription = "";
}

if ($this->language == null)
{
$this->language = "";
}

if ($this->internalID == null)
{
$this->internalID = "";
}
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
/**
* Copyright (C) 2018 Squizz PTY LTD
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
*/
namespace EcommerceStandardsDocuments;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Details of a tax assigned to a customer/supplier payment surcharge within a Ecommerce Standards Document
*/
class ESDRecordAccountPaymentSurchargeTax
{
/**
* @var string Key of the taxcode record that the payment surcharge tax record is linked to.
*/
public $keyTaxcodeID = "";

/**
* @var string Taxcode. May or may not be a unique identifier
*/
public $taxcode = "";

/**
* @var string Label of the taxcode
*/
public $taxcodeLabel = "";

/**
* @var double Numeric amount as a percentage rate that the taxcode applies to. Eg. if set to 10, then a 10% tax will be applied on top of the account payment surcharge price.
*/
public $taxRate = 0.0;

/**
* @var string Language that the descriptive text of the line is set in. Set it to a constant prefixed with LANG_ in the ESDocumentConstants class
*/
public $language = "";

/**
* @var double Number of units that the tax applies to
*/
public $quantity = 0.0;

/**
* @var double Monetary amount of tax priced for each unit
*/
public $priceTax = 0.0;

/**
* @var double Monetary amount of tax priced for the total quantity of units
*/
public $priceTotalTax = 0.0;

/**
* @var int Data Record OPeration. Denotes an operation that may need to be performed on the record when it is being processed.
* Set null, or set it to one of the ESD_RECORD_OPERATION constants in the ESDocumentConstants class to allow the record to be inserted, updated, deleted, or ignored.
*/
public $drop = ESDocumentConstants::ESD_RECORD_OPERATION_NA;

/**
* @var string Stores an identifier that is relevant only to the system referencing and storing the record for its own needs.
*/
public $internalID = "";

/**
* sets default values for members that have no values
*/
public function setDefaultValuesForNullMembers()
{
if ($this->taxcodeLabel == null)
{
$this->taxcodeLabel = "";
}

if ($this->keyTaxcodeID == null)
{
$this->keyTaxcodeID = "";
}

if ($this->taxcode == null)
{
$this->taxcode = "";
}

if ($this->language == null)
{
$this->language = "";
}

if ($this->internalID == null)
{
$this->internalID = "";
}
}
}
?>
Loading

0 comments on commit 4cf207b

Please sign in to comment.