Skip to content

Commit

Permalink
Changes for v2.1.0 (#143)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jimmymcpeter authored Feb 5, 2019
1 parent 39b7fa5 commit 0978b64
Show file tree
Hide file tree
Showing 527 changed files with 1,190 additions and 704 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3

before_script:
- composer self-update
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
],
"require": {
"php": ">=7.0",
"ext-dom": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xmlwriter": "*",
"guzzlehttp/guzzle": "^6.2.3",
"ramsey/uuid": "^3.6.1",
"psr/log": "~1.0"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2018 Sage Intacct, Inc.
Copyright 2019 Sage Intacct, Inc.
Licensed under the Apache License, Version 2.0 (the "License"). You may not
use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/AbstractClient.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
21 changes: 20 additions & 1 deletion src/Intacct/ClientConfig.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

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

/** @var string|null */
private $entityId;

/**
* @return string|null
*/
public function getEntityId() //:string
{
return $this->entityId;
}

/**
* @param string $entityId
*/
public function setEntityId(string $entityId)
{
$this->entityId = $entityId;
}

/** @var string */
private $userId = '';

Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Credentials/CredentialsInterface.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Credentials/Endpoint.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
37 changes: 36 additions & 1 deletion src/Intacct/Credentials/LoginCredentials.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

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

/** @var string */
const ENTITY_ID_ENV_NAME = 'INTACCT_ENTITY_ID';

/** @var string */
const USER_ID_ENV_NAME = 'INTACCT_USER_ID';

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

/** @var string|null */
private $entityId;

/** @var string */
private $userId;

Expand All @@ -64,6 +70,12 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
if (!$config->getCompanyId()) {
$config->setCompanyId(getenv(static::COMPANY_ID_ENV_NAME));
}
if ($config->getEntityId() == null) {
$envEntityId = getenv(static::ENTITY_ID_ENV_NAME);
if ($envEntityId !== false) {
$config->setEntityId($envEntityId);
}
}
if (!$config->getUserId()) {
$config->setUserId(getenv(static::USER_ID_ENV_NAME));
}
Expand All @@ -81,6 +93,9 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
if ($profile->getCompanyId()) {
$config->setCompanyId($profile->getCompanyId());
}
if ($profile->getEntityId() !== null) {
$config->setEntityId($profile->getEntityId());
}
if ($profile->getUserId()) {
$config->setUserId($profile->getUserId());
}
Expand All @@ -95,6 +110,7 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
. static::COMPANY_ID_ENV_NAME . '"'
);
}
// Entity ID is not required, no Error
if (!$config->getUserId()) {
throw new \InvalidArgumentException(
'Required User ID not supplied in config or env variable "'
Expand All @@ -109,6 +125,9 @@ public function __construct(ClientConfig $config, SenderCredentials $senderCreds
}

$this->setCompanyId($config->getCompanyId());
if ($config->getEntityId() !== null) {
$this->setEntityId($config->getEntityId());
}
$this->setUserId($config->getUserId());
$this->setPassword($config->getUserPassword());
$this->setSenderCredentials($senderCreds);
Expand All @@ -130,6 +149,22 @@ public function setCompanyId(string $companyId)
$this->companyId = $companyId;
}

/**
* @return string
*/
public function getEntityId() //: string
{
return $this->entityId;
}

/**
* @param string $entityId
*/
public function setEntityId(string $entityId)
{
$this->entityId = $entityId;
}

/**
* @return string
*/
Expand Down
5 changes: 4 additions & 1 deletion src/Intacct/Credentials/ProfileCredentialProvider.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -40,6 +40,9 @@ public static function getLoginCredentials(ClientConfig $config): ClientConfig
if (isset($data['company_id'])) {
$creds->setCompanyId($data['company_id']);
}
if (isset($data['entity_id'])) {
$creds->setEntityId($data['entity_id']);
}
if (isset($data['user_id'])) {
$creds->setUserId($data['user_id']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Credentials/SenderCredentials.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Credentials/SessionCredentials.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Exception/IntacctException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
6 changes: 5 additions & 1 deletion src/Intacct/Exception/ResponseException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

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

if (count($errors) > 0) {
$message = $message . ' - ' . implode(' - ', $errors);
}

parent::__construct($message, $code, $previous);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Exception/ResultException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Functions/AbstractFunction.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Functions/AccountsPayable/AbstractBill.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Functions/AccountsPayable/AbstractBillLine.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/Functions/AccountsPayable/AbstractVendor.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2018 Sage Intacct, Inc.
* Copyright 2019 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down
Loading

0 comments on commit 0978b64

Please sign in to comment.