Skip to content

Commit 0978b64

Browse files
authored
Changes for v2.1.0 (#143)
* Add entityId property support to ApiSessionCreate * Add entityId support to ClientConfig and SessionProvider * Implode error messages and append to ResponseException and ResultException * Add missing extensions to composer.json require: ext-dom, ext-libxml, ext-simplexml, ext-xmlwriter * Add PHP v7.3 to test in travis.yml * Remove exceptions for elements missing in control block response * Fix SessionProvider code coverage * Move ApiSessionCreateTest to Company folder and fix code coverage tag * Update copyright year * Bump version to 2.1.0
1 parent 39b7fa5 commit 0978b64

File tree

527 files changed

+1190
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

527 files changed

+1190
-704
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ php:
44
- 7.0
55
- 7.1
66
- 7.2
7+
- 7.3
78

89
before_script:
910
- composer self-update

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
],
1212
"require": {
1313
"php": ">=7.0",
14+
"ext-dom": "*",
15+
"ext-libxml": "*",
1416
"ext-mbstring": "*",
17+
"ext-simplexml": "*",
18+
"ext-xmlwriter": "*",
1519
"guzzlehttp/guzzle": "^6.2.3",
1620
"ramsey/uuid": "^3.6.1",
1721
"psr/log": "~1.0"

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright 2018 Sage Intacct, Inc.
3+
Copyright 2019 Sage Intacct, Inc.
44
55
Licensed under the Apache License, Version 2.0 (the "License"). You may not
66
use this file except in compliance with the License. You may obtain a copy

src/Intacct/AbstractClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/ClientConfig.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -159,6 +159,25 @@ public function setCompanyId(string $companyId)
159159
$this->companyId = $companyId;
160160
}
161161

162+
/** @var string|null */
163+
private $entityId;
164+
165+
/**
166+
* @return string|null
167+
*/
168+
public function getEntityId() //:string
169+
{
170+
return $this->entityId;
171+
}
172+
173+
/**
174+
* @param string $entityId
175+
*/
176+
public function setEntityId(string $entityId)
177+
{
178+
$this->entityId = $entityId;
179+
}
180+
162181
/** @var string */
163182
private $userId = '';
164183

src/Intacct/Credentials/CredentialsInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Credentials/Endpoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Credentials/LoginCredentials.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -28,6 +28,9 @@ class LoginCredentials implements CredentialsInterface
2828
/** @var string */
2929
const COMPANY_ID_ENV_NAME = 'INTACCT_COMPANY_ID';
3030

31+
/** @var string */
32+
const ENTITY_ID_ENV_NAME = 'INTACCT_ENTITY_ID';
33+
3134
/** @var string */
3235
const USER_ID_ENV_NAME = 'INTACCT_USER_ID';
3336

@@ -40,6 +43,9 @@ class LoginCredentials implements CredentialsInterface
4043
/** @var string */
4144
private $companyId;
4245

46+
/** @var string|null */
47+
private $entityId;
48+
4349
/** @var string */
4450
private $userId;
4551

@@ -64,6 +70,12 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
6470
if (!$config->getCompanyId()) {
6571
$config->setCompanyId(getenv(static::COMPANY_ID_ENV_NAME));
6672
}
73+
if ($config->getEntityId() == null) {
74+
$envEntityId = getenv(static::ENTITY_ID_ENV_NAME);
75+
if ($envEntityId !== false) {
76+
$config->setEntityId($envEntityId);
77+
}
78+
}
6779
if (!$config->getUserId()) {
6880
$config->setUserId(getenv(static::USER_ID_ENV_NAME));
6981
}
@@ -81,6 +93,9 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
8193
if ($profile->getCompanyId()) {
8294
$config->setCompanyId($profile->getCompanyId());
8395
}
96+
if ($profile->getEntityId() !== null) {
97+
$config->setEntityId($profile->getEntityId());
98+
}
8499
if ($profile->getUserId()) {
85100
$config->setUserId($profile->getUserId());
86101
}
@@ -95,6 +110,7 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
95110
. static::COMPANY_ID_ENV_NAME . '"'
96111
);
97112
}
113+
// Entity ID is not required, no Error
98114
if (!$config->getUserId()) {
99115
throw new \InvalidArgumentException(
100116
'Required User ID not supplied in config or env variable "'
@@ -109,6 +125,9 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
109125
}
110126

111127
$this->setCompanyId($config->getCompanyId());
128+
if ($config->getEntityId() !== null) {
129+
$this->setEntityId($config->getEntityId());
130+
}
112131
$this->setUserId($config->getUserId());
113132
$this->setPassword($config->getUserPassword());
114133
$this->setSenderCredentials($senderCreds);
@@ -130,6 +149,22 @@ public function setCompanyId(string $companyId)
130149
$this->companyId = $companyId;
131150
}
132151

152+
/**
153+
* @return string
154+
*/
155+
public function getEntityId() //: string
156+
{
157+
return $this->entityId;
158+
}
159+
160+
/**
161+
* @param string $entityId
162+
*/
163+
public function setEntityId(string $entityId)
164+
{
165+
$this->entityId = $entityId;
166+
}
167+
133168
/**
134169
* @return string
135170
*/

src/Intacct/Credentials/ProfileCredentialProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -40,6 +40,9 @@ public static function getLoginCredentials(ClientConfig $config): ClientConfig
4040
if (isset($data['company_id'])) {
4141
$creds->setCompanyId($data['company_id']);
4242
}
43+
if (isset($data['entity_id'])) {
44+
$creds->setEntityId($data['entity_id']);
45+
}
4346
if (isset($data['user_id'])) {
4447
$creds->setUserId($data['user_id']);
4548
}

src/Intacct/Credentials/SenderCredentials.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Credentials/SessionCredentials.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Exception/IntacctException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Exception/ResponseException.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -40,6 +40,10 @@ public function __construct(string $message, array $errors = [], int $code = 0,
4040
{
4141
$this->errors = $errors;
4242

43+
if (count($errors) > 0) {
44+
$message = $message . ' - ' . implode(' - ', $errors);
45+
}
46+
4347
parent::__construct($message, $code, $previous);
4448
}
4549

src/Intacct/Exception/ResultException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AbstractFunction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApAccountLabel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApAdjustment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApAdjustmentLine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApAdjustmentSummary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApPayment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractApPaymentRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractBill.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractBillLine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractBillSummary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/AbstractVendor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/ApAccountLabelCreate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/ApAccountLabelDelete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/ApAccountLabelUpdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

src/Intacct/Functions/AccountsPayable/ApAdjustmentCreate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Copyright 2018 Sage Intacct, Inc.
4+
* Copyright 2019 Sage Intacct, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. You may obtain a copy

0 commit comments

Comments
 (0)