Skip to content

Commit a47809a

Browse files
committed
Remove obsolete code
1 parent 16e836a commit a47809a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Client.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,14 @@ private static function formatHeaders( $soapUrl, $content, $requestType = "POST"
11291129
/**
11301130
* Send the SOAP message, and get the response
11311131
*
1132-
* @ignore
1132+
* @param $soapUrl
1133+
* @param $content
1134+
* @param bool $throwException
1135+
*
11331136
* @return string response XML
1137+
* @throws Exception
1138+
* @throws NotAuthorizedException
1139+
* @throws SoapFault
11341140
*/
11351141
public static function getSoapResponse( $soapUrl, $content, $throwException = true ) {
11361142
/* Format cUrl headers */
@@ -1162,13 +1168,11 @@ public static function getSoapResponse( $soapUrl, $content, $throwException = tr
11621168
if ( $responseDOM->getElementsByTagNameNS( 'http://www.w3.org/2003/05/soap-envelope', 'Envelope' )->length < 1 ) {
11631169
throw new Exception( 'Invalid SOAP Response: HTTP Response ' . $httpResponse . PHP_EOL . $responseXML );
11641170
}
1165-
/* Fast fix for CRM expiration, sets plugin connection to false */
1166-
if ( $responseDOM->getElementsByTagNameNS( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault', 'value' )->length > 0 && function_exists( "ASDK" ) && ASDK() ) {
1171+
/* Authentication error */
1172+
if ( $responseDOM->getElementsByTagNameNS( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault', 'value' )->length > 0 ) {
11671173
$errorCode = $responseDOM->getElementsByTagNameNS( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault', 'value' )->item( 0 )->textContent;
11681174
if ( $errorCode == "0x80048831" ) {
1169-
$options = get_option( ACRM()->prefix . 'options' );
1170-
$options["connected"] = false;
1171-
update_option( ACRM()->prefix . 'options', $options );
1175+
throw new NotAuthorizedException( $errorCode, 'Not authorized.' );
11721176
}
11731177
}
11741178
/* Check we have a SOAP Header */

src/NotAuthorizedException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace AlexaCRM\CRMToolkit;
4+
5+
class NotAuthorizedException extends \SoapFault {
6+
7+
}

0 commit comments

Comments
 (0)