@@ -195,6 +195,46 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
195
195
196
196
$ this ->creditMemoService ->refund ($ creditMemo , true );
197
197
$ 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
+ ];
198
238
$ expectedCreditMemoData = [
199
239
[
200
240
'comments ' => [
@@ -208,6 +248,30 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
208
248
'value ' => 15
209
249
],
210
250
'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
+ ],
211
275
'quantity_refunded ' => 1
212
276
],
213
277
@@ -250,6 +314,11 @@ public function testCreditMemoForBundledProductsWithPartialRefund()
250
314
]
251
315
];
252
316
$ firstOrderItem = current ($ response ['customer ' ]['orders ' ]['items ' ] ?? []);
317
+
318
+ $ this ->assertArrayHasKey ('invoices ' , $ firstOrderItem );
319
+ $ invoices = $ firstOrderItem ['invoices ' ];
320
+ $ this ->assertResponseFields ($ invoices , $ expectedInvoicesData );
321
+
253
322
$ this ->assertArrayHasKey ('credit_memos ' , $ firstOrderItem );
254
323
$ creditMemos = $ firstOrderItem ['credit_memos ' ];
255
324
$ this ->assertResponseFields ($ creditMemos , $ expectedCreditMemoData );
@@ -320,6 +389,30 @@ public function testCreditMemoForBundleProductWithTaxesAndDiscounts()
320
389
'label ' => 'Discount Label for 10% off '
321
390
]
322
391
],
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
+ ],
323
416
'quantity_refunded ' => 1
324
417
],
325
418
@@ -453,6 +546,32 @@ private function getCustomerOrderWithCreditMemoQuery(): array
453
546
customer {
454
547
orders {
455
548
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
+ }
456
575
credit_memos {
457
576
comments {
458
577
message
@@ -463,6 +582,20 @@ private function getCustomerOrderWithCreditMemoQuery(): array
463
582
product_sale_price {
464
583
value
465
584
}
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
+ }
466
599
discounts { amount{value currency} label }
467
600
quantity_refunded
468
601
}
0 commit comments