Skip to content

Commit

Permalink
#v1.2.2002.0-rc - Mayor updates (#7)
Browse files Browse the repository at this point in the history
- Php required version lowered
- Invoice model updated
- API frame headers added
- HTTP Headers refactor
- Sub-version upgrade
  • Loading branch information
Antonio Buedo authored Feb 25, 2020
1 parent 545ce61 commit ac44865
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/BitPaySDKLight/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
* Class Client
* @package Bitpay light
* @author Antonio Buedo
* @version 1.1.1912
* @version 1.2.2002
* See bitpay.com/api for more information.
* date 11.12.2019
* date 25.02.2020
*/
class Client
{
Expand Down
14 changes: 8 additions & 6 deletions src/BitPaySDKLight/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

interface Env
{
const Test = "Test";
const Prod = "Prod";
const TestUrl = "https://test.bitpay.com/";
const ProdUrl = "https://bitpay.com/";
const BitpayApiVersion = "2.0.0";
const BitpayPluginInfo = "BitPay_PHP_Client_v1.1.1912";
const Test = "Test";
const Prod = "Prod";
const TestUrl = "https://test.bitpay.com/";
const ProdUrl = "https://bitpay.com/";
const BitpayApiVersion = "2.0.0";
const BitpayPluginInfo = "BitPay_PHP_Client_v1.2.2002";
const BitpayApiFrame = "custom-light";
const BitpayApiFrameVersion = "1.0.0";
}
24 changes: 21 additions & 3 deletions src/BitPaySDKLight/Model/Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class Invoice
protected $_shopper;
protected $_billId;
protected $_refundInfo;

/**
* PaymentCodes will be deprecated TODO on version 2.0
*
* @var array
* @deprecated
*/
protected $_paymentCodes;
protected $_extendedNotifications = false;

Expand Down Expand Up @@ -78,7 +85,7 @@ public function __construct(float $price = null, string $currency = null)
$this->_minerFees = new MinerFees();
$this->_shopper = new Shopper();
$this->_refundInfo = new RefundInfo();
$this->_paymentCodes = new PaymentCodes();
$this->_paymentCodes = null;
$this->_paymentTotals = new PaymentTotal();
$this->_paymentSubtotals = new PaymentTotal();
$this->_paymentDisplayTotals = new PaymentTotal();
Expand Down Expand Up @@ -464,14 +471,25 @@ public function setRefundInfo(RefundInfo $refundInfo)
$this->_refundInfo = $refundInfo;
}

/**
* PaymentCodes will be deprecated TODO on version 2.0
*
* @deprecated
*/
public function getPaymentCodes()
{
return $this->_paymentCodes;
}

/**
* PaymentCodes will be deprecated TODO on version 2.0
*
* @var array
* @deprecated
*/
public function setPaymentCodes(PaymentCodes $paymentCodes)
{
$this->_paymentCodes = $paymentCodes;
$this->_paymentCodes = null;
}

public function getExtendedNotifications()
Expand Down Expand Up @@ -593,7 +611,7 @@ public function toArray()
'shopper' => $this->getShopper()->toArray(),
'billId' => $this->getBillId(),
'refundInfo' => $this->getRefundInfo()->toArray(),
'paymentCodes' => $this->getPaymentCodes()->toArray(),
'paymentCodes' => [],
'extendedNotifications' => $this->getExtendedNotifications(),
'transactionCurrency' => $this->getTransactionCurrency(),
'amountPaid' => $this->getAmountPaid(),
Expand Down
5 changes: 5 additions & 0 deletions src/BitPaySDKLight/Model/Invoice/PaymentCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
namespace BitPaySDKLight\Model\Invoice;


/**
* PaymentCode will be deprecated TODO on version 2.0
*
* @deprecated
*/
class PaymentCode
{
protected $_bip72b;
Expand Down
5 changes: 5 additions & 0 deletions src/BitPaySDKLight/Model/Invoice/PaymentCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
namespace BitPaySDKLight\Model\Invoice;


/**
* PaymentCode will be deprecated TODO on version 2.0
*
* @deprecated
*/
class PaymentCodes
{
protected $_btc;
Expand Down
6 changes: 4 additions & 2 deletions src/BitPaySDKLight/Util/RESTcli/RESTcli.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ public function init()
'base_url' => $this->_baseUrl,
'defaults' => [
'headers' => [
"x-accept-version" => Env::BitpayApiVersion,
'x-bitpay-plugin-info' => Env::BitpayPluginInfo,
"x-accept-version" => Env::BitpayApiVersion,
'X-BitPay-Plugin-Info' => Env::BitpayPluginInfo,
'x-bitpay-api-frame' => Env::BitpayApiFrame,
'x-bitpay-api-frame-version' => Env::BitpayApiFrameVersion,
],
],
]);
Expand Down

0 comments on commit ac44865

Please sign in to comment.