Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
Added core classes and classes for sales orders and purchase order documents, and records.
  • Loading branch information
Rowan Drew committed May 24, 2017
1 parent 4eb411d commit 7d4550e
Show file tree
Hide file tree
Showing 15 changed files with 4,841 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# ecommerce-standards-documents-php-library
Ecommerce Standards Documents Library for embedding within PHP applications
# Ecommerce Standards Documents PHP Library
The Ecommerce Standards Documents provides an open standard for storing different kinds of Ecommerce data, allowing the data be supported and transferred between business systems in a consistent, platform independent, software independent way.
Its aims are to provide an open, easy, and efficient way of allowing different software providers to allow Ecommerce data to be exchanged, reducing the complexities of integrations, cutting down development costs, and saving time for everybody.
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.

- [Documentation](https://www.squizz.com/esd/index.html)
- [License](LICENSE)
- Current Library Version 1.1
80 changes: 80 additions & 0 deletions src/EcommerceStandardsDocuments/ESDRecordOrderLineAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

/**
* Copyright (C) 2017 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\ESDocument;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Ecommerce Standards Record that holds data for a single attribute and value within a order line. This allows any additional fields and field values to be with the order line.
*/
class ESDRecordOrderLineAttribute
{
/**
* @var string Key of the order attribute record
*/
public $keyAttributeID = "";

/**
* @var string Code of the attribute. May or may not be a unqiue identifier.
*/
public $attributeCode = "";

/**
* @var string name of the attribute.
*/
public $attributeName = "";

/**
* @var string value of the attribute.
*/
public $attributeValue = "";

/**
* @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 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 = "";

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

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

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

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

if ($this->internalID== null)
{
$this->internalID = "";
}
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

/**
* Copyright (C) 2017 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\ESDocument;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Ecommerce Standards Record that holds data for a single attribute profile for a order line. This allows any additional attribute data to be for the line.
*/
class ESDRecordOrderLineAttributeProfile
{
/**
* @var string Key of the order attribute profile record
*/
public $keyAttributeProfileID = "";

/**
* @var string Code of the attribute profile. May or may not be a unqiue identifier.
*/
public $profileCode = "";

/**
* @var string Name of the attribute profile.
*/
public $profileName = "";

/**
* @var ESDRecordOrderLineAttribute[] List of attributes and values for the order attribute profile
*/
public $values = array();

/**
* @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 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 = "";

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

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

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

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

}
}
?>
100 changes: 100 additions & 0 deletions src/EcommerceStandardsDocuments/ESDRecordOrderLineTax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

/**
* Copyright (C) 2017 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\ESDocument;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Details of a tax assigned to a order line within a Ecommerce Standards Document
*/
class ESDRecordOrderLineTax
{
/**
* @var string Key of the taxcode record that the order line 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 to 10, then a 10% tax will be applied on top of the order line price.
*/
public $taxRate = 0;

/**
* @var string Language that the descriptive text of the line is 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;

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

/**
* @var double Monetary amount of tax priced for the total quantity of units
*/
public $priceTotalTax = 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 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 = "";

/**
* s 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 = "";
}
}
}
?>
85 changes: 85 additions & 0 deletions src/EcommerceStandardsDocuments/ESDRecordOrderPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

/**
* Copyright (C) 2017 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\ESDocument;
use EcommerceStandardsDocuments\ESDocumentConstants;

/**
* Ecommerce Standards Record that holds data for a single payment associated to an order.
*/
class ESDRecordOrderPayment
{
/**
* @var string Method on how the payment was made. The field must be to one of the class's constants prefixed by PAYMENT_METHOD_
*/
public $paymentMethod = "";

/**
* @var double Monetary amount the payment applies to
*/
public $paymentAmount = 0;

/**
* @var string Receipt number associated to the payment.
*/
public $paymentReceipt = "";

/**
* @var string Code the proprietary system that is used as the payment method.
*/
public $paymentProprietaryCode = "";

/**
* @var string Key of the payment type record that is assigned to the payment. The payment type record indicates how the payment was made.
*/
public $keyPaymentTypeID = "";

/**
* @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 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 = "";

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

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

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

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

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

0 comments on commit 7d4550e

Please sign in to comment.