@@ -195,6 +195,46 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
195195
196196 $ this ->creditMemoService ->refund ($ creditMemo , true );
197197 $ response = $ this ->getCustomerOrderWithCreditMemoQuery ();
198+ $ expectedInvoicesData = [
199+ [
200+ 'items ' => [
201+ [
202+ 'product_name ' => 'Bundle Product With Two dropdown options ' ,
203+ 'product_sku ' => 'bundle-product-two-dropdown-options-simple1-simple2 ' ,
204+ 'product_sale_price ' => [
205+ 'value ' => 15
206+ ],
207+ 'discounts ' => [],
208+ 'bundle_options ' => [
209+ [
210+ 'label ' => 'Drop Down Option 1 ' ,
211+ 'values ' => [
212+ [
213+ 'product_name ' => 'Simple Product1 ' ,
214+ 'product_sku ' => 'simple1 ' ,
215+ 'quantity ' => 1 ,
216+ 'price ' => ['value ' => 1 , 'currency ' => 'USD ' ]
217+ ]
218+ ]
219+ ],
220+ [
221+ 'label ' => 'Drop Down Option 2 ' ,
222+ 'values ' => [
223+ [
224+ 'product_name ' => 'Simple Product2 ' ,
225+ 'product_sku ' => 'simple2 ' ,
226+ 'quantity ' => 2 ,
227+ 'price ' => ['value ' => 2 , 'currency ' => 'USD ' ]
228+ ]
229+ ]
230+ ]
231+ ],
232+ 'quantity_invoiced ' => 2
233+ ],
234+
235+ ]
236+ ]
237+ ];
198238 $ expectedCreditMemoData = [
199239 [
200240 'comments ' => [
@@ -208,6 +248,30 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
208248 'value ' => 15
209249 ],
210250 'discounts ' => [],
251+ 'bundle_options ' => [
252+ [
253+ 'label ' => 'Drop Down Option 1 ' ,
254+ 'values ' => [
255+ [
256+ 'product_name ' => 'Simple Product1 ' ,
257+ 'product_sku ' => 'simple1 ' ,
258+ 'quantity ' => 1 ,
259+ 'price ' => ['value ' => 1 , 'currency ' => 'USD ' ]
260+ ]
261+ ]
262+ ],
263+ [
264+ 'label ' => 'Drop Down Option 2 ' ,
265+ 'values ' => [
266+ [
267+ 'product_name ' => 'Simple Product2 ' ,
268+ 'product_sku ' => 'simple2 ' ,
269+ 'quantity ' => 2 ,
270+ 'price ' => ['value ' => 2 , 'currency ' => 'USD ' ]
271+ ]
272+ ]
273+ ]
274+ ],
211275 'quantity_refunded ' => 1
212276 ],
213277
@@ -250,6 +314,11 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
250314 ]
251315 ];
252316 $ firstOrderItem = current ($ response ['customer ' ]['orders ' ]['items ' ] ?? []);
317+
318+ $ this ->assertArrayHasKey ('invoices ' , $ firstOrderItem );
319+ $ invoices = $ firstOrderItem ['invoices ' ];
320+ $ this ->assertResponseFields ($ invoices , $ expectedInvoicesData );
321+
253322 $ this ->assertArrayHasKey ('credit_memos ' , $ firstOrderItem );
254323 $ creditMemos = $ firstOrderItem ['credit_memos ' ];
255324 $ this ->assertResponseFields ($ creditMemos , $ expectedCreditMemoData );
@@ -320,6 +389,30 @@ public function testCreditMemoForBundleProductWithTaxesAndDiscounts()
320389 'label ' => 'Discount Label for 10% off '
321390 ]
322391 ],
392+ 'bundle_options ' => [
393+ [
394+ 'label ' => 'Drop Down Option 1 ' ,
395+ 'values ' => [
396+ [
397+ 'product_name ' => 'Simple Product1 ' ,
398+ 'product_sku ' => 'simple1 ' ,
399+ 'quantity ' => 1 ,
400+ 'price ' => ['value ' => 1 , 'currency ' => 'USD ' ]
401+ ]
402+ ]
403+ ],
404+ [
405+ 'label ' => 'Drop Down Option 2 ' ,
406+ 'values ' => [
407+ [
408+ 'product_name ' => 'Simple Product2 ' ,
409+ 'product_sku ' => 'simple2 ' ,
410+ 'quantity ' => 2 ,
411+ 'price ' => ['value ' => 2 , 'currency ' => 'USD ' ]
412+ ]
413+ ]
414+ ]
415+ ],
323416 'quantity_refunded ' => 1
324417 ],
325418
@@ -453,6 +546,32 @@ private function getCustomerOrderWithCreditMemoQuery(): array
453546 customer {
454547 orders {
455548 items {
549+ invoices {
550+ items {
551+ product_name
552+ product_sku
553+ product_sale_price {
554+ value
555+ }
556+ ... on BundleInvoiceItem {
557+ bundle_options {
558+ label
559+ values {
560+ product_sku
561+ product_name
562+ quantity
563+ price {
564+ value
565+ currency
566+ }
567+ }
568+ }
569+ }
570+ discounts { amount{value currency} label }
571+ quantity_invoiced
572+ discounts { amount{value currency} label }
573+ }
574+ }
456575 credit_memos {
457576 comments {
458577 message
@@ -463,6 +582,20 @@ private function getCustomerOrderWithCreditMemoQuery(): array
463582 product_sale_price {
464583 value
465584 }
585+ ... on BundleCreditMemoItem {
586+ bundle_options {
587+ label
588+ values {
589+ product_sku
590+ product_name
591+ quantity
592+ price {
593+ value
594+ currency
595+ }
596+ }
597+ }
598+ }
466599 discounts { amount{value currency} label }
467600 quantity_refunded
468601 }
0 commit comments