Merge pull request #22 from ndeet/allow-any-currency

Allow any currency symbol via overloaded class.
This commit is contained in:
Andrew Camilleri 2021-01-29 12:24:57 +01:00 committed by GitHub
commit 3b161c5d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

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)

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