Skip to content

Commit bcb51f5

Browse files
author
manasa
committed
Merge branch 'develop' into FearlessKiwis-MAGETWO-34068-Incorrect-tax-details
2 parents e9d102b + 143d4ac commit bcb51f5

22 files changed

+354
-230
lines changed

app/code/Magento/Quote/Model/Cart/CartTotalRepository.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
class CartTotalRepository implements CartTotalRepositoryInterface
1616
{
1717
/**
18-
* Cart totals builder.
18+
* Cart totals factory.
1919
*
20-
* @var Api\Data\TotalsDataBuilder
20+
* @var Api\Data\TotalsInterfaceFactory
2121
*/
22-
private $totalsBuilder;
22+
private $totalsFactory;
2323

2424
/**
2525
* Quote repository.
@@ -28,18 +28,26 @@ class CartTotalRepository implements CartTotalRepositoryInterface
2828
*/
2929
private $quoteRepository;
3030

31+
/**
32+
* @var \Magento\Framework\Api\DataObjectHelper
33+
*/
34+
private $dataObjectHelper;
35+
3136
/**
3237
* Constructs a cart totals data object.
3338
*
34-
* @param Api\Data\TotalsDataBuilder $totalsBuilder Cart totals builder.
39+
* @param Api\Data\TotalsInterfaceFactory $totalsFactory Cart totals factory.
3540
* @param QuoteRepository $quoteRepository Quote repository.
41+
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
3642
*/
3743
public function __construct(
38-
Api\Data\TotalsDataBuilder $totalsBuilder,
39-
QuoteRepository $quoteRepository
44+
Api\Data\TotalsInterfaceFactory $totalsFactory,
45+
QuoteRepository $quoteRepository,
46+
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper
4047
) {
41-
$this->totalsBuilder = $totalsBuilder;
48+
$this->totalsFactory = $totalsFactory;
4249
$this->quoteRepository = $quoteRepository;
50+
$this->dataObjectHelper = $dataObjectHelper;
4351
}
4452

4553
/**
@@ -57,10 +65,11 @@ public function get($cartId)
5765
*/
5866
$quote = $this->quoteRepository->getActive($cartId);
5967
$shippingAddress = $quote->getShippingAddress();
60-
$totals = array_merge($shippingAddress->getData(), $quote->getData());
61-
$this->totalsBuilder->populateWithArray($totals);
62-
$this->totalsBuilder->setItems($quote->getAllItems());
68+
$totalsData = array_merge($shippingAddress->getData(), $quote->getData());
69+
$totals = $this->totalsFactory->create();
70+
$this->dataObjectHelper->populateWithArray($totals, $totalsData, '\Magento\Quote\Api\Data\TotalsInterface');
71+
$totals->setItems($quote->getAllItems());
6372

64-
return $this->totalsBuilder->create();
73+
return $totals;
6574
}
6675
}

app/code/Magento/Quote/Model/Cart/ShippingMethodConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
class ShippingMethodConverter
1313
{
1414
/**
15-
* Shipping method builder.
15+
* Shipping method data factory.
1616
*
1717
* @var \Magento\Quote\Api\Data\ShippingMethodInterfaceFactory
1818
*/
1919
protected $shippingMethodDataFactory;
2020

2121
/**
22-
* Constructs a shipping method builder object.
22+
* Constructs a shipping method converter object.
2323
*
2424
* @param \Magento\Quote\Api\Data\ShippingMethodInterfaceFactory $shippingMethodDataFactory Shipping method factory.
2525
* @param \Magento\Store\Model\StoreManagerInterface $storeManager Store manager interface.

app/code/Magento/Quote/Model/ShippingMethodManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class ShippingMethodManagement implements ShippingMethodManagementInterface
4545
* Constructs a shipping method read service object.
4646
*
4747
* @param QuoteRepository $quoteRepository Quote repository.
48-
* @param \Magento\Quote\Api\Data\ShippingMethodInterfaceFactory $methodDataFactory Shipping method builder.
49-
* @param \Magento\Quote\Model\Cart\ShippingMethodConverter $converter Shipping method builder converter.
48+
* @param \Magento\Quote\Api\Data\ShippingMethodInterfaceFactory $methodDataFactory Shipping method factory.
49+
* @param \Magento\Quote\Model\Cart\ShippingMethodConverter $converter Shipping method converter.
5050
*/
5151
public function __construct(
5252
QuoteRepository $quoteRepository,

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,29 @@ public function getUpdatedAt();
561561
*/
562562
public function getItems();
563563

564+
/**
565+
* Sets credit memo items.
566+
*
567+
* @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items
568+
* @return $this
569+
*/
570+
public function setItems($items);
571+
564572
/**
565573
* Gets credit memo comments.
566574
*
567575
* @return \Magento\Sales\Api\Data\CreditmemoCommentInterface[]|null Array of any credit memo comments. Otherwise, null.
568576
*/
569577
public function getComments();
570578

579+
/**
580+
* Sets credit memo comments.
581+
*
582+
* @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $comments
583+
* @return $this
584+
*/
585+
public function setComments($comments);
586+
571587
/**
572588
* Sets the credit memo store ID.
573589
*
@@ -911,20 +927,4 @@ public function setBaseShippingInclTax($amount);
911927
* @return $this
912928
*/
913929
public function setDiscountDescription($description);
914-
915-
/**
916-
* Sets credit memo items.
917-
*
918-
* @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items
919-
* @return $this
920-
*/
921-
public function setItems(array $items = null);
922-
923-
/**
924-
* Sets credit memo comments.
925-
*
926-
* @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $comments
927-
* @return $this
928-
*/
929-
public function setComments(array $comments = null);
930930
}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,29 @@ public function getUpdatedAt();
515515
*/
516516
public function getItems();
517517

518+
/**
519+
* Sets the items in the invoice.
520+
*
521+
* @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items
522+
* @return $this
523+
*/
524+
public function setItems($items);
525+
518526
/**
519527
* Gets the comments, if any, for the invoice.
520528
*
521529
* @return \Magento\Sales\Api\Data\InvoiceCommentInterface[]|null Array of any invoice comments. Otherwise, null.
522530
*/
523531
public function getComments();
524532

533+
/**
534+
* Sets the comments, if any, for the invoice.
535+
*
536+
* @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $comments
537+
* @return $this
538+
*/
539+
public function setComments($comments);
540+
525541
/**
526542
* Sets the updated-at timestamp for the invoice.
527543
*
@@ -849,20 +865,4 @@ public function setBaseTotalRefunded($amount);
849865
* @return $this
850866
*/
851867
public function setDiscountDescription($description);
852-
853-
/**
854-
* Sets the items in the invoice.
855-
*
856-
* @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items
857-
* @return $this
858-
*/
859-
public function setItems($items);
860-
861-
/**
862-
* Sets the comments, if any, for the invoice.
863-
*
864-
* @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $comments
865-
* @return $this
866-
*/
867-
public function setComments(array $comments = null);
868868
}

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

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,41 +1526,89 @@ public function getXForwardedFor();
15261526
*/
15271527
public function getItems();
15281528

1529+
/**
1530+
* Sets items for the order.
1531+
*
1532+
* @param \Magento\Sales\Api\Data\OrderItemInterface[] $items
1533+
* @return $this
1534+
*/
1535+
public function setItems($items);
1536+
15291537
/**
15301538
* Gets the billing address, if any, for the order.
15311539
*
15321540
* @return \Magento\Sales\Api\Data\OrderAddressInterface|null Billing address. Otherwise, null.
15331541
*/
15341542
public function getBillingAddress();
15351543

1544+
/**
1545+
* Sets the billing address, if any, for the order.
1546+
*
1547+
* @param \Magento\Sales\Api\Data\OrderAddressInterface $billingAddress
1548+
* @return $this
1549+
*/
1550+
public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $billingAddress = null);
1551+
15361552
/**
15371553
* Gets the shipping address, if any, for the order.
15381554
*
15391555
* @return \Magento\Sales\Api\Data\OrderAddressInterface|null Shipping address. Otherwise, null.
15401556
*/
15411557
public function getShippingAddress();
15421558

1559+
/**
1560+
* Sets the shipping address, if any, for the order.
1561+
*
1562+
* @param \Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress
1563+
* @return $this
1564+
*/
1565+
public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress = null);
1566+
15431567
/**
15441568
* Gets the payments for the order.
15451569
*
15461570
* @return \Magento\Sales\Api\Data\OrderPaymentInterface[] Array of payments.
15471571
*/
15481572
public function getPayments();
15491573

1574+
/**
1575+
* Sets the payments for the order.
1576+
*
1577+
* @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $payments
1578+
* @return $this
1579+
*/
1580+
public function setPayments(array $payments = null);
1581+
15501582
/**
15511583
* Gets addresses for the order.
15521584
*
15531585
* @return \Magento\Sales\Api\Data\OrderAddressInterface[] Array of addresses.
15541586
*/
15551587
public function getAddresses();
15561588

1589+
/**
1590+
* Sets addresses for the order.
1591+
*
1592+
* @param \Magento\Sales\Api\Data\OrderAddressInterface[] $addresses
1593+
* @return $this
1594+
*/
1595+
public function setAddresses(array $addresses = null);
1596+
15571597
/**
15581598
* Gets status histories for the order.
15591599
*
15601600
* @return \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] Array of status histories.
15611601
*/
15621602
public function getStatusHistories();
15631603

1604+
/**
1605+
* Sets status histories for the order.
1606+
*
1607+
* @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $statusHistories
1608+
* @return $this
1609+
*/
1610+
public function setStatusHistories(array $statusHistories = null);
1611+
15641612
/**
15651613
* Sets the state for the order.
15661614
*
@@ -2616,52 +2664,4 @@ public function setShippingInclTax($amount);
26162664
* @return $this
26172665
*/
26182666
public function setBaseShippingInclTax($amount);
2619-
2620-
/**
2621-
* Sets items for the order.
2622-
*
2623-
* @param \Magento\Sales\Api\Data\OrderItemInterface[] $items
2624-
* @return $this
2625-
*/
2626-
public function setItems(array $items = null);
2627-
2628-
/**
2629-
* Sets the billing address, if any, for the order.
2630-
*
2631-
* @param \Magento\Sales\Api\Data\OrderAddressInterface $billingAddress
2632-
* @return $this
2633-
*/
2634-
public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $billingAddress = null);
2635-
2636-
/**
2637-
* Sets the shipping address, if any, for the order.
2638-
*
2639-
* @param \Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress
2640-
* @return $this
2641-
*/
2642-
public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress = null);
2643-
2644-
/**
2645-
* Sets the payments for the order.
2646-
*
2647-
* @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $payments
2648-
* @return $this
2649-
*/
2650-
public function setPayments(array $payments = null);
2651-
2652-
/**
2653-
* Sets addresses for the order.
2654-
*
2655-
* @param \Magento\Sales\Api\Data\OrderAddressInterface[] $addresses
2656-
* @return $this
2657-
*/
2658-
public function setAddresses(array $addresses = null);
2659-
2660-
/**
2661-
* Sets status histories for the order.
2662-
*
2663-
* @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $statusHistories
2664-
* @return $this
2665-
*/
2666-
public function setStatusHistories(array $statusHistories = null);
26672667
}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,14 @@ public function getProductId();
851851
*/
852852
public function getProductOptions();
853853

854+
/**
855+
* Sets the product options for the order item.
856+
*
857+
* @param string[] $productOptions
858+
* @return $this
859+
*/
860+
public function setProductOptions(array $productOptions = null);
861+
854862
/**
855863
* Gets the product type for the order item.
856864
*
@@ -1054,6 +1062,14 @@ public function getWeight();
10541062
*/
10551063
public function getParentItem();
10561064

1065+
/**
1066+
* Sets the parent item
1067+
*
1068+
* @param \Magento\Sales\Api\Data\OrderItemInterface $parentItem
1069+
* @return $this
1070+
*/
1071+
public function setParentItem($parentItem);
1072+
10571073
/**
10581074
* Sets the updated-at timestamp for the order item.
10591075
*
@@ -1118,14 +1134,6 @@ public function setProductId($id);
11181134
*/
11191135
public function setProductType($productType);
11201136

1121-
/**
1122-
* Sets the product options for the order item.
1123-
*
1124-
* @param string[] $productOptions
1125-
* @return $this
1126-
*/
1127-
public function setProductOptions(array $productOptions = null);
1128-
11291137
/**
11301138
* Sets the weight for the order item.
11311139
*
@@ -1789,12 +1797,4 @@ public function setBaseWeeeTaxDisposition($baseWeeeTaxDisposition);
17891797
* @return $this
17901798
*/
17911799
public function setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition);
1792-
1793-
/**
1794-
* Sets the parent item
1795-
*
1796-
* @param \Magento\Sales\Api\Data\OrderItemInterface $parentItem
1797-
* @return $this
1798-
*/
1799-
public function setParentItem($parentItem);
18001800
}

0 commit comments

Comments
 (0)