@@ -383,6 +383,26 @@ public function setGoogleAnalyticsCode($value)
383
383
return $ this ->setParameter ('google_analytics ' , $ value );
384
384
}
385
385
386
+ /**
387
+ * Get items HTML
388
+ *
389
+ * @return string
390
+ */
391
+ public function setItemsHtml ($ itemsHtml )
392
+ {
393
+ $ this ->setParameter ('itemsHtml ' , $ itemsHtml );
394
+ }
395
+
396
+ /**
397
+ * Get items HTML
398
+ *
399
+ * @return string
400
+ */
401
+ public function getItemsHtml ()
402
+ {
403
+ return $ this ->getParameter ('itemsHtml ' );
404
+ }
405
+
386
406
/**
387
407
* Get the payment options.
388
408
*
@@ -452,6 +472,29 @@ protected function getGatewayData()
452
472
return array_filter ($ data );
453
473
}
454
474
475
+ /**
476
+ * Get itembag data.
477
+ *
478
+ * @return array
479
+ */
480
+ protected function getItemBagData ()
481
+ {
482
+ $ items = array ();
483
+ $ itemBag = $ this ->getItems ();
484
+ if (! empty ($ itemBag )) {
485
+ foreach ($ itemBag ->all () as $ item ) {
486
+ $ items [] = array (
487
+ 'name ' => $ item ->getName (),
488
+ 'description ' => $ item ->getDescription (),
489
+ 'quantity ' => $ item ->getQuantity (),
490
+ 'unit_price ' => $ item ->getPrice (),
491
+ );
492
+ }
493
+ }
494
+
495
+ return $ items ;
496
+ }
497
+
455
498
/**
456
499
* Get the raw data array for this message. The format of this varies from gateway to
457
500
* gateway, but will usually be either an associative array, or a SimpleXMLElement.
@@ -492,7 +535,7 @@ public function getData()
492
535
'description ' => $ this ->getDescription (),
493
536
'gateway ' => $ this ->getGateway (),
494
537
'google_analytics ' => $ this ->getGoogleAnalyticsCode (),
495
- 'items ' => $ this ->getItems (),
538
+ 'items ' => $ this ->getItemsHtml (),
496
539
'manual ' => $ this ->getManual (),
497
540
'order_id ' => $ this ->getTransactionId (),
498
541
'recurring_id ' => $ this ->getRecurringId (),
@@ -520,6 +563,12 @@ public function getData()
520
563
$ data ['gateway_info ' ] = $ gatewayData ;
521
564
}
522
565
566
+ $ getItemBagData = $ this ->getItemBagData ();
567
+
568
+ if (! empty ($ getItemBagData )) {
569
+ $ data ['shopping_cart ' ]['items ' ] = $ getItemBagData ;
570
+ }
571
+
523
572
return array_filter ($ data );
524
573
}
525
574
0 commit comments