Skip to content
This repository was archived by the owner on Jan 22, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Bitpay/Client/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ public function __toString()
}

/**
* @param string $rawResponse
* @return Response
*/
public static function createFromRawResponse($rawResponse)
{
{
$response = new self($rawResponse);
// remove HTTP 100 responses
$delimiter = "\r\n\r\n"; // HTTP header delimiter
// check if the 100 Continue header exists
while ( preg_match('#^HTTP/[0-9\\.]+\s+100\s+Continue#i',$rawResponse) ) {
$tmp = explode($delimiter,$rawResponse,2); // grab the 100 Continue header
$rawResponse = $tmp[1]; // update the response, purging the most recent 100 Continue header
} // repeat
//remove HTTP 100 responses
$delimiter = "\r\n\r\n";// HTTP header delimiter
//check if the 100 Continue header exists
while (preg_match('#^HTTP/[0-9\\.]+\s+100\s+Continue#i', $rawResponse)) {
$tmp = explode($delimiter, $rawResponse, 2);// grab the 100 Continue header
$rawResponse = $tmp[1];// update the response, purging the most recent 100 Continue header
}// repeat

$lines = preg_split('/(\\r?\\n)/', $rawResponse);
$linesLen = count($lines);
Expand Down
19 changes: 4 additions & 15 deletions src/Bitpay/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Invoice implements InvoiceInterface
/**
* @var string
*/
protected $transactionSpeed;
protected $transactionSpeed = self::TRANSACTION_SPEED_MEDIUM;

/**
* @var string
Expand Down Expand Up @@ -60,12 +60,12 @@ class Invoice implements InvoiceInterface
/**
* @var boolean
*/
protected $fullNotifications;
protected $fullNotifications = true;

/**
* @var boolean
*/
protected $extendedNotifications;
protected $extendedNotifications = false;

/**
* @var string
Expand Down Expand Up @@ -123,20 +123,10 @@ class Invoice implements InvoiceInterface
protected $token;

/**
* @var Array
* @var array
*/
protected $refundAddresses;


/**
*/
public function __construct()
{
$this->transactionSpeed = self::TRANSACTION_SPEED_MEDIUM;
$this->fullNotifications = true;
$this->extendedNotifications = false;
}

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -756,5 +746,4 @@ public function setRefundAddresses($refundAddresses)

return $this;
}

}
1 change: 0 additions & 1 deletion src/Bitpay/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,4 @@ public function setNotify($boolvalue)

return $this;
}

}
7 changes: 4 additions & 3 deletions tests/Bitpay/Client/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,9 @@ private function getMockInvoice()
'getExpirationTime', 'getCurrentTime', 'getOrderId', 'getItemDesc', 'getItemCode',
'isPhysical', 'getBuyerName', 'getBuyerAddress1', 'getBuyerAddress2', 'getBuyerCity',
'getBuyerState', 'getBuyerZip', 'getBuyerCountry', 'getBuyerEmail', 'getBuyerPhone',
'getExceptionStatus', 'getBtcPaid', 'getRate', 'getToken', 'setId', 'setUrl',
'setStatus', 'setBtcPrice', 'setPrice', 'setInvoiceTime', 'setExpirationTime',
'setCurrentTime', 'setBtcPaid', 'setRate', 'setToken', 'setExceptionStatus',
'getExceptionStatus', 'getBtcPaid', 'getRate', 'getToken', 'getRefundAddresses',
'setId', 'setUrl', 'setStatus', 'setBtcPrice', 'setPrice', 'setInvoiceTime', 'setExpirationTime',
'setCurrentTime', 'setBtcPaid', 'setRate', 'setToken', 'setExceptionStatus', 'isExtendedNotifications'
)
)
->getMock();
Expand Down Expand Up @@ -688,6 +688,7 @@ private function getMockBuyer()
'getState',
'getZip',
'getCountry',
'getNotify'
)
)
->getMock();
Expand Down
6 changes: 3 additions & 3 deletions tests/Bitpay/InvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function testSetStatus()
public function testIsFullNotifications()
{
$this->assertNotNull($this->invoice);
$this->assertFalse($this->invoice->isFullNotifications());
$this->assertTrue($this->invoice->isFullNotifications());
}

public function testGetId()
Expand Down Expand Up @@ -523,9 +523,9 @@ public function testSetToken()

public function testSetFullNotifications()
{
$this->assertFalse($this->invoice->isFullNotifications());
$this->invoice->setFullNotifications(true);
$this->assertTrue($this->invoice->isFullNotifications());
$this->invoice->setFullNotifications(false);
$this->assertFalse($this->invoice->isFullNotifications());
}

private function getMockItem()
Expand Down