File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Controller/Adminhtml/Configuration Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1212namespace Adyen \Payment \Controller \Adminhtml \Configuration ;
1313
1414use Adyen \AdyenException ;
15+ use Adyen \Model \Management \TestWebhookResponse ;
1516use Adyen \Payment \Helper \Config ;
1617use Adyen \Payment \Helper \ManagementHelper ;
1718use Magento \Backend \App \Action ;
@@ -87,9 +88,19 @@ public function execute(): Json
8788
8889 $ client = $ this ->managementApiHelper ->getAdyenApiClient ($ apiKey , $ isDemoMode );
8990 $ service =$ this ->managementApiHelper ->getWebhooksMerchantLevelApi ($ client );
90- $ response = $ this ->managementApiHelper ->webhookTest ($ merchantAccount , $ webhookId , $ service );
91- $ success = isset ($ response ) &&
92- in_array ('success ' , array_column ($ response ->getData (), 'status ' ), true );
91+
92+ $ responseObj = $ this ->managementApiHelper ->webhookTest ($ merchantAccount , $ webhookId , $ service );
93+
94+ $ success = false ;
95+ $ response = null ;
96+
97+ if ($ responseObj instanceof TestWebhookResponse) {
98+ $ responseData = $ responseObj ->getData ();
99+ $ responseData = reset ($ responseData );
100+ $ response = $ responseData ->toArray ();
101+
102+ $ success = $ response ['status ' ] === 'success ' ;
103+ }
93104
94105 $ resultJson = $ this ->resultJsonFactory ->create ();
95106 $ resultJson ->setData ([
You can’t perform that action at this time.
0 commit comments