Skip to content

Commit

Permalink
Merge pull request #214 from magento-firedrakes/MAGETWO-54658
Browse files Browse the repository at this point in the history
[Firedrakes] Order status change after Invoice creation through API
  • Loading branch information
dvoskoboinikov authored Aug 4, 2016
2 parents 569bbc3 + 0d57cb5 commit a220ef9
Show file tree
Hide file tree
Showing 47 changed files with 3,448 additions and 66 deletions.
44 changes: 44 additions & 0 deletions app/code/Magento/Sales/Api/Data/CommentInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Api\Data;

/**
* Interface CommentInterface
*
* @api
*/
interface CommentInterface
{
/**
* Gets the comment for the invoice.
*
* @return string Comment.
*/
public function getComment();

/**
* Sets the comment for the invoice.
*
* @param string $comment
* @return $this
*/
public function setComment($comment);

/**
* Gets the is-visible-on-storefront flag value for the invoice.
*
* @return int Is-visible-on-storefront flag value.
*/
public function getIsVisibleOnFront();

/**
* Sets the is-visible-on-storefront flag value for the invoice.
*
* @param int $isVisibleOnFront
* @return $this
*/
public function setIsVisibleOnFront($isVisibleOnFront);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sales\Api\Data;

/**
* Interface InvoiceCommentCreationInterface
*
* @api
*/
interface InvoiceCommentCreationInterface extends \Magento\Sales\Api\Data\CommentInterface
{

}
33 changes: 2 additions & 31 deletions app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
* invoice history.
* @api
*/
interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface
interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface,
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface
{
/**#@+
* Constants for keys of data array. Identical to the name of the getter in snake case.
Expand Down Expand Up @@ -42,13 +43,6 @@ interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataI
*/
const CREATED_AT = 'created_at';

/**
* Gets the comment for the invoice.
*
* @return string Comment.
*/
public function getComment();

/**
* Gets the created-at timestamp for the invoice.
*
Expand Down Expand Up @@ -86,13 +80,6 @@ public function setEntityId($entityId);
*/
public function getIsCustomerNotified();

/**
* Gets the is-visible-on-storefront flag value for the invoice.
*
* @return int Is-visible-on-storefront flag value.
*/
public function getIsVisibleOnFront();

/**
* Gets the parent ID for the invoice.
*
Expand All @@ -116,22 +103,6 @@ public function setParentId($id);
*/
public function setIsCustomerNotified($isCustomerNotified);

/**
* Sets the is-visible-on-storefront flag value for the invoice.
*
* @param int $isVisibleOnFront
* @return $this
*/
public function setIsVisibleOnFront($isVisibleOnFront);

/**
* Sets the comment for the invoice.
*
* @param string $comment
* @return $this
*/
public function setComment($comment);

/**
* Retrieve existing extension attributes object or create a new one.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Api\Data;

/**
* Interface for creation arguments for Invoice.
*
* @api
*/
interface InvoiceCreationArgumentsInterface extends \Magento\Framework\Api\ExtensibleDataInterface
{
/**
* Gets existing extension attributes.
*
* @return \Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface|null
*/
public function getExtensionAttributes();

/**
* Sets extension attributes.
*
* @param \Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface $extensionAttributes
*
* @return $this
*/
public function setExtensionAttributes(
\Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface $extensionAttributes
);
}
19 changes: 19 additions & 0 deletions app/code/Magento/Sales/Api/Data/InvoiceItemCreationInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sales\Api\Data;

/**
* Input argument for invoice creation
*
* Interface InvoiceItemCreationInterface
*
* @api
*/
interface InvoiceItemCreationInterface extends LineItemInterface
{

}
35 changes: 4 additions & 31 deletions app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* An invoice is a record of the receipt of payment for an order. An invoice item is a purchased item in an invoice.
* @api
*/
interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInterface
interface InvoiceItemInterface extends \Magento\Sales\Api\Data\InvoiceItemCreationInterface,
\Magento\Framework\Api\ExtensibleDataInterface
{
/**#@+
* Constants for keys of data array. Identical to the name of the getter in snake case.
Expand Down Expand Up @@ -112,10 +113,12 @@ interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInte
* Base discount tax compensation amount.
*/
const BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT = 'base_discount_tax_compensation_amount';

/**
* Invoice
*/
const INVOICE = 'invoice';

/**
* Gets the additional data for the invoice item.
*
Expand Down Expand Up @@ -222,13 +225,6 @@ public function getDiscountTaxCompensationAmount();
*/
public function getName();

/**
* Gets the order item ID for the invoice item.
*
* @return int Order item ID.
*/
public function getOrderItemId();

/**
* Gets the parent ID for the invoice item.
*
Expand Down Expand Up @@ -257,13 +253,6 @@ public function getPriceInclTax();
*/
public function getProductId();

/**
* Gets the quantity for the invoice item.
*
* @return float Quantity.
*/
public function getQty();

/**
* Gets the row total for the invoice item.
*
Expand Down Expand Up @@ -372,14 +361,6 @@ public function setBaseTaxAmount($amount);
*/
public function setBasePriceInclTax($amount);

/**
* Sets the quantity for the invoice item.
*
* @param float $qty
* @return $this
*/
public function setQty($qty);

/**
* Sets the base cost for the invoice item.
*
Expand Down Expand Up @@ -420,14 +401,6 @@ public function setRowTotalInclTax($amount);
*/
public function setProductId($id);

/**
* Sets the order item ID for the invoice item.
*
* @param int $id
* @return $this
*/
public function setOrderItemId($id);

/**
* Sets the additional data for the invoice item.
*
Expand Down
46 changes: 46 additions & 0 deletions app/code/Magento/Sales/Api/Data/LineItemInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sales\Api\Data;

/**
* Base line item interface for order entities
*
* Interface LineItemInterface
* @api
*/
interface LineItemInterface
{
/**
* Gets the order item ID for the item.
*
* @return int Order item ID.
*/
public function getOrderItemId();

/**
* Sets the order item ID for the item.
*
* @param int $id
* @return $this
*/
public function setOrderItemId($id);

/**
* Gets the quantity for the item.
*
* @return float Quantity.
*/
public function getQty();

/**
* Sets the quantity for the item.
*
* @param float $qty
* @return $this
*/
public function setQty($qty);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Api\Exception;

/**
* @api
*/
interface CouldNotInvoiceExceptionInterface
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Api\Exception;

/**
* @api
*/
interface DocumentValidationExceptionInterface
{

}
35 changes: 35 additions & 0 deletions app/code/Magento/Sales/Api/OrderInvoiceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sales\Api;

/**
* Class OrderInvoiceInterface
*
* @api
*/
interface OrderInvoiceInterface
{
/**
* @param int $orderId
* @param bool|false $capture
* @param \Magento\Sales\Api\Data\InvoiceItemCreationInterface[] $items
* @param bool|false $notify
* @param bool|false $appendComment
* @param Data\InvoiceCommentCreationInterface|null $comment
* @param Data\InvoiceCreationArgumentsInterface|null $arguments
* @return int
*/
public function execute(
$orderId,
$capture = false,
array $items = [],
$notify = false,
$appendComment = false,
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface $comment = null,
\Magento\Sales\Api\Data\InvoiceCreationArgumentsInterface $arguments = null
);
}
17 changes: 17 additions & 0 deletions app/code/Magento/Sales/Exception/CouldNotInvoiceException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Exception;

use Magento\Framework\Exception\LocalizedException;
use Magento\Sales\Api\Exception\CouldNotInvoiceExceptionInterface;

/**
* Class CouldNotInvoiceException
*/
class CouldNotInvoiceException extends LocalizedException implements CouldNotInvoiceExceptionInterface
{

}
Loading

0 comments on commit a220ef9

Please sign in to comment.