Skip to content

Commit

Permalink
#v3.6.2005.0-rc - Fixed JsonMapper compatibility + Invoice properties…
Browse files Browse the repository at this point in the history
… deprecation (#43)

- Fixed JsonMapper compatibility PHP 7.4
- Added XRP and BUSD to currency model
- Deprecation of PaymentTotals in Invoice model
- Added XRP and BUSD to Currency model
  • Loading branch information
Antonio Buedo authored May 2, 2020
1 parent 1df1010 commit 7e09784
Show file tree
Hide file tree
Showing 8 changed files with 668 additions and 375 deletions.
351 changes: 262 additions & 89 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/BitPaySDK/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
* Class Client
* @package Bitpay
* @author Antonio Buedo
* @version 3.5.2003
* @version 3.6.2005
* See bitpay.com/api for more information.
* date 25.03.2020
* date 02.05.2020
*/
class Client
{
Expand Down
2 changes: 1 addition & 1 deletion src/BitPaySDK/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Env
const TestUrl = "https://test.bitpay.com/";
const ProdUrl = "https://bitpay.com/";
const BitpayApiVersion = "2.0.0";
const BitpayPluginInfo = "BitPay_PHP_Client_v3.5.2003";
const BitpayPluginInfo = "BitPay_PHP_Client_v3.6.2005";
const BitpayApiFrame = "custom";
const BitpayApiFrameVersion = "1.0.0";
}
2 changes: 2 additions & 0 deletions src/BitPaySDK/Model/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Currency
const USDC = "USDC";
const GUSD = "GUSD";
const PAX = "PAX";
const XRP = "XRP";
const BUSD = "BUSD";

// FIAT
const AED = "AED";
Expand Down
100 changes: 88 additions & 12 deletions src/BitPaySDK/Model/Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,37 @@ class Invoice
protected $_transactionCurrency;
protected $_amountPaid;
protected $_exchangeRates;

/**
* PaymentTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
protected $_paymentTotals;

/**
* PaymentSubtotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
protected $_paymentSubtotals;

/**
* PaymentDisplayTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
protected $_paymentDisplayTotals;

/**
* PaymentDisplaySubTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
protected $_paymentDisplaySubTotals;

/**
Expand All @@ -86,10 +114,10 @@ public function __construct(float $price = null, string $currency = null)
$this->_shopper = new Shopper();
$this->_refundInfo = new RefundInfo();
$this->_paymentCodes = null;
$this->_paymentTotals = new PaymentTotal();
$this->_paymentSubtotals = new PaymentTotal();
$this->_paymentDisplayTotals = new PaymentTotal();
$this->_paymentDisplaySubTotals = new PaymentTotal();
$this->_paymentTotals = null;
$this->_paymentSubtotals = null;
$this->_paymentDisplayTotals = null;
$this->_paymentDisplaySubTotals = null;
}

// API fields
Expand Down Expand Up @@ -534,44 +562,92 @@ public function setExchangeRates($exchangeRates)
$this->_exchangeRates = $exchangeRates;
}

/**
* PaymentTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function getPaymentTotals()
{
return $this->_paymentTotals;
}

/**
* PaymentTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function setPaymentTotals($paymentTotals)
{
$this->_paymentTotals = $paymentTotals;
$this->_paymentTotals = null;
}

/**
* PaymentSubtotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function getPaymentSubtotals()
{
return $this->_paymentSubtotals;
}

/**
* PaymentSubtotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function setPaymentSubtotals($paymentSubtotals)
{
$this->_paymentSubtotals = $paymentSubtotals;
$this->_paymentSubtotals = null;
}

/**
* PaymentDisplaySubTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function getPaymentDisplaySubTotals()
{
return $this->_paymentDisplaySubTotals;
}

/**
* PaymentDisplaySubTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function setPaymentDisplaySubTotals($paymentDisplaySubTotals)
{
$this->_paymentDisplaySubTotals = $paymentDisplaySubTotals;
$this->_paymentDisplaySubTotals = null;
}

/**
* PaymentDisplayTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function getPaymentDisplayTotals()
{
return $this->_paymentDisplayTotals;
}

/**
* PaymentDisplayTotals will be deprecated TODO on version 4.0
*
* @var array
* @deprecated
*/
public function setPaymentDisplayTotals($paymentDisplayTotals)
{
$this->_paymentDisplayTotals = $paymentDisplayTotals;
$this->_paymentDisplayTotals = null;
}

public function toArray()
Expand Down Expand Up @@ -618,10 +694,10 @@ public function toArray()
'transactionCurrency' => $this->getTransactionCurrency(),
'amountPaid' => $this->getAmountPaid(),
'exchangeRates' => $this->getExchangeRates(),
'paymentTotals' => $this->getPaymentTotals()->toArray(),
'paymentSubtotals' => $this->getPaymentSubtotals()->toArray(),
'paymentDisplayTotals' => $this->getPaymentDisplaySubTotals()->toArray(),
'paymentDisplaySubTotals' => $this->getPaymentDisplaySubTotals()->toArray(),
'paymentTotals' => [],
'paymentSubtotals' => [],
'paymentDisplayTotals' => [],
'paymentDisplaySubTotals' => [],
];

foreach ($elements as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/BitPaySDK/Model/Invoice/PaymentCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


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


/**
* PaymentTotal will be deprecated TODO on version 4.0
*
* @deprecated
*/
class PaymentTotal
{
protected $_btc;
Expand Down
Loading

0 comments on commit 7e09784

Please sign in to comment.