@@ -518,9 +518,31 @@ public function compareOnlineTokensData(): stdClass
518
518
$ onlineDataPreprod = $ this ->curlRequest ($ ENDPOINT_PREPROD , false , $ headers );
519
519
$ onlineDataProd = $ this ->curlRequest ($ ENDPOINT_PROD , false , $ headers );
520
520
521
+ $ onlineDataPreprod = $ this ->formatDataForParsing ($ onlineDataPreprod );
522
+ $ onlineDataProd = $ this ->formatDataForParsing ($ onlineDataProd );
523
+
521
524
$ treeWalker = new TreeWalker ([]);
522
525
523
- return json_decode ($ treeWalker ->getdiff ($ onlineDataPreprod , $ onlineDataProd , true ));
526
+ // Get json diff
527
+ $ filteredResult = $ treeWalker ->getdiff ($ onlineDataPreprod , $ onlineDataProd , true );
528
+
529
+ // Remove values
530
+ $ treeWalker ->walker ($ filteredResult , function (&$ struct , $ key ) {
531
+ if ($ key == "lastUpdate " ) {
532
+ unset($ struct [$ key ]);
533
+ }
534
+ });
535
+
536
+ // Check empty
537
+ foreach ($ filteredResult as $ key => $ options ) {
538
+ foreach ($ options as $ id => $ values ) {
539
+ if (empty ($ values )) {
540
+ unset($ filteredResult [$ key ][$ id ]);
541
+ }
542
+ }
543
+ }
544
+
545
+ return json_decode (json_encode ($ filteredResult ));
524
546
}
525
547
526
548
/**
@@ -588,4 +610,23 @@ private function doAppQuotaMapping(array $applicationsQuota): array
588
610
589
611
return $ result ;
590
612
}
613
+
614
+ /**
615
+ * Format data for parsing.
616
+ *
617
+ * @param $jsonData
618
+ *
619
+ * @return string
620
+ */
621
+ private function formatDataForParsing ($ jsonData ): string
622
+ {
623
+ $ orderedArray = [];
624
+
625
+ $ array = json_decode ($ jsonData );
626
+ foreach ($ array as $ value ) {
627
+ $ orderedArray [$ value ->blockchainAddresses ->ethereum ->distributor ] = $ value ;
628
+ }
629
+
630
+ return json_encode ($ orderedArray );
631
+ }
591
632
}
0 commit comments