From a79c76ff7413a1fd45e2bb67aa7cb47beb534d7b Mon Sep 17 00:00:00 2001 From: Antonio Buedo Date: Wed, 11 Dec 2019 12:22:33 +0100 Subject: [PATCH] #v1.1.1912.0-rc - Model updates and ERC_20 codes (#3) * - Added erc20 support --- composer.json | 2 +- composer.lock | 218 +++++++----------- src/BitPaySDKLight/Client.php | 4 +- src/BitPaySDKLight/Env.php | 2 +- .../Model/Invoice/MinerFees.php | 45 +++- .../Model/Invoice/PaymentCode.php | 28 ++- .../Model/Invoice/PaymentCodes.php | 73 ++++-- .../Model/Invoice/PaymentTotal.php | 70 ++++-- .../SupportedTransactionCurrencies.php | 73 ++++-- 9 files changed, 322 insertions(+), 193 deletions(-) diff --git a/composer.json b/composer.json index 58e6e38..c624ade 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } ], "require-dev": { - "phpunit/phpunit": "^8.3" + "phpunit/phpunit": "^7.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 45e4f5a..a33e7ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,48 +4,50 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "845ffc07ff5a725e6877cddb216810f5", + "content-hash": "93e762904ef2d6fcb80f0ef6cf8585e1", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.3.3", + "version": "6.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", + "reference": "dbc2bc3a293ed6b1ae08a3651e2bfd213d19b6a5", "shasum": "" }, "require": { + "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", + "guzzlehttp/psr7": "^1.6.1", "php": ">=5.5" }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.0" + "psr/log": "^1.1" }, "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -69,7 +71,7 @@ "rest", "web service" ], - "time": "2018-04-22T15:46:56+00:00" + "time": "2019-12-07T18:20:45+00:00" }, { "name": "guzzlehttp/promises", @@ -287,16 +289,16 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -339,7 +341,7 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "myclabs/deep-copy", @@ -706,40 +708,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.8", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", - "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.1", + "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" + "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -765,7 +767,7 @@ "testing", "xunit" ], - "time": "2019-09-17T06:24:36+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", @@ -958,52 +960,53 @@ }, { "name": "phpunit/phpunit", - "version": "8.4.1", + "version": "7.5.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "366a4a0f2b971fd43b7c351d621e8dd7d7131869" + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/366a4a0f2b971fd43b7c351d621e8dd7d7131869", - "reference": "366a4a0f2b971fd43b7c351d621e8dd7d7131869", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2.0", + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.9.1", - "phar-io/manifest": "^1.0.3", - "phar-io/version": "^2.0.1", - "php": "^7.2", - "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^7.0.7", - "phpunit/php-file-iterator": "^2.0.2", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.2", - "sebastian/exporter": "^3.1.1", - "sebastian/global-state": "^3.0.0", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1011,7 +1014,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.4-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1037,7 +1040,7 @@ "testing", "xunit" ], - "time": "2019-10-07T12:57:41+00:00" + "time": "2019-12-06T05:14:37+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1206,16 +1209,16 @@ }, { "name": "sebastian/environment", - "version": "4.2.2", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { @@ -1255,7 +1258,7 @@ "environment", "hhvm" ], - "time": "2019-05-05T09:05:15+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", @@ -1326,26 +1329,23 @@ }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.0" }, "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -1353,7 +1353,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1376,7 +1376,7 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", @@ -1565,52 +1565,6 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "time": "2018-10-04T04:07:39+00:00" }, - { - "name": "sebastian/type", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", - "shasum": "" - }, - "require": { - "php": "^7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "time": "2019-07-02T08:10:15+00:00" - }, { "name": "sebastian/version", "version": "2.0.1", @@ -1656,16 +1610,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -1677,7 +1631,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -1710,7 +1664,7 @@ "polyfill", "portable" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "theseer/tokenizer", @@ -1754,31 +1708,29 @@ }, { "name": "webmozart/assert", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1800,7 +1752,7 @@ "check", "validate" ], - "time": "2019-08-24T08:43:50+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "aliases": [], diff --git a/src/BitPaySDKLight/Client.php b/src/BitPaySDKLight/Client.php index a7bf08e..694c89d 100644 --- a/src/BitPaySDKLight/Client.php +++ b/src/BitPaySDKLight/Client.php @@ -23,9 +23,9 @@ * Class Client * @package Bitpay light * @author Antonio Buedo - * @version 3.0.1910 + * @version 1.1.1912 * See bitpay.com/api for more information. - * date 08.10.2019 + * date 11.12.2019 */ class Client { diff --git a/src/BitPaySDKLight/Env.php b/src/BitPaySDKLight/Env.php index 985676e..4629383 100644 --- a/src/BitPaySDKLight/Env.php +++ b/src/BitPaySDKLight/Env.php @@ -11,5 +11,5 @@ interface Env const TestUrl = "https://test.bitpay.com/"; const ProdUrl = "https://bitpay.com/"; const BitpayApiVersion = "2.0.0"; - const BitpayPluginInfo = "BitPay_PHP_Client_v3.0.1910"; + const BitpayPluginInfo = "BitPay_PHP_Client_v1.1.1912"; } \ No newline at end of file diff --git a/src/BitPaySDKLight/Model/Invoice/MinerFees.php b/src/BitPaySDKLight/Model/Invoice/MinerFees.php index 83d7c88..5c7ba0f 100644 --- a/src/BitPaySDKLight/Model/Invoice/MinerFees.php +++ b/src/BitPaySDKLight/Model/Invoice/MinerFees.php @@ -9,12 +9,18 @@ class MinerFees protected $_btc; protected $_bch; protected $_eth; + protected $_usdc; + protected $_gusd; + protected $_pax; public function __construct() { $this->_btc = new MinerFeesItem(); $this->_bch = new MinerFeesItem(); $this->_eth = new MinerFeesItem(); + $this->_usdc = new MinerFeesItem(); + $this->_gusd = new MinerFeesItem(); + $this->_pax = new MinerFeesItem(); } public function getBTH() @@ -47,12 +53,45 @@ public function setETH(MinerFeesItem $eth) $this->_eth = $eth; } + public function getUSDC() + { + return $this->_usdc; + } + + public function setUSDC(MinerFeesItem $usdc) + { + $this->_usdc = $usdc; + } + + public function getGUSD() + { + return $this->_gusd; + } + + public function setGUSD(MinerFeesItem $gusd) + { + $this->_gusd = $gusd; + } + + public function getPAX() + { + return $this->_pax; + } + + public function setPAX(MinerFeesItem $pax) + { + $this->_pax = $pax; + } + public function toArray() { $elements = [ - 'btc' => $this->getBTH()->toArray(), - 'bch' => $this->getBCH()->toArray(), - 'eth' => $this->getETH()->toArray(), + 'btc' => $this->getBTH()->toArray(), + 'bch' => $this->getBCH()->toArray(), + 'eth' => $this->getETH()->toArray(), + 'usdc' => $this->getUSDC()->toArray(), + 'gusd' => $this->getGUSD()->toArray(), + 'pax' => $this->getPAX()->toArray(), ]; foreach ($elements as $key => $value) { diff --git a/src/BitPaySDKLight/Model/Invoice/PaymentCode.php b/src/BitPaySDKLight/Model/Invoice/PaymentCode.php index 5634a47..ccf9e6a 100644 --- a/src/BitPaySDKLight/Model/Invoice/PaymentCode.php +++ b/src/BitPaySDKLight/Model/Invoice/PaymentCode.php @@ -8,6 +8,8 @@ class PaymentCode { protected $_bip72b; protected $_bip73; + protected $_eip681; + protected $_eip681b; public function __construct() { @@ -16,8 +18,10 @@ public function __construct() public function toArray() { $elements = [ - 'bip72b' => $this->getBip72b(), - 'bip73' => $this->getBip73(), + 'bip72b' => $this->getBip72b(), + 'bip73' => $this->getBip73(), + 'eip681' => $this->getEip681(), + 'eip681b' => $this->getEip681b(), ]; foreach ($elements as $key => $value) { @@ -48,4 +52,24 @@ public function setBip73(string $bip73) { $this->_bip73 = $bip73; } + + public function getEip681() + { + return $this->_eip681; + } + + public function setEip681(string $eip681) + { + $this->_eip681 = $eip681; + } + + public function getEip681b() + { + return $this->_eip681b; + } + + public function setEip681b(string $eip681b) + { + $this->_eip681b = $eip681b; + } } \ No newline at end of file diff --git a/src/BitPaySDKLight/Model/Invoice/PaymentCodes.php b/src/BitPaySDKLight/Model/Invoice/PaymentCodes.php index 5626b1b..56980a8 100644 --- a/src/BitPaySDKLight/Model/Invoice/PaymentCodes.php +++ b/src/BitPaySDKLight/Model/Invoice/PaymentCodes.php @@ -9,29 +9,18 @@ class PaymentCodes protected $_btc; protected $_bch; protected $_eth; + protected $_usdc; + protected $_gusd; + protected $_pax; public function __construct() { $this->_btc = new PaymentCode(); $this->_bch = new PaymentCode(); $this->_eth = new PaymentCode(); - } - - public function toArray() - { - $elements = [ - 'BTC' => $this->getBTC()->toArray(), - 'BCH' => $this->getBCH()->toArray(), - 'ETH' => $this->getETH()->toArray(), - ]; - - foreach ($elements as $key => $value) { - if (empty($value)) { - unset($elements[$key]); - } - } - - return $elements; + $this->_usdc = new PaymentCode(); + $this->_gusd = new PaymentCode(); + $this->_pax = new PaymentCode(); } public function getBTC() @@ -63,4 +52,54 @@ public function setETH(PaymentCode $eth) { $this->_eth = $eth; } + + public function getUSDC() + { + return $this->_usdc; + } + + public function setUSDC(PaymentCode $usdc) + { + $this->_usdc = $usdc; + } + + public function getGUSD() + { + return $this->_gusd; + } + + public function setGUSD(PaymentCode $gusd) + { + $this->_gusd = $gusd; + } + + public function getPAX() + { + return $this->_pax; + } + + public function setPAX(PaymentCode $pax) + { + $this->_pax = $pax; + } + + public function toArray() + { + $elements = [ + 'BTC' => $this->getBTC()->toArray(), + 'BCH' => $this->getBCH()->toArray(), + 'ETH' => $this->getETH()->toArray(), + 'USDC' => $this->getUSDC()->toArray(), + 'GUSD' => $this->getGUSD()->toArray(), + 'PAX' => $this->getPAX()->toArray(), + ]; + + foreach ($elements as $key => $value) { + if (empty($value)) { + unset($elements[$key]); + } + } + + return $elements; + } } \ No newline at end of file diff --git a/src/BitPaySDKLight/Model/Invoice/PaymentTotal.php b/src/BitPaySDKLight/Model/Invoice/PaymentTotal.php index dbbbcd8..1fde288 100644 --- a/src/BitPaySDKLight/Model/Invoice/PaymentTotal.php +++ b/src/BitPaySDKLight/Model/Invoice/PaymentTotal.php @@ -9,28 +9,14 @@ class PaymentTotal protected $_btc; protected $_bch; protected $_eth; + protected $_usdc; + protected $_gusd; + protected $_pax; public function __construct() { } - public function toArray() - { - $elements = [ - 'BTC' => $this->getBTC(), - 'BCH' => $this->getBCH(), - 'ETH' => $this->getETH(), - ]; - - foreach ($elements as $key => $value) { - if (empty($value)) { - unset($elements[$key]); - } - } - - return $elements; - } - public function getBTC() { return $this->_btc; @@ -60,4 +46,54 @@ public function setETH(float $eth) { $this->_eth = $eth; } + + public function getUSDC() + { + return $this->_usdc; + } + + public function setUSDC(float $usdc) + { + $this->_usdc = $usdc; + } + + public function getGUSD() + { + return $this->_gusd; + } + + public function setGUSD(float $gusd) + { + $this->_gusd = $gusd; + } + + public function getPAX() + { + return $this->_pax; + } + + public function setPAX(float $pax) + { + $this->_pax = $pax; + } + + public function toArray() + { + $elements = [ + 'BTC' => $this->getBTC(), + 'BCH' => $this->getBCH(), + 'ETH' => $this->getETH(), + 'USDC' => $this->getUSDC(), + 'GUSD' => $this->getGUSD(), + 'PAX' => $this->getPAX(), + ]; + + foreach ($elements as $key => $value) { + if (empty($value)) { + unset($elements[$key]); + } + } + + return $elements; + } } \ No newline at end of file diff --git a/src/BitPaySDKLight/Model/Invoice/SupportedTransactionCurrencies.php b/src/BitPaySDKLight/Model/Invoice/SupportedTransactionCurrencies.php index 2b9fb8b..b3efdb7 100644 --- a/src/BitPaySDKLight/Model/Invoice/SupportedTransactionCurrencies.php +++ b/src/BitPaySDKLight/Model/Invoice/SupportedTransactionCurrencies.php @@ -9,29 +9,18 @@ class SupportedTransactionCurrencies protected $_btc; protected $_bch; protected $_eth; + protected $_usdc; + protected $_gusd; + protected $_pax; public function __construct() { $this->_btc = new SupportedTransactionCurrency(); $this->_bch = new SupportedTransactionCurrency(); $this->_eth = new SupportedTransactionCurrency(); - } - - public function toArray() - { - $elements = [ - 'btc' => $this->getBTC()->toArray(), - 'bch' => $this->getBCH()->toArray(), - 'eth' => $this->getETH()->toArray(), - ]; - - foreach ($elements as $key => $value) { - if (empty($value)) { - unset($elements[$key]); - } - } - - return $elements; + $this->_usdc = new SupportedTransactionCurrency(); + $this->_gusd = new SupportedTransactionCurrency(); + $this->_pax = new SupportedTransactionCurrency(); } public function getBTC() @@ -63,4 +52,54 @@ public function setETH(SupportedTransactionCurrency $eth) { $this->_eth = $eth; } + + public function getUSDC() + { + return $this->_usdc; + } + + public function setUSDC(SupportedTransactionCurrency $usdc) + { + $this->_usdc = $usdc; + } + + public function getGUSD() + { + return $this->_gusd; + } + + public function setGUSD(SupportedTransactionCurrency $gusd) + { + $this->_gusd = $gusd; + } + + public function getPAX() + { + return $this->_pax; + } + + public function setPAX(SupportedTransactionCurrency $pax) + { + $this->_pax = $pax; + } + + public function toArray() + { + $elements = [ + 'btc' => $this->getBTC()->toArray(), + 'bch' => $this->getBCH()->toArray(), + 'eth' => $this->getETH()->toArray(), + 'usdc' => $this->getUSDC()->toArray(), + 'gusd' => $this->getGUSD()->toArray(), + 'pax' => $this->getPAX()->toArray(), + ]; + + foreach ($elements as $key => $value) { + if (empty($value)) { + unset($elements[$key]); + } + } + + return $elements; + } } \ No newline at end of file