Compare commits

..

10 Commits

Author SHA1 Message Date
Nicolas Dorier
4c0bf5a5bf
Update README.md 2021-11-08 21:02:40 +09:00
nicolas.dorier
75bd0f95f5
bump version 2021-10-03 10:42:34 +09:00
Nicolas Dorier
d59411a396
Merge pull request #23 from ndeet/patch-1
Fix Lets Encrypt root cert error
2021-10-03 10:40:16 +09:00
Andreas Tasch
16862d2ed6
Fix Lets Encrypt root cert error
@NicolasDorier 

Do not use the custom ca-bundle.crt as it contains outdated certs and there is no obvious reason imo to why even use it at all. Normally the system ssl library is good enough for major SSL certs to work. Maybe Bitpay had some need for self signed certs or something to even do that.

Note: just did edit in the web UI and not delete the ca-bundle.crt file for now.

Context:
https://chat.btcpayserver.org/btcpayserver/pl/cm9itj98hfbr9jgiq4t38hkeuw

including the comments afterwards of another user that tried this fix successfully.

Todo: after merging this somebody needs to do a WooCommerce plugin release, not sure who is in charge of that atm.
2021-10-02 22:52:09 +02:00
Andrew Camilleri
3b161c5d00
Merge pull request #22 from ndeet/allow-any-currency
Allow any currency symbol via overloaded class.
2021-01-29 12:24:57 +01:00
Andrew Camilleri
ca9e77e5df
Merge pull request #21 from ndeet/payment-currencies
Support for payment currencies.
2021-01-29 12:24:28 +01:00
Andreas Tasch
01057e8da8 Make sure to use CurrencyUnrestricted here to not break IPN callback. 2021-01-26 14:22:46 +01:00
Andreas Tasch
5522adcf5e Allow any currency symbol via overloaded class. 2021-01-26 13:28:07 +01:00
Andreas Tasch
c41360a6e2 Support for payment currencies. 2021-01-26 13:24:33 +01:00
nicolas.dorier
7815bc0312
bump ca 2020-07-17 21:07:10 +09:00
8 changed files with 1262 additions and 1657 deletions

View File

@ -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
=================

View File

@ -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

View File

@ -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) {

View File

@ -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);

View 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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}