Skip to content

Commit 212c4e3

Browse files
authored
Remove deprecated passport code (#147)
* Remove deprecated passport code * Validate config contains required TBA keys * Docs updates
1 parent db61ec1 commit 212c4e3

File tree

2 files changed

+7
-59
lines changed

2 files changed

+7
-59
lines changed

README.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ standard autoloading support. It allows configuration to be read from the
1414
environment, adds support to log requests and responses and provides a
1515
simplified client wrapper class (`NetSuiteService`).
1616

17-
| :warning: PHP5 support being discontinued in 2021|
18-
|:---------------------------|
19-
| Please see the [roadmap](#roadmap) for PHP support plans in the coming years.|
20-
2117
* [Installation](#installation)
2218
* [Quickstart](#quickstart)
2319
* [w/Laravel](#laravel-integration)
@@ -43,7 +39,8 @@ composer require ryanwinchester/netsuite-php
4339
#### Instantiating the NetSuiteService class:
4440

4541
Any of the examples herein will assume you have already instantiated a client
46-
object using one of the methods below.
42+
object using token-based authentication. The method of authenticating with
43+
user credentials was dropped from support by NetSuite in 2020.
4744

4845
```php
4946
// Token-based Authentication
@@ -69,33 +66,6 @@ $config = [
6966
];
7067
$service = new NetSuiteService($config);
7168
```
72-
73-
```php
74-
// Authentication with User Credentials
75-
require 'vendor/autoload.php';
76-
77-
use NetSuite\NetSuiteService;
78-
79-
// *****
80-
// No longer supported as of web services v2020.2, use TBA instead
81-
// *****
82-
83-
$config = [
84-
// required -------------------------------------
85-
"endpoint" => "2021_1",
86-
"host" => "https://webservices.netsuite.com",
87-
"email" => "jDoe@netsuite.com",
88-
"password" => "mySecretPwd",
89-
"role" => "3",
90-
"account" => "MYACCT1",
91-
"app_id" => "4AD027CA-88B3-46EC-9D3E-41C6E6A325E2",
92-
// optional -------------------------------------
93-
"logging" => true,
94-
"log_path" => "/var/www/myapp/logs/netsuite",
95-
];
96-
$service = new NetSuiteService($config);
97-
```
98-
9969
You can alternatively place your config in environment variables. This is
10070
helpful in hosted environments where deployment of config files is either
10171
not desired or practical. You can find the valid keys in the included

src/NetSuiteClient.php

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
use NetSuite\Classes\ApplicationInfo;
1616
use NetSuite\Classes\GetDataCenterUrlsRequest;
17-
use NetSuite\Classes\Passport;
1817
use NetSuite\Classes\Preferences;
19-
use NetSuite\Classes\RecordRef;
2018
use NetSuite\Classes\SearchPreferences;
2119
use NetSuite\Classes\TokenPassport;
2220
use NetSuite\Classes\TokenPassportSignature;
@@ -146,6 +144,10 @@ public function validateConfig(array $config)
146144
'endpoint',
147145
'host',
148146
'account',
147+
'token',
148+
'tokenSecret',
149+
'consumerKey',
150+
'consumerSecret',
149151
];
150152
foreach ($requiredParams as $key) {
151153
if (!isset($config[$key]) || empty($config[$key])) {
@@ -189,13 +191,7 @@ public static function createFromEnv(
189191
protected function makeSoapCall($operation, $parameter)
190192
{
191193
$this->fixWtfCookieBug();
192-
193-
if (isset($this->config['token'])) {
194-
$this->addHeader('tokenPassport', $this->createTokenPassportFromConfig($this->config));
195-
} else {
196-
$this->setApplicationInfo($this->config['app_id']);
197-
$this->addHeader("passport", $this->createPassportFromConfig($this->config));
198-
}
194+
$this->addHeader('tokenPassport', $this->createTokenPassportFromConfig($this->config));
199195

200196
try {
201197
$response = $this->getClient()->__soapCall($operation, [$parameter], null, $this->soapHeaders);
@@ -239,24 +235,6 @@ private function createWsdl($config)
239235
return $config['host'].'/wsdl/v'.$config['endpoint'].'_0/netsuite.wsdl';
240236
}
241237

242-
/**
243-
* Create the Passport.
244-
*
245-
* @param array $config
246-
* @return Passport
247-
*/
248-
private function createPassportFromConfig($config)
249-
{
250-
$passport = new Passport();
251-
$passport->account = $config['account'];
252-
$passport->email = $config['email'];
253-
$passport->password = $config['password'];
254-
$passport->role = new RecordRef();
255-
$passport->role->internalId = $config['role'];
256-
257-
return $passport;
258-
}
259-
260238
/**
261239
* Create the TokenPassport.
262240
*

0 commit comments

Comments
 (0)