Skip to content

Commit

Permalink
#v1.3.2006.0-rc - Mayor Security Updates (#11)
Browse files Browse the repository at this point in the history
- Php required version lowered
- Added missing Http headers
- XRP and BUSD to currency model
- Fixed JsonMapper compatibility PHP 7.4
- invoice:PaymentTotals deprecated and removed on next version
- invoice:PaymentCodes deprecated and removed on next version
- Sub-version upgrade
  • Loading branch information
Antonio Buedo authored Jun 15, 2020
1 parent ac44865 commit 6622ee0
Show file tree
Hide file tree
Showing 9 changed files with 667 additions and 355 deletions.
301 changes: 237 additions & 64 deletions composer.lock

Large diffs are not rendered by default.

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.2.2002
* @version 1.3.2006
* See bitpay.com/api for more information.
* date 25.02.2020
* date 15.06.2020
*/
class Client
{
Expand Down
2 changes: 1 addition & 1 deletion src/BitPaySDKLight/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_v1.2.2002";
const BitpayPluginInfo = "BitPay_PHP_Client_v1.3.2006";
const BitpayApiFrame = "custom-light";
const BitpayApiFrameVersion = "1.0.0";
}
2 changes: 2 additions & 0 deletions src/BitPaySDKLight/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
106 changes: 92 additions & 14 deletions src/BitPaySDKLight/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 2.0
*
* @var array
* @deprecated
*/
protected $_paymentTotals;

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

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

/**
* PaymentDisplaySubTotals will be deprecated TODO on version 2.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 @@ -471,6 +499,7 @@ public function setRefundInfo(RefundInfo $refundInfo)
$this->_refundInfo = $refundInfo;
}


/**
* PaymentCodes will be deprecated TODO on version 2.0
*
Expand All @@ -481,13 +510,14 @@ public function getPaymentCodes()
return $this->_paymentCodes;
}


/**
* PaymentCodes will be deprecated TODO on version 2.0
*
* @var array
* @deprecated
*/
public function setPaymentCodes(PaymentCodes $paymentCodes)
public function setPaymentCodes(PaymentCodes $paymentCodes = null)
{
$this->_paymentCodes = null;
}
Expand Down Expand Up @@ -532,44 +562,92 @@ public function setExchangeRates($exchangeRates)
$this->_exchangeRates = $exchangeRates;
}

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

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

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

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

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

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

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

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

public function toArray()
Expand Down Expand Up @@ -616,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 All @@ -630,4 +708,4 @@ public function toArray()

return $elements;
}
}
}
2 changes: 1 addition & 1 deletion src/BitPaySDKLight/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 2.0
* PaymentCodes will be deprecated TODO on version 2.0
*
* @deprecated
*/
Expand Down
5 changes: 5 additions & 0 deletions src/BitPaySDKLight/Model/Invoice/PaymentTotal.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
namespace BitPaySDKLight\Model\Invoice;


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

0 comments on commit 6622ee0

Please sign in to comment.