From d49bf1f7f44a5a4b990ea6f10b7f98d935570568 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:21:39 -0400 Subject: [PATCH 001/164] Removed deprecated nonce tests --- tests/Bitpay/AccessTokenTest.php | 39 +------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/tests/Bitpay/AccessTokenTest.php b/tests/Bitpay/AccessTokenTest.php index 2159603e..a469fd6e 100644 --- a/tests/Bitpay/AccessTokenTest.php +++ b/tests/Bitpay/AccessTokenTest.php @@ -1,6 +1,6 @@ assertNotNull($token); - $token->setId('test'); - $this->assertSame('test', $token->getId()); } @@ -24,9 +22,7 @@ public function testEmail() $token = new AccessToken(); $this->assertNotNull($token); - $token->setEmail('support@bitpay.com'); - $this->assertSame('support@bitpay.com', $token->getEmail()); } @@ -35,40 +31,7 @@ public function testLabel() $token = new AccessToken(); $this->assertNotNull($token); - $token->setLabel('label'); - $this->assertSame('label', $token->getLabel()); } - - public function testNonce() - { - $token = new AccessToken(); - - $this->assertNotNull($token); - - $this->assertFalse($token->isNonceDisabled()); - } - - public function testNonceDisable() - { - $token = new AccessToken(); - - $this->assertNotNull($token); - - $this->assertFalse($token->isNonceDisabled()); - $token->nonceDisable(); - $this->assertTrue($token->isNonceDisabled()); - } - - public function testNonceEnable() - { - $token = new AccessToken(); - - $this->assertNotNull($token); - - $this->assertFalse($token->isNonceDisabled()); - $token->nonceEnable(); - $this->assertFalse($token->isNonceDisabled()); - } } From e3e6beb1769a4f9b4b03348740748e67285a650d Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:28:39 -0400 Subject: [PATCH 002/164] Removed deprecated nonce tests --- tests/Bitpay/Util/UtilTest.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/Bitpay/Util/UtilTest.php b/tests/Bitpay/Util/UtilTest.php index 2b76d481..53e91e46 100644 --- a/tests/Bitpay/Util/UtilTest.php +++ b/tests/Bitpay/Util/UtilTest.php @@ -1,6 +1,6 @@ assertGreaterThan($a, $b); - } - public function testGuid() { $guid = Util::guid(); @@ -173,6 +162,7 @@ public function testDoubleAndAdd() $point = Util::doubleAndAdd('1', new Point(1, 1)); $this->assertEquals('1', $point->getX()); $this->assertEquals('1', $point->getY()); + $point = new Point( '0x'.substr(Secp256k1::G, 2, 64), '0x'.substr(Secp256k1::G, 66, 64) @@ -182,6 +172,7 @@ public function testDoubleAndAdd() '0xb7dafe35d7d1aab78b53982c8ba554584518f86d50af565c98e053613c8f15e0', $point ); + $this->assertEquals('14976827122927988984909748681266837395089399768482149532452617485742004777865', $R->getX()); $this->assertEquals('5009713401941157350243425146365130573323232660945282226881202857781593637456', $R->getY()); @@ -189,6 +180,7 @@ public function testDoubleAndAdd() '0xfd7c6914790d3bbf3184d9830e3f1a327e951e3478dd0b28f0fd3b0e774bbd68', $point ); + $this->assertEquals('65041784833307054098962518952641430476519680065454324565175938819000678523383', $R->getX()); $this->assertEquals('53140314933116045874248958072587249546886301333167874306830834776596206062743', $R->getY()); } @@ -199,6 +191,7 @@ public function testDecToBin() array('123456789', '101010001011001111011010111'), array('0x123456789', '100100011110011010100010110001001'), ); + foreach ($data as $datum) { $this->assertSame($datum[1], Util::decToBin($datum[0])); } @@ -229,6 +222,7 @@ public function testPointAdd() new Point(1, 1), new Point(1, 1) ); + $expectedpoint = new Point("28948022309329048855892746252171976963317496166410141009864396001977208667916", "14474011154664524427946373126085988481658748083205070504932198000988604333958"); $this->assertEquals($expectedpoint, $point); @@ -236,6 +230,7 @@ public function testPointAdd() new Point(0, 0), new Point(1, 1) ); + $expectedpoint = new Point("0", "0"); $this->assertEquals($expectedpoint, $point); @@ -243,6 +238,7 @@ public function testPointAdd() new Point(1, 0), new Point(0, 1) ); + $expectedpoint = new Point("0", "115792089237316195423570985008687907853269984665640564039457584007908834671662"); $this->assertEquals($expectedpoint, $point); } @@ -253,6 +249,7 @@ public function testBinConv() array('7361746f736869', 'satoshi'), array('0x7361746f736869', 'satoshi'), ); + foreach ($data as $datum) { $this->assertSame($datum[1], Util::binConv($datum[0])); } @@ -267,6 +264,7 @@ public function testCheckRequirements() $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } + if (PHP_VERSION_ID >= 50400) { $this->assertTrue($requirements['PHP']); } else { @@ -299,6 +297,7 @@ public function testCheckRequirements() $this->assertTrue($requirements['cURL']); $curl_version = curl_version(); $ssl_supported = ($curl_version['features'] & CURL_VERSION_SSL); + if ($ssl_supported) { $this->assertTrue($requirements['cURL.SSL']); } else { @@ -316,5 +315,4 @@ public function testCheckRequirements() $this->assertTrue(is_string($requirements['Math'])); } } - } From 9efe33beb18822af645b24e790a69d8230c2c712 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:29:41 -0400 Subject: [PATCH 003/164] Updated copyright year and minor refactoring --- tests/Bitpay/Util/SecureRandomTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bitpay/Util/SecureRandomTest.php b/tests/Bitpay/Util/SecureRandomTest.php index b272c287..02b5db14 100644 --- a/tests/Bitpay/Util/SecureRandomTest.php +++ b/tests/Bitpay/Util/SecureRandomTest.php @@ -1,13 +1,13 @@ Date: Tue, 15 Sep 2015 17:30:43 -0400 Subject: [PATCH 004/164] Updated copyright year and minor refactoring --- tests/Bitpay/Util/FingerprintTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Bitpay/Util/FingerprintTest.php b/tests/Bitpay/Util/FingerprintTest.php index 83d1a21c..1db1fa43 100644 --- a/tests/Bitpay/Util/FingerprintTest.php +++ b/tests/Bitpay/Util/FingerprintTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 17:31:44 -0400 Subject: [PATCH 005/164] Updated copyright year and minor refactoring --- tests/Bitpay/Util/Base58Test.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/Util/Base58Test.php b/tests/Bitpay/Util/Base58Test.php index 3165a2a2..ffe4dfcf 100644 --- a/tests/Bitpay/Util/Base58Test.php +++ b/tests/Bitpay/Util/Base58Test.php @@ -1,6 +1,6 @@ assertSame($datum[1], Base58::encode($datum[0])); } @@ -44,6 +45,7 @@ public function testDecodeSpecial() array('3e', '25', ''), array('39', 'z', ''), ); + foreach ($data as $datum) { $decoded = Base58::decode($datum[1]); $this->assertSame($datum[0], $decoded, sprintf('%s != %s', $datum[0], $decoded)); From 97162a5cd5a290785c34787ecce0743bfb3bdc96 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:34:52 -0400 Subject: [PATCH 006/164] Updated copyright year and minor refactoring --- tests/Bitpay/UserTest.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/Bitpay/UserTest.php b/tests/Bitpay/UserTest.php index 1689254f..a7545c99 100644 --- a/tests/Bitpay/UserTest.php +++ b/tests/Bitpay/UserTest.php @@ -1,6 +1,6 @@ assertNotNull($this->user); - $this->user->setPhone('555-555-5555'); $this->assertNotNull($this->user->getPhone()); $this->assertSame('555-555-5555', $this->user->getPhone()); @@ -45,7 +44,6 @@ public function testGetEmail() public function testSetEmail() { $this->assertNotNull($this->user); - $this->user->setEmail('support@bitpay.com'); $this->assertNotNull($this->user->getEmail()); $this->assertSame('support@bitpay.com', $this->user->getEmail()); @@ -63,7 +61,6 @@ public function testGetFirstName() public function testSetFirstName() { $this->assertNotNull($this->user); - $this->user->setFirstName('BitPay'); $this->assertNotNull($this->user->getFirstName()); $this->assertSame('BitPay', $this->user->getFirstName()); @@ -81,7 +78,6 @@ public function testGetLastName() public function testSetLastName() { $this->assertNotNull($this->user); - $this->user->setLastName('Inc'); $this->assertNotNull($this->user->getLastName()); $this->assertSame('Inc', $this->user->getLastName()); @@ -122,7 +118,6 @@ public function testGetCity() public function testSetCity() { $this->assertNotNull($this->user); - $this->user->setCity('Atlanta'); $this->assertNotNull($this->user->getCity()); $this->assertSame('Atlanta', $this->user->getCity()); @@ -140,7 +135,6 @@ public function testGetState() public function testSetState() { $this->assertNotNull($this->user); - $this->user->setState('GA'); $this->assertNotNull($this->user->getState()); $this->assertSame('GA', $this->user->getState()); @@ -158,7 +152,6 @@ public function testGetZip() public function testSetZip() { $this->assertNotNull($this->user); - $this->user->setZip('37379'); $this->assertNotNull($this->user->getZip()); $this->assertSame('37379', $this->user->getZip()); @@ -176,7 +169,6 @@ public function testGetCountry() public function testSetCountry() { $this->assertNotNull($this->user); - $this->user->setCountry('US'); $this->assertNotNull($this->user->getCountry()); $this->assertSame('US', $this->user->getCountry()); From 8da8aeda2c348d240ff5f49049c8dd8dc43a73d3 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:35:34 -0400 Subject: [PATCH 007/164] Updated copyright year and minor refactoring --- tests/Bitpay/TokenTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/TokenTest.php b/tests/Bitpay/TokenTest.php index 24067b7d..f6541c32 100644 --- a/tests/Bitpay/TokenTest.php +++ b/tests/Bitpay/TokenTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 17:36:57 -0400 Subject: [PATCH 008/164] Updated copyright year and minor refactoring --- tests/Bitpay/SinKeyTest.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/tests/Bitpay/SinKeyTest.php b/tests/Bitpay/SinKeyTest.php index 4fb3758d..a319a57b 100644 --- a/tests/Bitpay/SinKeyTest.php +++ b/tests/Bitpay/SinKeyTest.php @@ -1,34 +1,30 @@ assertNotNull($pubKey); - $pubKey->setPrivateKey(PrivateKey::create()->generate()); - $pubKey->generate(); $sinKey = new SinKey(); + $this->assertNotNull($sinKey); - $sinKey->setPublicKey($pubKey); - $this->assertSame('', (string) $sinKey); - $sinKey->generate(); - $this->assertEquals(35, strlen((string) $sinKey)); } @@ -38,6 +34,7 @@ public function testToString() public function testGenerateWithException() { $sinKey = new SinKey(); + $this->assertNotNull($sinKey); $sinKey->generate(); } @@ -48,27 +45,24 @@ public function testGenerateWithException() public function testGenerateWithoutPublicKey() { $sinKey = new SinKey(); + $this->assertNotNull($sinKey); - $sinKey->generate(); } public function testGenerateWithoutException() { $pubKey = PublicKey::create(); + $this->assertNotNull($pubKey); - $pubKey->setPrivateKey(PrivateKey::create()->generate()); - $pubKey->generate(); $sinKey = new SinKey(); + $this->assertNotNull($sinKey); - $sinKey->setPublicKey($pubKey); - $sinKey->generate(); - $this->assertEquals(35, strlen((string) $sinKey)); } @@ -78,21 +72,17 @@ public function testGenerateWithoutException() public function testIsValid() { $sinKey = new SinKey(); + $this->assertNotNull($sinKey); - $this->assertFalse($sinKey->isValid()); $pubKey = PublicKey::create(); + $this->assertNotNull($pubKey); - $pubKey->setPrivateKey(PrivateKey::create()->generate()); - $pubKey->generate(); - $sinKey->setPublicKey($pubKey); - $sinKey->generate(); - $this->assertTrue($sinKey->isValid()); } } From 014da0dc55319452b67a17c1f73cb85ecda67a86 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:41:24 -0400 Subject: [PATCH 009/164] Updated copyright year and minor refactoring --- tests/Bitpay/PublicKeyTest.php | 57 +++++++++++++++------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/tests/Bitpay/PublicKeyTest.php b/tests/Bitpay/PublicKeyTest.php index 1a89b7e7..6ae2db43 100644 --- a/tests/Bitpay/PublicKeyTest.php +++ b/tests/Bitpay/PublicKeyTest.php @@ -1,17 +1,13 @@ '10a2036fd1c8f7aeae1e21cd2a11bb9654f76844d1636809618b5e2cbb00c35d', @@ -78,6 +74,7 @@ class PublicKeyTest extends \PHPUnit_Framework_TestCase public function testId() { $key = new PublicKey('/path/to/key.pub'); + $this->assertSame('/path/to/key.pub', $key->getId()); } @@ -90,6 +87,7 @@ public function testGenerate() { foreach($this->hexKeys as $hexKey) { $pubKey = new PublicKey(); + $pubKey->setPrivateKey($this->getMockPrivateKey($hexKey['private'])); $pubKey->generate(); $this->assertEquals($hexKey['public'], (string) $pubKey); @@ -99,6 +97,7 @@ public function testGenerate() public function testGenerateOnlyOnce() { $key = new PublicKey(); + $key->setPrivateKey($this->getMockPrivateKey()); $key->generate(); @@ -107,10 +106,7 @@ public function testGenerateOnlyOnce() $key->generate(); // Make sure values do not change - $this->assertSame( - $hexValue, - $key->getHex() - ); + $this->assertSame($hexValue, $key->getHex()); } /** @@ -119,6 +115,7 @@ public function testGenerateOnlyOnce() public function testGetHex() { $pubKey = new PublicKey(); + $pubKey->setPrivateKey($this->getMockPrivateKey()); $this->assertNull($pubKey->getHex()); $pubKey->generate(); @@ -131,46 +128,41 @@ public function testGetHex() public function testGetDec() { $pubKey = new PublicKey(); - $this->assertNotNull($pubKey); + $this->assertNotNull($pubKey); $pubKey->setPrivateKey($this->getMockPrivateKey()); - $this->assertNull($pubKey->getDec()); - $pubKey->generate(); $this->assertGreaterThanOrEqual(154, strlen($pubKey->getDec())); } /** - * @see https://github.com/bitpay/bitcore/blob/master/test/test.Key.js * @depends testGenerate */ public function testToString() { $pubKey = new PublicKey(); + $this->assertNotNull($pubKey); - $pubKey->setPrivateKey(PrivateKey::create()->generate()); - - $this->assertSame('', (string) $pubKey); - + $this->assertSame('', (string)$pubKey); $pubKey->generate(PrivateKey::create()->generate()); - if ('02'.$pubKey->getX() == $pubKey) { - $compressed = '02'.$pubKey->getX(); + if ('02' . $pubKey->getX() == $pubKey) { + $compressed = '02' . $pubKey->getX(); } else { - $compressed = '03'.$pubKey->getX(); + $compressed = '03' . $pubKey->getX(); } - $this->assertSame($compressed, (string) $pubKey); - - $this->assertEquals(66, strlen((string) $pubKey)); + $this->assertSame($compressed, (string)$pubKey); + $this->assertEquals(66, strlen((string)$pubKey)); } public function testGetX() { foreach($this->hexKeys as $hexKey) { $pubKey = new PublicKey(); + $pubKey->setPrivateKey($this->getMockPrivateKey($hexKey['private'])); $pubKey->generate(); $this->assertEquals($hexKey['pub_x'], $pubKey->getX()); @@ -181,6 +173,7 @@ public function testGetY() { foreach($this->hexKeys as $hexKey) { $pubKey = new PublicKey(); + $pubKey->setPrivateKey($this->getMockPrivateKey($hexKey['private'])); $pubKey->generate(); $this->assertEquals($hexKey['pub_y'], $pubKey->getY()); @@ -190,12 +183,14 @@ public function testGetY() public function testCreateFromPrivateKey() { $key = PublicKey::createFromPrivateKey($this->getMockPrivateKey()); + $this->assertInstanceOf('Bitpay\PublicKey', $key); } public function testIsValid() { $key = new PublicKey(); + $this->assertFalse($key->isValid()); $key->setPrivateKey($this->getMockPrivateKey()); $key->generate(); @@ -205,7 +200,9 @@ public function testIsValid() public function testGetSin() { $pub = new PublicKey(); + $pub->setPrivateKey($this->getMockPrivateKey()); + $sin = $pub->getSin(); $this->assertInstanceOf('Bitpay\SinKey', $sin); @@ -214,19 +211,18 @@ public function testGetSin() public function testGetSinOnlyOnce() { $pub = new PublicKey(); + $pub->setPrivateKey($this->getMockPrivateKey()); $sin = $pub->getSin(); - $this->assertSame( - $sin, - $pub->getSin() - ); + $this->assertSame($sin,$pub->getSin()); } public function testIsGenerated() { $pub = new PublicKey(); + $pub->setPrivateKey($this->getMockPrivateKey()); $this->assertFalse($pub->isGenerated()); $pub->generate(); @@ -237,13 +233,10 @@ private function getMockPrivateKey($hex = null) { $hex = ($hex === null) ? $this->hexKeys[0]['private'] : $hex; $key = $this->getMock('Bitpay\PrivateKey'); + $key->method('isValid')->will($this->returnValue(true)); + $key->method('getHex')->will($this->returnValue($hex)); - $key - ->method('getHex') - ->will($this->returnValue($hex)); - return $key; } - } From c6503e0233471c37b0b3040e26f0a88eaf6d8bd3 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:45:11 -0400 Subject: [PATCH 010/164] Updated copyright year and minor refactoring --- tests/Bitpay/PrivateKeyTest.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/Bitpay/PrivateKeyTest.php b/tests/Bitpay/PrivateKeyTest.php index 06579dec..d3216e10 100644 --- a/tests/Bitpay/PrivateKeyTest.php +++ b/tests/Bitpay/PrivateKeyTest.php @@ -1,6 +1,6 @@ assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertNull($priKey->getHex()); $this->assertNull($priKey->getDec()); @@ -44,8 +44,11 @@ public function testGenerate() public function testGenerateCannotHappenTwice() { $privateKey = new PrivateKey(); + $privateKey->generate(); + $hex = $privateKey->getHex(); + $privateKey->generate(); $this->assertSame($hex, $privateKey->getHex()); } @@ -53,10 +56,9 @@ public function testGenerateCannotHappenTwice() public function testGetHex() { $priKey = new PrivateKey(); - $this->assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertNull($priKey->getHex()); - $this->assertEquals(0, strlen($priKey->getHex())); $priKey->generate(); @@ -71,6 +73,7 @@ public function testGetHex() public function testToString() { $priKey = new PrivateKey(); + $this->assertNotNull($priKey); // Make sure this is a string @@ -87,10 +90,9 @@ public function testToString() public function testGetDec() { $priKey = new PrivateKey(); - $this->assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertNull($priKey->getDec()); - $this->assertEquals(0, strlen($priKey->getDec())); $priKey->generate(); @@ -101,8 +103,8 @@ public function testGetDec() public function testIsValid() { $priKey = new PrivateKey(); - $this->assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertFalse($priKey->isValid()); $priKey->generate(); @@ -113,6 +115,7 @@ public function testIsValid() public function testSign() { $priKey = new PrivateKey(); + $priKey->generate(); // Make sure not exceptions are thrown @@ -122,8 +125,8 @@ public function testSign() public function testHasValidHex() { $priKey = new PrivateKey(); - $this->assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertFalse($priKey->hasValidHex()); $priKey->generate(); @@ -134,8 +137,8 @@ public function testHasValidHex() public function testHasValidDec() { $priKey = new PrivateKey(); - $this->assertNotNull($priKey); + $this->assertNotNull($priKey); $this->assertFalse($priKey->hasValidDec()); $priKey->generate(); @@ -163,9 +166,11 @@ public function testPemDecode() $public_key = '048d970d6ba29dcfa190c177140fd889fadd6d2590b1ee1a6a06e255dbf22b4017ee7bc8e1f07ed0ff8bd77c002b98d31a1a8b53a63767ca65a531fb33cd726197'; $pkey = new PrivateKey(); + $this->assertNotNull($pkey); $keys = $pkey->pemDecode($data); + $this->assertNotNull($pkey); // Ensure it's an array @@ -190,11 +195,12 @@ public function testPemEncode() $public_key = '048d970d6ba29dcfa190c177140fd889fadd6d2590b1ee1a6a06e255dbf22b4017ee7bc8e1f07ed0ff8bd77c002b98d31a1a8b53a63767ca65a531fb33cd726197'; $keypair = array($private_key, $public_key); + $pkey = new PrivateKey(); - $pkey = new PrivateKey(); $this->assertNotNull($pkey); $pemdata = $pkey->pemEncode($keypair); + $this->assertNotNull($pemdata); // Ensure it's a string From 2f60d3acb74c0b9388a30373c35498b26028073b Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:49:29 -0400 Subject: [PATCH 011/164] Updated copyright year and minor refactoring --- tests/Bitpay/PointTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/PointTest.php b/tests/Bitpay/PointTest.php index 69fd82c5..b2a8ea96 100644 --- a/tests/Bitpay/PointTest.php +++ b/tests/Bitpay/PointTest.php @@ -1,6 +1,6 @@ assertInstanceOf('Bitpay\PointInterface', $pointA); $this->assertSame('1', $pointA->getX()); $this->assertSame('2', $pointA->getY()); From 4d12f6aa65c145d494f23eb72df0c9aedfc38e97 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:50:23 -0400 Subject: [PATCH 012/164] Updated copyright year and minor refactoring --- tests/Bitpay/PayoutTransactionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/PayoutTransactionTest.php b/tests/Bitpay/PayoutTransactionTest.php index 826e637a..135a8a29 100644 --- a/tests/Bitpay/PayoutTransactionTest.php +++ b/tests/Bitpay/PayoutTransactionTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 17:53:07 -0400 Subject: [PATCH 013/164] Updated copyright year and minor refactoring --- tests/Bitpay/PayoutTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Bitpay/PayoutTest.php b/tests/Bitpay/PayoutTest.php index 10b34e0f..6059ae4e 100644 --- a/tests/Bitpay/PayoutTest.php +++ b/tests/Bitpay/PayoutTest.php @@ -1,6 +1,6 @@ setLabel($label); $this->payout->addInstruction($instruction); - $this->assertInternalType('array', $this->payout->getInstructions()); $this->assertTrue(count($this->payout->getInstructions()) == 1); From 8bf7a62e9780baa20ab342caea733171a11abe82 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:54:14 -0400 Subject: [PATCH 014/164] Updated copyright year and minor refactoring --- tests/Bitpay/PayoutInstructionTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/PayoutInstructionTest.php b/tests/Bitpay/PayoutInstructionTest.php index 67663f36..4c22416e 100644 --- a/tests/Bitpay/PayoutInstructionTest.php +++ b/tests/Bitpay/PayoutInstructionTest.php @@ -1,6 +1,6 @@ assertNotNull($this->instruction->getBtc()); $this->assertSame($btc, $this->instruction->getBtc()); } + /** * @depends testGetAmount */ @@ -140,6 +141,7 @@ public function testSetAmount() $this->assertInternalType('float', $this->instruction->getAmount()); $this->assertSame(10.99, $this->instruction->getAmount()); } + /** * @depends testGetStatus */ From 580d4a5b27de0fe2cb30fc0359ae2cc44fcd0f01 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:57:58 -0400 Subject: [PATCH 015/164] Updated copyright year and minor refactoring --- tests/Bitpay/KeyManagerTest.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/KeyManagerTest.php b/tests/Bitpay/KeyManagerTest.php index 290d04d3..f3fe434e 100644 --- a/tests/Bitpay/KeyManagerTest.php +++ b/tests/Bitpay/KeyManagerTest.php @@ -1,6 +1,6 @@ temp_path = '/tmp/mock.key'; + } + public function testConstruct() { $storage = $this->getMockStorage(); @@ -41,13 +48,12 @@ public function testLoad() $manager = new KeyManager($storage); $this->assertNotNull($manager); - $manager->load($this->getMockKey()); } private function getMockKey() { - return new \Bitpay\PublicKey('/tmp/mock.key'); + return new \Bitpay\PublicKey($this->temp_path); } private function getMockStorage() From 5f7b18ccb035c7b67091ea104b0712c4b3d98da4 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 17:59:38 -0400 Subject: [PATCH 016/164] Updated copyright year and minor refactoring --- tests/Bitpay/ItemTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/ItemTest.php b/tests/Bitpay/ItemTest.php index 8f49a6dc..a50ce469 100644 --- a/tests/Bitpay/ItemTest.php +++ b/tests/Bitpay/ItemTest.php @@ -1,6 +1,6 @@ item->setPrice(9.99); $this->assertSame(9.99, $this->item->getPrice()); @@ -142,7 +143,7 @@ public function testBadStringPrice() } /** - * @expectedException \Bitpay\Client\ArgumentException + * @expectedException \Bitpay\Client\ArgumentException */ public function testSetPriceExceptionNoNumber() { @@ -150,7 +151,7 @@ public function testSetPriceExceptionNoNumber() } /** - * @expectedException \Bitpay\Client\ArgumentException + * @expectedException \Bitpay\Client\ArgumentException */ public function testSetPriceExceptionDoubleDecimal() { From 6689dd3344c6a0a9ada7cb6db891aee9d6eb03b5 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:04:44 -0400 Subject: [PATCH 017/164] Updated copyright year and minor refactoring and removed empty tests. --- tests/Bitpay/InvoiceTest.php | 83 ++---------------------------------- 1 file changed, 3 insertions(+), 80 deletions(-) diff --git a/tests/Bitpay/InvoiceTest.php b/tests/Bitpay/InvoiceTest.php index 9eab65ea..ba65bd61 100644 --- a/tests/Bitpay/InvoiceTest.php +++ b/tests/Bitpay/InvoiceTest.php @@ -1,6 +1,6 @@ assertNotNull($this->invoice); - $this->invoice->setNotificationEmail('support@bitpay.com'); - $this->assertSame('support@bitpay.com', $this->invoice->getNotificationEmail()); + $this->invoice->setNotificationEmail('integrations@bitpay.com'); + $this->assertSame('integrations@bitpay.com', $this->invoice->getNotificationEmail()); } public function testGetNotificationUrl() @@ -313,26 +313,12 @@ public function testGetItemDesc() $this->assertNull($this->invoice->getItemDesc()); } - public function testSetItemDesc() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the item description... - } - public function testGetItemCode() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getItemCode()); } - public function testSetItemCode() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the item code... - } - public function testIsPhysical() { $this->assertNotNull($this->invoice); @@ -345,117 +331,54 @@ public function testGetBuyerName() $this->assertEmpty($this->invoice->getBuyerName()); } - public function testSetBuyerName() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer name... - } - public function testGetBuyerAddress1() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerAddress1()); } - public function testSetBuyerAddress1() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer address1... - } - public function testGetBuyerAddress2() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerAddress2()); } - public function testSetBuyerAddress2() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer address2... - } - public function testGetBuyerCity() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerCity()); } - public function testSetBuyerCity() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer city... - } - public function testGetBuyerState() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerState()); } - public function testSetBuyerState() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer state... - } - public function testGetBuyerZip() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerZip()); } - public function testSetBuyerZip() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer zip... - } - public function testGetBuyerCountry() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerCountry()); } - public function testSetBuyerCountry() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer country... - } - public function testGetBuyerEmail() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerEmail()); } - public function testSetBuyerEmail() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer email... - } - public function testGetBuyerPhone() { $this->assertNotNull($this->invoice); $this->assertNull($this->invoice->getBuyerPhone()); } - public function testSetBuyerPhone() - { - $this->assertNotNull($this->invoice); - - // TODO: add a test for setting the buyer phone... - } - public function testGetExceptionStatus() { $this->assertNotNull($this->invoice); From 281a2625e5057127eeaff62de636ade97753e552 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:06:52 -0400 Subject: [PATCH 018/164] Updated copyright year and minor refactoring --- tests/Bitpay/CurrencyTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Bitpay/CurrencyTest.php b/tests/Bitpay/CurrencyTest.php index 295cf014..31645534 100644 --- a/tests/Bitpay/CurrencyTest.php +++ b/tests/Bitpay/CurrencyTest.php @@ -1,6 +1,6 @@ assertNotNull($this->currency); - $this->currency->setAlts('usd bucks'); - $this->assertSame('usd bucks', $this->currency->getAlts()); + $this->currency->setAlts('USD Bucks'); + $this->assertSame('USD Bucks', $this->currency->getAlts()); } public function testGetPayoutFields() From 65bc02b4d9e857c527f58bdb5a8db7ac4a8fa740 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:07:59 -0400 Subject: [PATCH 019/164] Updated copyright year and minor refactoring --- tests/Bitpay/BuyerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/BuyerTest.php b/tests/Bitpay/BuyerTest.php index 9570d0fd..1d6b0f53 100644 --- a/tests/Bitpay/BuyerTest.php +++ b/tests/Bitpay/BuyerTest.php @@ -1,6 +1,6 @@ assertNotNull($this->user); - $this->user->setEmail('support@bitpay.com'); - $this->assertSame('support@bitpay.com', $this->user->getEmail()); + $this->user->setEmail('integrations@bitpay.com'); + $this->assertSame('integrations@bitpay.com', $this->user->getEmail()); } public function testGetFirstName() From 6b67fbab84260061623341a0dddb2bea23e30b09 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:16:01 -0400 Subject: [PATCH 020/164] Updated copyright year and minor refactoring --- tests/Bitpay/BitpayTest.php | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/Bitpay/BitpayTest.php b/tests/Bitpay/BitpayTest.php index 2b353409..d75d69f7 100644 --- a/tests/Bitpay/BitpayTest.php +++ b/tests/Bitpay/BitpayTest.php @@ -1,6 +1,6 @@ temp_path_root = 'tmp'; + $this->temp_path_pri = $this->temp_path_root . '/key.pri'; + $this->temp_path_pub = $this->temp_path_root . '/key.pub'; + $this->network_type = 'testnet'; + } public function testConstruct() { $bitpay = new \Bitpay\Bitpay( array( 'bitpay' => array( - 'network' => 'testnet', + 'network' => $this->network_type, ) ) ); @@ -45,20 +57,21 @@ public function testGetInvalidService() public function testConfigAbleToPersistAndLoadKeys() { - $root = vfsStream::setup('tmp'); + $root = vfsStream::setup($this->temp_path_root); $bitpay = new \Bitpay\Bitpay( array( 'bitpay' => array( 'network' => 'testnet', - 'private_key' => vfsStream::url('tmp/key.pri'), - 'public_key' => vfsStream::url('tmp/key.pub'), + 'private_key' => vfsStream::url($this->temp_path_pri), + 'public_key' => vfsStream::url($this->temp_path_pub), ) ) ); - $pri = new \Bitpay\PrivateKey(vfsStream::url('tmp/key.pri')); + $pri = new \Bitpay\PrivateKey(vfsStream::url($this->temp_path_pri)); $pri->generate(); - $pub = new \Bitpay\PublicKey(vfsStream::url('tmp/key.pub')); + + $pub = new \Bitpay\PublicKey(vfsStream::url($this->temp_path_pub)); $pub->setPrivateKey($pri)->generate(); /** From a8ebc01d9d686067bc6cc43b72c1efe0d0737ec4 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:17:06 -0400 Subject: [PATCH 021/164] Updated copyright year and minor refactoring --- tests/Bitpay/BillTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/BillTest.php b/tests/Bitpay/BillTest.php index d399b13c..438e7236 100644 --- a/tests/Bitpay/BillTest.php +++ b/tests/Bitpay/BillTest.php @@ -1,6 +1,6 @@ assertNotNull($this->bill); - $this->bill->setEmail('support@bitpay.com'); - $this->assertSame('support@bitpay.com', $this->bill->getEmail()); + $this->bill->setEmail('integrations@bitpay.com'); + $this->assertSame('integrations@bitpay.com', $this->bill->getEmail()); } public function testGetPhone() From 18d8219ca61e1e984569c03c67b6bf8afc215ade Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:18:16 -0400 Subject: [PATCH 022/164] Updated copyright year and minor refactoring --- tests/Bitpay/AutoloaderTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/Bitpay/AutoloaderTest.php b/tests/Bitpay/AutoloaderTest.php index 1dbebf56..6db3cf6a 100644 --- a/tests/Bitpay/AutoloaderTest.php +++ b/tests/Bitpay/AutoloaderTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 18:19:05 -0400 Subject: [PATCH 023/164] Updated copyright year and minor refactoring --- tests/Bitpay/ApplicationTest.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/Bitpay/ApplicationTest.php b/tests/Bitpay/ApplicationTest.php index 7cd700da..8c9f4905 100644 --- a/tests/Bitpay/ApplicationTest.php +++ b/tests/Bitpay/ApplicationTest.php @@ -1,6 +1,6 @@ assertNotNull($application); - $this->assertInternalType('array', $application->getUsers()); $this->assertEmpty($application->getUsers()); } @@ -26,7 +25,6 @@ public function testAddUser() $application = new Application(); $this->assertNotNull($application); - $application->addUser($this->getMockUser()); $this->assertInternalType('array', $application->getUsers()); @@ -38,7 +36,6 @@ public function testGetOrgs() $application = new Application(); $this->assertNotNull($application); - $this->assertInternalType('array', $application->getOrgs()); $this->assertEmpty($application->getOrgs()); } @@ -51,7 +48,6 @@ public function testAddOrg() $application = new Application(); $this->assertNotNull($application); - $application->addOrg($this->getMockOrg()); $this->assertInternalType('array', $application->getOrgs()); From ba83f555ea14c4669ee6c6f459fc030aa9260899 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:26:47 -0400 Subject: [PATCH 024/164] Updated copyright year and minor refactoring --- tests/Bitpay/Storage/FilesystemStorageTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/Storage/FilesystemStorageTest.php b/tests/Bitpay/Storage/FilesystemStorageTest.php index 5cfa954b..c511f02a 100644 --- a/tests/Bitpay/Storage/FilesystemStorageTest.php +++ b/tests/Bitpay/Storage/FilesystemStorageTest.php @@ -1,6 +1,6 @@ key_file_content = 'C:16:"Bitpay\PublicKey":62:{a:5:{i:0;s:20:"vfs://tmp/public.key";i:1;N;i:2;N;i:3;N;i:4;N;}}'; $this->root = vfsStream::setup('tmp'); } @@ -28,7 +31,7 @@ public function testLoad() vfsStream::newFile('public.key') ->at($this->root) - ->setContent('C:16:"Bitpay\PublicKey":62:{a:5:{i:0;s:20:"vfs://tmp/public.key";i:1;N;i:2;N;i:3;N;i:4;N;}}'); + ->setContent($this->key_file_content); $key = $storage->load(vfsStream::url('tmp/public.key')); $this->assertInstanceOf('Bitpay\PublicKey', $key); @@ -49,11 +52,13 @@ public function testNotFileException() public function testLoadNotReadableException() { $storage = new FilesystemStorage(); + vfsStream::newFile('public.key', 0600) ->at($this->root) - ->setContent('C:16:"Bitpay\PublicKey":62:{a:5:{i:0;s:20:"vfs://tmp/public.key";i:1;N;i:2;N;i:3;N;i:4;N;}}') + ->setContent($this->key_file_content) ->chown(vfsStream::OWNER_ROOT) ->chgrp(vfsStream::GROUP_ROOT); + $storage->load(vfsStream::url('tmp/public.key')); } } From effcee7a15993dca443c1b81c737827fd8fdfc54 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:28:12 -0400 Subject: [PATCH 025/164] Updated copyright year and minor refactoring --- tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php index 58908128..1396eefb 100644 --- a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php +++ b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php @@ -1,6 +1,6 @@ root = vfsStream::setup('tmp'); From b424b2ae9065a80e1dfd54d6c49d674cef7d3590 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:29:07 -0400 Subject: [PATCH 026/164] Updated copyright year and minor refactoring --- tests/Bitpay/Network/TestnetTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/Network/TestnetTest.php b/tests/Bitpay/Network/TestnetTest.php index 62405309..b419b7c0 100644 --- a/tests/Bitpay/Network/TestnetTest.php +++ b/tests/Bitpay/Network/TestnetTest.php @@ -1,6 +1,6 @@ network = new Testnet(); From dfa099e381ccab146b1898a69915673c3ba82590 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:29:44 -0400 Subject: [PATCH 027/164] Updated copyright year and minor refactoring --- tests/Bitpay/Network/NetworkAwareTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/Network/NetworkAwareTest.php b/tests/Bitpay/Network/NetworkAwareTest.php index 207dd4ef..204dd008 100644 --- a/tests/Bitpay/Network/NetworkAwareTest.php +++ b/tests/Bitpay/Network/NetworkAwareTest.php @@ -1,6 +1,6 @@ setNetwork(new \Bitpay\Network\Testnet()); $r = new \ReflectionObject($networkAware); + $network = $r->getProperty('network'); $network->setAccessible(true); $network = $network->getValue($networkAware); From 7364d7cd426b7e3c7a9d4773d4180134f8dcc6e8 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:30:14 -0400 Subject: [PATCH 028/164] Updated copyright year and minor refactoring --- tests/Bitpay/Network/LivenetTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Bitpay/Network/LivenetTest.php b/tests/Bitpay/Network/LivenetTest.php index c2acb487..87fe9639 100644 --- a/tests/Bitpay/Network/LivenetTest.php +++ b/tests/Bitpay/Network/LivenetTest.php @@ -1,6 +1,6 @@ network = new Livenet(); From 7fa813938066f3e0fc6f6a57e99b659b8e268cd4 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:33:27 -0400 Subject: [PATCH 029/164] Updated copyright year and minor refactoring --- tests/Bitpay/Math/MathTest.php | 81 +++++++++++++++++----------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/tests/Bitpay/Math/MathTest.php b/tests/Bitpay/Math/MathTest.php index 0bdb5f4a..7668772c 100644 --- a/tests/Bitpay/Math/MathTest.php +++ b/tests/Bitpay/Math/MathTest.php @@ -1,6 +1,6 @@ assertNull(Math::getEngine()); - $engine = $this->getMock('Bitpay\Math\EngineInterface'); - Math::setEngine($engine); - $this->assertInstanceOf('Bitpay\Math\EngineInterface', Math::getEngine()); - } - - /** - * @requires extension gmp - * @runInSeparateProcess - */ - public function testGmpMath() - { - if (!extension_loaded('gmp')) - { - $this->markTestSkipped('The GMP extension is NOT loaded! You must enable it to run this test'); - } - Math::add("3324234234234234234", "3324234234234234234"); - $this->assertEquals(new GmpEngine(), Math::getEngine()); - } - - /** - * @requires extension bcmath - * @runInSeparateProcess - */ - public function testBcMath() - { - if (!extension_loaded('bcmath')) - { - $this->markTestSkipped('The Bcmath extension is NOT loaded! You must enable it to run this test'); - } elseif (extension_loaded('gmp')) { - $this->markTestSkipped('The GMP extension is loaded! You must remove it to run this test'); - } - Math::add("3324234234234234234", "3324234234234234234"); - $this->assertEquals(new BcEngine(), Math::getEngine()); - } + public function testIsEngineSet() + { + Math::setEngine(null); + $this->assertNull(Math::getEngine()); + $engine = $this->getMock('Bitpay\Math\EngineInterface'); + + Math::setEngine($engine); + $this->assertInstanceOf('Bitpay\Math\EngineInterface', Math::getEngine()); + } + + /** + * @requires extension gmp + * @runInSeparateProcess + */ + public function testGmpMath() + { + if (!extension_loaded('gmp')) { + $this->markTestSkipped('The GMP extension is NOT loaded! You must enable it to run this test'); + } + + Math::add("3324234234234234234", "3324234234234234234"); + $this->assertEquals(new GmpEngine(), Math::getEngine()); + } + + /** + * @requires extension bcmath + * @runInSeparateProcess + */ + public function testBcMath() + { + if (!extension_loaded('bcmath')) { + $this->markTestSkipped('The Bcmath extension is NOT loaded! You must enable it to run this test'); + } else if (extension_loaded('gmp')) { + $this->markTestSkipped('The GMP extension is loaded! You must remove it to run this test'); + } + + Math::add("3324234234234234234", "3324234234234234234"); + $this->assertEquals(new BcEngine(), Math::getEngine()); + } } From e6aa1c44b2534d0858209402c811ed2ff308893c Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:47:56 -0400 Subject: [PATCH 030/164] Updated copyright year and minor refactoring --- tests/Bitpay/Math/GmpEngineTest.php | 137 ++++++++++++---------------- 1 file changed, 57 insertions(+), 80 deletions(-) diff --git a/tests/Bitpay/Math/GmpEngineTest.php b/tests/Bitpay/Math/GmpEngineTest.php index 4a5cb5f9..b10ea4c0 100644 --- a/tests/Bitpay/Math/GmpEngineTest.php +++ b/tests/Bitpay/Math/GmpEngineTest.php @@ -1,6 +1,6 @@ markTestSkipped('The GMP extension is NOT loaded! You must enable it to run this test'); - } + $this->a = 1234; + $this->b = '1234123412341234123412341234123412412341234213412421341342342'; + $this->c = '0x1234123412341234123412341234123412412341234213412421341342342'; + + if (!extension_loaded('gmp')) { + $this->markTestSkipped('The GMP extension is NOT loaded! You must enable it to run this test'); + } else { + $this->math = new GmpEngine(); + } } - public function testadd() + public function testAdd() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_add($a, $a)), $math->add($a, $a)); - $this->assertEquals(gmp_strval(gmp_add($b, $b)), $math->add($b, $b)); - $this->assertEquals(gmp_strval(gmp_add($c, $c)), $math->add($c, $c)); - $this->assertEquals(2, $math->add(1, 1)); + $this->assertEquals(gmp_strval(gmp_add($this->a, $this->a)), $this->math->add($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_add($this->b, $this->b)), $this->math->add($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_add($this->c, $this->c)), $this->math->add($this->c, $this->c)); + $this->assertEquals(2, $this->math->add(1, 1)); } - public function testcmp() + public function testCmp() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_cmp($a, $a)), $math->cmp($a, $a)); - $this->assertEquals(gmp_strval(gmp_cmp($b, $b)), $math->cmp($b, $b)); - $this->assertEquals(gmp_strval(gmp_cmp($c, $c)), $math->cmp($c, $c)); - $this->assertEquals(0, $math->cmp(1, 1)); + $this->assertEquals(gmp_strval(gmp_cmp($this->a, $this->a)), $this->math->cmp($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_cmp($this->b, $this->b)), $this->math->cmp($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_cmp($this->c, $this->c)), $this->math->cmp($this->c, $this->c)); + $this->assertEquals(0, $this->math->cmp(1, 1)); } - public function testdiv() + public function testDiv() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_div($a, $a)), $math->div($a, $a)); - $this->assertEquals(gmp_strval(gmp_div($b, $b)), $math->div($b, $b)); - $this->assertEquals(gmp_strval(gmp_div($c, $c)), $math->div($c, $c)); - $this->assertEquals(1, $math->div(1, 1)); + $this->assertEquals(gmp_strval(gmp_div($this->a, $this->a)), $this->math->div($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_div($this->b, $this->b)), $this->math->div($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_div($this->c, $this->c)), $this->math->div($this->c, $this->c)); + $this->assertEquals(1, $this->math->div(1, 1)); } - public function testinvertm() + public function testInvertm() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_invert($a, $a)), $math->invertm($a, $a)); - $this->assertEquals(gmp_strval(gmp_invert($b, $b)), $math->invertm($b, $b)); - $this->assertEquals(gmp_strval(gmp_invert($c, $c)), $math->invertm($c, $c)); - $this->assertEquals(0, $math->invertm(1, 1)); + $this->assertEquals(gmp_strval(gmp_invert($this->a, $this->a)), $this->math->invertm($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_invert($this->b, $this->b)), $this->math->invertm($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_invert($this->c, $this->c)), $this->math->invertm($this->c, $this->c)); + $this->assertEquals(0, $this->math->invertm(1, 1)); $o = '2'; $p = '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'; - $this->assertEquals('57896044618658097711785492504343953926634992332820282019728792003954417335832', $math->invertm($o, $p)); + $this->assertEquals('57896044618658097711785492504343953926634992332820282019728792003954417335832', $this->math->invertm($o, $p)); $o = '-207267379875244730201206352791949018434229233557197871725317424106240926035466'; $p = '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'; - $this->assertEquals('93736451599995461267424215486556527005103980679329099329644578865571485201981', $math->invertm($o, $p)); + $this->assertEquals('93736451599995461267424215486556527005103980679329099329644578865571485201981', $this->math->invertm($o, $p)); } - public function testmod() + public function testMod() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_mod($a, $a)), $math->mod($a, $a)); - $this->assertEquals(gmp_strval(gmp_mod($b, $b)), $math->mod($b, $b)); - $this->assertEquals(gmp_strval(gmp_mod($c, $c)), $math->mod($c, $c)); - $this->assertEquals(0, $math->mod(1, 1)); + $this->assertEquals(gmp_strval(gmp_mod($this->a, $this->a)), $this->math->mod($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_mod($this->b, $this->b)), $this->math->mod($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_mod($this->c, $this->c)), $this->math->mod($this->c, $this->c)); + $this->assertEquals(0, $this->math->mod(1, 1)); } - public function testmul() + public function testMul() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_mul($a, $a)), $math->mul($a, $a)); - $this->assertEquals(gmp_strval(gmp_mul($b, $b)), $math->mul($b, $b)); - $this->assertEquals(gmp_strval(gmp_mul($c, $c)), $math->mul($c, $c)); - $this->assertEquals(1, $math->mul(1, 1)); + $this->assertEquals(gmp_strval(gmp_mul($this->a, $this->a)), $this->math->mul($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_mul($this->b, $this->b)), $this->math->mul($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_mul($this->c, $this->c)), $this->math->mul($this->c, $this->c)); + $this->assertEquals(1, $this->math->mul(1, 1)); } - public function testpow() + public function testPow() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_pow($a, $a)), $math->pow($a, $a)); - $this->assertEquals(gmp_strval(gmp_pow($b, $b)), $math->pow($b, $b)); - $this->assertEquals(gmp_strval(gmp_pow($c, $c)), $math->pow($c, $c)); - $this->assertEquals(1, $math->pow(1, 1)); + $this->assertEquals(gmp_strval(gmp_pow($this->a, $this->a)), $this->math->pow($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_pow($this->b, $this->b)), $this->math->pow($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_pow($this->c, $this->c)), $this->math->pow($this->c, $this->c)); + $this->assertEquals(1, $this->math->pow(1, 1)); } - public function testsub() + public function testSub() { - $a = 1234; - $b = '1234123412341234123412341234123412412341234213412421341342342'; - $c = '0x1234123412341234123412341234123412412341234213412421341342342'; - $math = new GmpEngine(); - $this->assertEquals(gmp_strval(gmp_sub($a, $a)), $math->sub($a, $a)); - $this->assertEquals(gmp_strval(gmp_sub($b, $b)), $math->sub($b, $b)); - $this->assertEquals(gmp_strval(gmp_sub($c, $c)), $math->sub($c, $c)); - $this->assertEquals(0, $math->sub(1, 1)); + $this->assertEquals(gmp_strval(gmp_sub($this->a, $this->a)), $this->math->sub($this->a, $this->a)); + $this->assertEquals(gmp_strval(gmp_sub($this->b, $this->b)), $this->math->sub($this->b, $this->b)); + $this->assertEquals(gmp_strval(gmp_sub($this->c, $this->c)), $this->math->sub($this->c, $this->c)); + $this->assertEquals(0, $this->math->sub(1, 1)); } } From 971f65c5840ee426ab060cfb8971cade711ee191 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:53:46 -0400 Subject: [PATCH 031/164] Updated copyright year and minor refactoring --- tests/Bitpay/Math/BcEngineTest.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/Bitpay/Math/BcEngineTest.php b/tests/Bitpay/Math/BcEngineTest.php index 08c27020..178b7917 100644 --- a/tests/Bitpay/Math/BcEngineTest.php +++ b/tests/Bitpay/Math/BcEngineTest.php @@ -1,6 +1,6 @@ markTestSkipped('The Bcmath extension is NOT loaded! You must enable it to run this test'); - } elseif (!extension_loaded('gmp')) - { - $this->markTestSkipped('The GMPmath extension is NOT loaded! You must enable it to run this test'); - } - + if (!extension_loaded('bcmath')) { + $this->markTestSkipped('The Bcmath extension is NOT loaded! You must enable it to run this test'); + } else if (!extension_loaded('gmp')) { + $this->markTestSkipped('The GMPmath extension is NOT loaded! You must enable it to run this test'); + } } public function testConstruct() @@ -81,7 +78,7 @@ public function testiInvertm() $this->assertEquals(gmp_strval(gmp_invert($c, $c)), $math->invertm($c, $c)); $this->assertEquals(gmp_strval(gmp_invert(15, 14)), $math->invertm(15, 14)); - $this->assertEquals(gmp_strval(gmp_invert(-1, 1)), $math->invertm(-1, 1)); + $this->assertEquals(gmp_strval(gmp_invert(-1, 1)), $math->invertm(-1, 1)); $this->assertEquals(0, $math->invertm(1, 1)); $o = '2'; @@ -171,7 +168,8 @@ public function testInput() ); $math = new BcEngine(); - for($i = 0, $size = count($inputs); $i < $size; $i++) { + + for ($i = 0, $size = count($inputs); $i < $size; $i++) { $this->assertEquals($outputs[$i], $math->input($inputs[$i])); } } @@ -211,5 +209,4 @@ public function testCoprime() $math = new BcEngine(); $this->assertTrue($math->coprime($a, $b)); } - } From 9a28b90f608525a72291a99524b5825adcbfd918 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:56:03 -0400 Subject: [PATCH 032/164] Updated copyright year and minor refactoring --- tests/Bitpay/Crypto/McryptExtensionTest.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/Bitpay/Crypto/McryptExtensionTest.php b/tests/Bitpay/Crypto/McryptExtensionTest.php index df9e29fc..d0726745 100644 --- a/tests/Bitpay/Crypto/McryptExtensionTest.php +++ b/tests/Bitpay/Crypto/McryptExtensionTest.php @@ -1,6 +1,6 @@ 'I8OFg5parn9b0Qk8mJnQH0+SgQWwYER5' ); - foreach($data as $unencrypted => $encrypted ) - { + foreach ($data as $unencrypted => $encrypted) { $encryptedtext = $mcrypt->encrypt($unencrypted, $key, '00000000'); $this->assertEquals($encrypted, $encryptedtext); } @@ -39,7 +36,6 @@ public function testEncrypt() public function testDecrypt() { - $mcrypt = new McryptExtension(); $key = 'testEncrypt'; $data = array( @@ -49,8 +45,7 @@ public function testDecrypt() '___asdfa234($*(#__' => 'I8OFg5parn9b0Qk8mJnQH0+SgQWwYER5' ); - foreach($data as $unencrypted => $encrypted ) - { + foreach ($data as $unencrypted => $encrypted) { $plaintext = $mcrypt->decrypt($encrypted, $key, '00000000'); $this->assertEquals($unencrypted, $plaintext); } @@ -60,11 +55,11 @@ private function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; + for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; } return $randomString; } - } From 4ae7392e8c2e01f054b26504bb54a39a7053bb84 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 18:56:48 -0400 Subject: [PATCH 033/164] Updated copyright year and minor refactoring --- tests/Bitpay/Config/ConfigurationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/Config/ConfigurationTest.php b/tests/Bitpay/Config/ConfigurationTest.php index b7f17a7d..478db75c 100644 --- a/tests/Bitpay/Config/ConfigurationTest.php +++ b/tests/Bitpay/Config/ConfigurationTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 18:57:49 -0400 Subject: [PATCH 034/164] Updated copyright year and minor refactoring --- tests/Bitpay/Client/ResponseTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/Client/ResponseTest.php b/tests/Bitpay/Client/ResponseTest.php index 40242cce..8be09a2d 100644 --- a/tests/Bitpay/Client/ResponseTest.php +++ b/tests/Bitpay/Client/ResponseTest.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 18:58:50 -0400 Subject: [PATCH 035/164] Updated copyright year and minor refactoring --- tests/Bitpay/Client/RequestTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Bitpay/Client/RequestTest.php b/tests/Bitpay/Client/RequestTest.php index 77999c70..10c33fc0 100644 --- a/tests/Bitpay/Client/RequestTest.php +++ b/tests/Bitpay/Client/RequestTest.php @@ -1,6 +1,6 @@ assertSame(444, $this->request->getPort()); } - public function testGetSchema() { $this->assertSame('https', $this->request->getSchema()); From 82f1ea62b49248a314b8014a076f6042e9f146f2 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:02:02 -0400 Subject: [PATCH 036/164] Updated copyright year and minor refactoring --- tests/Bitpay/Client/ClientTest.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/Bitpay/Client/ClientTest.php b/tests/Bitpay/Client/ClientTest.php index f0b40e8b..ff457f31 100644 --- a/tests/Bitpay/Client/ClientTest.php +++ b/tests/Bitpay/Client/ClientTest.php @@ -1,6 +1,6 @@ client->setAdapter($adapter); } - /** * @expectedException \Exception */ @@ -63,7 +62,7 @@ public function testCreatePayout() ->setEffectiveDate("1415853007000") ->setPricingMethod('bitcoinbestbuy') ->setNotificationUrl('https://bitpay.com') - ->setNotificationEmail('support@bitpay.com') + ->setNotificationEmail('integrations@bitpay.com') ->setPricingMethod('bitcoinbestbuy') ->setReference('your reference, can be json') ->setAmount(5625) @@ -73,6 +72,7 @@ public function testCreatePayout() \Bitpay\PayoutInstruction::STATUS_UNPAID => null, \Bitpay\PayoutInstruction::STATUS_PAID => '0' ); + $instruction0 = new \Bitpay\PayoutInstruction(); $instruction0 ->setId('Sra19AFU57Rx53rKQbbRKZ') @@ -124,7 +124,7 @@ public function testCreatePayout() $this->assertEquals('your reference, can be json', $payout->getReference()); $this->assertEquals('1415853007000', $payout->getEffectiveDate()); $this->assertEquals('https://bitpay.com', $payout->getNotificationUrl()); - $this->assertEquals('support@bitpay.com', $payout->getNotificationEmail()); + $this->assertEquals('integrations@bitpay.com', $payout->getNotificationEmail()); $this->assertEquals('8mZ37Gt91Wr7GXGPnB9zj1zwTcLGweRDka4axVBPi9Uxiiv7zZWvEKSgmFddQZA1Jy', $payout->getResponseToken()); $instructions = $payout->getInstructions(); $this->assertSame($instruction0, $instructions[0]); @@ -134,7 +134,6 @@ public function testCreatePayout() public function testCreateInvoice() { - $buyer = $this->getMockBuyer(); $buyer->method('getAddress')->will($this->returnValue(array())); @@ -150,7 +149,6 @@ public function testCreateInvoice() $item->setPrice('19.95'); $invoice->setItem($item); - $response = $this->getMockResponse(); $response->method('getBody')->willReturn(file_get_contents(__DIR__ . '/../../DataFixtures/invoice.json')); @@ -243,7 +241,6 @@ public function testCreateInvoiceWithTooMuchPrecisionForAnythingButBitcoin() $this->client->createInvoice($invoice); } - /** * @expectedException Exception */ @@ -364,7 +361,6 @@ public function testGetPayouts() $payouts = $this->client->getPayouts(); $this->assertInternalType('array', $payouts); $this->assertInstanceOf('Bitpay\PayoutInterface', $payouts[0]); - } /** @@ -380,7 +376,6 @@ public function testGetPayoutsWithException() $this->client->setAdapter($adapter); $payouts = $this->client->getPayouts(); - } public function testGetTokens() @@ -536,7 +531,6 @@ public function testDeletePayout() $payout = $this->client->getPayout('7m7hSF3ws1LhnWUf17CXsJ'); - // Test deletePayout $response = $this->getMockResponse(); $response->method('getBody')->willReturn(file_get_contents(__DIR__ . '/../../DataFixtures/payouts/cancelled.json')); @@ -546,7 +540,6 @@ public function testDeletePayout() $this->client->setAdapter($adapter); $payout = $this->client->deletePayout($payout); - $this->assertSame($payout->getStatus(), \Bitpay\Payout::STATUS_CANCELLED); } @@ -566,7 +559,6 @@ public function testDeletePayoutWithException() $payout = $this->client->getPayout('7m7hSF3ws1LhnWUf17CXsJ'); // Test with exception - $response = $this->getMockResponse(); $response->method('getBody')->willReturn('{"error":"Object not found"}'); @@ -578,7 +570,6 @@ public function testDeletePayoutWithException() $this->assertSame($payout->getStatus(), \Bitpay\Payout::STATUS_CANCELLED); } - private function getMockInvoice() { $invoice = $this->getMockBuilder('Bitpay\InvoiceInterface') From e211ed5834a85f1e045752497a1c781b8f0aea4b Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:02:41 -0400 Subject: [PATCH 037/164] Updated copyright year and minor refactoring --- tests/Bitpay/Client/Adapter/CurlAdapterTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/Client/Adapter/CurlAdapterTest.php b/tests/Bitpay/Client/Adapter/CurlAdapterTest.php index b511ab31..e00bb378 100644 --- a/tests/Bitpay/Client/Adapter/CurlAdapterTest.php +++ b/tests/Bitpay/Client/Adapter/CurlAdapterTest.php @@ -1,6 +1,6 @@ sendRequest($this->request); $this->assertNotNull($response); } - -} \ No newline at end of file +} From 4d59247fc0a060d06bc905ca62b9b33a4b8fb6b9 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:03:23 -0400 Subject: [PATCH 038/164] Update with_tokens.json --- tests/DataFixtures/with_tokens.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/DataFixtures/with_tokens.json b/tests/DataFixtures/with_tokens.json index 86066635..554c2cfd 100644 --- a/tests/DataFixtures/with_tokens.json +++ b/tests/DataFixtures/with_tokens.json @@ -1,2 +1 @@ {"data":[{"payroll":"39zPuHaBbO8VMZe8Bdr9RjmRY6pHT7Gs3ifcbKM6PYSg2"},{"payroll/payoutRequest":"FFehd3N8CmNFqdQnPC4HMMx1MQUbmN6RsbLZsrqPqS8x"},{"payroll/payoutRequest":"5QziWnr75x7c4B9DdJ5QUo"}]} - From 77367340338aeeee35960af5416dd22c4238b4da Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:04:47 -0400 Subject: [PATCH 039/164] Update currencies.json --- tests/DataFixtures/currencies.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/DataFixtures/currencies.json b/tests/DataFixtures/currencies.json index 063cebde..62f244ce 100644 --- a/tests/DataFixtures/currencies.json +++ b/tests/DataFixtures/currencies.json @@ -23,7 +23,6 @@ "plural": "Zimbabwean Dollar", "alts": "", "payoutFields": [ - ] } ] From 5f22e8208b830f5d2cdf819737c04d3702b98605 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:07:37 -0400 Subject: [PATCH 040/164] Minor formatting --- tests/integrations/bootstrap/StepHelper.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/integrations/bootstrap/StepHelper.php b/tests/integrations/bootstrap/StepHelper.php index 9f9bd000..8d116094 100644 --- a/tests/integrations/bootstrap/StepHelper.php +++ b/tests/integrations/bootstrap/StepHelper.php @@ -31,19 +31,21 @@ function loadKeys() function createClient($network, $privateKey = null, $publicKey = null, $curl_options = null) { - if(true === is_null($curl_options)) { + if (true === is_null($curl_options)) { $curl_options = array( CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, ); } + $adapter = new \Bitpay\Client\Adapter\CurlAdapter($curl_options); - $client = new \Bitpay\Client\Client(); + $client = new \Bitpay\Client\Client(); - if(true === !is_null($privateKey)) { + if (false === is_null($privateKey)) { $client->setPrivateKey($privateKey); } - if(true === !is_null($publicKey)) { + + if (false === is_null($publicKey)) { $client->setPublicKey($publicKey); } @@ -51,4 +53,4 @@ function createClient($network, $privateKey = null, $publicKey = null, $curl_opt $client->setAdapter($adapter); return $client; -} \ No newline at end of file +} From a6e5b5f436203d145fdf001a8a904631eb083a81 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:14:27 -0400 Subject: [PATCH 041/164] Updated copyright year and minor refactoring cleaned up unnecessary inverted logic checks --- .../integrations/bootstrap/FeatureContext.php | 64 +++++++++++-------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/tests/integrations/bootstrap/FeatureContext.php b/tests/integrations/bootstrap/FeatureContext.php index 2719c925..8b6cd4db 100644 --- a/tests/integrations/bootstrap/FeatureContext.php +++ b/tests/integrations/bootstrap/FeatureContext.php @@ -10,7 +10,6 @@ use Behat\Mink\Session; use Behat\Mink\Driver\Selenium2Driver; - require_once __DIR__ . '/../../../vendor/autoload.php'; require_once __DIR__ . '/StepHelper.php'; @@ -58,6 +57,7 @@ public function __construct(array $parameters) } else { $this->email = getenv('BITPAY_EMAIL'); } + if (null == getenv('BITPAY_PASSWORD')) { $this->password = $this->params['password']; } else { @@ -71,7 +71,8 @@ public function __construct(array $parameters) } $port = parse_url($this->base_url, PHP_URL_PORT); - if (true == is_null(parse_url($this->base_url, PHP_URL_PORT))) { + + if (true === is_null(parse_url($this->base_url, PHP_URL_PORT))) { $this->port = 443; $this->port_required_in_url = false; } else { @@ -114,7 +115,7 @@ public function __construct(array $parameters) */ public function theUserIsAuthenticatedWithBitpay() { - if(true == !file_exists('/tmp/token.json') || true == !file_exists('/tmp/bitpay.pri') || true == !file_exists('/tmp/bitpay.pub')){ + if (false === file_exists('/tmp/token.json') || false === file_exists('/tmp/bitpay.pri') || false === file_exists('/tmp/bitpay.pub')) { $this->theUserPairsWithBitpayWithAValidPairingCode(); $this->theUserIsPairedWithBitpay(); } @@ -143,13 +144,16 @@ public function theUserCreatesAnInvoiceFor($price, $currency) ->setCode('skuNumber') ->setDescription('General Description of Item') ->setPrice($price); - $invoice->setItem($item); + $invoice->setItem($item); $invoice->setCurrency(new \Bitpay\Currency($currency)); $client->createInvoice($invoice); + $this->response = $client->getResponse(); + $body = $this->response->getBody(); $json = json_decode($body, true); + $this->invoiceId = $json['data']['id']; } catch (\Exception $e) { $this->error = $e; @@ -167,11 +171,13 @@ public function theyShouldRecieveAnInvoiceInResponseFor($price, $currency) $json = json_decode($body, true); $responsePrice = (string) $json['data']['price']; $responseCurrency = $json['data']['currency']; - if ($responsePrice !== $price){ - throw new Exception("Error: Price is different", 1); + + if ($responsePrice !== $price) { + throw new \Exception("Error: Price is different", 1); } - if ($responseCurrency !== $currency){ - throw new Exception("Error: Currency is different", 1); + + if ($responseCurrency !== $currency) { + throw new \Exception("Error: Currency is different", 1); } } @@ -181,9 +187,7 @@ public function theyShouldRecieveAnInvoiceInResponseFor($price, $currency) public function theUserPairsWithBitpayWithAValidPairingCode() { // Login - - $this->mink->getSession()->visit($this->base_url.'/merchant-login'); - + $this->mink->getSession()->visit($this->base_url . '/merchant-login'); $this->mink->getSession()->wait(1500); $this->mink->getSession()->getPage()->fillField('email', $this->email); $this->mink->getSession()->getPage()->fillField('password', $this->password); @@ -204,13 +208,16 @@ public function theUserPairsWithBitpayWithAValidPairingCode() // Create and set pairing code $cssSelector = ".icon-plus"; + $element = $this->mink->getSession()->getPage()->find( 'xpath', $this->mink->getSession()->getSelectorsHandler()->selectorToXpath('css', $cssSelector) // just changed xpath to css ); + if (null === $element) { throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector)); } + $element->press(); $this->mink->getSession()->wait(1500); @@ -231,7 +238,6 @@ public function theUserIsPairedWithBitpay() //Set Client $network = $this->network; $client = createClient($network, $privateKey, $publicKey); - $pairingCode = $this->validPairingCode; // Pair @@ -243,17 +249,20 @@ public function theUserIsPairedWithBitpay() 'id' => (string) $sinKey, ) ); + $token_file = fopen('/tmp/token.json', 'w'); + fwrite($token_file, $token); fclose($token_file); } catch (\Exception $e) { $request = $client->getRequest(); $response = $client->getResponse(); + echo (string) $request.PHP_EOL.PHP_EOL.PHP_EOL; echo (string) $response.PHP_EOL.PHP_EOL; + exit(1); } - } /** @@ -285,7 +294,6 @@ public function theUserFailsToPairWithASemanticallyValidCode($pairingCode) } finally { return true; } - } /** @@ -295,9 +303,11 @@ public function theyWillReceiveAnErrorMatching($expectedErrorName, $expectedErro { $curlError = $this->error; $curlErrorMessage = $this->error->getMessage(); + if (strpos($curlErrorMessage, $expectedErrorMessage) === false) { throw new Exception("Error message incorrect: ".$curlErrorMessage, 1); } + if (strpos(get_class($curlError), $expectedErrorName) === false) { throw new Exception("Error name incorrect: ".get_class($curlError), 1); } @@ -318,11 +328,13 @@ public function theClientFailsToPairWithBitpayBecauseOfAnIncorrectPort($status, //Set Client $url = parse_url($this->base_url, PHP_URL_HOST); $network = new \Bitpay\Network\Customnet($url, $port, true); + $curl_options = array( CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_TIMEOUT => 5, ); + $client = createClient($network, $privateKey, $publicKey, $curl_options); // Pair @@ -330,7 +342,7 @@ public function theClientFailsToPairWithBitpayBecauseOfAnIncorrectPort($status, array( 'pairingCode' => 'aaaaaaa', 'label' => 'Integrations Testing', - 'id' => (string) $sinKey, + 'id' => (string)$sinKey, ) ); } catch (\Exception $e) { @@ -345,10 +357,11 @@ public function theClientFailsToPairWithBitpayBecauseOfAnIncorrectPort($status, */ public function thatAUserKnowsAnInvoiceId() { - if(true == !file_exists('/tmp/token.json') || true == !file_exists('/tmp/bitpay.pri') || true == !file_exists('/tmp/bitpay.pub')){ + if (false === file_exists('/tmp/token.json') || false === file_exists('/tmp/bitpay.pri') || false === file_exists('/tmp/bitpay.pub')) { $this->theUserPairsWithBitpayWithAValidPairingCode(); $this->theUserIsPairedWithBitpay(); } + $this->theUserCreatesAnInvoiceFor(1.99, 'USD'); } @@ -357,17 +370,18 @@ public function thatAUserKnowsAnInvoiceId() */ public function theyCanRetrieveThatInvoice() { - try - { - $network = $this->network; - $client = createClient($network); - $response = $client->getInvoice($this->invoiceId); - } catch (Exception $e){ + try { + $network = $this->network; + $client = createClient($network); + $response = $client->getInvoice($this->invoiceId); + } catch (\Exception $e) { var_dump($e->getMessage()); } + $responseInvoiceId = $response->getId(); - if($responseInvoiceId !== $this->invoiceId){ - throw new Exception("Invoice ids don't match"); + + if ($responseInvoiceId !== $this->invoiceId) { + throw new \Exception("Invoice ids don't match"); } } -} \ No newline at end of file +} From 198b304dd7b4701d0a744cb74a013fd1576838de Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:17:47 -0400 Subject: [PATCH 042/164] Minor formatting Removed deprecated docs badge. --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5ab56917..ebc54617 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,10 @@ bitpay/php-bitpay-client [![Scrutinizer](https://img.shields.io/scrutinizer/g/bitpay/php-bitpay-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/bitpay/php-bitpay-client/) [![Coveralls](https://img.shields.io/coveralls/bitpay/php-bitpay-client.svg?style=flat-square)](https://coveralls.io/r/bitpay/php-bitpay-client) -[![Documentation Status](https://readthedocs.org/projects/php-bitpay-client/badge/?version=latest)](https://readthedocs.org/projects/php-bitpay-client/?badge=latest) [![Total Downloads](https://poser.pugx.org/bitpay/php-client/downloads.svg)](https://packagist.org/packages/bitpay/php-client) [![Latest Unstable Version](https://poser.pugx.org/bitpay/php-client/v/unstable.svg)](https://packagist.org/packages/bitpay/php-client) -This is a self-contained PHP implementation of BitPay's new cryptographically secure API: https://bitpay.com/api +This is a self-contained PHP implementation of BitPay's cryptographically secure API: https://bitpay.com/api # Installation @@ -65,9 +64,8 @@ instead of composer's autoloader, use the following code: ```php Date: Tue, 15 Sep 2015 19:19:53 -0400 Subject: [PATCH 043/164] Updated description --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b2951204..c554a0fc 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "bitpay/php-client", - "description": "PHP Library to work with the new cryptographically secure BitPay API", + "description": "PHP Library to work with the cryptographically secure BitPay API", "license": "MIT", "minimum-stability": "stable", "keywords": ["bitpay", "bitcoin"], From 31cc0f7a8db7e7dfd3c804a72a52f9b7e0761647 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:28:02 -0400 Subject: [PATCH 044/164] Minor formatting --- build.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.xml b/build.xml index 7830815e..56fd8aa2 100644 --- a/build.xml +++ b/build.xml @@ -3,12 +3,11 @@ - + - + From 31a128305716a9e31ab525a64c646a8f18409faa Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:33:46 -0400 Subject: [PATCH 045/164] Added experimental hhvm build testing --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index cce0875c..e3a019e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 5.4 - 5.5 - 5.6 + - hhvm install: - composer install @@ -25,6 +26,8 @@ notifications: matrix: fast_finish: true + allow_failures: + - php: hhvm # Only build the master branch and pull requests for the master branch branches: From 03fe25ceee7673c4ebcd97e6e52f0de5895d55a7 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:48:37 -0400 Subject: [PATCH 046/164] Removed deprecated nonce method --- src/Bitpay/AccessTokenInterface.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Bitpay/AccessTokenInterface.php b/src/Bitpay/AccessTokenInterface.php index b701db3a..b32722b9 100644 --- a/src/Bitpay/AccessTokenInterface.php +++ b/src/Bitpay/AccessTokenInterface.php @@ -7,7 +7,7 @@ namespace Bitpay; /** - * Creates an access token for the given client + * Interface for an access token for the given client * * @package Bitpay */ @@ -27,9 +27,4 @@ public function getEmail(); * @return string */ public function getLabel(); - - /** - * @return boolean - */ - public function isNonceDisabled(); } From 7fee602207586f41436ef229207ea9bfa72f5c85 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 19:54:40 -0400 Subject: [PATCH 047/164] Removed deprecated nonce methods & vars also added parameters to the constructor. --- src/Bitpay/AccessToken.php | 56 ++++++++------------------------------ 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/src/Bitpay/AccessToken.php b/src/Bitpay/AccessToken.php index 69a02f87..14166c83 100644 --- a/src/Bitpay/AccessToken.php +++ b/src/Bitpay/AccessToken.php @@ -27,23 +27,19 @@ class AccessToken implements AccessTokenInterface protected $label; /** - * @var boolean + * Set various defaults for this object. */ - protected $useNonce; - - /** - */ - public function __construct() + public function __construct($id = null, $email = null, $label = null) { - /** - * Set various defaults for this object. - */ - $this->useNonce = true; + $this->id = $id; + $this->email = $email; + $this->label = $label; } /** - * @param string $id + * Setter for the id. * + * @param string $id * @return AccessTokenInterface */ public function setId($id) @@ -64,8 +60,9 @@ public function getId() } /** - * @param string $email + * Setter for the email address. * + * @param string $email * @return AccessTokenInterface */ public function setEmail($email) @@ -86,8 +83,9 @@ public function getEmail() } /** - * @param string $label + * Setter for the label. * + * @param string $label * @return AccessTokenInterface */ public function setLabel($label) @@ -106,36 +104,4 @@ public function getLabel() { return $this->label; } - - /** - * @inheritdoc - */ - public function isNonceDisabled() - { - return !($this->useNonce); - } - - /** - * Enable nonce usage - * - * @return AccessTokenInterface - */ - public function nonceEnable() - { - $this->useNonce = true; - - return $this; - } - - /** - * Disable nonce usage - * - * @return AccessTokenInterface - */ - public function nonceDisable() - { - $this->useNonce = false; - - return $this; - } } From 81987904880e0316411b64f95c35a463a05b2fa2 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 20:22:04 -0400 Subject: [PATCH 048/164] Removed deprecated nonce method also cleaned up the inline documentation and minor formatting. --- src/Bitpay/Util/Util.php | 135 +++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 68 deletions(-) diff --git a/src/Bitpay/Util/Util.php b/src/Bitpay/Util/Util.php index 0972fd56..9736a57f 100644 --- a/src/Bitpay/Util/Util.php +++ b/src/Bitpay/Util/Util.php @@ -1,6 +1,6 @@ 0) { - $q = Math::div($dec, 16); - $rem = Math::mod($dec, 16); + while (Math::cmp($dec, '0') > 0) { + $q = Math::div($dec, '16'); + $rem = Math::mod($dec, '16'); $dec = $q; - $hex = substr(self::HEX_CHARS, intval($rem), 1).$hex; + $hex = substr(self::HEX_CHARS, intval($rem), 1) . $hex; } return $hex; @@ -167,6 +154,7 @@ public static function encodeHex($dec) * * @param string $hex * @return string + * @throws \Exception */ public static function decodeHex($hex) { @@ -174,7 +162,7 @@ public static function decodeHex($hex) throw new \Exception('Argument must be a string of hex digits.'); } - $hex = strtolower($hex); + $hex = strtolower(trim($hex)); // if it has a prefix of 0x this needs to be trimed if (substr($hex, 0, 2) == '0x') { @@ -182,31 +170,40 @@ public static function decodeHex($hex) } $hexLen = strlen($hex); + for ($dec = '0', $i = 0; $i < $hexLen; $i++) { $current = strpos(self::HEX_CHARS, $hex[$i]); - $dec = Math::add(Math::mul($dec, 16), $current); + $dec = Math::add(Math::mul($dec, '16'), $current); } return $dec; } + /** + * Calculates a new EC curve point. + * + * @param string $hex + * @param PointInterface $point + * @param CurveParameterInterface $parameters + * @return Point + */ public static function doubleAndAdd($hex, PointInterface $point, CurveParameterInterface $parameters = null) { if (null === $parameters) { $parameters = new Secp256k1(); } - $tmp = self::decToBin($hex); + $tmp = self::decToBin($hex); $n = strlen($tmp) - 1; $S = new Point(PointInterface::INFINITY, PointInterface::INFINITY); - while ($n >= 0) { $S = self::pointDouble($S); if ($tmp[$n] == 1) { $S = self::pointAdd($S, $point); } + $n--; } @@ -217,10 +214,9 @@ public static function doubleAndAdd($hex, PointInterface $point, CurveParameterI * This method returns a binary string representation of * the decimal number. Used for the doubleAndAdd() method. * - * @see http://php.net/manual/en/function.decbin.php but for large numbers - * - * @param string - * @return string + * @see http://php.net/manual/en/function.decbin.php (but for large numbers) + * @param string $dec + * @return string $bin */ public static function decToBin($dec) { @@ -229,13 +225,15 @@ public static function decToBin($dec) } $bin = ''; + while (Math::cmp($dec, '0') > 0) { - if (Math::mod($dec, 2) == '1') { + if (Math::mod($dec, '2') == '1') { $bin .= '1'; } else { $bin .= '0'; } - $dec = Math::div($dec, 2); + + $dec = Math::div($dec, '2'); } return $bin; @@ -247,9 +245,10 @@ public static function decToBin($dec) * xR = s2 - 2xP mod p * yR = -yP + s(xP - xR) mod p * - * @param PointInterface $point - * @param CurveParameterInterface + * @param PointInterface $point + * @param CurveParameterInterface $parameters * @return PointInterface + * @throws \Exception */ public static function pointDouble(PointInterface $point, CurveParameterInterface $parameters = null) { @@ -273,41 +272,38 @@ public static function pointDouble(PointInterface $point, CurveParameterInterfac // Critical math section try { $m = Math::add(Math::mul(3, Math::mul($point->getX(), $point->getX())), $a); - $o = Math::mul(2, $point->getY()); + $o = Math::mul('2', $point->getY()); $n = Math::invertm($o, $p); $n2 = Math::mod($o, $p); $st = Math::mul($m, $n); $st2 = Math::mul($m, $n2); $s = Math::mod($st, $p); $s2 = Math::mod($st2, $p); - $xmul = Math::mul(2, $point->getX()); + $xmul = Math::mul('2', $point->getX()); $smul = Math::mul($s, $s); $xsub = Math::sub($smul, $xmul); $xmod = Math::mod($xsub, $p); $R['x'] = $xmod; $ysub = Math::sub($point->getX(), $R['x']); $ymul = Math::mul($s, $ysub); - $ysub2 = Math::sub(0, $point->getY()); + $ysub2 = Math::sub('0', $point->getY()); $yadd = Math::add($ysub2, $ymul); - $R['y'] = Math::mod($yadd, $p); - } catch (\Exception $e) { - throw new \Exception('Error in Util::pointDouble(): '.$e->getMessage()); + throw new \Exception('Error in Util::pointDouble(): ' . $e->getMessage()); } return new Point($R['x'], $R['y']); } - /** + /** * Point addition method P + Q = R where: * s = (yP - yQ)/(xP - xQ) mod p * xR = s2 - xP - xQ mod p * yR = -yP + s(xP - xR) mod p * - * @param PointInterface - * @param PointInterface - * + * @param PointInterface $P + * @param PointInterface $Q * @return PointInterface */ public static function pointAdd(PointInterface $P, PointInterface $Q) @@ -324,8 +320,9 @@ public static function pointAdd(PointInterface $P, PointInterface $Q) return self::pointDouble(new Point($P->getX(), $P->getY())); } - $p = '0x'.Secp256k1::P; - $a = '0x'.Secp256k1::A; + $p = '0x' . Secp256k1::P; + $a = '0x' . Secp256k1::A; + $s = 0; $R = array( 'x' => 0, @@ -351,10 +348,11 @@ public static function pointAdd(PointInterface $P, PointInterface $Q) ), $p ); + $R['y'] = Math::mod( Math::add( Math::sub( - 0, + '0', $P->getY() ), Math::mul( @@ -370,18 +368,17 @@ public static function pointAdd(PointInterface $P, PointInterface $Q) $R['s'] = $s; } catch (Exception $e) { - throw new \Exception('Error in Util::pointAdd(): '.$e->getMessage()); + throw new \Exception('Error in Util::pointAdd(): ' . $e->getMessage()); } return new Point($R['x'], $R['y']); } /** - * Converts hex value into octet (byte) string - * - * @param string + * Converts hex value into octet (byte) string. * - * @return string + * @param string $hex + * @return string $byte */ public static function binConv($hex) { @@ -395,21 +392,21 @@ public static function binConv($hex) } if (substr(strtolower($hex), 0, 2) != '0x') { - $hex = '0x'.strtolower($hex); + $hex = '0x' . strtolower(trim($hex)); } - while (Math::cmp($hex, 0) > 0) { - $dv = Math::div($hex, 256); - $rem = Math::mod($hex, 256); + while (Math::cmp($hex, '0') > 0) { + $dv = Math::div($hex, '256'); + $rem = Math::mod($hex, '256'); $hex = $dv; - $byte = $byte.$digits[$rem]; + $byte = $byte . $digits[$rem]; } return strrev($byte); } /** - * Checks dependencies for the library + * Checks dependencies for the library. * * @return array list of each requirement, boolean true if met, string error message if not as value */ @@ -422,6 +419,7 @@ public static function checkRequirements() $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } + if (PHP_VERSION_ID < 50400) { $requirements['PHP'] = 'Your PHP version, ' . PHP_VERSION . ', is too low. PHP version >= 5.4 is required.'; } else { @@ -454,8 +452,9 @@ public static function checkRequirements() $requirements['cURL'] = 'The cURL PHP extension could not be found.'; } else { $requirements['cURL'] = true; - $curl_version = curl_version(); + $curl_version = curl_version(); $ssl_supported = ($curl_version['features'] & CURL_VERSION_SSL); + if (!$ssl_supported) { $requirements['cURL.SSL'] = 'The cURL PHP extension does not have SSL support.'; } else { From 715e4cd70b82d20cac74abd1dd74967702044f99 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 20:27:34 -0400 Subject: [PATCH 049/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/SecureRandom.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Util/SecureRandom.php b/src/Bitpay/Util/SecureRandom.php index b2977aed..8ec50b35 100644 --- a/src/Bitpay/Util/SecureRandom.php +++ b/src/Bitpay/Util/SecureRandom.php @@ -1,13 +1,15 @@ Date: Tue, 15 Sep 2015 20:28:24 -0400 Subject: [PATCH 050/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/Secp256k1.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Util/Secp256k1.php b/src/Bitpay/Util/Secp256k1.php index 9c7e738a..41714e45 100644 --- a/src/Bitpay/Util/Secp256k1.php +++ b/src/Bitpay/Util/Secp256k1.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 20:30:53 -0400 Subject: [PATCH 051/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/Fingerprint.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/Util/Fingerprint.php b/src/Bitpay/Util/Fingerprint.php index 14535149..50d1f741 100644 --- a/src/Bitpay/Util/Fingerprint.php +++ b/src/Bitpay/Util/Fingerprint.php @@ -1,13 +1,15 @@ Date: Tue, 15 Sep 2015 20:32:37 -0400 Subject: [PATCH 052/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/Error.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bitpay/Util/Error.php b/src/Bitpay/Util/Error.php index 95b9c5bf..cdfa80a7 100644 --- a/src/Bitpay/Util/Error.php +++ b/src/Bitpay/Util/Error.php @@ -1,11 +1,16 @@ Date: Tue, 15 Sep 2015 20:33:03 -0400 Subject: [PATCH 053/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/CurveParameterInterface.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Bitpay/Util/CurveParameterInterface.php b/src/Bitpay/Util/CurveParameterInterface.php index 683f8ded..0d690ae3 100644 --- a/src/Bitpay/Util/CurveParameterInterface.php +++ b/src/Bitpay/Util/CurveParameterInterface.php @@ -1,13 +1,11 @@ Date: Tue, 15 Sep 2015 20:36:00 -0400 Subject: [PATCH 054/164] Updated copyright year and minor refactoring --- src/Bitpay/Util/Base58.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Bitpay/Util/Base58.php b/src/Bitpay/Util/Base58.php index 51dfa6d4..82a6a5d0 100644 --- a/src/Bitpay/Util/Base58.php +++ b/src/Bitpay/Util/Base58.php @@ -1,6 +1,6 @@ 0) { - $q = Math::div($x, 58); - $r = Math::mod($x, 58); + $q = Math::div($x, '58'); + $r = Math::mod($x, '58'); $output_string .= substr($code_string, intval($r), 1); $x = $q; } @@ -55,11 +56,10 @@ public static function encode($data) } /** - * Decodes $data from BASE-58 format + * Decodes a numeric string from BASE-58 format. * * @param string $data - * - * @return string + * @return string $return */ public static function decode($data) { @@ -74,11 +74,11 @@ public static function decode($data) $return = Util::encodeHex($return); for ($i = 0; $i < $dataLen && substr($data, $i, 1) == '1'; $i++) { - $return = '00'.$return; + $return = '00' . $return; } if (strlen($return) % 2 != 0) { - $return = '0'.$return; + $return = '0' . $return; } return $return; From f923cf2ae31e5dbd751d9e3e668b12bb9f5a4895 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 20:48:25 -0400 Subject: [PATCH 055/164] Removed deprecated nonce method --- src/Bitpay/Client/Client.php | 101 +++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 27 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 1be3740c..29ae8840 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -1,6 +1,6 @@ $buyer->getEmail(), 'buyerPhone' => $buyer->getPhone(), 'guid' => Util::guid(), - 'nonce' => Util::nonce(), 'token' => $this->token->getToken(), ); $request->setBody(json_encode($body)); + $this->addIdentityHeader($request); $this->addSignatureHeader($request); + $this->request = $request; $this->response = $this->sendRequest($request); $body = json_decode($this->response->getBody(), true); + $error_message = false; $error_message = (!empty($body['error'])) ? $body['error'] : $error_message; $error_message = (!empty($body['errors'])) ? $body['errors'] : $error_message; $error_message = (is_array($error_message)) ? implode("\n", $error_message) : $error_message; + if (false !== $error_message) { throw new \Exception($error_message); } + $data = $body['data']; $invoiceToken = new \Bitpay\Token(); + $invoice ->setToken($invoiceToken->setToken($data['token'])) ->setId($data['id']) @@ -192,12 +201,17 @@ public function getCurrencies() $this->request = $this->createNewRequest(); $this->request->setMethod(Request::METHOD_GET); $this->request->setPath('currencies'); + $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + + $body = json_decode($this->response->getBody(), true); + if (empty($body['data'])) { throw new \Exception('Error with request: no data returned'); } + $currencies = $body['data']; + array_walk($currencies, function (&$value, $key) { $currency = new \Bitpay\Currency(); $currency @@ -210,6 +224,7 @@ public function getCurrencies() ->setPluralName($value['plural']) ->setAlts($value['alts']) ->setPayoutFields($value['payoutFields']); + $value = $currency; }); @@ -238,12 +253,12 @@ public function createPayout(PayoutInterface $payout) 'effectiveDate' => $effectiveDate, 'pricingMethod' => $payout->getPricingMethod(), 'guid' => Util::guid(), - 'nonce' => Util::nonce() ); // Optional foreach (array('reference','notificationURL','notificationEmail') as $value) { $function = 'get' . ucfirst($value); + if ($payout->$function() != null) { $body[$value] = $payout->$function(); } @@ -259,21 +274,26 @@ public function createPayout(PayoutInterface $payout) } $request->setBody(json_encode($body)); + $this->addIdentityHeader($request); $this->addSignatureHeader($request); $this->request = $request; $this->response = $this->sendRequest($request); + $body = json_decode($this->response->getBody(), true); + $error_message = false; $error_message = (!empty($body['error'])) ? $body['error'] : $error_message; $error_message = (!empty($body['errors'])) ? $body['errors'] : $error_message; $error_message = (is_array($error_message)) ? implode("\n", $error_message) : $error_message; + if (false !== $error_message) { throw new \Exception($error_message); } $data = $body['data']; + $payout ->setId($data['id']) ->setAccountId($data['account']) @@ -294,9 +314,11 @@ public function getPayouts($status = null) { $request = $this->createNewRequest(); $request->setMethod(Request::METHOD_GET); + $path = 'payouts?token=' . $this->token->getToken() . (($status == null) ? '' : '&status=' . $status); + $request->setPath($path); $this->addIdentityHeader($request); @@ -304,11 +326,14 @@ public function getPayouts($status = null) $this->request = $request; $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + + $body = json_decode($this->response->getBody(), true); + $error_message = false; $error_message = (!empty($body['error'])) ? $body['error'] : $error_message; $error_message = (!empty($body['errors'])) ? $body['errors'] : $error_message; $error_message = (is_array($error_message)) ? implode("\n", $error_message) : $error_message; + if (false !== $error_message) { throw new \Exception($error_message); } @@ -376,12 +401,13 @@ public function deletePayout(PayoutInterface $payout) $this->request = $request; $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + $body = json_decode($this->response->getBody(), true); + if (empty($body['data'])) { throw new \Exception('Error with request: no data returned'); } - $data = $body['data']; + $data = $body['data']; $payout->setStatus($data['status']); @@ -396,19 +422,22 @@ public function getPayout($payoutId) $request = $this->createNewRequest(); $request->setMethod(Request::METHOD_GET); $request->setPath(sprintf('payouts/%s?token=%s', $payoutId, $this->token->getToken())); + $this->addIdentityHeader($request); $this->addSignatureHeader($request); $this->request = $request; $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + $body = json_decode($this->response->getBody(), true); + if (empty($body['data'])) { throw new \Exception('Error with request: no data returned'); } - $data = $body['data']; + $data = $body['data']; $payout = new \Bitpay\Payout(); + $payout ->setId($data['id']) ->setAccountId($data['account']) @@ -459,12 +488,15 @@ public function getTokens() $request = $this->createNewRequest(); $request->setMethod(Request::METHOD_GET); $request->setPath('tokens'); + $this->addIdentityHeader($request); $this->addSignatureHeader($request); $this->request = $request; $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + + $body = json_decode($this->response->getBody(), true); + if (empty($body['data'])) { throw new \Exception('Error with request: no data returned'); } @@ -497,25 +529,28 @@ public function createToken(array $payload = array()) $this->request = $this->createNewRequest(); $this->request->setMethod(Request::METHOD_POST); $this->request->setPath('tokens'); + $payload['guid'] = Util::guid(); + $this->request->setBody(json_encode($payload)); $this->response = $this->sendRequest($this->request); - $body = json_decode($this->response->getBody(), true); + + $body = json_decode($this->response->getBody(), true); if (isset($body['error'])) { - throw new \Bitpay\Client\BitpayException($this->response->getStatusCode().": ".$body['error']); + throw new \Bitpay\Client\BitpayException($this->response->getStatusCode() . ": " . $body['error']); } $tkn = $body['data'][0]; $createdAt = new \DateTime(); $pairingExpiration = new \DateTime(); - $token = new \Bitpay\Token(); + $token ->setPolicies($tkn['policies']) ->setToken($tkn['token']) ->setFacade($tkn['facade']) - ->setCreatedAt($createdAt->setTimestamp(floor($tkn['dateCreated']/1000))); + ->setCreatedAt($createdAt->setTimestamp(floor($tkn['dateCreated'] / 1000))); if (isset($tkn['resource'])) { $token->setResource($tkn['resource']); @@ -523,15 +558,15 @@ public function createToken(array $payload = array()) if (isset($tkn['pairingCode'])) { $token->setPairingCode($tkn['pairingCode']); - $token->setPairingExpiration($pairingExpiration->setTimestamp(floor($tkn['pairingExpiration']/1000))); + $token->setPairingExpiration($pairingExpiration->setTimestamp(floor($tkn['pairingExpiration'] / 1000))); } return $token; } /** - * Returns the Response object that BitPay returned from the request that - * was sent + * Returns the Response object that BitPay returned from + * the request that was sent. * * @return ResponseInterface */ @@ -541,7 +576,7 @@ public function getResponse() } /** - * Returns the request object that was sent to BitPay + * Returns the request object that was sent to BitPay. * * @return RequestInterface */ @@ -557,6 +592,7 @@ public function getInvoice($invoiceId) { $this->request = $this->createNewRequest(); $this->request->setMethod(Request::METHOD_GET); + if ($this->token->getFacade() === 'merchant') { $this->request->setPath(sprintf('invoices/%s?token=%s', $invoiceId, $this->token->getToken())); $this->addIdentityHeader($this->request); @@ -564,7 +600,9 @@ public function getInvoice($invoiceId) } else { $this->request->setPath(sprintf('invoices/%s', $invoiceId)); } + $this->response = $this->sendRequest($this->request); + $body = json_decode($this->response->getBody(), true); if (isset($body['error'])) { @@ -572,9 +610,9 @@ public function getInvoice($invoiceId) } $data = $body['data']; - $invoice = new \Bitpay\Invoice(); $invoiceToken = new \Bitpay\Token(); + $invoice ->setToken($invoiceToken->setToken($data['token'])) ->setUrl($data['url']) @@ -611,6 +649,7 @@ public function sendRequest(RequestInterface $request) /** * @param RequestInterface $request + * @throws \Exception */ protected function addIdentityHeader(RequestInterface $request) { @@ -623,6 +662,7 @@ protected function addIdentityHeader(RequestInterface $request) /** * @param RequestInterface $request + * @throws \Exception */ protected function addSignatureHeader(RequestInterface $request) { @@ -667,26 +707,33 @@ protected function createNewRequest() /** * Prepares the request object by adding additional headers * + * @see http://en.wikipedia.org/wiki/User_agent * @param RequestInterface $request */ protected function prepareRequestHeaders(RequestInterface $request) { - // @see http://en.wikipedia.org/wiki/User_agent $request->setHeader( 'User-Agent', sprintf('%s/%s (PHP %s)', self::NAME, self::VERSION, phpversion()) ); + $request->setHeader('X-BitPay-Plugin-Info', sprintf('%s/%s', self::NAME, self::VERSION)); $request->setHeader('Content-Type', 'application/json'); - $request->setHeader('X-Accept-Version', '2.0.0'); + $request->setHeader('X-Accept-Version', '2.2.6'); } + /** + * @param string $price + * @param string $currency + * @throws \Exception + */ protected function checkPriceAndCurrency($price, $currency) { - //get the decimal precision of the price - $decimalPrecision = strlen(substr($price, strpos($price, '.')+1)); - if (($decimalPrecision > 2 && $currency != "BTC") || $decimalPrecision > 6) { - throw new ArgumentException("Incorrect price format"); + // Get the decimal precision of the price + $decimalPrecision = strlen(substr($price, strpos($price, '.') + 1)); + + if (($decimalPrecision > 2 && $currency != 'BTC') || $decimalPrecision > 6) { + throw new \Exception('Incorrect price format or currency type.'); } } } From a21df08eb86af46ddb1ce0292b14db277c70b892 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 20:52:25 -0400 Subject: [PATCH 056/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/ClientInterface.php | 41 ++++++--------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/src/Bitpay/Client/ClientInterface.php b/src/Bitpay/Client/ClientInterface.php index 5c165a26..603612fc 100644 --- a/src/Bitpay/Client/ClientInterface.php +++ b/src/Bitpay/Client/ClientInterface.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 20:52:50 -0400 Subject: [PATCH 057/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/ResponseInterface.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/Client/ResponseInterface.php b/src/Bitpay/Client/ResponseInterface.php index 11664d23..9a617e70 100644 --- a/src/Bitpay/Client/ResponseInterface.php +++ b/src/Bitpay/Client/ResponseInterface.php @@ -1,13 +1,12 @@ Date: Tue, 15 Sep 2015 20:53:21 -0400 Subject: [PATCH 058/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/RequestInterface.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/Client/RequestInterface.php b/src/Bitpay/Client/RequestInterface.php index 7042f031..626b8719 100644 --- a/src/Bitpay/Client/RequestInterface.php +++ b/src/Bitpay/Client/RequestInterface.php @@ -1,13 +1,12 @@ Date: Tue, 15 Sep 2015 20:56:43 -0400 Subject: [PATCH 059/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/Request.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Bitpay/Client/Request.php b/src/Bitpay/Client/Request.php index bf8c986f..dc9dec8b 100644 --- a/src/Bitpay/Client/Request.php +++ b/src/Bitpay/Client/Request.php @@ -1,6 +1,6 @@ headers; + foreach ($headers as $header => $value) { if (empty($header) || empty($value)) { unset($headers[$header]); @@ -205,9 +203,13 @@ public function getHeaders() return $headers; } + /** + * @return array + */ public function getHeaderFields() { $fields = array(); + foreach ($this->getHeaders() as $header => $value) { $fields[] = sprintf('%s: %s', $header, $value); } @@ -227,20 +229,22 @@ public function getHeadersAsString() $return .= sprintf("%s: %s\r\n", $h, $v); } - return $return."\r\n"; + return $return . "\r\n"; } /** - * Set a http header for the request + * Set a http header for the request. * * @param string $header * @param string $value + * @throws \Exception */ public function setHeader($header, $value) { if (is_array($value)) { - throw new \Exception('Could not set the header: '.$header); + throw new \Exception('Could not set the header: ' . $header); } + $this->headers[$header] = $value; } @@ -253,9 +257,10 @@ public function getBody() } /** - * The the body of the request + * Sets the body of the request. * * @param string $body + * @return Request */ public function setBody($body) { @@ -275,6 +280,7 @@ public function getPath() /** * @param string $host + * @return Request */ public function setPath($path) { From e2a6fae9ed7c42c9d76374ea05db23df9e243ba9 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 20:57:49 -0400 Subject: [PATCH 060/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/ConnectionException.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bitpay/Client/ConnectionException.php b/src/Bitpay/Client/ConnectionException.php index ca4fc580..606d1e89 100644 --- a/src/Bitpay/Client/ConnectionException.php +++ b/src/Bitpay/Client/ConnectionException.php @@ -1,7 +1,13 @@ Date: Tue, 15 Sep 2015 20:58:32 -0400 Subject: [PATCH 061/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/BitpayException.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Bitpay/Client/BitpayException.php b/src/Bitpay/Client/BitpayException.php index f3a357c9..e7ef10bf 100644 --- a/src/Bitpay/Client/BitpayException.php +++ b/src/Bitpay/Client/BitpayException.php @@ -1,7 +1,14 @@ Date: Tue, 15 Sep 2015 20:59:11 -0400 Subject: [PATCH 062/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/ArgumentException.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Bitpay/Client/ArgumentException.php b/src/Bitpay/Client/ArgumentException.php index 3f1aa746..e1c50369 100644 --- a/src/Bitpay/Client/ArgumentException.php +++ b/src/Bitpay/Client/ArgumentException.php @@ -1,7 +1,14 @@ Date: Tue, 15 Sep 2015 21:02:10 -0400 Subject: [PATCH 063/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/Response.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Bitpay/Client/Response.php b/src/Bitpay/Client/Response.php index 186e76b2..88f2d2af 100644 --- a/src/Bitpay/Client/Response.php +++ b/src/Bitpay/Client/Response.php @@ -1,13 +1,13 @@ headers = array(); @@ -48,26 +46,31 @@ public function __construct($raw = null) */ public function __toString() { - return (string) $this->raw; + return (string)$this->raw; } /** + * @param Response */ public static function createFromRawResponse($rawResponse) { $response = new self($rawResponse); $lines = preg_split('/(\\r?\\n)/', $rawResponse); $linesLen = count($lines); + for ($i = 0; $i < $linesLen; $i++) { if (0 == $i) { preg_match('/^HTTP\/(\d\.\d)\s(\d+)\s(.+)/', $lines[$i], $statusLine); + $response->setStatusCode($statusCode = $statusLine[2]); + continue; } if (empty($lines[$i])) { $body = array_slice($lines, $i + 1); $response->setBody(implode("\n", $body)); + break; } @@ -90,12 +93,11 @@ public function getStatusCode() /** * @param integer - * - * @return ResponseInterface + * @return Response */ public function setStatusCode($statusCode) { - $this->statusCode = (integer) $statusCode; + $this->statusCode = (integer)$statusCode; return $this; } @@ -112,6 +114,7 @@ public function getBody() * Set the body of the response * * @param string $body + * @return Response */ public function setBody($body) { @@ -131,6 +134,7 @@ public function getHeaders() /** * @param string $header * @param string $value + * @return Response */ public function setHeader($header, $value) { From 51c74e5768be09b99846835e73b51cc4fd9994f0 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 21:06:29 -0400 Subject: [PATCH 064/164] New Mozilla cert bundle update --- src/Bitpay/Client/Adapter/ca-bundle.crt | 520 ++++++++++++++---------- 1 file changed, 307 insertions(+), 213 deletions(-) diff --git a/src/Bitpay/Client/Adapter/ca-bundle.crt b/src/Bitpay/Client/Adapter/ca-bundle.crt index 0838d5de..759a4d6f 100644 --- a/src/Bitpay/Client/Adapter/ca-bundle.crt +++ b/src/Bitpay/Client/Adapter/ca-bundle.crt @@ -1,7 +1,7 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla downloaded on: Thu Sep 4 06:31:22 2014 +## Certificate data from Mozilla as of: Mon Apr 27 08:58:04 2015 ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates @@ -13,66 +13,11 @@ ## an Apache+mod_ssl webserver for SSL client authentication. ## Just configure this file as the SSLCACertificateFile. ## -## Conversion done with mk-ca-bundle.pl verison 1.22. -## SHA1: c4540021427a6fa29e5f50db9f12d48c97d33889 +## Conversion done with mk-ca-bundle.pl version 1.25. +## SHA1: ed3c0bbfb7912bcc00cd2033b0cb85c98d10559c ## -GTE CyberTrust Global Root -========================== ------BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg -Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG -A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz -MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL -Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0 -IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u -sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql -HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID -AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW -M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF -NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ ------END CERTIFICATE----- - -Thawte Server CA -================ ------BEGIN CERTIFICATE----- -MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE -AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j -b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV -BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u -c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG -A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0 -ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl -/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7 -1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR -MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J -GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ -GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc= ------END CERTIFICATE----- - -Thawte Premium Server CA -======================== ------BEGIN CERTIFICATE----- -MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT -DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs -dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE -AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl -ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT -AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU -VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2 -aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ -cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2 -aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh -Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/ -qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm -SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf -8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t -UCemDaYj+bvLpgcUQg== ------END CERTIFICATE----- - Equifax Secure CA ================= -----BEGIN CERTIFICATE----- @@ -93,25 +38,6 @@ BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95 70+sB3c4 -----END CERTIFICATE----- -Verisign Class 3 Public Primary Certification Authority - G2 -============================================================ ------BEGIN CERTIFICATE----- -MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy -eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO -FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71 -lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB -MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT -1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD -Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9 ------END CERTIFICATE----- - GlobalSign Root CA ================== -----BEGIN CERTIFICATE----- @@ -248,40 +174,6 @@ Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp -----END CERTIFICATE----- -Equifax Secure Global eBusiness CA -================================== ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp -bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx -HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds -b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV -PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN -qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn -hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j -BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs -MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN -I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY -NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- - -Equifax Secure eBusiness CA 1 -============================= ------BEGIN CERTIFICATE----- -MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB -LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE -ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz -IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ -1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a -IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk -MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW -Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF -AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5 -lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+ -KpYrtWKmpj29f5JZzVoqgrI3eQ== ------END CERTIFICATE----- - AddTrust Low-Value Services Root ================================ -----BEGIN CERTIFICATE----- @@ -527,59 +419,6 @@ gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS -----END CERTIFICATE----- -America Online Root Certification Authority 1 -============================================= ------BEGIN CERTIFICATE----- -MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG -v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z -DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh -sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP -8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T -AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z -o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf -GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF -VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft -3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g -Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds -sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 ------END CERTIFICATE----- - -America Online Root Certification Authority 2 -============================================= ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT -QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG -A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg -T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en -fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8 -f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO -qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN -RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0 -gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn -6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid -FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6 -Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj -B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op -aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY -T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p -+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg -JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy -zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO -ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh -1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf -GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff -Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP -cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk= ------END CERTIFICATE----- - Visa eCommerce Root =================== -----BEGIN CERTIFICATE----- @@ -1777,33 +1616,6 @@ JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk vQ== -----END CERTIFICATE----- -TC TrustCenter Class 3 CA II -============================ ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC -REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy -IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw -MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 -c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE -AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W -yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo -6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ -uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk -2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB -7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 -Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU -cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i -SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE -O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8 -yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9 -IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal -092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc -5A== ------END CERTIFICATE----- - TC TrustCenter Universal CA I ============================= -----BEGIN CERTIFICATE----- @@ -2421,28 +2233,6 @@ yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi LXpUq3DDfSJlgnCW -----END CERTIFICATE----- -E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi -=================================================== ------BEGIN CERTIFICATE----- -MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG -EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz -ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3 -MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0 -cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u -aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY -8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y -jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI -JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk -9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG -SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d -F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq -D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4 -Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq -fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX ------END CERTIFICATE----- - GlobalSign Root CA - R3 ======================= -----BEGIN CERTIFICATE----- @@ -3892,3 +3682,307 @@ ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO kI26oQ== -----END CERTIFICATE----- + +COMODO RSA Certification Authority +================================== +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE +BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG +A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC +R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE +ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn +dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ +FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+ +5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG +x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX +2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL +OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3 +sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C +GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5 +WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w +DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt +rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+ +nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg +tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW +sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp +pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA +zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq +ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52 +7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I +LaZRfyHBNVOFBkpdn627G190 +-----END CERTIFICATE----- + +USERTrust RSA Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz +0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j +Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn +RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O ++T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq +/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE +Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM +lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8 +yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+ +eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW +FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ +7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ +Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM +8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi +FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi +yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c +J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw +sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx +Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +USERTrust ECC Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2 +0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez +nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV +HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB +HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu +9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R4 +=========================== +-----BEGIN CERTIFICATE----- +MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl +OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P +AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV +MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF +JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R5 +=========================== +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6 +SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS +h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd +BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx +uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7 +yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA - G3 +================================== +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC +TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l +ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y +olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t +x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy +EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K +Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur +mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5 +1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp +07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo +FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE +41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu +yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD +U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq +KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1 +v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA +8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b +8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r +mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq +1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI +JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV +tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk= +-----END CERTIFICATE----- + +Staat der Nederlanden EV Root CA +================================ +-----BEGIN CERTIFICATE----- +MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M +MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl +cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk +SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW +O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r +0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8 +Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV +XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr +08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV +0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd +74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx +fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa +ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI +eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu +c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq +5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN +b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN +f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi +5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4 +WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK +DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy +eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg== +-----END CERTIFICATE----- + +IdenTrust Commercial Root CA 1 +============================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS +b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES +MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB +IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld +hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/ +mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi +1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C +XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl +3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy +NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV +WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg +xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix +uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC +AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI +hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg +ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt +ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV +YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX +feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro +kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe +2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz +Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R +cGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +IdenTrust Public Sector Root CA 1 +================================= +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv +ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV +UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS +b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy +P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6 +Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI +rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf +qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS +mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn +ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh +LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v +iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL +4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B +Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw +DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A +mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt +GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt +m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx +NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4 +Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI +ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC +ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ +3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +Entrust Root Certification Authority - G2 +========================================= +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV +BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy +bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug +b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw +HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT +DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx +OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP +/vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz +HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU +s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y +TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx +AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6 +0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z +iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi +nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+ +vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO +e4pIb4tF9g== +-----END CERTIFICATE----- + +Entrust Root Certification Authority - EC1 +========================================== +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx +FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn +YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl +ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw +FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs +LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg +dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy +AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef +9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h +vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8 +kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +CFCA EV ROOT +============ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE +CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB +IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw +MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD +DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV +BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD +7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN +uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW +ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7 +xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f +py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K +gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol +hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ +tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf +BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB +/wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q +ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua +4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG +E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX +BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn +aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy +PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX +kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C +ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- From 37847b542253b000afe721cce314e391d0ac54e6 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 21:08:33 -0400 Subject: [PATCH 065/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/Adapter/CurlAdapter.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 8d6327c2..3f882a5e 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 21:09:03 -0400 Subject: [PATCH 066/164] Updated copyright year and minor refactoring --- src/Bitpay/Client/Adapter/AdapterInterface.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Adapter/AdapterInterface.php b/src/Bitpay/Client/Adapter/AdapterInterface.php index e2613bf7..b4c2df7b 100644 --- a/src/Bitpay/Client/Adapter/AdapterInterface.php +++ b/src/Bitpay/Client/Adapter/AdapterInterface.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 21:09:44 -0400 Subject: [PATCH 067/164] Updated copyright year and minor refactoring --- src/Bitpay/UserInterface.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/UserInterface.php b/src/Bitpay/UserInterface.php index a0a610ce..5c4ee8f6 100644 --- a/src/Bitpay/UserInterface.php +++ b/src/Bitpay/UserInterface.php @@ -1,13 +1,12 @@ Date: Tue, 15 Sep 2015 21:11:23 -0400 Subject: [PATCH 068/164] Updated copyright year and minor refactoring --- src/Bitpay/User.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/Bitpay/User.php b/src/Bitpay/User.php index 181e15da..7076d355 100644 --- a/src/Bitpay/User.php +++ b/src/Bitpay/User.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 21:11:50 -0400 Subject: [PATCH 069/164] Updated copyright year and minor refactoring --- src/Bitpay/TokenInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/TokenInterface.php b/src/Bitpay/TokenInterface.php index eeb774d4..96790dd5 100644 --- a/src/Bitpay/TokenInterface.php +++ b/src/Bitpay/TokenInterface.php @@ -1,6 +1,6 @@ Date: Tue, 15 Sep 2015 21:14:31 -0400 Subject: [PATCH 070/164] Updated copyright year and minor refactoring --- src/Bitpay/Token.php | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/Token.php b/src/Bitpay/Token.php index c11b5e7e..6bfc0f29 100644 --- a/src/Bitpay/Token.php +++ b/src/Bitpay/Token.php @@ -1,6 +1,6 @@ policies = array(); @@ -58,7 +56,7 @@ public function __construct() */ public function __toString() { - return (string) $this->getToken(); + return (string)$this->getToken(); } /** @@ -69,6 +67,10 @@ public function getToken() return $this->token; } + /** + * @param string + * @return Token + */ public function setToken($token) { $this->token = $token; @@ -84,6 +86,10 @@ public function getResource() return $this->resource; } + /** + * @param string + * @return Token + */ public function setResource($resource) { $this->resource = $resource; @@ -99,6 +105,10 @@ public function getFacade() return $this->facade; } + /** + * @param string + * @return Token + */ public function setFacade($facade) { $this->facade = $facade; @@ -114,6 +124,10 @@ public function getCreatedAt() return $this->createdAt; } + /** + * @param \DateTime + * @return Token + */ public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; @@ -129,6 +143,10 @@ public function getPolicies() return $this->policies; } + /** + * @param string + * @return Token + */ public function setPolicies($policies) { $this->policies = $policies; @@ -143,7 +161,11 @@ public function getPairingCode() { return $this->pairingCode; } - + + /** + * @param string + * @return Token + */ public function setPairingCode($pairingCode) { $this->pairingCode = $pairingCode; @@ -159,6 +181,10 @@ public function getPairingExpiration() return $this->pairingExpiration; } + /** + * @param \DateTime + * @return Token + */ public function setPairingExpiration(\DateTime $pairingExpiration) { $this->pairingExpiration = $pairingExpiration; From a16d1191249582d8417070fcd41d5a98babd71e4 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 21:16:47 -0400 Subject: [PATCH 071/164] Updated copyright year and minor refactoring --- src/Bitpay/SinKey.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Bitpay/SinKey.php b/src/Bitpay/SinKey.php index 09fce7b4..e4b7eca9 100644 --- a/src/Bitpay/SinKey.php +++ b/src/Bitpay/SinKey.php @@ -1,6 +1,6 @@ value = Base58::encode($step6); From 43e9b915aec34880eaf7410137dc3a5b115a06fd Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 21:18:40 -0400 Subject: [PATCH 072/164] Updated copyright year and minor refactoring --- src/Bitpay/PublicKey.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/PublicKey.php b/src/Bitpay/PublicKey.php index 50bb9dd5..cb9173aa 100644 --- a/src/Bitpay/PublicKey.php +++ b/src/Bitpay/PublicKey.php @@ -1,6 +1,6 @@ x = $RxHex; $this->y = $RyHex; + $this->hex = sprintf('%s%s', $RxHex, $RyHex); $this->dec = Util::decodeHex($this->hex); @@ -139,6 +142,7 @@ public function getSin() if (null === $this->sin) { $this->sin = new SinKey(); + $this->sin->setPublicKey($this); $this->sin->generate(); } From 82eade1531b42c06fbeb0bb07cf89ce8f9eefdf7 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 15 Sep 2015 21:25:03 -0400 Subject: [PATCH 073/164] Updated copyright year and minor refactoring --- src/Bitpay/PrivateKey.php | 71 +++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/Bitpay/PrivateKey.php b/src/Bitpay/PrivateKey.php index b7120b2b..bc0c833a 100644 --- a/src/Bitpay/PrivateKey.php +++ b/src/Bitpay/PrivateKey.php @@ -1,6 +1,6 @@ hex = strtolower(bin2hex($privateKey)); - } while (Math::cmp('0x'.$this->hex, '1') <= 0 || Math::cmp('0x'.$this->hex, '0x'.Secp256k1::N) >= 0); + } while (Math::cmp('0x'.$this->hex, '1') <= 0 || Math::cmp('0x' . $this->hex, '0x' . Secp256k1::N) >= 0); $this->dec = Util::decodeHex($this->hex); @@ -104,9 +104,11 @@ public function hasValidDec() } /** - * Creates an ECDSA signature of $message + * Creates an ECDSA signature of $data. * + * @param string * @return string + * @throws \Exception */ public function sign($data) { @@ -122,19 +124,19 @@ public function sign($data) do { if (substr(strtolower($this->hex), 0, 2) != '0x') { - $d = '0x'.$this->hex; + $d = '0x' . $this->hex; } else { $d = $this->hex; } $k = SecureRandom::generateRandom(32); - $k_hex = '0x'.strtolower(bin2hex($k)); - $n_hex = '0x'.Secp256k1::N; + $k_hex = '0x' . strtolower(bin2hex($k)); + $n_hex = '0x' . Secp256k1::N; - $Gx = '0x'.substr(Secp256k1::G, 2, 64); - $Gy = '0x'.substr(Secp256k1::G, 66, 64); + $Gx = '0x' . substr(Secp256k1::G, 2, 64); + $Gy = '0x' . substr(Secp256k1::G, 66, 64); $P = new Point($Gx, $Gy); @@ -142,11 +144,10 @@ public function sign($data) $R = Util::doubleAndAdd($k_hex, $P); $Rx_hex = Util::encodeHex($R->getX()); - $Rx_hex = str_pad($Rx_hex, 64, '0', STR_PAD_LEFT); // r = x1 mod n - $r = Math::mod('0x'.$Rx_hex, $n_hex); + $r = Math::mod('0x' . $Rx_hex, $n_hex); // s = k^-1 * (e+d*r) mod n $edr = Math::add($e, Math::mul($d, $r)); @@ -198,42 +199,44 @@ public static function serializeSig($r, $s) $dec = Util::decodeHex($r); while (Math::cmp($dec, '0') > 0) { - $dv = Math::div($dec, '256'); - $rem = Math::mod($dec, '256'); - $dec = $dv; - $byte = $byte.$digits[$rem]; + $dv = Math::div($dec, '256'); + $rem = Math::mod($dec, '256'); + $dec = $dv; + $byte = $byte . $digits[$rem]; } $byte = strrev($byte); // msb check - if (Math::cmp('0x'.bin2hex($byte[0]), '0x80') >= 0) { - $byte = chr(0x00).$byte; + if (Math::cmp('0x' . bin2hex($byte[0]), '0x80') >= 0) { + $byte = chr(0x00) . $byte; } $retval['bin_r'] = bin2hex($byte); - $seq = chr(0x02).chr(strlen($byte)).$byte; + $seq = chr(0x02) . chr(strlen($byte)) . $byte; $dec = Util::decodeHex($s); $byte = ''; while (Math::cmp($dec, '0') > 0) { - $dv = Math::div($dec, '256'); - $rem = Math::mod($dec, '256'); - $dec = $dv; - $byte = $byte.$digits[$rem]; + $dv = Math::div($dec, '256'); + $rem = Math::mod($dec, '256'); + $dec = $dv; + $byte = $byte . $digits[$rem]; } $byte = strrev($byte); // msb check - if (Math::cmp('0x'.bin2hex($byte[0]), '0x80') >= 0) { - $byte = chr(0x00).$byte; + if (Math::cmp('0x' . bin2hex($byte[0]), '0x80') >= 0) { + $byte = chr(0x00) . $byte; } $retval['bin_s'] = bin2hex($byte); - $seq = $seq.chr(0x02).chr(strlen($byte)).$byte; - $seq = chr(0x30).chr(strlen($seq)).$seq; + + $seq = $seq . chr(0x02) . chr(strlen($byte)) . $byte; + $seq = chr(0x30) . chr(strlen($seq)) . $seq; + $retval['seq'] = bin2hex($seq); return $retval; @@ -244,6 +247,7 @@ public static function serializeSig($r, $s) * * @param string $pem_data The data to decode. * @return array The keypair info. + * @throws \Exception */ public function pemDecode($pem_data) { @@ -293,6 +297,7 @@ public function pemDecode($pem_data) * * @param array $keypair The keypair info. * @return string The data to decode. + * @throws \Exception */ public function pemEncode($keypair) { @@ -329,7 +334,7 @@ public function pemEncode($keypair) 'a1_ele_len' => '44', 'bit_str_beg' => '03', 'bit_str_len' => '42', - 'bit_str_val' => '00'.$keypair[1], + 'bit_str_val' => '00' . $keypair[1], ); $beg_ec_text = '-----BEGIN EC PRIVATE KEY-----'; @@ -341,16 +346,16 @@ public function pemEncode($keypair) throw new \Exception('Invalid or corrupt secp256k1 keypair provided. Cannot encode the supplied data.'); } - $dec = Util::decodeHex('0x'.$dec); + $dec = Util::decodeHex('0x' . $dec); while (Math::cmp($dec, '0') > 0) { - $dv = Math::div($dec, '256'); - $rem = Math::mod($dec, '256'); - $dec = $dv; - $byte = $byte.$digits[$rem]; + $dv = Math::div($dec, '256'); + $rem = Math::mod($dec, '256'); + $dec = $dv; + $byte = $byte . $digits[$rem]; } - $byte = $beg_ec_text."\r\n".chunk_split(base64_encode(strrev($byte)), 64).$end_ec_text; + $byte = $beg_ec_text . "\r\n" . chunk_split(base64_encode(strrev($byte)), 64) . $end_ec_text; $this->pemEncoded = $byte; From 848a9006c232f59d524120fbdbb9166e814c8c00 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 15:03:16 -0400 Subject: [PATCH 074/164] Updated copyright year and minor refactoring --- src/Bitpay/Storage/StorageInterface.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Storage/StorageInterface.php b/src/Bitpay/Storage/StorageInterface.php index 92b10dfd..fb276f64 100644 --- a/src/Bitpay/Storage/StorageInterface.php +++ b/src/Bitpay/Storage/StorageInterface.php @@ -1,13 +1,13 @@ Date: Wed, 16 Sep 2015 15:35:41 -0400 Subject: [PATCH 075/164] Update MockStorage.php --- src/Bitpay/Storage/MockStorage.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Storage/MockStorage.php b/src/Bitpay/Storage/MockStorage.php index 5cc1d1b0..fc5635b8 100644 --- a/src/Bitpay/Storage/MockStorage.php +++ b/src/Bitpay/Storage/MockStorage.php @@ -1,6 +1,6 @@ Date: Wed, 16 Sep 2015 15:43:21 -0400 Subject: [PATCH 076/164] Updated copyright year and minor refactoring also improved error messages to be more informative. --- src/Bitpay/Storage/FilesystemStorage.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Storage/FilesystemStorage.php b/src/Bitpay/Storage/FilesystemStorage.php index b84a996a..7bf8cfc6 100644 --- a/src/Bitpay/Storage/FilesystemStorage.php +++ b/src/Bitpay/Storage/FilesystemStorage.php @@ -1,13 +1,15 @@ getId(); - file_put_contents($path, serialize($key)); + try { + $path = $key->getId(); + file_put_contents($path, serialize($key)); + } catch (\Exception $e) { + throw new \Exception('[ERROR] In FilesystemStorage::persist(): ' . $e->getMessage()); + } } /** @@ -26,11 +32,11 @@ public function persist(\Bitpay\KeyInterface $key) public function load($id) { if (!is_file($id)) { - throw new \Exception(sprintf('Could not find "%s"', $id)); + throw new \Exception(sprintf('[ERROR] In FilesystemStorage::load(): Could not find "%s".', $id)); } if (!is_readable($id)) { - throw new \Exception(sprintf('"%s" cannot be read, check permissions', $id)); + throw new \Exception(sprintf('[ERROR] In FilesystemStorage::load(): "%s" cannot be read, check permissions.', $id)); } return unserialize(file_get_contents($id)); From 7a27ea32a901b62cf440b7178545106867c8d450 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 16:11:55 -0400 Subject: [PATCH 077/164] Updated copyright year and minor refactoring added base64_encode/decode method to ensure proper storage of binary data from the encryption process. Also added some more value checks to detect failure in the file operations. --- .../Storage/EncryptedFilesystemStorage.php | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 2424026a..9a3d4063 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -1,12 +1,13 @@ getId(); $data = serialize($key); - $encoded = bin2hex(openssl_encrypt( + + $encoded = base64_encode(openssl_encrypt( $data, self::METHOD, $this->password, @@ -53,7 +55,9 @@ public function persist(\Bitpay\KeyInterface $key) self::IV )); - file_put_contents($path, $encoded); + if (file_put_contents($path, $encoded) === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not write to the file "' . $path . '".'); + } } /** @@ -61,19 +65,24 @@ public function persist(\Bitpay\KeyInterface $key) */ public function load($id) { - if (!is_file($id)) { - throw new \Exception(sprintf('Could not find "%s"', $id)); + if (is_file($id) === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not find the file "' . $id . '".'); } - if (!is_readable($id)) { - throw new \Exception(sprintf('"%s" cannot be read, check permissions', $id)); + if (is_readable($id) === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): The file "' . $id . '" cannot be read, check permissions.'); } $encoded = file_get_contents($id); - $decoded = openssl_decrypt(\Bitpay\Util\Util::binConv($encoded), self::METHOD, $this->password, 1, self::IV); - if (false === $decoded) { - throw new \Exception('Could not decode key'); + if ($encoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): The file "' . $id . '" cannot be read, check permissions.'); + } + + $decoded = openssl_decrypt(base64_decode($encoded), self::METHOD, $this->password, 1, self::IV); + + if ($decoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode key "' . $id . '".'); } return unserialize($decoded); From 7f840e39bc9e57284059a2f960a9916ab7be7d25 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 16:14:04 -0400 Subject: [PATCH 078/164] Updated copyright year and minor refactoring --- src/Bitpay/Network/Testnet.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Network/Testnet.php b/src/Bitpay/Network/Testnet.php index 43131337..59504ca3 100644 --- a/src/Bitpay/Network/Testnet.php +++ b/src/Bitpay/Network/Testnet.php @@ -1,14 +1,13 @@ Date: Wed, 16 Sep 2015 16:35:36 -0400 Subject: [PATCH 079/164] Travis update for new container infrastructure --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index e3a019e2..e77378b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,9 @@ after_script: notifications: email: false +sudo: + false + matrix: fast_finish: true allow_failures: From 58a52f76b5a7dea1066f3b60d4cc8c0fd33b0c11 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 16:44:17 -0400 Subject: [PATCH 080/164] Added check for encryption failure in persist() --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 9a3d4063..ab136190 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -47,15 +47,19 @@ public function persist(\Bitpay\KeyInterface $key) $path = $key->getId(); $data = serialize($key); - $encoded = base64_encode(openssl_encrypt( + $encoded = openssl_encrypt( $data, self::METHOD, $this->password, 1, self::IV - )); + ); - if (file_put_contents($path, $encoded) === false) { + if ($encoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encode key file "' . $id . '" with the data "' . $data . '".'); + } + + if (file_put_contents($path, base64_encode($encoded)) === false) { throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not write to the file "' . $path . '".'); } } From 7e7737416e8efaae3bd8c4733cc48dcceb10a073 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 16:56:50 -0400 Subject: [PATCH 081/164] Added base64 encode/decode failure checks --- .../Storage/EncryptedFilesystemStorage.php | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index ab136190..27baf807 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -47,19 +47,19 @@ public function persist(\Bitpay\KeyInterface $key) $path = $key->getId(); $data = serialize($key); - $encoded = openssl_encrypt( - $data, - self::METHOD, - $this->password, - 1, - self::IV - ); + $encrypted = openssl_encrypt($data, self::METHOD, $this->password, 1, self::IV); + + if ($encrypted === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '".'); + } + + $encoded = base64_encode($encrypted); if ($encoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encode key file "' . $id . '" with the data "' . $data . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); } - if (file_put_contents($path, base64_encode($encoded)) === false) { + if (file_put_contents($path, $encoded) === false) { throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not write to the file "' . $path . '".'); } } @@ -83,12 +83,18 @@ public function load($id) throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): The file "' . $id . '" cannot be read, check permissions.'); } - $decoded = openssl_decrypt(base64_decode($encoded), self::METHOD, $this->password, 1, self::IV); + $decoded = base64_decode($encoded); if ($decoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode encrypted data for key file "' . $id . '" with the data "' . $encoded . '".'); + } + + $decrypted = openssl_decrypt($decoded, self::METHOD, $this->password, 1, self::IV); + + if ($decrypted === false) { throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode key "' . $id . '".'); } - return unserialize($decoded); + return unserialize($decrypted); } } From 597e364d65a2d0148573e20bd9f98e5f3983f822 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 16:59:52 -0400 Subject: [PATCH 082/164] Corrected return method types --- src/Bitpay/AccessToken.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/AccessToken.php b/src/Bitpay/AccessToken.php index 14166c83..a02819fc 100644 --- a/src/Bitpay/AccessToken.php +++ b/src/Bitpay/AccessToken.php @@ -40,7 +40,7 @@ public function __construct($id = null, $email = null, $label = null) * Setter for the id. * * @param string $id - * @return AccessTokenInterface + * @return AccessToken */ public function setId($id) { @@ -63,7 +63,7 @@ public function getId() * Setter for the email address. * * @param string $email - * @return AccessTokenInterface + * @return AccessToken */ public function setEmail($email) { @@ -86,7 +86,7 @@ public function getEmail() * Setter for the label. * * @param string $label - * @return AccessTokenInterface + * @return AccessToken */ public function setLabel($label) { From f50af5c4f70f0b3d6aba18915897a259e1fc3287 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 17:03:10 -0400 Subject: [PATCH 083/164] Updated exception message with more info --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 27baf807..1f3c0fa9 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -92,7 +92,7 @@ public function load($id) $decrypted = openssl_decrypt($decoded, self::METHOD, $this->password, 1, self::IV); if ($decrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode key "' . $id . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decrypt key "' . $id . '" with data "' . $decoded . '".'); } return unserialize($decrypted); From df9a608d0719950d8b34fe5087fb6d80f09475da Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 17:21:52 -0400 Subject: [PATCH 084/164] Added specific openssl error messages --- .../Storage/EncryptedFilesystemStorage.php | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 1f3c0fa9..66b39383 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -44,13 +44,20 @@ public function __construct($password) */ public function persist(\Bitpay\KeyInterface $key) { - $path = $key->getId(); - $data = serialize($key); + $msg = ''; + $openssl_error_msg = ''; + $path = $key->getId(); + $data = serialize($key); - $encrypted = openssl_encrypt($data, self::METHOD, $this->password, 1, self::IV); + $encrypted = openssl_encrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($encrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '".'); + while ($msg = openssl_error_string()) { + $openssl_error_msg .= $msg . "\r\n"; + $msg = ''; + } + + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $openssl_error_msg . '".'); } $encoded = base64_encode($encrypted); @@ -69,6 +76,9 @@ public function persist(\Bitpay\KeyInterface $key) */ public function load($id) { + $msg = ''; + $openssl_error_msg = ''; + if (is_file($id) === false) { throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not find the file "' . $id . '".'); } @@ -89,10 +99,15 @@ public function load($id) throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode encrypted data for key file "' . $id . '" with the data "' . $encoded . '".'); } - $decrypted = openssl_decrypt($decoded, self::METHOD, $this->password, 1, self::IV); + $decrypted = openssl_decrypt($decoded, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($decrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decrypt key "' . $id . '" with data "' . $decoded . '".'); + while ($msg = openssl_error_string()) { + $openssl_error_msg .= $msg . "\r\n"; + $msg = ''; + } + + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decrypt key "' . $id . '" with data "' . $decoded . '". OpenSSL error(s) are: "' . $openssl_error_msg . '".'); } return unserialize($decrypted); From 26111752880970ee32718199ecded5b4f4a3a8ff Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 17:38:45 -0400 Subject: [PATCH 085/164] Update tests to use class-level vars --- .../EncryptedFilesystemStorageTest.php | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php index 1396eefb..ea63f440 100644 --- a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php +++ b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php @@ -11,28 +11,31 @@ class EncryptedFilesystemStorageTest extends \PHPUnit_Framework_TestCase { private $root; + private $pubkeyStream; + private $pubkeyName; + private $storage; public function setUp() { + $this->pubkeyName = 'tmp/public.key'; + $this->pubkeyStream = vfsStream::url($this->pubkeyName); $this->root = vfsStream::setup('tmp'); + $this->storage = new EncryptedFilesystemStorage('satoshi'); } public function testPersist() { - $storage = new EncryptedFilesystemStorage('satoshi'); - $storage->persist(new \Bitpay\PublicKey(vfsStream::url('tmp/public.key'))); - $this->assertTrue($this->root->hasChild('tmp/public.key')); + $this->storage->persist(new \Bitpay\PublicKey($this->pubkeyStream)); + $this->assertTrue($this->root->hasChild($this->pubkeyName)); } public function testLoad() { - $storage = new EncryptedFilesystemStorage('satoshi'); + //vfsStream::newFile('public.key') + // ->at($this->root) + // ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); - vfsStream::newFile('public.key') - ->at($this->root) - ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); - - $key = $storage->load(vfsStream::url('tmp/public.key')); + $key = $this->storage->load($this->pubkeyStream); $this->assertInstanceOf('Bitpay\PublicKey', $key); } @@ -41,8 +44,7 @@ public function testLoad() */ public function testNotFileException() { - $storage = new EncryptedFilesystemStorage('satoshi'); - $storage->load(vfsStream::url('tmp/public.key')); + $this->storage->load($this->pubkeyStream); } /** @@ -50,13 +52,13 @@ public function testNotFileException() */ public function testLoadNotReadableException() { - $storage = new EncryptedFilesystemStorage('satoshi'); - vfsStream::newFile('public.key', 0600) + vfsStream::newFile('badpublic.key', 0600) ->at($this->root) ->setContent('') ->chown(vfsStream::OWNER_ROOT) ->chgrp(vfsStream::GROUP_ROOT); - $storage->load(vfsStream::url('tmp/public.key')); + + $this->storage->load(vfsStream::url('tmp/badpublic.key')); } /** @@ -64,23 +66,22 @@ public function testLoadNotReadableException() */ public function testLoadCouldNotDecode() { - $storage = new EncryptedFilesystemStorage('satoshi'); - - vfsStream::newFile('public.key') + vfsStream::newFile('badpublic.key') ->at($this->root) ->setContent('00'); - $key = $storage->load(vfsStream::url('tmp/public.key')); + $key = $this->storage->load(vfsStream::url('tmp/badpublic.key')); $this->assertInstanceOf('Bitpay\PublicKey', $key); } public function testPersistAndLoadWithoutPassword() { $storage = new EncryptedFilesystemStorage(null); - $storage->persist(new \Bitpay\PublicKey(vfsStream::url('tmp/public.key'))); - $this->assertTrue($this->root->hasChild('tmp/public.key')); - $key = $storage->load(vfsStream::url('tmp/public.key')); + $storage->persist(new \Bitpay\PublicKey($this->pubkeyStream)); + $this->assertTrue($this->root->hasChild($this->pubkeyName)); + + $key = $storage->load($this->pubkeyStream); $this->assertInstanceOf('Bitpay\PublicKey', $key); } } From 9668ccdb93686f6085c2dddbf7fa3792cec05f32 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 17:44:24 -0400 Subject: [PATCH 086/164] Moved stream create order --- tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php index ea63f440..28088b3e 100644 --- a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php +++ b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php @@ -18,8 +18,8 @@ class EncryptedFilesystemStorageTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->pubkeyName = 'tmp/public.key'; - $this->pubkeyStream = vfsStream::url($this->pubkeyName); $this->root = vfsStream::setup('tmp'); + $this->pubkeyStream = vfsStream::url($this->pubkeyName); $this->storage = new EncryptedFilesystemStorage('satoshi'); } From a360bdeeee911fa671063293e67eb4069a310df6 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 17:54:26 -0400 Subject: [PATCH 087/164] Uncommented file creation test --- tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php index 28088b3e..28b03deb 100644 --- a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php +++ b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php @@ -31,9 +31,9 @@ public function testPersist() public function testLoad() { - //vfsStream::newFile('public.key') - // ->at($this->root) - // ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); + vfsStream::newFile('public.key') + ->at($this->root) + ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); $key = $this->storage->load($this->pubkeyStream); $this->assertInstanceOf('Bitpay\PublicKey', $key); From 87614cf4945db77e5f7c9a15592f4282b7d08b81 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 18:13:15 -0400 Subject: [PATCH 088/164] Fix to load test --- tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php index 28b03deb..0d2d671a 100644 --- a/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php +++ b/tests/Bitpay/Storage/EncryptedFilesystemStorageTest.php @@ -31,9 +31,11 @@ public function testPersist() public function testLoad() { - vfsStream::newFile('public.key') - ->at($this->root) - ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); + //vfsStream::newFile('public.key') + // ->at($this->root) + // ->setContent('8bc03b8e4272d47ea81d63c6571b8172072ed03203ff7cd3fd434c03f7994b5721363d0dda3cec833f6f263bde0ececa06b79f68d5616be18b8e9311c486223e18c7424daaa59991f4b10db9f2fb8b4c42896c50d216010b403d562738ef5a96'); + + $this->storage->persist(new \Bitpay\PublicKey($this->pubkeyStream)); $key = $this->storage->load($this->pubkeyStream); $this->assertInstanceOf('Bitpay\PublicKey', $key); From 3f95d2fe87f76ca5642cfdfce4889f9b8dc0a56a Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 18:39:56 -0400 Subject: [PATCH 089/164] Refactor to improve code quality --- .../Storage/EncryptedFilesystemStorage.php | 136 +++++++++++++----- 1 file changed, 100 insertions(+), 36 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 66b39383..b8ea982f 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -44,72 +44,136 @@ public function __construct($password) */ public function persist(\Bitpay\KeyInterface $key) { - $msg = ''; - $openssl_error_msg = ''; $path = $key->getId(); $data = serialize($key); + $encrypted = $this->dataEncrypt($data); + $encoded = $this->dataEncode($encrypted); + + $this->saveToFile($encoded, $path); + } + + /** + * @inheritdoc + */ + public function load($id) + { + $encoded = $this->readFromFile($id); + $decoded = $this->dataDecode($encoded); + $decrypted = $this->dataDecrypt($decoded); + + return unserialize($decrypted); + } + + /** + * @param string $data + * @return string + * @throws \Exception + */ + private function dataEncrypt($data) + { $encrypted = openssl_encrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($encrypted === false) { - while ($msg = openssl_error_string()) { - $openssl_error_msg .= $msg . "\r\n"; - $msg = ''; - } - - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $openssl_error_msg . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncrypt(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSSLErrors() . '".'); } - $encoded = base64_encode($encrypted); + return $encrypted; + } - if ($encoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not encode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); - } + /** + * @param string $data + * @return string + * @throws \Exception + */ + private function dataDecrypt($data) + { + $decrypted = openssl_decrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); - if (file_put_contents($path, $encoded) === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::persist(): Could not write to the file "' . $path . '".'); + if ($decrypted === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecrypt(): Could not decrypt key "' . $id . '" with data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSSLErrors() . '".'); } + + return $decrypted; } /** - * @inheritdoc + * @param string $data + * @return string + * @throws \Exception */ - public function load($id) + private function dataEncode($data) { - $msg = ''; - $openssl_error_msg = ''; + $encoded = base64_encode($data); - if (is_file($id) === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not find the file "' . $id . '".'); + if ($encoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncode(): Could not encode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); } - if (is_readable($id) === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): The file "' . $id . '" cannot be read, check permissions.'); + return $encoded; + } + + /** + * @param string $data + * @return string + * @throws \Exception + */ + private function dataDecode($data) + { + $decoded = base64_decode($data); + + if ($decoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecode(): Could not decode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); } - $encoded = file_get_contents($id); + return $decoded; + } - if ($encoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): The file "' . $id . '" cannot be read, check permissions.'); + /** + * @param string $data + * @param string $path + * @throws \Exception + */ + private function saveToFile($data, $path) + { + if (file_put_contents($path, $data) === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::saveToFile(): Could not write to the file "' . $path . '".'); + } + } + + /** + * @param string $path + * @return string + * @throws \Exception + */ + private function readFromFile($path) + { + if (is_file($path) === false || is_readable($path) === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $path . '" does not exist or cannot be read, check permissions.'); } - $decoded = base64_decode($encoded); + $data = file_get_contents($path); - if ($decoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decode encrypted data for key file "' . $id . '" with the data "' . $encoded . '".'); + if ($encoded === false) { + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $id . '" cannot be read, check permissions.'); } - $decrypted = openssl_decrypt($decoded, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); + return $data; + } - if ($decrypted === false) { - while ($msg = openssl_error_string()) { - $openssl_error_msg .= $msg . "\r\n"; - $msg = ''; - } + /** + * @return string + */ + private function getOpenSSLErrors() + { + $msg = ''; + $openssl_error_msg = ''; - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::load(): Could not decrypt key "' . $id . '" with data "' . $decoded . '". OpenSSL error(s) are: "' . $openssl_error_msg . '".'); + while ($msg = openssl_error_string()) { + $openssl_error_msg .= $msg . "\r\n"; + $msg = ''; } - return unserialize($decrypted); + return $openssl_error_msg; } } From 0ae18e763b172d8eba52135f9483813b9b69c26a Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 18:44:30 -0400 Subject: [PATCH 090/164] Corrected variable name --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index b8ea982f..88b0b565 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -154,7 +154,7 @@ private function readFromFile($path) $data = file_get_contents($path); - if ($encoded === false) { + if ($data === false) { throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $id . '" cannot be read, check permissions.'); } From 2c854bdd44c5c6a3b1bc56e00fd9452d4e43f986 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 18:46:22 -0400 Subject: [PATCH 091/164] Corrected camel case method name --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 88b0b565..d721f1eb 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -75,7 +75,7 @@ private function dataEncrypt($data) $encrypted = openssl_encrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($encrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncrypt(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSSLErrors() . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncrypt(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); } return $encrypted; @@ -91,7 +91,7 @@ private function dataDecrypt($data) $decrypted = openssl_decrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($decrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecrypt(): Could not decrypt key "' . $id . '" with data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSSLErrors() . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecrypt(): Could not decrypt key "' . $id . '" with data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); } return $decrypted; @@ -164,7 +164,7 @@ private function readFromFile($path) /** * @return string */ - private function getOpenSSLErrors() + private function getOpenSslErrors() { $msg = ''; $openssl_error_msg = ''; From feef9081de8239dd97603cc25b1e3b8a5c560daf Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 18:59:10 -0400 Subject: [PATCH 092/164] Removed unneeded variables in exception handling --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index d721f1eb..76e9d745 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -75,7 +75,7 @@ private function dataEncrypt($data) $encrypted = openssl_encrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($encrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncrypt(): Could not encrypt data for key file "' . $id . '" with the data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncrypt(): Could not encrypt data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); } return $encrypted; @@ -91,7 +91,7 @@ private function dataDecrypt($data) $decrypted = openssl_decrypt($data, self::METHOD, $this->password, self::OPENSSL_RAW_DATA, self::IV); if ($decrypted === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecrypt(): Could not decrypt key "' . $id . '" with data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecrypt(): Could not decrypt data "' . $data . '". OpenSSL error(s) are: "' . $this->getOpenSslErrors() . '".'); } return $decrypted; @@ -107,7 +107,7 @@ private function dataEncode($data) $encoded = base64_encode($data); if ($encoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncode(): Could not encode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataEncode(): Could not encode data "' . $data . '".'); } return $encoded; @@ -123,7 +123,7 @@ private function dataDecode($data) $decoded = base64_decode($data); if ($decoded === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecode(): Could not decode encrypted data for key file "' . $id . '" with the data "' . $data . '".'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::dataDecode(): Could not decode data "' . $data . '".'); } return $decoded; @@ -155,7 +155,7 @@ private function readFromFile($path) $data = file_get_contents($path); if ($data === false) { - throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $id . '" cannot be read, check permissions.'); + throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $path . '" cannot be read, check permissions.'); } return $data; From 6fad9f6b78758999447d2f34073dd4b62ffc3d46 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:03:19 -0400 Subject: [PATCH 093/164] Removed white space for PSR check --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 76e9d745..5e42d252 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -158,7 +158,7 @@ private function readFromFile($path) throw new \Exception('[ERROR] In EncryptedFilesystemStorage::readFromFile(): The file "' . $path . '" cannot be read, check permissions.'); } - return $data; + return $data; } /** From 70df1190ba377119e919f9ab43f2c711a97eed19 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:07:02 -0400 Subject: [PATCH 094/164] Corrected return method types --- src/Bitpay/Application.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Bitpay/Application.php b/src/Bitpay/Application.php index 2e6931ca..85bcea9f 100644 --- a/src/Bitpay/Application.php +++ b/src/Bitpay/Application.php @@ -22,8 +22,6 @@ class Application implements ApplicationInterface */ protected $orgs; - /** - */ public function __construct() { $this->users = array(); @@ -49,9 +47,8 @@ public function getOrgs() /** * Add user to stack * - * @param UserInterface $user - * - * @return ApplicationInterface + * @param User $user + * @return Application */ public function addUser(UserInterface $user) { @@ -65,9 +62,8 @@ public function addUser(UserInterface $user) /** * Add org to stack * - * @param OrgInterface $org - * - * @return ApplicationInterface + * @param Org $org + * @return Application */ public function addOrg(OrgInterface $org) { From 1e72d49bfc658b8c2d07098ff357820328027681 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:14:06 -0400 Subject: [PATCH 095/164] Updated copyright year and minor refactoring also added return value checks for registering and unregistering the autoloader. --- src/Bitpay/Autoloader.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Bitpay/Autoloader.php b/src/Bitpay/Autoloader.php index 415635b8..b577803e 100644 --- a/src/Bitpay/Autoloader.php +++ b/src/Bitpay/Autoloader.php @@ -1,6 +1,6 @@ Date: Wed, 16 Sep 2015 19:17:09 -0400 Subject: [PATCH 096/164] Updated copyright year and minor refactoring --- src/Bitpay/Bill.php | 49 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/src/Bitpay/Bill.php b/src/Bitpay/Bill.php index a3203d93..b22b6e9d 100644 --- a/src/Bitpay/Bill.php +++ b/src/Bitpay/Bill.php @@ -1,6 +1,6 @@ address = array(); @@ -96,9 +94,8 @@ public function getItems() } /** - * @param ItemInterface $item - * - * @return BillInterface + * @param Item $item + * @return Bill */ public function addItem(ItemInterface $item) { @@ -118,9 +115,8 @@ public function getCurrency() } /** - * @param CurrencyInterface $currency - * - * @return BillInterface + * @param Currency $currency + * @return Bill */ public function setCurrency(CurrencyInterface $currency) { @@ -141,8 +137,7 @@ public function getName() /** * @param string $name - * - * @return BillInterface + * @return Bill */ public function setName($name) { @@ -163,8 +158,7 @@ public function getAddress() /** * @param array $address - * - * @return BillInterface + * @return Bill */ public function setAddress($address) { @@ -185,8 +179,7 @@ public function getCity() /** * @param string $city - * - * @return BillInterface + * @return Bill */ public function setCity($city) { @@ -207,8 +200,7 @@ public function getState() /** * @param string $state - * - * @return BillInterface + * @return Bill */ public function setState($state) { @@ -229,8 +221,7 @@ public function getZip() /** * @param string $zip - * - * @return BillInterface + * @return Bill */ public function setZip($zip) { @@ -251,8 +242,7 @@ public function getCountry() /** * @param string $country - * - * @return BillInterface + * @return Bill */ public function setCountry($country) { @@ -273,8 +263,7 @@ public function getEmail() /** * @param string $email - * - * @return BillInterface + * @return Bill */ public function setEmail($email) { @@ -295,8 +284,7 @@ public function getPhone() /** * @param string $phone - * - * @return BillInterface + * @return Bill */ public function setPhone($phone) { @@ -317,8 +305,7 @@ public function getStatus() /** * @param string $status - * - * @return BillInterface + * @return Bill */ public function setStatus($status) { @@ -339,8 +326,7 @@ public function getShowRate() /** * @param string $showRate - * - * @return BillInterface + * @return Bill */ public function setShowRate($showRate) { @@ -361,8 +347,7 @@ public function getArchived() /** * @param boolean $archived - * - * @return BillInterface + * @return Bill */ public function setArchived($archived) { From 97c4344237be30686afe2c4a0c6f078ba5a7f7e0 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:20:27 -0400 Subject: [PATCH 097/164] Added param to ignore autloader unregister fails --- src/Bitpay/Autoloader.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Autoloader.php b/src/Bitpay/Autoloader.php index b577803e..ebdea46a 100644 --- a/src/Bitpay/Autoloader.php +++ b/src/Bitpay/Autoloader.php @@ -31,12 +31,15 @@ public static function register($prepend = true) /** * Unregister this autoloader. * + * @param boolean $ignoreFailures * @throws \Exception */ - public static function unregister() + public static function unregister($ignoreFailures = true) { if (false === spl_autoload_unregister(array(__CLASS__, 'autoload'))) { - throw new \Exception('[ERROR] In Autoloader::unregister(): Call to spl_autoload_unregister() failed.'); + if ($ignoreFailures === false) { + throw new \Exception('[ERROR] In Autoloader::unregister(): Call to spl_autoload_unregister() failed.'); + } } } From 701129a81109e9ecffa7ee4324408ef5b5b8147f Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:22:57 -0400 Subject: [PATCH 098/164] Corrected method parameter types --- src/Bitpay/Application.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Application.php b/src/Bitpay/Application.php index 85bcea9f..10c2d923 100644 --- a/src/Bitpay/Application.php +++ b/src/Bitpay/Application.php @@ -7,7 +7,6 @@ namespace Bitpay; /** - * * @package Bitpay */ class Application implements ApplicationInterface @@ -50,7 +49,7 @@ public function getOrgs() * @param User $user * @return Application */ - public function addUser(UserInterface $user) + public function addUser(User $user) { if (!empty($user)) { $this->users[] = $user; @@ -65,7 +64,7 @@ public function addUser(UserInterface $user) * @param Org $org * @return Application */ - public function addOrg(OrgInterface $org) + public function addOrg(Org $org) { if (!empty($org)) { $this->orgs[] = $org; From 80e710c5210d34b39a781a9c1a1b840c60948d1a Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:23:57 -0400 Subject: [PATCH 099/164] Corrected method parameter types --- src/Bitpay/Bill.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Bill.php b/src/Bitpay/Bill.php index b22b6e9d..02b4660e 100644 --- a/src/Bitpay/Bill.php +++ b/src/Bitpay/Bill.php @@ -97,7 +97,7 @@ public function getItems() * @param Item $item * @return Bill */ - public function addItem(ItemInterface $item) + public function addItem(Item $item) { if (!empty($item)) { $this->items[] = $item; @@ -118,7 +118,7 @@ public function getCurrency() * @param Currency $currency * @return Bill */ - public function setCurrency(CurrencyInterface $currency) + public function setCurrency(Currency $currency) { if (!empty($currency)) { $this->currency = $currency; From d4902d9cf07a29d5391acb6f0fde1e06479384d2 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:29:51 -0400 Subject: [PATCH 100/164] Corrected class types --- tests/Bitpay/ApplicationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bitpay/ApplicationTest.php b/tests/Bitpay/ApplicationTest.php index 8c9f4905..23627b72 100644 --- a/tests/Bitpay/ApplicationTest.php +++ b/tests/Bitpay/ApplicationTest.php @@ -56,11 +56,11 @@ public function testAddOrg() private function getMockUser() { - return $this->getMock('Bitpay\UserInterface'); + return $this->getMock('Bitpay\User'); } private function getMockOrg() { - return $this->getMock('Bitpay\OrgInterface'); + return $this->getMock('Bitpay\Org'); } } From f84b9ec3bd3f2ad8518cb15f4a566c374453ef3d Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:30:15 -0400 Subject: [PATCH 101/164] Updated copyright year and minor refactoring also corrected method parameter & return types --- src/Bitpay/Bitpay.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/Bitpay/Bitpay.php b/src/Bitpay/Bitpay.php index 918b9d66..9c6634ff 100644 --- a/src/Bitpay/Bitpay.php +++ b/src/Bitpay/Bitpay.php @@ -1,6 +1,6 @@ container = $container; @@ -50,6 +50,8 @@ public function __construct($config = array(), ContainerInterface $container = n /** * Initialize the container + * + * @param array|string $config */ protected function initializeContainer($config) { @@ -58,7 +60,10 @@ protected function initializeContainer($config) } /** - * Build the container of services and parameters + * Build the container of services and parameters. + * + * @param array|string $config + * @return Container */ protected function buildContainer($config) { @@ -70,6 +75,9 @@ protected function buildContainer($config) return $container; } + /** + * @return array + */ protected function getParameters() { return array( @@ -78,8 +86,9 @@ protected function getParameters() } /** + * @param Container $container */ - private function prepareContainer(ContainerInterface $container) + private function prepareContainer(Container $container) { foreach ($this->getDefaultExtensions() as $ext) { $container->registerExtension($ext); @@ -88,10 +97,10 @@ private function prepareContainer(ContainerInterface $container) } /** - * @param ContainerInterface $container - * @return LoaderInterface + * @param Container $container + * @return DelegatingLoader */ - private function getContainerLoader(ContainerInterface $container) + private function getContainerLoader(Container $container) { $locator = new FileLocator(); $resolver = new LoaderResolver( @@ -105,7 +114,7 @@ private function getContainerLoader(ContainerInterface $container) } /** - * Returns an array of the default extensions + * Returns an array of the default extensions. * * @return array */ @@ -117,7 +126,7 @@ private function getDefaultExtensions() } /** - * @return ContainerInterface + * @return Container */ public function getContainer() { From a0facda4d9acf058c0fe24dfefdb7868a3393fd3 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:31:21 -0400 Subject: [PATCH 102/164] Updated copyright year and minor refactoring --- src/Bitpay/ApplicationInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/ApplicationInterface.php b/src/Bitpay/ApplicationInterface.php index 63dbbee5..89480994 100644 --- a/src/Bitpay/ApplicationInterface.php +++ b/src/Bitpay/ApplicationInterface.php @@ -1,13 +1,13 @@ Date: Wed, 16 Sep 2015 19:31:58 -0400 Subject: [PATCH 103/164] Updated copyright year and minor refactoring --- src/Bitpay/BillInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/BillInterface.php b/src/Bitpay/BillInterface.php index a957fe82..17cffa11 100644 --- a/src/Bitpay/BillInterface.php +++ b/src/Bitpay/BillInterface.php @@ -1,13 +1,13 @@ Date: Wed, 16 Sep 2015 19:32:28 -0400 Subject: [PATCH 104/164] Updated copyright year and minor refactoring --- src/Bitpay/Buyer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Buyer.php b/src/Bitpay/Buyer.php index a065c961..82681b62 100644 --- a/src/Bitpay/Buyer.php +++ b/src/Bitpay/Buyer.php @@ -1,6 +1,6 @@ Date: Wed, 16 Sep 2015 19:33:45 -0400 Subject: [PATCH 105/164] Corrected class types --- tests/Bitpay/BillTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bitpay/BillTest.php b/tests/Bitpay/BillTest.php index 438e7236..0c78b453 100644 --- a/tests/Bitpay/BillTest.php +++ b/tests/Bitpay/BillTest.php @@ -232,11 +232,11 @@ public function testSetArchived() private function getMockItem() { - return $this->getMock('Bitpay\ItemInterface'); + return $this->getMock('Bitpay\Item'); } private function getMockCurrency() { - return $this->getMock('Bitpay\CurrencyInterface'); + return $this->getMock('Bitpay\Currency'); } } From 5503814aa671808469fa63793eb973f278199e60 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:34:56 -0400 Subject: [PATCH 106/164] Corrected class types --- tests/Bitpay/BillTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bitpay/BillTest.php b/tests/Bitpay/BillTest.php index 0c78b453..231458fa 100644 --- a/tests/Bitpay/BillTest.php +++ b/tests/Bitpay/BillTest.php @@ -35,7 +35,7 @@ public function testAddItem() public function testGetCurrency() { $this->assertNotNull($this->bill); - $this->assertInstanceOf('Bitpay\CurrencyInterface', $this->bill->getCurrency()); + $this->assertInstanceOf('Bitpay\Currency', $this->bill->getCurrency()); } /** @@ -45,7 +45,7 @@ public function testSetCurrency() { $this->assertNotNull($this->bill); $this->bill->setCurrency($this->getMockCurrency()); - $this->assertInstanceOf('Bitpay\CurrencyInterface', $this->bill->getCurrency()); + $this->assertInstanceOf('Bitpay\Currency', $this->bill->getCurrency()); } public function testGetName() From 5cafe38f809f89d0fcec26360ecb16182e3f4706 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:35:42 -0400 Subject: [PATCH 107/164] Updated copyright year and minor refactoring --- src/Bitpay/BuyerInterface.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/BuyerInterface.php b/src/Bitpay/BuyerInterface.php index 6e76b665..049dc09e 100644 --- a/src/Bitpay/BuyerInterface.php +++ b/src/Bitpay/BuyerInterface.php @@ -1,13 +1,12 @@ Date: Wed, 16 Sep 2015 19:41:53 -0400 Subject: [PATCH 108/164] Corrected class types --- tests/Bitpay/BitpayTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/BitpayTest.php b/tests/Bitpay/BitpayTest.php index d75d69f7..da4ac4ac 100644 --- a/tests/Bitpay/BitpayTest.php +++ b/tests/Bitpay/BitpayTest.php @@ -37,7 +37,7 @@ public function testConstruct() public function testGetContainer() { $bitpay = new \Bitpay\Bitpay(); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $bitpay->getContainer()); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Container', $bitpay->getContainer()); } public function testGet() From 654184bc2af149e2f89d68058d7bc81bf2beb54d Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:48:43 -0400 Subject: [PATCH 109/164] Updated currency list with new values --- src/Bitpay/Currency.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Bitpay/Currency.php b/src/Bitpay/Currency.php index faab33ba..f2bb33a1 100644 --- a/src/Bitpay/Currency.php +++ b/src/Bitpay/Currency.php @@ -1,6 +1,6 @@ Date: Wed, 16 Sep 2015 19:50:55 -0400 Subject: [PATCH 110/164] Corrected method parameter types --- src/Bitpay/Bitpay.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/Bitpay.php b/src/Bitpay/Bitpay.php index 9c6634ff..51e946ac 100644 --- a/src/Bitpay/Bitpay.php +++ b/src/Bitpay/Bitpay.php @@ -37,9 +37,9 @@ class Bitpay * The second argument is the container if you want to build one by hand. * * @param array|string $config - * @param Container $container + * @param ContainerBuilder $container */ - public function __construct($config = array(), Container $container = null) + public function __construct($config = array(), ContainerBuilder $container = null) { $this->container = $container; @@ -63,7 +63,7 @@ protected function initializeContainer($config) * Build the container of services and parameters. * * @param array|string $config - * @return Container + * @return ContainerBuilder */ protected function buildContainer($config) { @@ -86,9 +86,9 @@ protected function getParameters() } /** - * @param Container $container + * @param ContainerBuilder $container */ - private function prepareContainer(Container $container) + private function prepareContainer(ContainerBuilder $container) { foreach ($this->getDefaultExtensions() as $ext) { $container->registerExtension($ext); From 6641f919dae7a56ab7191c1e636036088ae06924 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:56:26 -0400 Subject: [PATCH 111/164] Corrected class types --- tests/Bitpay/BitpayTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/BitpayTest.php b/tests/Bitpay/BitpayTest.php index da4ac4ac..7aa3e65d 100644 --- a/tests/Bitpay/BitpayTest.php +++ b/tests/Bitpay/BitpayTest.php @@ -37,7 +37,7 @@ public function testConstruct() public function testGetContainer() { $bitpay = new \Bitpay\Bitpay(); - $this->assertInstanceOf('Symfony\Component\DependencyInjection\Container', $bitpay->getContainer()); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $bitpay->getContainer()); } public function testGet() From ff7876fe3a7448d488ffc19654d69e9da052118c Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 19:59:43 -0400 Subject: [PATCH 112/164] Refactor to improve code quality --- src/Bitpay/Client/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 29ae8840..8e323bd8 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -523,7 +523,7 @@ public function getTokens() public function createToken(array $payload = array()) { if (isset($payload['pairingCode']) && 1 !== preg_match('/^[a-zA-Z0-9]{7}$/', $payload['pairingCode'])) { - throw new ArgumentException("pairing code is not legal"); + throw new \ArgumentException('[ERROR] In Client::createToken(): The pairing code provided is not legal.'); } $this->request = $this->createNewRequest(); @@ -538,7 +538,7 @@ public function createToken(array $payload = array()) $body = json_decode($this->response->getBody(), true); if (isset($body['error'])) { - throw new \Bitpay\Client\BitpayException($this->response->getStatusCode() . ": " . $body['error']); + throw new \Bitpay\Client\BitpayException($this->response->getStatusCode() . ': ' . $body['error']); } $tkn = $body['data'][0]; From 10b8cecaedfa995860a3107b6a4ca284af9ece3f Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 20:01:56 -0400 Subject: [PATCH 113/164] Updated copyright year and minor refactoring --- src/Bitpay/Item.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Bitpay/Item.php b/src/Bitpay/Item.php index 68375022..a34154fd 100644 --- a/src/Bitpay/Item.php +++ b/src/Bitpay/Item.php @@ -9,7 +9,6 @@ use Bitpay\Client; /** - * * @package Bitpay */ class Item implements ItemInterface @@ -39,8 +38,6 @@ class Item implements ItemInterface */ protected $physical; - /** - */ public function __construct() { $this->physical = false; @@ -56,7 +53,6 @@ public function getCode() /** * @param string $code - * * @return ItemInterface */ public function setCode($code) @@ -76,7 +72,6 @@ public function getDescription() /** * @param string $description - * * @return ItemInterface */ public function setDescription($description) @@ -88,8 +83,6 @@ public function setDescription($description) /** * @inheritdoc - * - * @return float */ public function getPrice() { @@ -98,8 +91,7 @@ public function getPrice() /** * @param mixed $price A float, integer, or en_US formatted numeric string - * - * @return ItemInterface + * @return Item */ public function setPrice($price) { @@ -122,8 +114,7 @@ public function getQuantity() /** * @param integer $quantity - * - * @return ItemInterface + * @return Item */ public function setQuantity($quantity) { @@ -142,8 +133,7 @@ public function isPhysical() /** * @param boolean $physical - * - * @return ItemInterface + * @return Item */ public function setPhysical($physical) { @@ -162,7 +152,7 @@ public function setPhysical($physical) protected function checkPriceFormat($price) { if (preg_match('/^[0-9]+?[\.,][0-9]{1,6}?$/', $price) !== 1) { - throw new \Bitpay\Client\ArgumentException("Price must be formatted as a float"); + throw new \Bitpay\Client\ArgumentException('[ERROR] In Item::checkPriceFormat(): Price value must be formatted as a float.'); } } } From 0fbb661de98258b10eb70b1424da67373465095f Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 20:03:28 -0400 Subject: [PATCH 114/164] Corrected class types --- src/Bitpay/Bitpay.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Bitpay.php b/src/Bitpay/Bitpay.php index 51e946ac..303abc73 100644 --- a/src/Bitpay/Bitpay.php +++ b/src/Bitpay/Bitpay.php @@ -25,7 +25,7 @@ class Bitpay { /** - * @var Container + * @var ContainerBuilder */ protected $container; @@ -37,7 +37,7 @@ class Bitpay * The second argument is the container if you want to build one by hand. * * @param array|string $config - * @param ContainerBuilder $container + * @param null|ContainerBuilder $container */ public function __construct($config = array(), ContainerBuilder $container = null) { From b1382029d2ab4593b06318e95afb905666a6d424 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 20:05:51 -0400 Subject: [PATCH 115/164] Updated exception message with more info --- src/Bitpay/Client/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 8e323bd8..ddbb4e91 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -523,7 +523,7 @@ public function getTokens() public function createToken(array $payload = array()) { if (isset($payload['pairingCode']) && 1 !== preg_match('/^[a-zA-Z0-9]{7}$/', $payload['pairingCode'])) { - throw new \ArgumentException('[ERROR] In Client::createToken(): The pairing code provided is not legal.'); + throw new \Exception('[ERROR] In Client::createToken(): The pairing code provided is not legal.'); } $this->request = $this->createNewRequest(); @@ -654,7 +654,7 @@ public function sendRequest(RequestInterface $request) protected function addIdentityHeader(RequestInterface $request) { if (null === $this->publicKey) { - throw new \Exception('Please set your Public Key.'); + throw new \Exception('[ERROR] In Client::addIdentityHeader(): No public key value found. Please set your kublic key first before you can add the x-identity header.'); } $request->setHeader('x-identity', (string) $this->publicKey); From 2204e5e42a28c63b1456639d70b71a1e81276e72 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Wed, 16 Sep 2015 20:07:59 -0400 Subject: [PATCH 116/164] Corrected method parameter types --- src/Bitpay/Client/Adapter/CurlAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 3f882a5e..2a544f31 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -90,7 +90,7 @@ public function sendRequest(RequestInterface $request) * @param Request $request * @return array */ - private function getCurlDefaultOptions(RequestInterface $request) + private function getCurlDefaultOptions(Request $request) { return array( CURLOPT_URL => $request->getUri(), From 2486247fd6e3257b4ccd1d01a9d9e7c160919275 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:05:08 -0400 Subject: [PATCH 117/164] Corrected class types --- src/Bitpay/Bitpay.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Bitpay.php b/src/Bitpay/Bitpay.php index 303abc73..14cadd84 100644 --- a/src/Bitpay/Bitpay.php +++ b/src/Bitpay/Bitpay.php @@ -97,10 +97,10 @@ private function prepareContainer(ContainerBuilder $container) } /** - * @param Container $container + * @param ContainerBuilder $container * @return DelegatingLoader */ - private function getContainerLoader(Container $container) + private function getContainerLoader(ContainerBuilder $container) { $locator = new FileLocator(); $resolver = new LoaderResolver( From 58dd99921b19d3ffc8d31d4b27e0c0e18a36fed3 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:32:22 -0400 Subject: [PATCH 118/164] Corrected class types --- src/Bitpay/Client/Adapter/AdapterInterface.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bitpay/Client/Adapter/AdapterInterface.php b/src/Bitpay/Client/Adapter/AdapterInterface.php index b4c2df7b..9e8b1c28 100644 --- a/src/Bitpay/Client/Adapter/AdapterInterface.php +++ b/src/Bitpay/Client/Adapter/AdapterInterface.php @@ -18,10 +18,10 @@ interface AdapterInterface { /** - * Send request to BitPay + * Send a request to BitPay. * - * @param RequestInterface $request - * @return ResponseInterface + * @param \Bitpay\Client\Adapter\Request $request + * @return Response */ - public function sendRequest(RequestInterface $request); + public function sendRequest(\Bitpay\Client\Adapter\Request $request); } From 6827953da03a8436e2144f689d1ff3f6c112fdce Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:32:46 -0400 Subject: [PATCH 119/164] Updated copyright year and minor refactoring and corrected parameter type. --- src/Bitpay/Client/Adapter/CurlAdapter.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 2a544f31..8efc0d3f 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -43,14 +43,18 @@ public function getCurlOptions() /** * @inheritdoc */ - public function sendRequest(RequestInterface $request) + public function sendRequest(\Bitpay\Client\Adapter\Request $request) { $curl = curl_init(); + if ($curl === false) { + throw new \Exception('[ERROR] In CurlAdapter::sendRequest(): Could not initialize cURL.'); + } + $default_curl_options = $this->getCurlDefaultOptions($request); foreach ($this->getCurlOptions() as $curl_option_key => $curl_option_value) { - if (!is_null($curl_option_value)) { + if (is_null($curl_option_value) === false) { $default_curl_options[$curl_option_key] = $curl_option_value; } } @@ -69,14 +73,14 @@ public function sendRequest(RequestInterface $request) $raw = curl_exec($curl); - if (false === $raw) { + if ($raw === false) { $errorMessage = curl_error($curl); curl_close($curl); - throw new \Bitpay\Client\ConnectionException($errorMessage); + throw new \Exception('[ERROR] In CurlAdapter::sendRequest(): curl_exec failed with the error "' . $errorMessage . '".'); } - /** @var ResponseInterface */ + /** @var Response */ $response = Response::createFromRawResponse($raw); curl_close($curl); @@ -87,10 +91,10 @@ public function sendRequest(RequestInterface $request) /** * Returns an array of default cURL settings to use. * - * @param Request $request + * @param \Bitpay\Client\Adapter\Request $request * @return array */ - private function getCurlDefaultOptions(Request $request) + private function getCurlDefaultOptions(\Bitpay\Client\Adapter\Request $request) { return array( CURLOPT_URL => $request->getUri(), @@ -100,7 +104,7 @@ private function getCurlDefaultOptions(Request $request) CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYPEER => 1, CURLOPT_SSL_VERIFYHOST => 2, - CURLOPT_CAINFO => __DIR__.'/ca-bundle.crt', + CURLOPT_CAINFO => __DIR__ . '/ca-bundle.crt', CURLOPT_RETURNTRANSFER => true, CURLOPT_FORBID_REUSE => 1, CURLOPT_FRESH_CONNECT => 1, From d74d6dba115448b4b6ee2228ec1f505f95dd86fa Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:36:59 -0400 Subject: [PATCH 120/164] Corrected class types --- src/Bitpay/Client/Adapter/AdapterInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Adapter/AdapterInterface.php b/src/Bitpay/Client/Adapter/AdapterInterface.php index 9e8b1c28..77a8b66f 100644 --- a/src/Bitpay/Client/Adapter/AdapterInterface.php +++ b/src/Bitpay/Client/Adapter/AdapterInterface.php @@ -20,8 +20,8 @@ interface AdapterInterface /** * Send a request to BitPay. * - * @param \Bitpay\Client\Adapter\Request $request + * @param Request $request * @return Response */ - public function sendRequest(\Bitpay\Client\Adapter\Request $request); + public function sendRequest(Request $request); } From b4b377c77c457f2b6f69e00c705421610ce37c84 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:37:16 -0400 Subject: [PATCH 121/164] Corrected class types --- src/Bitpay/Client/Adapter/CurlAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 8efc0d3f..07455769 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -43,7 +43,7 @@ public function getCurlOptions() /** * @inheritdoc */ - public function sendRequest(\Bitpay\Client\Adapter\Request $request) + public function sendRequest(Request $request) { $curl = curl_init(); From 8c02b57175a0dcbb8cbcf571abe733473b7e28fd Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:42:18 -0400 Subject: [PATCH 122/164] Corrected class types --- src/Bitpay/Client/Adapter/AdapterInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/Adapter/AdapterInterface.php b/src/Bitpay/Client/Adapter/AdapterInterface.php index 77a8b66f..1304a3e8 100644 --- a/src/Bitpay/Client/Adapter/AdapterInterface.php +++ b/src/Bitpay/Client/Adapter/AdapterInterface.php @@ -23,5 +23,5 @@ interface AdapterInterface * @param Request $request * @return Response */ - public function sendRequest(Request $request); + public function sendRequest(\Bitpay\Client\Request $request); } From e30a00a40536da1cd760479236fd897c469853fb Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:42:38 -0400 Subject: [PATCH 123/164] Corrected class types --- src/Bitpay/Client/Adapter/CurlAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 07455769..50d6e8bc 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -43,7 +43,7 @@ public function getCurlOptions() /** * @inheritdoc */ - public function sendRequest(Request $request) + public function sendRequest(\Bitpay\Client\Request $request) { $curl = curl_init(); From 344adcf98f89c76a2b3f95debefcdc147929cf4f Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:46:18 -0400 Subject: [PATCH 124/164] Updated copyright year and minor refactoring --- src/Bitpay/CurrencyInterface.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Bitpay/CurrencyInterface.php b/src/Bitpay/CurrencyInterface.php index 0eb1e625..c5dc909f 100644 --- a/src/Bitpay/CurrencyInterface.php +++ b/src/Bitpay/CurrencyInterface.php @@ -1,15 +1,14 @@ Date: Tue, 22 Sep 2015 12:48:21 -0400 Subject: [PATCH 125/164] Corrected class types --- src/Bitpay/Client/Adapter/CurlAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Adapter/CurlAdapter.php b/src/Bitpay/Client/Adapter/CurlAdapter.php index 50d6e8bc..d0c8c7c8 100644 --- a/src/Bitpay/Client/Adapter/CurlAdapter.php +++ b/src/Bitpay/Client/Adapter/CurlAdapter.php @@ -91,10 +91,10 @@ public function sendRequest(\Bitpay\Client\Request $request) /** * Returns an array of default cURL settings to use. * - * @param \Bitpay\Client\Adapter\Request $request + * @param \Bitpay\Client\Request $request * @return array */ - private function getCurlDefaultOptions(\Bitpay\Client\Adapter\Request $request) + private function getCurlDefaultOptions(\Bitpay\Client\Request $request) { return array( CURLOPT_URL => $request->getUri(), From cde7566614bff1f6f76e47b90be48013cc5dd6a4 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 12:56:19 -0400 Subject: [PATCH 126/164] Corrected exception type --- tests/Bitpay/Client/Adapter/CurlAdapterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/Client/Adapter/CurlAdapterTest.php b/tests/Bitpay/Client/Adapter/CurlAdapterTest.php index e00bb378..7eef08dc 100644 --- a/tests/Bitpay/Client/Adapter/CurlAdapterTest.php +++ b/tests/Bitpay/Client/Adapter/CurlAdapterTest.php @@ -31,7 +31,7 @@ public function testGetCurlOptions() public function testSendRequestWithException() { - $this->setExpectedException('Bitpay\Client\ConnectionException'); + $this->setExpectedException('\Exception'); $curl_options = array( CURLOPT_URL => "www.example.com", From 713f46b70b27e544d05a623737c7f66ddefc35da Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:27:14 -0400 Subject: [PATCH 127/164] Corrected namespace scope in documentation --- src/Bitpay/Client/Adapter/AdapterInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Adapter/AdapterInterface.php b/src/Bitpay/Client/Adapter/AdapterInterface.php index 1304a3e8..6e251b31 100644 --- a/src/Bitpay/Client/Adapter/AdapterInterface.php +++ b/src/Bitpay/Client/Adapter/AdapterInterface.php @@ -20,8 +20,8 @@ interface AdapterInterface /** * Send a request to BitPay. * - * @param Request $request - * @return Response + * @param \Bitpay\Client\Request $request + * @return \Bitpay\Client\Response */ public function sendRequest(\Bitpay\Client\Request $request); } From 35ae47f04fc443f6a4156374b12926ffdbd2f4ab Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:29:04 -0400 Subject: [PATCH 128/164] Updated copyright year and minor refactoring also moved hardcoded default configuration values to class properties. --- src/Bitpay/Config/Configuration.php | 69 ++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/src/Bitpay/Config/Configuration.php b/src/Bitpay/Config/Configuration.php index 6a6100ea..1029c6ee 100644 --- a/src/Bitpay/Config/Configuration.php +++ b/src/Bitpay/Config/Configuration.php @@ -1,6 +1,6 @@ root('bitpay'); + $rootNode ->children() ->scalarNode('public_key') ->info('Public Key Filename') - ->defaultValue(getenv('HOME').'/.bitpay/api.pub') + ->defaultValue($this->getPubKeyFilename()) ->end() ->scalarNode('private_key') ->info('Private Key Filename') - ->defaultValue(getenv('HOME').'/.bitpay/api.key') + ->defaultValue($this->getPriKeyFilename()) ->end() ->scalarNode('sin_key') - ->info('Private Key Filename') - ->defaultValue(getenv('HOME').'/.bitpay/api.sin') + ->info('SIN Filename') + ->defaultValue($this->getSinKeyFilename()) ->end() ->enumNode('network') - ->values(array('livenet', 'testnet')) + ->values($this->networks) ->info('Network') - ->defaultValue('livenet') + ->defaultValue($this->networks[0]) ->end() ->enumNode('adapter') - ->values(array('curl', 'mock')) + ->values($this->adapters) ->info('Client Adapter') - ->defaultValue('curl') + ->defaultValue($this->adapters[0]) ->end() ->append($this->addKeyStorageNode()) ->scalarNode('key_storage_password') @@ -61,11 +69,13 @@ public function getConfigTreeBuilder() } /** - * Adds the key_storage node with validation rules - * + * Adds the key_storage node with validation rules. * key_storage MUST: * * implement Bitpay\Storage\StorageInterface * * be a class that can be loaded + * + * @return TreeBuilder + * @throws \Exception */ protected function addKeyStorageNode() { @@ -74,7 +84,7 @@ protected function addKeyStorageNode() $node ->info('Class that is used to store your keys') - ->defaultValue('Bitpay\Storage\EncryptedFilesystemStorage') + ->defaultValue($this->defstorage) ->validate() ->always() ->then(function ($value) { @@ -88,13 +98,8 @@ protected function addKeyStorageNode() } // requires PHP >= 5.3.7 - if (!is_subclass_of($value, 'Bitpay\Storage\StorageInterface')) { - throw new \Exception( - sprintf( - '"%s" does not implement "Bitpay\Storage\StorageInterface"', - $value - ) - ); + if (is_subclass_of($value, 'Bitpay\Storage\StorageInterface') === false) { + throw new \Exception('[ERROR] In Configuration::addKeyStorageNode(): "' . $value . '" does not implement "Bitpay\Storage\StorageInterface".'); } return $value; @@ -103,4 +108,28 @@ protected function addKeyStorageNode() return $node; } + + /** + * @return string + */ + private function getPubKeyFilename() + { + return getenv('HOME') . $this->pubfilename; + } + + /** + * @return string + */ + private function getPriKeyFilename() + { + return getenv('HOME') . $this->prifilename; + } + + /** + * @return string + */ + private function getSinFilename() + { + return getenv('HOME') . $this->sinfilename; + } } From e796d8ee0ccc64722adf7550e989c0d4b38ab32a Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:33:36 -0400 Subject: [PATCH 129/164] Corrected typo in method name --- src/Bitpay/Config/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Config/Configuration.php b/src/Bitpay/Config/Configuration.php index 1029c6ee..c70508b6 100644 --- a/src/Bitpay/Config/Configuration.php +++ b/src/Bitpay/Config/Configuration.php @@ -46,7 +46,7 @@ public function getConfigTreeBuilder() ->end() ->scalarNode('sin_key') ->info('SIN Filename') - ->defaultValue($this->getSinKeyFilename()) + ->defaultValue($this->getSinFilename()) ->end() ->enumNode('network') ->values($this->networks) From 2f9295eb59c04058aef99bd96b72abe3692f3c56 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:36:53 -0400 Subject: [PATCH 130/164] Updated method parameter documenation --- src/Bitpay/Bitpay.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bitpay/Bitpay.php b/src/Bitpay/Bitpay.php index 14cadd84..269cf679 100644 --- a/src/Bitpay/Bitpay.php +++ b/src/Bitpay/Bitpay.php @@ -76,12 +76,12 @@ protected function buildContainer($config) } /** - * @return array + * @return array */ protected function getParameters() { return array( - 'bitpay.root_dir' => realpath(__DIR__.'/..'), + 'bitpay.root_dir' => realpath(__DIR__ . '/..'), ); } @@ -116,7 +116,7 @@ private function getContainerLoader(ContainerBuilder $container) /** * Returns an array of the default extensions. * - * @return array + * @return BitpayExtension[] */ private function getDefaultExtensions() { @@ -126,7 +126,7 @@ private function getDefaultExtensions() } /** - * @return Container + * @return ContainerBuilder */ public function getContainer() { @@ -134,7 +134,7 @@ public function getContainer() } /** - * @return mixed + * @return object|null */ public function get($service) { From c0fe48e9478596fcf62eeaf612529f6ecc2ac5cc Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:40:47 -0400 Subject: [PATCH 131/164] Refactor to improve code quality --- src/Bitpay/Storage/EncryptedFilesystemStorage.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Bitpay/Storage/EncryptedFilesystemStorage.php b/src/Bitpay/Storage/EncryptedFilesystemStorage.php index 5e42d252..00407cbe 100644 --- a/src/Bitpay/Storage/EncryptedFilesystemStorage.php +++ b/src/Bitpay/Storage/EncryptedFilesystemStorage.php @@ -166,12 +166,10 @@ private function readFromFile($path) */ private function getOpenSslErrors() { - $msg = ''; $openssl_error_msg = ''; while ($msg = openssl_error_string()) { $openssl_error_msg .= $msg . "\r\n"; - $msg = ''; } return $openssl_error_msg; From b43a8750f172826be014c89cdd1168ad8ef867cb Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 13:49:44 -0400 Subject: [PATCH 132/164] Updated copyright year and minor refactoring --- src/Bitpay/Invoice.php | 63 ++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 42 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index f1ec688d..be92f207 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -1,13 +1,12 @@ transactionSpeed = self::TRANSACTION_SPEED_MEDIUM; @@ -135,8 +132,7 @@ public function getPrice() /** * @param float $price - * - * @return InvoiceInterface + * @return Invoice */ public function setPrice($price) { @@ -157,8 +153,7 @@ public function getCurrency() /** * @param CurrencyInterface $currency - * - * @return InvoiceInterface + * @return Invoice */ public function setCurrency(CurrencyInterface $currency) { @@ -186,8 +181,7 @@ public function getItem() /** * @param ItemInterface $item - * - * @return InvoiceInterface + * @return Invoice */ public function setItem(ItemInterface $item) { @@ -213,8 +207,7 @@ public function getBuyer() /** * @param BuyerInterface $buyer - * - * @return InvoiceInterface + * @return Invoice */ public function setBuyer(BuyerInterface $buyer) { @@ -235,8 +228,7 @@ public function getTransactionSpeed() /** * @param string $transactionSpeed - * - * @return InvoiceInterface + * @return Invoice */ public function setTransactionSpeed($transactionSpeed) { @@ -257,8 +249,7 @@ public function getNotificationEmail() /** * @param string $notificationEmail - * - * @return InvoiceInterface + * @return Invoice */ public function setNotificationEmail($notificationEmail) { @@ -279,8 +270,7 @@ public function getNotificationUrl() /** * @param string $notificationUrl - * - * @return InvoiceInterface + * @return Invoice */ public function setNotificationUrl($notificationUrl) { @@ -301,8 +291,7 @@ public function getRedirectUrl() /** * @param string $redirectUrl - * - * @return InvoiceInterface + * @return Invoice */ public function setRedirectUrl($redirectUrl) { @@ -323,8 +312,7 @@ public function getPosData() /** * @param string $posData - * - * @return InvoiceInterface + * @return Invoice */ public function setPosData($posData) { @@ -345,8 +333,7 @@ public function getStatus() /** * @param string $status - * - * @return InvoiceInterface + * @return Invoice */ public function setStatus($status) { @@ -382,8 +369,7 @@ public function getId() /** * @param string $id - * - * @return InvoiceInterface + * @return Invoice */ public function setId($id) { @@ -404,8 +390,7 @@ public function getUrl() /** * @param string $url - * - * @return InvoiceInterface + * @return Invoice */ public function setUrl($url) { @@ -426,8 +411,7 @@ public function getBtcPrice() /** * @param float $btcPrice - * - * @return InvoiceInterface + * @return Invoice */ public function setBtcPrice($btcPrice) { @@ -448,8 +432,7 @@ public function getInvoiceTime() /** * @param DateTime $invoiceTime - * - * @return InvoiceInterface + * @return Invoice */ public function setInvoiceTime($invoiceTime) { @@ -470,8 +453,7 @@ public function getExpirationTime() /** * @param DateTime $expirationTime - * - * return InvoiceInterface + * return Invoice */ public function setExpirationTime($expirationTime) { @@ -492,8 +474,7 @@ public function getCurrentTime() /** * @param DateTime $currentTime - * - * @return InvoiceInterface + * @return Invoice */ public function setCurrentTime($currentTime) { @@ -514,8 +495,7 @@ public function getOrderId() /** * @param string $orderId - * - * @return InvoiceInterface + * @return Invoice */ public function setOrderId($orderId) { @@ -639,8 +619,7 @@ public function getExceptionStatus() /** * @param - * - * @return InvoiceInterface + * @return Invoice */ public function setExceptionStatus($exceptionStatus) { @@ -701,7 +680,7 @@ public function getToken() } /** * @param TokenInterface $token - * @return InvoiceInterface + * @return Invoice */ public function setToken(TokenInterface $token) { From 34de91fa4b8384b00798b5e886b9a6ae0d182853 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 14:05:58 -0400 Subject: [PATCH 133/164] Updated method return type documenation --- src/Bitpay/Config/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Config/Configuration.php b/src/Bitpay/Config/Configuration.php index c70508b6..123eb29e 100644 --- a/src/Bitpay/Config/Configuration.php +++ b/src/Bitpay/Config/Configuration.php @@ -74,7 +74,7 @@ public function getConfigTreeBuilder() * * implement Bitpay\Storage\StorageInterface * * be a class that can be loaded * - * @return TreeBuilder + * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition * @throws \Exception */ protected function addKeyStorageNode() From db614578197d92e0fce32ca00b4479a5b44f1231 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 14:14:16 -0400 Subject: [PATCH 134/164] Updated method parameter documenation --- src/Bitpay/Invoice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index be92f207..c785b003 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -431,7 +431,7 @@ public function getInvoiceTime() } /** - * @param DateTime $invoiceTime + * @param \DateTime $invoiceTime * @return Invoice */ public function setInvoiceTime($invoiceTime) @@ -452,7 +452,7 @@ public function getExpirationTime() } /** - * @param DateTime $expirationTime + * @param \DateTime $expirationTime * return Invoice */ public function setExpirationTime($expirationTime) @@ -473,7 +473,7 @@ public function getCurrentTime() } /** - * @param DateTime $currentTime + * @param \DateTime $currentTime * @return Invoice */ public function setCurrentTime($currentTime) From 9506d425cdb6c3f2711026539fc8c5c059b06c90 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 14:22:34 -0400 Subject: [PATCH 135/164] Updated copyright year and minor refactoring also updated the documentation. --- src/Bitpay/InvoiceInterface.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bitpay/InvoiceInterface.php b/src/Bitpay/InvoiceInterface.php index 3ea4f518..f5d430d5 100644 --- a/src/Bitpay/InvoiceInterface.php +++ b/src/Bitpay/InvoiceInterface.php @@ -1,14 +1,12 @@ Date: Tue, 22 Sep 2015 16:02:18 -0400 Subject: [PATCH 136/164] Moved documentation to interface and refactor for property validation checking, added constructor parameters. --- src/Bitpay/Invoice.php | 133 +++++++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 57 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index c785b003..d75539ae 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -14,112 +14,116 @@ class Invoice implements InvoiceInterface /** * @var CurrencyInterface */ - protected $currency; + protected $currency = null; /** * @var string */ - protected $orderId; + protected $orderId = ''; /** * @var ItemInterface */ - protected $item; + protected $item = null; /** * @var string */ - protected $transactionSpeed; + protected $transactionSpeed = ''; /** * @var string */ - protected $notificationEmail; + protected $notificationEmail = ''; /** * @var string */ - protected $notificationUrl; + protected $notificationUrl = ''; /** * @var string */ - protected $redirectUrl; + protected $redirectUrl = ''; /** * @var string */ - protected $posData; + protected $posData = ''; /** * @var string */ - protected $status; + protected $status = ''; /** * @var boolean */ - protected $fullNotifications; + protected $fullNotifications = false; /** * @var string */ - protected $id; + protected $id = ''; /** * @var string */ - protected $url; + protected $url = ''; /** * @var float */ - protected $btcPrice; + protected $btcPrice = 0.000000; /** * @var \DateTime */ - protected $invoiceTime; + protected $invoiceTime = null; /** * @var \DateTime */ - protected $expirationTime; + protected $expirationTime = null; /** * @var \DateTime */ - protected $currentTime; + protected $currentTime = null; /** * @var BuyerInterface */ - protected $buyer; + protected $buyer = null; /** - * @var + * @var string */ - protected $exceptionStatus; + protected $exceptionStatus = ''; /** - * @var + * @var float */ - protected $btcPaid; + protected $btcPaid = 0.000000; /** - * @var + * @var float */ - protected $rate; + protected $rate = 0.000000; /** - * @var + * @var Token */ - protected $token; + protected $token = null; - public function __construct() + public function __construct($transactionSpeed = self::TRANSACTION_SPEED_LOW, $fullNotifications = false, $item = null, $currency = null, $orderId = '', $posData = '') { - $this->transactionSpeed = self::TRANSACTION_SPEED_MEDIUM; - $this->fullNotifications = false; + $this->currency = $currency; + $this->transactionSpeed = $transactionSpeed; + $this->fullNotifications = $fullNotifications; + $this->item = $item; + $this->orderId = $orderId; + $this->posData = $posData; } /** @@ -127,7 +131,11 @@ public function __construct() */ public function getPrice() { - return $this->getItem()->getPrice(); + if (is_a($this->item, 'Item')) { + return $this->getItem()->getPrice(); + } else { + return 0.000000; + } } /** @@ -136,7 +144,7 @@ public function getPrice() */ public function setPrice($price) { - if (!empty($price)) { + if (is_float($price)) { $this->getItem()->setPrice($price); } @@ -148,6 +156,10 @@ public function setPrice($price) */ public function getCurrency() { + if ($this->currency === null) { + $this->currency = new Currency('BTC'); + } + return $this->currency; } @@ -157,7 +169,7 @@ public function getCurrency() */ public function setCurrency(CurrencyInterface $currency) { - if (!empty($currency)) { + if (is_a($currency, 'Currency')) { $this->currency = $currency; } @@ -169,10 +181,7 @@ public function setCurrency(CurrencyInterface $currency) */ public function getItem() { - // If there is not an item already set, we need to use a default item - // so that some methods do not throw errors about methods and - // non-objects. - if (null == $this->item) { + if (null === $this->item) { $this->item = new Item(); } @@ -185,7 +194,7 @@ public function getItem() */ public function setItem(ItemInterface $item) { - if (!empty($item)) { + if (is_a($item, 'Item')) { $this->item = $item; } @@ -197,8 +206,7 @@ public function setItem(ItemInterface $item) */ public function getBuyer() { - // Same logic as getItem method - if (null == $this->buyer) { + if ($this->buyer === null) { $this->buyer = new Buyer(); } @@ -211,7 +219,7 @@ public function getBuyer() */ public function setBuyer(BuyerInterface $buyer) { - if (!empty($buyer)) { + if (is_a($buyer, 'Buyer')) { $this->buyer = $buyer; } @@ -232,8 +240,16 @@ public function getTransactionSpeed() */ public function setTransactionSpeed($transactionSpeed) { - if (!empty($transactionSpeed) && ctype_print($transactionSpeed)) { - $this->transactionSpeed = trim($transactionSpeed); + switch (strtolower(trim($transactionSpeed))) { + case 'high': + $this->transactionSpeed = self::TRANSACTION_SPEED_HIGH; + break; + case 'medium': + $this->transactionSpeed = self::TRANSACTION_SPEED_MEDIUM; + break; + case 'low': + default: + $this->transactionSpeed = self::TRANSACTION_SPEED_LOW; } return $this; @@ -253,7 +269,7 @@ public function getNotificationEmail() */ public function setNotificationEmail($notificationEmail) { - if (!empty($notificationEmail) && ctype_print($notificationEmail)) { + if (filter_var($notificationEmail, FILTER_VALIDATE_EMAIL)) { $this->notificationEmail = trim($notificationEmail); } @@ -274,7 +290,7 @@ public function getNotificationUrl() */ public function setNotificationUrl($notificationUrl) { - if (!empty($notificationUrl) && ctype_print($notificationUrl)) { + if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $notificationUrl)) { $this->notificationUrl = trim($notificationUrl); } @@ -295,7 +311,7 @@ public function getRedirectUrl() */ public function setRedirectUrl($redirectUrl) { - if (!empty($redirectUrl) && ctype_print($redirectUrl)) { + if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $redirectUrl)) { $this->redirectUrl = trim($redirectUrl); } @@ -316,7 +332,7 @@ public function getPosData() */ public function setPosData($posData) { - if (!empty($posData)) { + if (is_string($posData)) { $this->posData = $posData; } @@ -337,7 +353,7 @@ public function getStatus() */ public function setStatus($status) { - if (!empty($status) && ctype_print($status)) { + if (is_string($status)) { $this->status = trim($status); } @@ -373,7 +389,7 @@ public function getId() */ public function setId($id) { - if (!empty($id) && ctype_print($id)) { + if (is_string($id)) { $this->id = trim($id); } @@ -394,7 +410,7 @@ public function getUrl() */ public function setUrl($url) { - if (!empty($url) && ctype_print($url)) { + if (is_string($url)) { $this->url = trim($url); } @@ -415,7 +431,7 @@ public function getBtcPrice() */ public function setBtcPrice($btcPrice) { - if (!empty($btcPrice)) { + if (is_float($btcPrice)) { $this->btcPrice = $btcPrice; } @@ -436,7 +452,7 @@ public function getInvoiceTime() */ public function setInvoiceTime($invoiceTime) { - if (!empty($invoiceTime)) { + if (is_a($invoiceTime, 'DateTime')) { $this->invoiceTime = $invoiceTime; } @@ -457,7 +473,7 @@ public function getExpirationTime() */ public function setExpirationTime($expirationTime) { - if (!empty($expirationTime)) { + if (is_a($expirationTime, 'DateTime')) { $this->expirationTime = $expirationTime; } @@ -478,7 +494,7 @@ public function getCurrentTime() */ public function setCurrentTime($currentTime) { - if (!empty($currentTime)) { + if (is_a($currentTime, 'DateTime')) { $this->currentTime = $currentTime; } @@ -499,7 +515,7 @@ public function getOrderId() */ public function setOrderId($orderId) { - if (!empty($orderId) && ctype_print($orderId)) { + if (is_string($orderId)) { $this->orderId = trim($orderId); } @@ -538,7 +554,7 @@ public function getBuyerName() $firstName = $this->getBuyer()->getFirstName(); $lastName = $this->getBuyer()->getLastName(); - return trim($firstName.' '.$lastName); + return trim($firstName . ' ' . $lastName); } /** @@ -642,7 +658,7 @@ public function getBtcPaid() */ public function setBtcPaid($btcPaid) { - if (isset($btcPaid)) { + if (is_float($btcPaid)) { $this->btcPaid = $btcPaid; } @@ -664,7 +680,7 @@ public function getRate() */ public function setRate($rate) { - if (!empty($rate)) { + if (is_float($rate)) { $this->rate = $rate; } @@ -684,7 +700,10 @@ public function getToken() */ public function setToken(TokenInterface $token) { - $this->token = $token; + if (is_a($token, 'Token')) { + $this->token = $token; + } + return $this; } } From 8f5625eb3e2ae285367305def29ad6c7dae1aca8 Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 16:05:04 -0400 Subject: [PATCH 137/164] Corrected transaction speed set test --- tests/Bitpay/InvoiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/InvoiceTest.php b/tests/Bitpay/InvoiceTest.php index ba65bd61..ea48b946 100644 --- a/tests/Bitpay/InvoiceTest.php +++ b/tests/Bitpay/InvoiceTest.php @@ -85,7 +85,7 @@ public function testSetBuyer() public function testGetTransactionSpeed() { $this->assertNotNull($this->invoice); - $this->assertSame(Invoice::TRANSACTION_SPEED_MEDIUM, $this->invoice->getTransactionSpeed()); + $this->assertSame(Invoice::TRANSACTION_SPEED_LOW, $this->invoice->getTransactionSpeed()); } /** From aeb965c8f774c83e0af13e515129ab4a4008ba1c Mon Sep 17 00:00:00 2001 From: Rich Morgan Date: Tue, 22 Sep 2015 16:10:14 -0400 Subject: [PATCH 138/164] Added validation for url parameter --- src/Bitpay/Invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index d75539ae..c3a93c5e 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -410,7 +410,7 @@ public function getUrl() */ public function setUrl($url) { - if (is_string($url)) { + if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $url)) { $this->url = trim($url); } From e3de9d97577fb03753d1edab3a903b24a995353f Mon Sep 17 00:00:00 2001 From: Gabe Gattis Date: Fri, 23 Oct 2015 13:14:10 -0400 Subject: [PATCH 139/164] change btcPrice to btcPaid --- src/Bitpay/Client/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index ddbb4e91..22c39e32 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -626,7 +626,7 @@ public function getInvoice($invoiceId) ->setExpirationTime($data['expirationTime']) ->setCurrentTime($data['currentTime']) ->setId($data['id']) - ->setBtcPaid($data['btcPrice']) + ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) ->setExceptionStatus($data['exceptionStatus']); From 5bfcc6026b3fc8b70d69744910890d60ac4026ce Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 16 Nov 2015 15:58:35 -0500 Subject: [PATCH 140/164] Namespaced class name references/ Custom HTTP Accept Version Header 1. is_a function is now returning false unless the class name is given with the namespace reference. 2. X-Accept-Version needs to be 2.0.0, referring to the API version and not the plugin version. --- src/Bitpay/Client/Client.php | 2 +- src/Bitpay/Invoice.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 22c39e32..c12e2f85 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -719,7 +719,7 @@ protected function prepareRequestHeaders(RequestInterface $request) $request->setHeader('X-BitPay-Plugin-Info', sprintf('%s/%s', self::NAME, self::VERSION)); $request->setHeader('Content-Type', 'application/json'); - $request->setHeader('X-Accept-Version', '2.2.6'); + $request->setHeader('X-Accept-Version', '2.0.0'); } /** diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index c3a93c5e..4f66310f 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -131,7 +131,7 @@ public function __construct($transactionSpeed = self::TRANSACTION_SPEED_LOW, $fu */ public function getPrice() { - if (is_a($this->item, 'Item')) { + if (is_a($this->item, '\Bitpay\Item')) { return $this->getItem()->getPrice(); } else { return 0.000000; @@ -169,7 +169,7 @@ public function getCurrency() */ public function setCurrency(CurrencyInterface $currency) { - if (is_a($currency, 'Currency')) { + if (is_a($currency, '\Bitpay\Currency')) { $this->currency = $currency; } @@ -194,7 +194,7 @@ public function getItem() */ public function setItem(ItemInterface $item) { - if (is_a($item, 'Item')) { + if (is_a($item, '\Bitpay\Item')) { $this->item = $item; } @@ -219,7 +219,7 @@ public function getBuyer() */ public function setBuyer(BuyerInterface $buyer) { - if (is_a($buyer, 'Buyer')) { + if (is_a($buyer, '\Bitpay\Buyer')) { $this->buyer = $buyer; } @@ -700,7 +700,7 @@ public function getToken() */ public function setToken(TokenInterface $token) { - if (is_a($token, 'Token')) { + if (is_a($token, '\Bitpay\Token')) { $this->token = $token; } From 63bd1a6a0c82806d43cda2b60770613e05141a62 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 16 Nov 2015 18:58:49 -0500 Subject: [PATCH 141/164] Repaired tests based on current changes to the code. --- src/Bitpay/Client/Client.php | 1 + src/Bitpay/Invoice.php | 18 ++++++++++++++++-- src/Bitpay/Payout.php | 2 ++ src/Bitpay/PayoutInstruction.php | 2 ++ src/Bitpay/Token.php | 4 +++- tests/Bitpay/Client/ClientTest.php | 8 ++++---- tests/Bitpay/InvoiceTest.php | 28 ++++++++++++++-------------- 7 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index c12e2f85..72a80632 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -15,6 +15,7 @@ use Bitpay\PublicKey; use Bitpay\PrivateKey; +date_default_timezone_set('utc'); /** * Client used to send requests and receive responses for BitPay's Web API. * diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index 4f66310f..97798eac 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -6,6 +6,8 @@ namespace Bitpay; +date_default_timezone_set('utc'); + /** * @package Bitpay */ @@ -433,6 +435,8 @@ public function setBtcPrice($btcPrice) { if (is_float($btcPrice)) { $this->btcPrice = $btcPrice; + } else if (is_numeric($btcPrice)) { + $this->btcPrice = floatval($btcPrice); } return $this; @@ -454,8 +458,11 @@ public function setInvoiceTime($invoiceTime) { if (is_a($invoiceTime, 'DateTime')) { $this->invoiceTime = $invoiceTime; + } else if (is_numeric($invoiceTime)) { + $invoiceDateTime = new \DateTime(); + $invoiceDateTime->setTimestamp($invoiceTime); + $this->invoiceTime = $invoiceDateTime; } - return $this; } @@ -475,8 +482,11 @@ public function setExpirationTime($expirationTime) { if (is_a($expirationTime, 'DateTime')) { $this->expirationTime = $expirationTime; + } else if (is_numeric($expirationTime)) { + $expirationDateTime = new \DateTime(); + $expirationDateTime->setTimestamp($expirationTime); + $this->expirationTime = $expirationDateTime; } - return $this; } @@ -496,6 +506,10 @@ public function setCurrentTime($currentTime) { if (is_a($currentTime, 'DateTime')) { $this->currentTime = $currentTime; + } else if (is_numeric($currentTime)) { + $currentDateTime = new \DateTime(); + $currentDateTime->setTimestamp($currentTime); + $this->currentTime = $currentDateTime; } return $this; diff --git a/src/Bitpay/Payout.php b/src/Bitpay/Payout.php index 7195d886..4bb598f8 100644 --- a/src/Bitpay/Payout.php +++ b/src/Bitpay/Payout.php @@ -6,6 +6,8 @@ namespace Bitpay; +date_default_timezone_set('utc'); + /** * Class Payout * @package Bitpay diff --git a/src/Bitpay/PayoutInstruction.php b/src/Bitpay/PayoutInstruction.php index 973c1583..fb4febe9 100644 --- a/src/Bitpay/PayoutInstruction.php +++ b/src/Bitpay/PayoutInstruction.php @@ -6,6 +6,8 @@ namespace Bitpay; +date_default_timezone_set('utc'); + /** * Class PayoutInstruction * @package Bitpay diff --git a/src/Bitpay/Token.php b/src/Bitpay/Token.php index 6bfc0f29..1fdf1517 100644 --- a/src/Bitpay/Token.php +++ b/src/Bitpay/Token.php @@ -6,6 +6,8 @@ namespace Bitpay; +date_default_timezone_set('utc'); + /** * @package Bitpay */ @@ -169,7 +171,7 @@ public function getPairingCode() public function setPairingCode($pairingCode) { $this->pairingCode = $pairingCode; - + return $this; } diff --git a/tests/Bitpay/Client/ClientTest.php b/tests/Bitpay/Client/ClientTest.php index ff457f31..c34501ff 100644 --- a/tests/Bitpay/Client/ClientTest.php +++ b/tests/Bitpay/Client/ClientTest.php @@ -163,9 +163,9 @@ public function testCreateInvoice() $this->assertEquals('new', $invoice->getStatus()); $this->assertEquals('0.0632', $invoice->getBtcPrice()); $this->assertEquals(19.95, $invoice->getPrice()); - $this->assertEquals(1412594514486, $invoice->getInvoiceTime()); - $this->assertEquals(1412595414486, $invoice->getExpirationTime()); - $this->assertEquals(1412594514518, $invoice->getCurrentTime()); + $this->assertEquals(1412594514486, $invoice->getInvoiceTime()->getTimestamp()); + $this->assertEquals(1412595414486, $invoice->getExpirationTime()->getTimestamp()); + $this->assertEquals(1412594514518, $invoice->getCurrentTime()->getTimestamp()); $this->assertEquals('0.0000', $invoice->getBtcPaid()); $this->assertEquals(315.7, $invoice->getRate()); $this->assertEquals(false, $invoice->getExceptionStatus()); @@ -272,7 +272,7 @@ public function testCreateInvoiceWithTooMuchPrecisionEvenForBitcoin() $this->client->createInvoice($invoice); } - + /** * @depends testCreateInvoice */ diff --git a/tests/Bitpay/InvoiceTest.php b/tests/Bitpay/InvoiceTest.php index ea48b946..5a22e471 100644 --- a/tests/Bitpay/InvoiceTest.php +++ b/tests/Bitpay/InvoiceTest.php @@ -18,7 +18,7 @@ public function setUp() public function testGetPrice() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getPrice()); + $this->assertSame($this->invoice->getPrice(), 0.0); } /** @@ -34,7 +34,7 @@ public function testSetPrice() public function testGetCurrency() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getCurrency()); + $this->assertInstanceOf('Bitpay\Currency', $this->invoice->getCurrency()); } /** @@ -101,7 +101,7 @@ public function testSetTransactionSpeed() public function testGetNotificationEmail() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getNotificationEmail()); + $this->assertSame($this->invoice->getNotificationEmail(), ''); } /** @@ -117,7 +117,7 @@ public function testSetNotificationEmail() public function testGetNotificationUrl() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getNotificationUrl()); + $this->assertSame($this->invoice->getNotificationUrl(), ''); } /** @@ -133,7 +133,7 @@ public function testSetNotificationUrl() public function testGetRedirectUrl() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getRedirectUrl()); + $this->assertSame($this->invoice->getRedirectUrl(), ''); } /** @@ -149,7 +149,7 @@ public function testSetRedirectUrl() public function testGetPosData() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getPosData()); + $this->assertSame($this->invoice->getPosData(), ''); } /** @@ -165,7 +165,7 @@ public function testSetPosData() public function testGetStatus() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getStatus()); + $this->assertSame($this->invoice->getStatus(), ''); } /** @@ -187,7 +187,7 @@ public function testIsFullNotifications() public function testGetId() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getId()); + $this->assertSame($this->invoice->getId(), ''); } /** @@ -203,7 +203,7 @@ public function testSetId() public function testGetUrl() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getUrl()); + $this->assertSame($this->invoice->getUrl(), ''); } /** @@ -219,7 +219,7 @@ public function testSetUrl() public function testGetBtcPrice() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getBtcPrice()); + $this->assertSame($this->invoice->getBtcPrice(), 0.0); } /** @@ -294,7 +294,7 @@ public function testSetCurrentTime() public function testGetOrderId() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getOrderId()); + $this->assertSame($this->invoice->getOrderId(), ''); } /** @@ -382,7 +382,7 @@ public function testGetBuyerPhone() public function testGetExceptionStatus() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getExceptionStatus()); + $this->assertSame($this->invoice->getExceptionStatus(), ''); } /** @@ -398,7 +398,7 @@ public function testSetExcpetionStatus() public function testGetBtcPaid() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getBtcPaid()); + $this->assertSame($this->invoice->getBtcPaid(), 0.0); } /** @@ -414,7 +414,7 @@ public function testSetBtcPaid() public function testGetRate() { $this->assertNotNull($this->invoice); - $this->assertNull($this->invoice->getRate()); + $this->assertSame($this->invoice->getRate(), 0.0); } /** From 8d758fa24a5fc1a1cc3525bf0c3affdf59c952cd Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 3 Dec 2015 16:30:02 -0500 Subject: [PATCH 142/164] Bumped version to 2.2.8 from 2.2.6 (it was supposed to be 2.2.7 at this point). --- src/Bitpay/Client/ClientInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Client/ClientInterface.php b/src/Bitpay/Client/ClientInterface.php index 603612fc..b63b450a 100644 --- a/src/Bitpay/Client/ClientInterface.php +++ b/src/Bitpay/Client/ClientInterface.php @@ -26,7 +26,7 @@ interface ClientInterface * @see RFC2616 section 14.43 for User-Agent Format */ const NAME = 'BitPay PHP Client'; - const VERSION = '2.2.6'; + const VERSION = '2.2.8'; public function getCurrencies(); From dfeeb04b252d5e7a7d559aadb7422a1bedb12e11 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Fri, 25 Dec 2015 14:25:16 +0500 Subject: [PATCH 143/164] Update Token.php --- src/Bitpay/Token.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitpay/Token.php b/src/Bitpay/Token.php index 1fdf1517..9fb209b3 100644 --- a/src/Bitpay/Token.php +++ b/src/Bitpay/Token.php @@ -6,7 +6,7 @@ namespace Bitpay; -date_default_timezone_set('utc'); +date_default_timezone_set('UTC'); /** * @package Bitpay From e0ed633d5043cfe7bfb70e7cc574086da907d3cc Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 22 Jan 2016 11:30:30 -0500 Subject: [PATCH 144/164] Fixed invoice, expiration, and current time error - client was trying to create objects from unix timestamps with millisecond resolution - added a test to ensure these time-based objects are always in the past --- src/Bitpay/Invoice.php | 9 ++++++--- tests/Bitpay/Client/ClientTest.php | 11 ++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index 97798eac..1ec6f35c 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -460,7 +460,8 @@ public function setInvoiceTime($invoiceTime) $this->invoiceTime = $invoiceTime; } else if (is_numeric($invoiceTime)) { $invoiceDateTime = new \DateTime(); - $invoiceDateTime->setTimestamp($invoiceTime); + //this comes back from the api in milliseconds + $invoiceDateTime->setTimestamp($invoiceTime / 1000); $this->invoiceTime = $invoiceDateTime; } return $this; @@ -484,7 +485,8 @@ public function setExpirationTime($expirationTime) $this->expirationTime = $expirationTime; } else if (is_numeric($expirationTime)) { $expirationDateTime = new \DateTime(); - $expirationDateTime->setTimestamp($expirationTime); + //this comes back from the api in milliseconds + $expirationDateTime->setTimestamp($expirationTime / 1000); $this->expirationTime = $expirationDateTime; } return $this; @@ -508,7 +510,8 @@ public function setCurrentTime($currentTime) $this->currentTime = $currentTime; } else if (is_numeric($currentTime)) { $currentDateTime = new \DateTime(); - $currentDateTime->setTimestamp($currentTime); + //this comes back from the api in milliseconds + $currentDateTime->setTimestamp($currentTime / 1000); $this->currentTime = $currentDateTime; } diff --git a/tests/Bitpay/Client/ClientTest.php b/tests/Bitpay/Client/ClientTest.php index c34501ff..049c13f7 100644 --- a/tests/Bitpay/Client/ClientTest.php +++ b/tests/Bitpay/Client/ClientTest.php @@ -163,13 +163,18 @@ public function testCreateInvoice() $this->assertEquals('new', $invoice->getStatus()); $this->assertEquals('0.0632', $invoice->getBtcPrice()); $this->assertEquals(19.95, $invoice->getPrice()); - $this->assertEquals(1412594514486, $invoice->getInvoiceTime()->getTimestamp()); - $this->assertEquals(1412595414486, $invoice->getExpirationTime()->getTimestamp()); - $this->assertEquals(1412594514518, $invoice->getCurrentTime()->getTimestamp()); + $this->assertEquals(1412594514, $invoice->getInvoiceTime()->getTimestamp()); + $this->assertEquals(1412595414, $invoice->getExpirationTime()->getTimestamp()); + $this->assertEquals(1412594514, $invoice->getCurrentTime()->getTimestamp()); $this->assertEquals('0.0000', $invoice->getBtcPaid()); $this->assertEquals(315.7, $invoice->getRate()); $this->assertEquals(false, $invoice->getExceptionStatus()); $this->assertEquals('abcdefghijklmno', $invoice->getToken()->getToken()); + //assert that invoice, expiration and currenttime are in the past + //meaning we didn't try to create date objects from unix timestamps including milliseconds + $this->assertLessThan(time(), $invoice->getInvoiceTime()->getTimestamp()); + $this->assertLessThan(time(), $invoice->getExpirationTime()->getTimestamp()); + $this->assertLessThan(time(), $invoice->getCurrentTime()->getTimestamp()); } /** From 8253cd25d260d012f6cb22a8e664967c037e1140 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 22 Jan 2016 19:00:39 -0500 Subject: [PATCH 145/164] Manipulated the times from the API in the client class instead of the invoice class. --- src/Bitpay/Client/Client.php | 12 ++++++------ src/Bitpay/Invoice.php | 9 +++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 72a80632..344a1ef1 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -184,9 +184,9 @@ public function createInvoice(InvoiceInterface $invoice) ->setStatus($data['status']) ->setBtcPrice($data['btcPrice']) ->setPrice($data['price']) - ->setInvoiceTime($data['invoiceTime']) - ->setExpirationTime($data['expirationTime']) - ->setCurrentTime($data['currentTime']) + ->setInvoiceTime($data['invoiceTime'] / 1000) + ->setExpirationTime($data['expirationTime'] / 1000) + ->setCurrentTime($data['currentTime'] / 1000) ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) ->setExceptionStatus($data['exceptionStatus']); @@ -623,9 +623,9 @@ public function getInvoice($invoiceId) ->setPrice($data['price']) ->setCurrency(new \Bitpay\Currency($data['currency'])) ->setOrderId($data['orderId']) - ->setInvoiceTime($data['invoiceTime']) - ->setExpirationTime($data['expirationTime']) - ->setCurrentTime($data['currentTime']) + ->setInvoiceTime($data['invoiceTime'] / 1000) + ->setExpirationTime($data['expirationTime'] / 1000) + ->setCurrentTime($data['currentTime'] / 1000) ->setId($data['id']) ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index 1ec6f35c..97798eac 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -460,8 +460,7 @@ public function setInvoiceTime($invoiceTime) $this->invoiceTime = $invoiceTime; } else if (is_numeric($invoiceTime)) { $invoiceDateTime = new \DateTime(); - //this comes back from the api in milliseconds - $invoiceDateTime->setTimestamp($invoiceTime / 1000); + $invoiceDateTime->setTimestamp($invoiceTime); $this->invoiceTime = $invoiceDateTime; } return $this; @@ -485,8 +484,7 @@ public function setExpirationTime($expirationTime) $this->expirationTime = $expirationTime; } else if (is_numeric($expirationTime)) { $expirationDateTime = new \DateTime(); - //this comes back from the api in milliseconds - $expirationDateTime->setTimestamp($expirationTime / 1000); + $expirationDateTime->setTimestamp($expirationTime); $this->expirationTime = $expirationDateTime; } return $this; @@ -510,8 +508,7 @@ public function setCurrentTime($currentTime) $this->currentTime = $currentTime; } else if (is_numeric($currentTime)) { $currentDateTime = new \DateTime(); - //this comes back from the api in milliseconds - $currentDateTime->setTimestamp($currentTime / 1000); + $currentDateTime->setTimestamp($currentTime); $this->currentTime = $currentDateTime; } From f539f435b38c43d2561cec6ac2a587db6ceeb5e6 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 28 Jan 2016 12:44:59 -0500 Subject: [PATCH 146/164] Updated package for use with Symfony 3.0 or 2.3 - Please note that the integration tests won't work with Symfony 3 due to Behat not supporting this version yet. - Unit tests are function with both Symfony 2.x or 3.0 --- Makefile | 2 +- VERSION | 2 +- composer.json | 12 ++++++------ src/Bitpay/DependencyInjection/services.xml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index c3d61c37..696d737e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ setup: - composer.phar install + ./composer.phar install npm install test: diff --git a/VERSION b/VERSION index 21bb5e15..0d3ad67a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.5 +2.2.10 diff --git a/composer.json b/composer.json index c554a0fc..06033dff 100644 --- a/composer.json +++ b/composer.json @@ -29,17 +29,17 @@ "ext-json": "*", "ext-openssl": "*", "ext-mcrypt": "*", - "symfony/config": "2.5.*", - "symfony/dependency-injection": "2.5.*" + "symfony/config": "^2.3 || ^3.0", + "symfony/dependency-injection": "^2.3 || ^3.0" }, "require-dev": { - "behat/behat": "2.5.*@stable", - "behat/mink": "1.6.1", - "behat/mink-extension": "1.3.*", + "behat/behat": "master-dev", + "behat/mink": "master-dev", + "behat/mink-extension": "master-dev", "behat/mink-selenium2-driver": "1.2.0", "fabpot/goutte": "~1.0.4", "behat/mink-goutte-driver": "1.*", - "phpmd/phpmd": "~2.1.3", + "phpmd/phpmd": "master-dev", "phpunit/phpunit": "~4.3.1", "fzaninotto/faker": "~1.4.0", "mikey179/vfsStream": "~1.4.0", diff --git a/src/Bitpay/DependencyInjection/services.xml b/src/Bitpay/DependencyInjection/services.xml index a38e440d..36e81995 100644 --- a/src/Bitpay/DependencyInjection/services.xml +++ b/src/Bitpay/DependencyInjection/services.xml @@ -1,7 +1,7 @@ @@ -31,7 +31,7 @@ - + %bitpay.key_storage_password% @@ -39,11 +39,11 @@ - + %bitpay.public_key% - + %bitpay.private_key% From 37cc9f97f01d2f7d9f21c3cf83a7693acef08ed6 Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Tue, 12 Jan 2016 17:02:01 -0800 Subject: [PATCH 147/164] created paymentUrlInterface and PaymentUrlSet to hold the various payment urls returned for an invoice --- src/Bitpay/PaymentUrlInterface.php | 31 ++++++++++++++++++ src/Bitpay/PaymentUrlSet.php | 51 ++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/Bitpay/PaymentUrlInterface.php create mode 100644 src/Bitpay/PaymentUrlSet.php diff --git a/src/Bitpay/PaymentUrlInterface.php b/src/Bitpay/PaymentUrlInterface.php new file mode 100644 index 00000000..228c77dc --- /dev/null +++ b/src/Bitpay/PaymentUrlInterface.php @@ -0,0 +1,31 @@ +paymentUrls = $paymentUrls; + } + + /** + * Return the account parameter given by Bitpay. + * + * @return string + */ + public function getUrl($urlType) + { + if (array_key_exists($urlType, $this->paymentUrls)) { + return $this->paymentUrls[$urlType]; + } + + return null; + } + + /** + * Return the account parameter given by Bitpay. + * + * @return PaymentUrlInterface + */ + public function setUrls(array $paymentUrls) + { + $this->paymentUrls = $paymentUrls; + + return $this; + } +} From 9a2250c71d00dc43da40fab2af8b3b8d21c041ac Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Tue, 12 Jan 2016 17:03:30 -0800 Subject: [PATCH 148/164] updated the invoiceintercae and invoice class to support the new paymentUrlSet object --- src/Bitpay/Invoice.php | 39 +++++++++++++++++++++++++++++++++ src/Bitpay/InvoiceInterface.php | 7 ++++++ 2 files changed, 46 insertions(+) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index 97798eac..24cb19c5 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -118,6 +118,11 @@ class Invoice implements InvoiceInterface */ protected $token = null; + /** + * @var PaymentUrlInterface + */ + protected $paymentUrls = null; + public function __construct($transactionSpeed = self::TRANSACTION_SPEED_LOW, $fullNotifications = false, $item = null, $currency = null, $orderId = '', $posData = '') { $this->currency = $currency; @@ -708,6 +713,7 @@ public function getToken() { return $this->token; } + /** * @param TokenInterface $token * @return Invoice @@ -720,4 +726,37 @@ public function setToken(TokenInterface $token) return $this; } + + /** + * @return PaymentUrlInterface + */ + public function getPaymentUrls() + { + if ($this->paymentUrls === null) { + $this->paymentUrls = new PaymentUrlSet(); + } + + return $this->paymentUrls; + } + + /** + * @param PaymentUrlInterface $paymentUrls + * @return Invoice + */ + public function setPaymentUrls(PaymentUrlInterface $paymentUrls) + { + $this->paymentUrls = $paymentUrls; + + return $this; + } + + /** + * @param string $paymentUrlType + * @return string + */ + public function getPaymentUrl($paymentUrlType) + { + return $this->getPaymentUrls()->getUrl($paymentUrlType); + } + } diff --git a/src/Bitpay/InvoiceInterface.php b/src/Bitpay/InvoiceInterface.php index f5d430d5..af31a665 100644 --- a/src/Bitpay/InvoiceInterface.php +++ b/src/Bitpay/InvoiceInterface.php @@ -362,4 +362,11 @@ public function getRate(); * Returns the token for this resource. */ public function getToken(); + + /** + * Returns a set of payment urls. + * + * @return PaymentUrlInterface + */ + public function getPaymentUrls(); } From 4a0f0f969b64fa28c143209fb922d2226c93a6fe Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Tue, 12 Jan 2016 17:05:10 -0800 Subject: [PATCH 149/164] set paymentUrls when creating or loading an invoice via client --- src/Bitpay/Client/Client.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 344a1ef1..6e700e38 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -176,6 +176,7 @@ public function createInvoice(InvoiceInterface $invoice) $data = $body['data']; $invoiceToken = new \Bitpay\Token(); + $paymentUrls = new \Bitpay\PaymentUrlSet(); $invoice ->setToken($invoiceToken->setToken($data['token'])) @@ -189,7 +190,8 @@ public function createInvoice(InvoiceInterface $invoice) ->setCurrentTime($data['currentTime'] / 1000) ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) - ->setExceptionStatus($data['exceptionStatus']); + ->setExceptionStatus($data['exceptionStatus']) + ->setPaymentUrls($paymentUrls->setUrls($data['paymentUrls'])); return $invoice; } @@ -613,6 +615,7 @@ public function getInvoice($invoiceId) $data = $body['data']; $invoice = new \Bitpay\Invoice(); $invoiceToken = new \Bitpay\Token(); + $paymentUrls = new \Bitpay\PaymentUrlSet(); $invoice ->setToken($invoiceToken->setToken($data['token'])) @@ -629,7 +632,8 @@ public function getInvoice($invoiceId) ->setId($data['id']) ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) - ->setExceptionStatus($data['exceptionStatus']); + ->setExceptionStatus($data['exceptionStatus']) + ->setPaymentUrls($paymentUrls->setUrls($data['paymentUrls'])); return $invoice; } From d8d23fcbd86ac375e259a2e7b026a5cba1fe878c Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Wed, 13 Jan 2016 16:42:46 -0800 Subject: [PATCH 150/164] fixed PSR issues --- src/Bitpay/Invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index 24cb19c5..f0f995b9 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -736,7 +736,7 @@ public function getPaymentUrls() $this->paymentUrls = new PaymentUrlSet(); } - return $this->paymentUrls; + return $this->paymentUrls; } /** @@ -759,4 +759,4 @@ public function getPaymentUrl($paymentUrlType) return $this->getPaymentUrls()->getUrl($paymentUrlType); } -} +} \ No newline at end of file From dba40cf5794a38455847c730518c2d6cd9139105 Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Wed, 13 Jan 2016 16:46:41 -0800 Subject: [PATCH 151/164] more PSR fixes --- src/Bitpay/Invoice.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index f0f995b9..fcb18c89 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -758,5 +758,4 @@ public function getPaymentUrl($paymentUrlType) { return $this->getPaymentUrls()->getUrl($paymentUrlType); } - -} \ No newline at end of file +} From f5cf55eed67603e94d20d9aeae83d3fd7349b0ea Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Wed, 13 Jan 2016 17:21:16 -0800 Subject: [PATCH 152/164] fixed clientTest to add newly required invoice interface method added new test to make sure payment urls are accessed correctly --- tests/Bitpay/Client/ClientTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Bitpay/Client/ClientTest.php b/tests/Bitpay/Client/ClientTest.php index 049c13f7..d86e9467 100644 --- a/tests/Bitpay/Client/ClientTest.php +++ b/tests/Bitpay/Client/ClientTest.php @@ -170,6 +170,7 @@ public function testCreateInvoice() $this->assertEquals(315.7, $invoice->getRate()); $this->assertEquals(false, $invoice->getExceptionStatus()); $this->assertEquals('abcdefghijklmno', $invoice->getToken()->getToken()); + $this->assertEquals('bitcoin:mabcdefghijkmnopqrstuvw123456789AB?amount=0.0632', $invoice->getPaymentUrl(PaymentUrlSet::BIP_21)); //assert that invoice, expiration and currenttime are in the past //meaning we didn't try to create date objects from unix timestamps including milliseconds $this->assertLessThan(time(), $invoice->getInvoiceTime()->getTimestamp()); @@ -589,6 +590,7 @@ private function getMockInvoice() 'getExceptionStatus', 'getBtcPaid', 'getRate', 'getToken', 'setId', 'setUrl', 'setStatus', 'setBtcPrice', 'setPrice', 'setInvoiceTime', 'setExpirationTime', 'setCurrentTime', 'setBtcPaid', 'setRate', 'setToken', 'setExceptionStatus', + 'getPaymentUrls', ) ) ->getMock(); From c0ab5182825d809381ce5fdaeba83c7e0b1da9f8 Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Wed, 13 Jan 2016 17:43:02 -0800 Subject: [PATCH 153/164] updated test data for invoices --- tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json b/tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json index 3b5b17cf..f90a74db 100644 --- a/tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json +++ b/tests/DataFixtures/invoices/5NxFkXcJbCSivtQRJa4kHP.json @@ -1 +1 @@ -{"facade":"public/invoice","data":{"url":"https://test.bitpay.com/invoice?id=5NxFkXcJbCSivtQRJa4kHP","posData":"{\"posData\":{\"orderId\":\"100000009\"},\"hash\":\"GA.VW7o8puqPA\"}","status":"expired","btcPrice":"0.0032","btcDue":"0.0032","price":1.99,"currency":"USD","exRates":{"USD":619.39},"orderId":"100000009","invoiceTime":1405974404088,"expirationTime":1405975304088,"currentTime":1412886370907,"id":"5NxFkXcJbCSivtQRJa4kHP","btcPaid":"0.0000","rate":619.39,"exceptionStatus":false,"token":"9CKEkTYE4VA4skhMPBxUsPQyUqXE36qpmitmYbtKssPnY3p8rYqhTTcEzUeowKwvzL"}} +{"facade":"public/invoice","data":{"url":"https://test.bitpay.com/invoice?id=5NxFkXcJbCSivtQRJa4kHP","paymentUrls":{"BIP21":"bitcoin:mgjLEW6oUZ5TeAGMikYsFoBE54dzJybTpH?amount=0.0632","BIP72":"bitcoin:mgjLEW6oUZ5TeAGMikYsFoBE54dzJybTpH?amount=0.0632&r=https://test.bitpay.com/i/5NxFkXcJbCSivtQRJa4kHP","BIP72b":"bitcoin:?r=https://test.bitpay.com/i/5NxFkXcJbCSivtQRJa4kHP","BIP73":"https://test.bitpay.com/i/5NxFkXcJbCSivtQRJa4kHP"},"posData":"{\"posData\":{\"orderId\":\"100000009\"},\"hash\":\"GA.VW7o8puqPA\"}","status":"expired","btcPrice":"0.0032","btcDue":"0.0032","price":1.99,"currency":"USD","exRates":{"USD":619.39},"orderId":"100000009","invoiceTime":1405974404088,"expirationTime":1405975304088,"currentTime":1412886370907,"id":"5NxFkXcJbCSivtQRJa4kHP","btcPaid":"0.0000","rate":619.39,"exceptionStatus":false,"token":"9CKEkTYE4VA4skhMPBxUsPQyUqXE36qpmitmYbtKssPnY3p8rYqhTTcEzUeowKwvzL"}} From f52511c7d238597860410195dfe983985ed93a03 Mon Sep 17 00:00:00 2001 From: Leo Hochberg Date: Sun, 24 Jan 2016 14:08:45 -0800 Subject: [PATCH 154/164] fixed an issue where bitpay API doesn't return paymentUrls when an invoice is already paid --- src/Bitpay/Client/Client.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 6e700e38..42e6be76 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -632,8 +632,12 @@ public function getInvoice($invoiceId) ->setId($data['id']) ->setBtcPaid($data['btcPaid']) ->setRate($data['rate']) - ->setExceptionStatus($data['exceptionStatus']) - ->setPaymentUrls($paymentUrls->setUrls($data['paymentUrls'])); + ->setExceptionStatus($data['exceptionStatus']); + + if (isset($data['paymentUrls'])) { + $invoice + ->setPaymentUrls($paymentUrls->setUrls($data['paymentUrls'])); + } return $invoice; } From 0f8c3abd27a0287e74f4c1d92fe7e9de350d0834 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 5 Feb 2016 12:42:44 -0500 Subject: [PATCH 155/164] Fixed scope of PaymentUrlSet. --- tests/Bitpay/Client/ClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bitpay/Client/ClientTest.php b/tests/Bitpay/Client/ClientTest.php index d86e9467..37ad06ff 100644 --- a/tests/Bitpay/Client/ClientTest.php +++ b/tests/Bitpay/Client/ClientTest.php @@ -170,7 +170,7 @@ public function testCreateInvoice() $this->assertEquals(315.7, $invoice->getRate()); $this->assertEquals(false, $invoice->getExceptionStatus()); $this->assertEquals('abcdefghijklmno', $invoice->getToken()->getToken()); - $this->assertEquals('bitcoin:mabcdefghijkmnopqrstuvw123456789AB?amount=0.0632', $invoice->getPaymentUrl(PaymentUrlSet::BIP_21)); + $this->assertEquals('bitcoin:mabcdefghijkmnopqrstuvw123456789AB?amount=0.0632', $invoice->getPaymentUrl(\BitPay\PaymentUrlSet::BIP_21)); //assert that invoice, expiration and currenttime are in the past //meaning we didn't try to create date objects from unix timestamps including milliseconds $this->assertLessThan(time(), $invoice->getInvoiceTime()->getTimestamp()); From b6b12087d5579b9476c6b9f5328e242ab2117ae7 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 12 Feb 2016 13:52:20 -0500 Subject: [PATCH 156/164] Invoice class mutator type-checking - Model classes will/should test types on mutators, a sane model is calling is_numeric followed by floatval for float types Rationale: Instantiators of models should take care to construct fields of the appropriate type, but model's should have a bit of checking as well for safety. --- src/Bitpay/Invoice.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index fcb18c89..a660cb42 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -151,8 +151,8 @@ public function getPrice() */ public function setPrice($price) { - if (is_float($price)) { - $this->getItem()->setPrice($price); + if (is_numeric($price)) { + $this->getItem()->setPrice(floatval($price)); } return $this; @@ -438,9 +438,7 @@ public function getBtcPrice() */ public function setBtcPrice($btcPrice) { - if (is_float($btcPrice)) { - $this->btcPrice = $btcPrice; - } else if (is_numeric($btcPrice)) { + if (is_numeric($btcPrice)) { $this->btcPrice = floatval($btcPrice); } @@ -677,7 +675,7 @@ public function getBtcPaid() */ public function setBtcPaid($btcPaid) { - if (is_float($btcPaid)) { + if (is_numeric($btcPaid)) { $this->btcPaid = $btcPaid; } @@ -699,8 +697,8 @@ public function getRate() */ public function setRate($rate) { - if (is_float($rate)) { - $this->rate = $rate; + if (is_numeric($rate)) { + $this->rate = floatval($rate); } return $this; From a4bd4a2733e2df0d63010fe46c6532172179eba2 Mon Sep 17 00:00:00 2001 From: James Walpole Date: Sun, 14 Feb 2016 21:47:46 -0500 Subject: [PATCH 157/164] Update Configuration Doc Links --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ebc54617..4511059a 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ php composer.phar require bitpay/php-client:^2.2 # Configuration -See https://labs.bitpay.com/t/php-bitpay-client-library-configuration/555 +https://help.bitpay.com/8451-Implementation-/how-to-configure-the-php-bitpay-client-library # Usage @@ -84,8 +84,7 @@ Reading the latest documentation at https://labs.bitpay.com/c/libraries/php migh # Support * https://github.com/bitpay/php-bitpay-client/issues -* https://labs.bitpay.com/c/libraries/php -* https://support.bitpay.com/ +* https://help.bitpay.com/ # License From 366a62065f156db399e503cdc59a835fe8646265 Mon Sep 17 00:00:00 2001 From: Marco Dania Date: Mon, 15 Feb 2016 15:04:35 +0100 Subject: [PATCH 158/164] fix timezone ids for case-sensitive systems --- src/Bitpay/Client/Client.php | 2 +- src/Bitpay/Invoice.php | 2 +- src/Bitpay/Payout.php | 2 +- src/Bitpay/PayoutInstruction.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index 42e6be76..c7818318 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -15,7 +15,7 @@ use Bitpay\PublicKey; use Bitpay\PrivateKey; -date_default_timezone_set('utc'); +date_default_timezone_set('UTC'); /** * Client used to send requests and receive responses for BitPay's Web API. * diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index fcb18c89..65339c23 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -6,7 +6,7 @@ namespace Bitpay; -date_default_timezone_set('utc'); +date_default_timezone_set('UTC'); /** * @package Bitpay diff --git a/src/Bitpay/Payout.php b/src/Bitpay/Payout.php index 4bb598f8..e839b2fd 100644 --- a/src/Bitpay/Payout.php +++ b/src/Bitpay/Payout.php @@ -6,7 +6,7 @@ namespace Bitpay; -date_default_timezone_set('utc'); +date_default_timezone_set('UTC'); /** * Class Payout diff --git a/src/Bitpay/PayoutInstruction.php b/src/Bitpay/PayoutInstruction.php index fb4febe9..4a6a9e74 100644 --- a/src/Bitpay/PayoutInstruction.php +++ b/src/Bitpay/PayoutInstruction.php @@ -6,7 +6,7 @@ namespace Bitpay; -date_default_timezone_set('utc'); +date_default_timezone_set('UTC'); /** * Class PayoutInstruction From 871debbbb477f7a1a78d8e20a02305b988f9fb8a Mon Sep 17 00:00:00 2001 From: James Walpole Date: Fri, 19 Feb 2016 09:12:08 -0500 Subject: [PATCH 159/164] Remove Outdated Link --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 4511059a..78f3eafe 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,6 @@ Please see the ``docs`` directory for information on how to use this library and the ``examples`` directory for examples on using this library. You should be able to run all the examples by running ``php examples/File.php``. -Reading the latest documentation at https://labs.bitpay.com/c/libraries/php might also help. - # Support * https://github.com/bitpay/php-bitpay-client/issues From b2c805099aeb0080bce1878e254538984a03766c Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 2 Mar 2016 15:17:25 -0500 Subject: [PATCH 160/164] checkPriceAndCurrency - should respect that numbers coming from the api might not have decimal points at all, but they are still valid --- src/Bitpay/Client/Client.php | 7 +++++- src/Bitpay/InvoiceInterface.php | 4 ++-- src/Bitpay/ItemInterface.php | 6 ++--- tests/Bitpay/Client/ClientTest.php | 36 ++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index c7818318..e5e433d9 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -739,7 +739,12 @@ protected function prepareRequestHeaders(RequestInterface $request) protected function checkPriceAndCurrency($price, $currency) { // Get the decimal precision of the price - $decimalPrecision = strlen(substr($price, strpos($price, '.') + 1)); + $decimalPosition = strpos($price, '.'); + if ($decimalPosition == 0) { + $decimalPrecision = 0; + } else { + $decimalPrecision = strlen(substr($price, $decimalPosition + 1)); + } if (($decimalPrecision > 2 && $currency != 'BTC') || $decimalPrecision > 6) { throw new \Exception('Incorrect price format or currency type.'); diff --git a/src/Bitpay/InvoiceInterface.php b/src/Bitpay/InvoiceInterface.php index af31a665..7323aab7 100644 --- a/src/Bitpay/InvoiceInterface.php +++ b/src/Bitpay/InvoiceInterface.php @@ -78,7 +78,7 @@ interface InvoiceInterface * specified in a currency other than BTC, the price will be converted into BTC at * market exchange rates to determine the amount collected from the buyer. * - * @return string + * @return float */ public function getPrice(); @@ -195,7 +195,7 @@ public function getUrl(); * The amount of bitcoins being requested for payment of this invoice (same as the * price if the merchant set the price in BTC). * - * @return string + * @return float */ public function getBtcPrice(); diff --git a/src/Bitpay/ItemInterface.php b/src/Bitpay/ItemInterface.php index 36e2dc58..ea96ea5d 100644 --- a/src/Bitpay/ItemInterface.php +++ b/src/Bitpay/ItemInterface.php @@ -1,6 +1,6 @@ client->setAdapter($adapter); } + public function testCheckPriceAndCurrency() { + $client = new ChildOfClient(); + $res = $client->checkPriceAndCurrency(.999999, 'BTC'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(1000, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(0, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(.01, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(99, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(100.9, 'USD'); + $this->assertNull($res); + } + + /** + * @expectedException \Exception + */ + public function testCheckPriceAndCurrencyWithException() { + $client = new ChildOfClient(); + $res = $client->checkPriceAndCurrency(.991, 'ABC'); + } + /** * @expectedException \Exception */ From c2e204850529f75b3b9218b115aac01a4cc76408 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 2 Mar 2016 15:17:25 -0500 Subject: [PATCH 161/164] checkPriceAndCurrency - should respect that numbers coming from the api might not have decimal points at all, but they are still valid --- src/Bitpay/Client/Client.php | 7 +++++- src/Bitpay/InvoiceInterface.php | 4 ++-- src/Bitpay/ItemInterface.php | 6 ++--- tests/Bitpay/Client/ClientTest.php | 36 ++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/Bitpay/Client/Client.php b/src/Bitpay/Client/Client.php index c7818318..c4d0b723 100644 --- a/src/Bitpay/Client/Client.php +++ b/src/Bitpay/Client/Client.php @@ -739,7 +739,12 @@ protected function prepareRequestHeaders(RequestInterface $request) protected function checkPriceAndCurrency($price, $currency) { // Get the decimal precision of the price - $decimalPrecision = strlen(substr($price, strpos($price, '.') + 1)); + $decimalPosition = strpos($price, '.'); + if ($decimalPosition == 0) { + $decimalPrecision = 0; + } else { + $decimalPrecision = strlen(substr($price, $decimalPosition + 1)); + } if (($decimalPrecision > 2 && $currency != 'BTC') || $decimalPrecision > 6) { throw new \Exception('Incorrect price format or currency type.'); diff --git a/src/Bitpay/InvoiceInterface.php b/src/Bitpay/InvoiceInterface.php index af31a665..7323aab7 100644 --- a/src/Bitpay/InvoiceInterface.php +++ b/src/Bitpay/InvoiceInterface.php @@ -78,7 +78,7 @@ interface InvoiceInterface * specified in a currency other than BTC, the price will be converted into BTC at * market exchange rates to determine the amount collected from the buyer. * - * @return string + * @return float */ public function getPrice(); @@ -195,7 +195,7 @@ public function getUrl(); * The amount of bitcoins being requested for payment of this invoice (same as the * price if the merchant set the price in BTC). * - * @return string + * @return float */ public function getBtcPrice(); diff --git a/src/Bitpay/ItemInterface.php b/src/Bitpay/ItemInterface.php index 36e2dc58..ea96ea5d 100644 --- a/src/Bitpay/ItemInterface.php +++ b/src/Bitpay/ItemInterface.php @@ -1,6 +1,6 @@ client->setAdapter($adapter); } + public function testCheckPriceAndCurrency() { + $client = new ChildOfClient(); + $res = $client->checkPriceAndCurrency(.999999, 'BTC'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(1000, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(0, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(.01, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(99, 'USD'); + $this->assertNull($res); + + $res = $client->checkPriceAndCurrency(100.9, 'USD'); + $this->assertNull($res); + } + + /** + * @expectedException \Exception + */ + public function testCheckPriceAndCurrencyWithException() { + $client = new ChildOfClient(); + $res = $client->checkPriceAndCurrency(.991, 'ABC'); + } + /** * @expectedException \Exception */ From 5967bd115cd7d125d8da8e8f56bf2ade47f4f8c3 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 10 Mar 2016 15:58:09 -0500 Subject: [PATCH 162/164] Bumped version. --- VERSION | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 98c938ec..4a36342f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.12 +3.0.0 diff --git a/composer.json b/composer.json index 06033dff..c1d88d82 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "3.0.x-dev" } } } From 4f370def472878b591afb686c69ed5cca223920d Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 10 Mar 2016 16:03:17 -0500 Subject: [PATCH 163/164] Updated Changelog for 3.0.0. --- CHANGELOG.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22b93295..ba154065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,27 +3,17 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][unreleased] -## [2.2.12] - 2016-03-04 +## [3.0.0] - 2016-03-10 ###Fixed - should respect that numbers coming from the api might not have decimal points at all, but they are still valid - -## [2.2.11] - 2016-02-16 -###Fixed - Bug fixes that include proper type checking for invoice object creation +- Fixed invoice, expiration, and current time error +- Repaired tests based on current changes to the code. -## [2.2.10] - 2016-02-05 ###Added - Using this library with Symfony >=2.3 or Symfony 3.0.x should work. So if you are already using Symfony 3.0, then this library should work with it too. - Leo Hochberg added PaymentUrl support to the library since the BitPay backend support it. Thanks Leo. -## [2.2.9] - 2016-01-25 -###Fixed -- Fixed invoice, expiration, and current time error - -## [2.2.8] - 2015-11-16 -###Fixed -- Repaired tests based on current changes to the code. - ## [2.2.7] - 2015-10-28 ###Fixed - btcPaid on invoice responses now contains the amount paid instead of the price From cf0ae957cb55cac21396d02386714b09604cbdc5 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 10 Mar 2016 16:32:22 -0500 Subject: [PATCH 164/164] updated README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 78f3eafe..b55b6780 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Add to your composer.json file by hand. ... "require": { ... - "bitpay/php-client": "^2.2" + "bitpay/php-client": "^3.0" } ... } @@ -47,7 +47,7 @@ php composer.phar update bitpay/php-client ### Install using composer ```bash -php composer.phar require bitpay/php-client:^2.2 +php composer.phar require bitpay/php-client:^3.0 ``` # Configuration @@ -88,7 +88,7 @@ be able to run all the examples by running ``php examples/File.php``. The MIT License (MIT) -Copyright (c) 2011-2015 BitPay, Inc. +Copyright (c) 2011-2016 BitPay, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal