Skip to content

Commit

Permalink
Commit all changed files to see if we can get this working on php81
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiden committed Dec 21, 2021
1 parent b1a448d commit 2598095
Show file tree
Hide file tree
Showing 641 changed files with 89,378 additions and 88,293 deletions.
23 changes: 16 additions & 7 deletions src/QuickBooksPhpDevKit/Adapter/Client.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php

/**
* Client adapter base class
Expand All @@ -16,22 +16,31 @@
* @subpackage Adapter
*/

declare(strict_types=1);

namespace QuickBooksPhpDevKit\Adapter;

/**
*
*/
interface Client
{
public function __construct($endpoint, $wsdl, $trace = true);
public function __construct($endpoint, $wsdl, bool $trace = true);

public function authenticate($user, $pass);
public function authenticate(string $user, string $pass);

public function sendRequestXML($ticket, $hcpresponse, $companyfile, $country, $majorversion, $minorversion);
public function sendRequestXML(
string $ticket,
$hcpresponse,
$companyfile,
string $country,
int $majorversion,
int $minorversion
);

public function receiveResponseXML($ticket, $response, $hresult, $message);
public function receiveResponseXML(string $ticket, string $response, $hresult, string $message);

public function getLastRequest();
public function getLastRequest();

public function getLastResponse();
public function getLastResponse();
}
145 changes: 76 additions & 69 deletions src/QuickBooksPhpDevKit/Adapter/Client/Php.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php

/**
*
Expand All @@ -16,9 +16,11 @@
* @subpackage Adapter
*/

declare(strict_types=1);

namespace QuickBooksPhpDevKit\Adapter\Client;

use \SoapClient as SoapClient;
use SoapClient as SoapClient;
use QuickBooksPhpDevKit\Adapter\Client;
use QuickBooksPhpDevKit\PackageInfo;
use QuickBooksPhpDevKit\WebConnector\Request\Authenticate;
Expand All @@ -35,71 +37,76 @@
*/
class Php extends SoapClient implements Client
{
public function __construct(string $endpoint, ?string $wsdl = null, bool $trace = true)
{
ini_set('soap.wsdl_cache_enabled', '0');

$wsdl = $wsdl ?? PackageInfo::$WSDL;

$options= [
'location' => $endpoint,
];

if ($trace)
{
$options['trace'] = 1;
}

parent::__construct($wsdl, $options);
}

/**
* Authenticate against a QuickBooks SOAP server
*/
public function authenticate(string $user, string $pass): array
{
$req = new Authenticate($user, $pass);

$resp = parent::__soapCall('authenticate', [$req]);
$tmp = current($resp);

return current($tmp);
}

/**
* Get the QBXML from the server to send to quickbooks
*/
public function sendRequestXML(string $ticket, string $hcpresponse, string $companyfile, string $country, int $majorversion, int $minorversion): array
{
$req = new Sendrequestxml($ticket, $hcpresponse, $companyfile, $country, $majorversion, $minorversion);

//print("SENDING:<pre>");
//print_r($req);
//print('</pre>');

$resp = parent::__soapCall('sendRequestXML', [$req]);
$tmp = current($resp);

return $tmp;
}

public function receiveResponseXML(string $ticket, string $response, $hresult, string $message): array
{
$req = new Receiveresponsexml($ticket, $response, $hresult, $message);

$resp = parent::__soapCall('receiveResponseXML', [$req]);
$tmp = current($resp);

return $tmp;
}

public function getLastRequest()
{
return parent::__getLastRequest();
}

public function getLastResponse()
{
return parent::__getLastResponse();
}
public function __construct(string $endpoint, ?string $wsdl = null, bool $trace = true)
{
ini_set('soap.wsdl_cache_enabled', '0');

$wsdl = $wsdl ?? PackageInfo::$WSDL;

$options = [
'location' => $endpoint,
];

if ($trace) {
$options['trace'] = 1;
}

parent::__construct($wsdl, $options);
}

/**
* Authenticate against a QuickBooks SOAP server
*/
public function authenticate(string $user, string $pass): array
{
$req = new Authenticate($user, $pass);

$resp = parent::__soapCall('authenticate', [$req]);
$tmp = current($resp);

return current($tmp);
}

/**
* Get the QBXML from the server to send to quickbooks
*/
public function sendRequestXML(
string $ticket,
string $hcpresponse,
string $companyfile,
string $country,
int $majorversion,
int $minorversion
): array {
$req = new Sendrequestxml($ticket, $hcpresponse, $companyfile, $country, $majorversion, $minorversion);

//print("SENDING:<pre>");
//print_r($req);
//print('</pre>');

$resp = parent::__soapCall('sendRequestXML', [$req]);
$tmp = current($resp);

return $tmp;
}

public function receiveResponseXML(string $ticket, string $response, $hresult, string $message): array
{
$req = new Receiveresponsexml($ticket, $response, $hresult, $message);

$resp = parent::__soapCall('receiveResponseXML', [$req]);
$tmp = current($resp);

return $tmp;
}

public function getLastRequest()
{
return parent::__getLastRequest();
}

public function getLastResponse()
{
return parent::__getLastResponse();
}
}
Loading

0 comments on commit 2598095

Please sign in to comment.