Skip to content

Commit a220ef9

Browse files
Merge pull request #214 from magento-firedrakes/MAGETWO-54658
[Firedrakes] Order status change after Invoice creation through API
2 parents 569bbc3 + 0d57cb5 commit a220ef9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3448
-66
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Api\Data;
7+
8+
/**
9+
* Interface CommentInterface
10+
*
11+
* @api
12+
*/
13+
interface CommentInterface
14+
{
15+
/**
16+
* Gets the comment for the invoice.
17+
*
18+
* @return string Comment.
19+
*/
20+
public function getComment();
21+
22+
/**
23+
* Sets the comment for the invoice.
24+
*
25+
* @param string $comment
26+
* @return $this
27+
*/
28+
public function setComment($comment);
29+
30+
/**
31+
* Gets the is-visible-on-storefront flag value for the invoice.
32+
*
33+
* @return int Is-visible-on-storefront flag value.
34+
*/
35+
public function getIsVisibleOnFront();
36+
37+
/**
38+
* Sets the is-visible-on-storefront flag value for the invoice.
39+
*
40+
* @param int $isVisibleOnFront
41+
* @return $this
42+
*/
43+
public function setIsVisibleOnFront($isVisibleOnFront);
44+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Sales\Api\Data;
8+
9+
/**
10+
* Interface InvoiceCommentCreationInterface
11+
*
12+
* @api
13+
*/
14+
interface InvoiceCommentCreationInterface extends \Magento\Sales\Api\Data\CommentInterface
15+
{
16+
17+
}

app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* invoice history.
1313
* @api
1414
*/
15-
interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface
15+
interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataInterface,
16+
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface
1617
{
1718
/**#@+
1819
* Constants for keys of data array. Identical to the name of the getter in snake case.
@@ -42,13 +43,6 @@ interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataI
4243
*/
4344
const CREATED_AT = 'created_at';
4445

45-
/**
46-
* Gets the comment for the invoice.
47-
*
48-
* @return string Comment.
49-
*/
50-
public function getComment();
51-
5246
/**
5347
* Gets the created-at timestamp for the invoice.
5448
*
@@ -86,13 +80,6 @@ public function setEntityId($entityId);
8680
*/
8781
public function getIsCustomerNotified();
8882

89-
/**
90-
* Gets the is-visible-on-storefront flag value for the invoice.
91-
*
92-
* @return int Is-visible-on-storefront flag value.
93-
*/
94-
public function getIsVisibleOnFront();
95-
9683
/**
9784
* Gets the parent ID for the invoice.
9885
*
@@ -116,22 +103,6 @@ public function setParentId($id);
116103
*/
117104
public function setIsCustomerNotified($isCustomerNotified);
118105

119-
/**
120-
* Sets the is-visible-on-storefront flag value for the invoice.
121-
*
122-
* @param int $isVisibleOnFront
123-
* @return $this
124-
*/
125-
public function setIsVisibleOnFront($isVisibleOnFront);
126-
127-
/**
128-
* Sets the comment for the invoice.
129-
*
130-
* @param string $comment
131-
* @return $this
132-
*/
133-
public function setComment($comment);
134-
135106
/**
136107
* Retrieve existing extension attributes object or create a new one.
137108
*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Api\Data;
7+
8+
/**
9+
* Interface for creation arguments for Invoice.
10+
*
11+
* @api
12+
*/
13+
interface InvoiceCreationArgumentsInterface extends \Magento\Framework\Api\ExtensibleDataInterface
14+
{
15+
/**
16+
* Gets existing extension attributes.
17+
*
18+
* @return \Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface|null
19+
*/
20+
public function getExtensionAttributes();
21+
22+
/**
23+
* Sets extension attributes.
24+
*
25+
* @param \Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface $extensionAttributes
26+
*
27+
* @return $this
28+
*/
29+
public function setExtensionAttributes(
30+
\Magento\Sales\Api\Data\InvoiceCreationArgumentsExtensionInterface $extensionAttributes
31+
);
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Sales\Api\Data;
8+
9+
/**
10+
* Input argument for invoice creation
11+
*
12+
* Interface InvoiceItemCreationInterface
13+
*
14+
* @api
15+
*/
16+
interface InvoiceItemCreationInterface extends LineItemInterface
17+
{
18+
19+
}

app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* An invoice is a record of the receipt of payment for an order. An invoice item is a purchased item in an invoice.
1212
* @api
1313
*/
14-
interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInterface
14+
interface InvoiceItemInterface extends \Magento\Sales\Api\Data\InvoiceItemCreationInterface,
15+
\Magento\Framework\Api\ExtensibleDataInterface
1516
{
1617
/**#@+
1718
* Constants for keys of data array. Identical to the name of the getter in snake case.
@@ -112,10 +113,12 @@ interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInte
112113
* Base discount tax compensation amount.
113114
*/
114115
const BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT = 'base_discount_tax_compensation_amount';
116+
115117
/**
116118
* Invoice
117119
*/
118120
const INVOICE = 'invoice';
121+
119122
/**
120123
* Gets the additional data for the invoice item.
121124
*
@@ -222,13 +225,6 @@ public function getDiscountTaxCompensationAmount();
222225
*/
223226
public function getName();
224227

225-
/**
226-
* Gets the order item ID for the invoice item.
227-
*
228-
* @return int Order item ID.
229-
*/
230-
public function getOrderItemId();
231-
232228
/**
233229
* Gets the parent ID for the invoice item.
234230
*
@@ -257,13 +253,6 @@ public function getPriceInclTax();
257253
*/
258254
public function getProductId();
259255

260-
/**
261-
* Gets the quantity for the invoice item.
262-
*
263-
* @return float Quantity.
264-
*/
265-
public function getQty();
266-
267256
/**
268257
* Gets the row total for the invoice item.
269258
*
@@ -372,14 +361,6 @@ public function setBaseTaxAmount($amount);
372361
*/
373362
public function setBasePriceInclTax($amount);
374363

375-
/**
376-
* Sets the quantity for the invoice item.
377-
*
378-
* @param float $qty
379-
* @return $this
380-
*/
381-
public function setQty($qty);
382-
383364
/**
384365
* Sets the base cost for the invoice item.
385366
*
@@ -420,14 +401,6 @@ public function setRowTotalInclTax($amount);
420401
*/
421402
public function setProductId($id);
422403

423-
/**
424-
* Sets the order item ID for the invoice item.
425-
*
426-
* @param int $id
427-
* @return $this
428-
*/
429-
public function setOrderItemId($id);
430-
431404
/**
432405
* Sets the additional data for the invoice item.
433406
*
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Sales\Api\Data;
8+
9+
/**
10+
* Base line item interface for order entities
11+
*
12+
* Interface LineItemInterface
13+
* @api
14+
*/
15+
interface LineItemInterface
16+
{
17+
/**
18+
* Gets the order item ID for the item.
19+
*
20+
* @return int Order item ID.
21+
*/
22+
public function getOrderItemId();
23+
24+
/**
25+
* Sets the order item ID for the item.
26+
*
27+
* @param int $id
28+
* @return $this
29+
*/
30+
public function setOrderItemId($id);
31+
32+
/**
33+
* Gets the quantity for the item.
34+
*
35+
* @return float Quantity.
36+
*/
37+
public function getQty();
38+
39+
/**
40+
* Sets the quantity for the item.
41+
*
42+
* @param float $qty
43+
* @return $this
44+
*/
45+
public function setQty($qty);
46+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Api\Exception;
7+
8+
/**
9+
* @api
10+
*/
11+
interface CouldNotInvoiceExceptionInterface
12+
{
13+
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Api\Exception;
7+
8+
/**
9+
* @api
10+
*/
11+
interface DocumentValidationExceptionInterface
12+
{
13+
14+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Sales\Api;
8+
9+
/**
10+
* Class OrderInvoiceInterface
11+
*
12+
* @api
13+
*/
14+
interface OrderInvoiceInterface
15+
{
16+
/**
17+
* @param int $orderId
18+
* @param bool|false $capture
19+
* @param \Magento\Sales\Api\Data\InvoiceItemCreationInterface[] $items
20+
* @param bool|false $notify
21+
* @param bool|false $appendComment
22+
* @param Data\InvoiceCommentCreationInterface|null $comment
23+
* @param Data\InvoiceCreationArgumentsInterface|null $arguments
24+
* @return int
25+
*/
26+
public function execute(
27+
$orderId,
28+
$capture = false,
29+
array $items = [],
30+
$notify = false,
31+
$appendComment = false,
32+
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface $comment = null,
33+
\Magento\Sales\Api\Data\InvoiceCreationArgumentsInterface $arguments = null
34+
);
35+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Exception;
7+
8+
use Magento\Framework\Exception\LocalizedException;
9+
use Magento\Sales\Api\Exception\CouldNotInvoiceExceptionInterface;
10+
11+
/**
12+
* Class CouldNotInvoiceException
13+
*/
14+
class CouldNotInvoiceException extends LocalizedException implements CouldNotInvoiceExceptionInterface
15+
{
16+
17+
}

0 commit comments

Comments
 (0)