Compare commits
10 Commits
Kukks-patc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c0bf5a5bf | ||
|
|
75bd0f95f5 | ||
|
|
d59411a396 | ||
|
|
16862d2ed6 | ||
|
|
3b161c5d00 | ||
|
|
ca9e77e5df | ||
|
|
01057e8da8 | ||
|
|
5522adcf5e | ||
|
|
c41360a6e2 | ||
|
|
7815bc0312 |
@ -1,3 +1,7 @@
|
||||
# === Warning ===
|
||||
|
||||
This is the old BitPay based PHP client and should be considered deprecated (even though it currently still works). If you are building something from scratch, [use the new Greenfield API](https://github.com/btcpayserver/btcpayserver-greenfield-php).
|
||||
|
||||
bitpay/php-bitpay-client
|
||||
=================
|
||||
|
||||
|
||||
@ -103,7 +103,6 @@ class CurlAdapter implements AdapterInterface
|
||||
CURLOPT_TIMEOUT => 10,
|
||||
CURLOPT_SSL_VERIFYPEER => 1,
|
||||
CURLOPT_SSL_VERIFYHOST => 2,
|
||||
CURLOPT_CAINFO => __DIR__.'/ca-bundle.crt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_FORBID_REUSE => 1,
|
||||
CURLOPT_FRESH_CONNECT => 1,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -121,7 +121,7 @@ class Client implements ClientInterface
|
||||
->setBtcPrice(array_key_exists('btcPrice', $data) ? $data['btcPrice'] : '')
|
||||
->setPrice($data['price'])
|
||||
->setTaxIncluded($data['taxIncluded'])
|
||||
->setCurrency(new \Bitpay\Currency($data['currency']))
|
||||
->setCurrency(new \Bitpay\CurrencyUnrestricted($data['currency']))
|
||||
->setOrderId(array_key_exists('orderId', $data) ? $data['orderId'] : '')
|
||||
->setInvoiceTime($invoiceTime)
|
||||
->setExpirationTime($expirationTime)
|
||||
@ -164,7 +164,6 @@ class Client implements ClientInterface
|
||||
'transactionSpeed' => $invoice->getTransactionSpeed(),
|
||||
'fullNotifications' => $invoice->isFullNotifications(),
|
||||
'extendedNotifications' => $invoice->isExtendedNotifications(),
|
||||
'redirectAutomatically' => $invoice->isRedirectAutomatically(),
|
||||
'notificationEmail' => $invoice->getNotificationEmail(),
|
||||
'redirectURL' => $invoice->getRedirectUrl(),
|
||||
'orderID' => $invoice->getOrderId(),
|
||||
@ -184,6 +183,7 @@ class Client implements ClientInterface
|
||||
'guid' => Util::guid(),
|
||||
'nonce' => Util::nonce(),
|
||||
'token' => $this->token->getToken(),
|
||||
'paymentCurrencies' => $invoice->getPaymentCurrencies(),
|
||||
);
|
||||
|
||||
foreach(array_keys($body) as $key) {
|
||||
|
||||
@ -26,7 +26,7 @@ interface ClientInterface
|
||||
* @see RFC2616 section 14.43 for User-Agent Format
|
||||
*/
|
||||
const NAME = 'BitPay PHP-Client BTCPAY';
|
||||
const VERSION = '2.2.22';
|
||||
const VERSION = '2.2.23';
|
||||
|
||||
//public function createApplication(ApplicationInterface $application);
|
||||
|
||||
|
||||
16
src/Bitpay/CurrencyUnrestricted.php
Normal file
16
src/Bitpay/CurrencyUnrestricted.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Bitpay;
|
||||
|
||||
class CurrencyUnrestricted extends Currency
|
||||
{
|
||||
/**
|
||||
* Overrides the parent method to allow any currency symbol to be set.
|
||||
*/
|
||||
public function setCode($code)
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@ -66,10 +66,7 @@ class Invoice implements InvoiceInterface
|
||||
* @var boolean
|
||||
*/
|
||||
protected $extendedNotifications = false;
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $redirectAutomatically = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -158,6 +155,10 @@ class Invoice implements InvoiceInterface
|
||||
*/
|
||||
protected $paymentTotals;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $paymentCurrencies;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@ -442,21 +443,6 @@ class Invoice implements InvoiceInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isRedirectAutomatically()
|
||||
{
|
||||
return $this->redirectAutomatically;
|
||||
}
|
||||
|
||||
public function setRedirectAutomatically($redirectAutomatically)
|
||||
{
|
||||
$this->redirectAutomatically = (boolean) $redirectAutomatically;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@ -937,4 +923,21 @@ class Invoice implements InvoiceInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getPaymentCurrencies() {
|
||||
return $this->paymentCurrencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setPaymentCurrencies($paymentCurrencies) {
|
||||
$this->paymentCurrencies = $paymentCurrencies;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,14 +185,7 @@ interface InvoiceInterface
|
||||
* @return boolean
|
||||
*/
|
||||
public function isExtendedNotifications();
|
||||
/**
|
||||
* default value: false
|
||||
* ● true: Redirect from the checkout UI to the set redirect url
|
||||
* ● false: checkout UIwill not redirect but will display a button with a link to the set redirect url
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isRedirectAutomatically();
|
||||
|
||||
/**
|
||||
* The unique id of the invoice assigned by bitpay.com
|
||||
*
|
||||
@ -386,4 +379,22 @@ interface InvoiceInterface
|
||||
* @return array|object
|
||||
*/
|
||||
public function getRefundAddresses();
|
||||
|
||||
/**
|
||||
* Get the enforced transaction currencies.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getPaymentCurrencies();
|
||||
|
||||
/**
|
||||
* Set specific invoice currencies and to enforce them on payment step.
|
||||
*
|
||||
* @param array $paymentCurrencies
|
||||
* The currencies need to match what is supported by BTCPay Server.
|
||||
* E.g. BTC, BTC_ONCHAIN, BTC_OFFCHAIN, LTC, XMR_MONEROLIKE etc.
|
||||
*
|
||||
* @return InvoiceInterface
|
||||
*/
|
||||
public function setPaymentCurrencies($paymentCurrencies);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user