Skip to content

Commit 0fcfca1

Browse files
authored
Merge pull request #15 from rogerd330/issue-14
Issue 14
2 parents d269122 + 2b3cff4 commit 0fcfca1

File tree

7 files changed

+576
-1247
lines changed

7 files changed

+576
-1247
lines changed

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ composer update
3434
and see if specifying a version resolves the issue, example:
3535

3636
```php
37-
composer require quickbooks/payments-sdk 1.0.2
37+
composer require quickbooks/payments-sdk 1.0.5
3838
```
3939

4040
To use the package, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

src/HttpClients/core/ClientFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ClientFactory
88
public static function buildCurlClient(
99
int $connectionTimeOut = 10,
1010
int $requestTimeOut = 100,
11-
bool $isVerify = true
11+
bool $isVerify = false
1212
) {
1313
$client = new HttpCurlClient();
1414
$client->setVerifySSL($isVerify);
@@ -19,7 +19,7 @@ public static function buildCurlClient(
1919
public static function buildGuzzleClient(
2020
int $connectionTimeOut = 10,
2121
int $requestTimeOut = 100,
22-
bool $isVerify = true
22+
bool $isVerify = false
2323
) {
2424
$client = new GuzzleClient();
2525
$client->setVerifySSL($isVerify);

src/HttpClients/core/HttpCurlClient.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private function prepare(RequestInterface $request) : void
115115
} else {
116116
$this->baseCurl->setupOption(CURLOPT_CUSTOMREQUEST, $request->getMethod());
117117
}
118+
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, true);
118119
if ($this->isVerifySSL) {
119120
$this->setSSLConfig();
120121
} else {
@@ -145,19 +146,13 @@ private function setPostBodyAndMethod(RequestInterface $request)
145146

146147
private function setSSLConfig()
147148
{
148-
$tlsVersion = $this->baseCurl->versionOfTLS();
149-
$versions = ['TLS 1.2', 'TLS 1.3'];
150-
if (!in_array($tlsVersion, $versions)) {
151-
throw new \RuntimeException("Error. Checking TLS 1.2/1.3 version failed. Please make sure your PHP cURL supports TSL 1.2/1.3");
152-
}
153-
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, true);
154149
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYHOST, 2);
155150
$this->baseCurl->setupOption(CURLOPT_CAINFO, CoreConstants::getCertPath());
156151
}
157152

158153
private function acceptAll()
159154
{
160-
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYPEER, false);
155+
$this->baseCurl->setupOption(CURLOPT_SSL_VERIFYHOST, 0);
161156
}
162157

163158
private function updateCurlSettings()

src/HttpClients/core/certs/cacert.pem

100755100644
Lines changed: 541 additions & 1236 deletions
Large diffs are not rendered by default.

src/Modules/Card.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Card extends Entity
2121
public $entityVersion;
2222
public $entityId;
2323
public $entityType;
24+
public $zeroDollarVerification;
2425

2526
public function __construct(array $array = array())
2627
{
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
namespace QuickBooksOnline\Payments\Modules;
3+
4+
use QuickBooksOnline\Payments\Operations\OperationsConverter;
5+
6+
class ZeroDollarVerification
7+
{
8+
public $status;
9+
10+
public function __construct(array $array = array())
11+
{
12+
foreach ($array as $name => $value) {
13+
if (property_exists(get_class($this), $name)) {
14+
if (isset($value)) {
15+
if (is_array($value)) {
16+
$className = ModulesConstants::NAMESPACE_Modules . OperationsConverter::toUpperCaseClassName($name);
17+
$obj = new $className($value);
18+
$this->{$name} = $obj;
19+
} else {
20+
$this->{$name} = $value;
21+
}
22+
}
23+
} else {
24+
throw new \RuntimeException("Property name: [" . $name . "] is not a valid field for: [" . get_class($this) . "]. Please check your keys.");
25+
}
26+
}
27+
}
28+
}

tests/TestClientCreator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class TestClientCreator
1010
public static function createInstance()
1111
{
1212
$client = new PaymentClient();
13-
$client->setAccessToken("eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..mDJrjB3DU7H-aY0UXgj-FQ._GHonQ_YitarEemB6gwuK6D6LJHjuuNBvl2Vcp8wn1DK_4KcmU2pAcp6dcljWY66_mDwAEsO-UDBQaPt2m4UP9uG12Gm2080Sskk-l7z4WWAbGtjOhgnyULB3FKR5ZEaZN9U0rEMtG7ux9grNIJr4EmMtTVYsQa1PdNSfHOXLBj9ixqXdE9zDkqgVioNows3JILlaqMqr3vz3yFhWQYimDmSFD1lwfb_TcB5P9iLNCTOFtvi0_gSM1_hkgC7H4rNsuyiCzt1KN5DpPQ3Dcc76t6NLT7JlLivMHHyjFq_QqWve-mnNrDK1nxSpE5wPoQLLKfg_0UuZIky6Ba_BGsr5PXxEozGTzLNsXpw8qGrUzn4gl9xe2m31DtULfDlhNHevzMbqHrO6uLwNyI2Nd0BnVpES0V7o2kpwg4P_ulj3jValmHtyv-yjsfA0fpmU0KFHpCYnBnhqKiybbsicHzsY6QpjotMrqek36-G3ZvkVSdANKLUu_PsgvStV2VnL_7ARbFYrDqqkAKhUKHoPLG0b40MXzKFGJrZi0OQfWVT3Xe_E8beRdkL6tGOrVcxXIsetn_qQ-TdDmXCteErO1iR17gV_4MqgByF07TP1qfmpothSQUC0HmAryX2fcdPDBmOcTrDYX7LquNdTBIoPuVuCLvZJshC2sVhKnz5Z1HBhqDkkyrwWqRZnRThUSunYUyyK4IlaNvC2JZg-OrtVbncJA.Fs_60T_tIyXcHEc_c6G0Kg")
13+
$client->setAccessToken("eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..wHu2qRYIlYamWVTBlehQbg.TXVWb7h7mEryDAPrUUE3TfALiqRzzyOHpzl4PYy8BbZfCX1b9ws8C4CQ0orsNQYZQD22dy_OUvNRkCjDIYWBFq12IROdyx6rX-cAaJubp4kABelHbJHEaEhio2mgkItnYq2OHc4tnb_bEKVgEjPPk5A0ikNQRoMZXK-Icoo9m0TcSFfomBRlSMj0JexcB9qn-qwAi4U5uaqixZ93Qq6OFIJCBYwW_9C15OG6jcL7lrtXjQPKE6I6p1PEeih6IjArlvSiLmENtcIpv8TTL5AASqDuNoFtbGkCt8VHmAMdkoDos2YRvXQdI_hXzvqYtulC9kzf0b0GVc-rtA0X1HYlLiJ2f9pE6U_nU4g-ndGTR-V8VYN9_X8ftjHAhn6CgBsPptgI9bsWHw5t5fVNo4fBIwuuHoMTHiVp_UM4K-gCimTuDz3W07gf3yfsCvGfOqxpW8hc8mhPRpkuLE3oT5b7UrEpqyOCk0tUSi3KLbez8gpVutsp2J-4zmsaf4Zbl1IAfDkqjgfYSzD3lwn0pkjzvTDErFkxaz7uFH4vSoZ58rmQm0GjSdjcxgKGR_-c63-WKm3Cp14Q2NJx1CO8sRkbefyF-zttvas2PS0rpZaHLOEtLdRZxWW6eVAAZie3i0joZIrcQ4JU6ERuMstYI0il4bH9OyeWGuM9uFUEJ6cPgyxIiLWvKAi_FtGvSpzD6olhPbJun6yOBxESxkdIcuvruw.wuAWaQkIIIfV6R2InAdJrg")
1414
->setEnvironment("sandbox");
1515
return $client;
1616
}

0 commit comments

Comments
 (0)