Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Model/SalesOrder.php
#	tests/SalesOrdersTest.php
  • Loading branch information
aelsaidy committed Jul 25, 2020
2 parents 2a2ccf6 + b798384 commit 4371358
Show file tree
Hide file tree
Showing 8 changed files with 634 additions and 1 deletion.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<directory>tests/SchemaTest.php</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/SalesOrdersTest.php</directory>
<directory suffix="Test.php">./tests/PurchaseOrdersTest.php</directory>
</testsuite>
</testsuites>
</phpunit>
118 changes: 118 additions & 0 deletions src/Model/PurchaseOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/**
* Created by PhpStorm.
* User: brightantwiboasiako
* Date: 7/24/20
* Time: 8:52 AM
*/

namespace Skuio\Sdk\Model;


use Carbon\Carbon;
use Skuio\Sdk\Model;

/**
* Class PurchaseOrder
* @package Skuio\Sdk\Model
*
* @property int $id
* @property Carbon $purchase_order_date
* @property string $purchase_order_number
* @property string $submission_format
* @property string $approval_status
* @property int $payment_term_id
* @property int $incoterm_id
* @property int $shipping_method_id
* @property int $vendor_id
* @property int $vendor_warehouse_id
* @property int $destination_warehouse_id
* @property int $currency_id
* @property string $currency_code
* @property Carbon $estimated_delivery_date
* @property string $vendor_notes
* @property array $purchase_order_lines
*/
class PurchaseOrder extends Model
{

/**
* Order Statuses
*/
const STATUS_DRAFT = 'draft';
const STATUS_OPEN = 'open';
const STATUS_CLOSED = 'closed';
const STATUS = [
self::STATUS_DRAFT,
self::STATUS_OPEN,
self::STATUS_CLOSED,
];

// Approval Statuses
const APPROVAL_STATUS_PENDING = 'pending';
const APPROVAL_STATUS_APPROVED = 'approved';
const APPROVAL_STATUS = [ self::APPROVAL_STATUS_PENDING, self::APPROVAL_STATUS_APPROVED ];

/**
* Submission Statuses
*/
const SUBMISSION_STATUS_UNSUBMITTED = 'unsubmitted';
const SUBMISSION_STATUS_SUBMITTED = 'submitted';
const SUBMISSION_STATUS_CHANGE_REQUEST_VENDOR = 'Change Request - Vendor Initiated';
const SUBMISSION_STATUS_CHANGE_REQUEST_BUYER = 'Change Request - Buyer Initiated';
const SUBMISSION_STATUS_FINALIZED = 'finalized';
const SUBMISSION_STATUS_CANCELED = 'canceled'; // by Vendor (After Submission)
const SUBMISSION_STATUS_VOIDED = 'voided '; // by Buyer (Before Submission)
const SUBMISSION_STATUS = [
self::SUBMISSION_STATUS_UNSUBMITTED,
self::SUBMISSION_STATUS_SUBMITTED,
self::SUBMISSION_STATUS_CHANGE_REQUEST_BUYER,
self::SUBMISSION_STATUS_CHANGE_REQUEST_VENDOR,
self::SUBMISSION_STATUS_FINALIZED,
self::SUBMISSION_STATUS_CANCELED,
self::SUBMISSION_STATUS_VOIDED,
];

/**
* Receipt Statuses
*/
const RECEIPT_STATUS_UNRECEIVED = 'unreceived';
const RECEIPT_STATUS_RECEIVED = 'received';
const RECEIPT_STATUS_PARTIALLY_RECEIVED = 'partially_received';
const RECEIPT_STATUS_DROPSHIP = 'Dropship';
const RECEIPT_STATUS = [
self::RECEIPT_STATUS_UNRECEIVED,
self::RECEIPT_STATUS_RECEIVED,
self::RECEIPT_STATUS_PARTIALLY_RECEIVED,
self::RECEIPT_STATUS_DROPSHIP,
];

//
// const SHIPMENT_STATUS_UNSHIPPED = 'unshipped';
// const SHIPMENT_STATUS_SHIPPED_WAREHOUSE = 'shipped_to_warehouse';
// const SHIPMENT_STATUS_SHIPPED_CUSTOMER = 'shipped_to_customer'; // In the case of dropship orders
// const SHIPMENT_STATUS = [
// self::SHIPMENT_STATUS_UNSHIPPED,
// self::SHIPMENT_STATUS_SHIPPED_WAREHOUSE,
// self::SHIPMENT_STATUS_SHIPPED_CUSTOMER,
// ];
//
// const INVOICE_STATUS_UNINVOICED = 'uninvoiced';
// const INVOICE_STATUS_PARTIALLY_INVOICED = 'partially_invoiced';
// const INVOICE_STATUS_INVOICED = 'invoiced'; // Ready to submit to Accounting Software
// const INVOICE_STATUS_INVOICED_AND_PAID = 'invoiced_and_paid'; // Can be determined by pulling status from Accounting Software
// const INVOICE_STATUS = [
// self::INVOICE_STATUS_UNINVOICED,
// self::INVOICE_STATUS_PARTIALLY_INVOICED,
// self::INVOICE_STATUS_INVOICED,
// self::INVOICE_STATUS_INVOICED_AND_PAID,
// ];
//
// const SUBMISSION_FORMAT_PDF_ATTACHMENT = 'email_pdf_attachment';
// const SUBMISSION_FORMAT_MANUAL = 'manual';
// const SUBMISSION_FORMATS = [
// self::SUBMISSION_FORMAT_PDF_ATTACHMENT,
// self::SUBMISSION_FORMAT_MANUAL,
// ];

}
32 changes: 32 additions & 0 deletions src/Model/PurchaseOrderLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Created by PhpStorm.
* User: brightantwiboasiako
* Date: 7/24/20
* Time: 9:02 AM
*/

namespace Skuio\Sdk\Model;


use Carbon\Carbon;
use Skuio\Sdk\Model;

/**
* Class PurchaseOrderLine
* @package Skuio\Sdk\Model
*
* @property int $id
* @property int $product_id
* @property string $description
* @property int $quantity
* @property float $amount
* @property float $tax
* @property float $discount
* @property Carbon $estimated_delivery_date
* @property int $nominal_code_id
*/
class PurchaseOrderLine extends Model
{

}
28 changes: 28 additions & 0 deletions src/Model/PurchaseOrderShipment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Created by PhpStorm.
* User: brightantwiboasiako
* Date: 7/24/20
* Time: 11:24 AM
*/

namespace Skuio\Sdk\Model;


use Carbon\Carbon;
use Skuio\Sdk\Model;

/**
* Class PurchaseOrderShipment
* @package Skuio\Sdk\Model
*
* @property int $purchase_order_id
* @property Carbon $shipment_date
* @property int $shipping_method_id
* @property string $tracking
* @property array $shipment_lines
*/
class PurchaseOrderShipment extends Model
{

}
22 changes: 22 additions & 0 deletions src/Model/PurchaseOrderShipmentLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Created by PhpStorm.
* User: brightantwiboasiako
* Date: 7/24/20
* Time: 11:26 AM
*/

namespace Skuio\Sdk\Model;


/**
* Class PurchaseOrderShipmentLine
* @package Skuio\Sdk\Model
*
* @property int $purchase_order_line_id
* @property int $quantity
*/
class PurchaseOrderShipmentLine
{

}
37 changes: 37 additions & 0 deletions src/Resource/PurchaseOrderLines.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Created by PhpStorm.
* User: brightantwiboasiako
* Date: 7/24/20
* Time: 11:29 AM
*/

namespace Skuio\Sdk\Resource;

use Exception;
use Skuio\Sdk\Response;
use Skuio\Sdk\Sdk;

/**
* Class PurchaseOrderLines
* @package Skuio\Sdk\Resource
*/
class PurchaseOrderLines extends Sdk
{

protected $endpoint = 'purchase-order-lines';

/**
* Delete a purchase order line by id
*
* @param int $id
*
* @return Response
* @throws Exception
*/
public function delete( int $id )
{
return $this->authorizedRequest( $this->endpoint . '/' . $id, null, self::METHOD_DELETE );
}

}
Loading

0 comments on commit 4371358

Please sign in to comment.