Skip to content

Commit

Permalink
SP-750 Code Examples: PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarzybok-sumoheavy committed Jan 11, 2024
1 parent 634a62a commit d527062
Show file tree
Hide file tree
Showing 10 changed files with 305 additions and 35 deletions.
7 changes: 3 additions & 4 deletions examples/Merchant/BillRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use BitPaySDK\Model\Bill\Bill;
use BitPaySDK\Model\Bill\Item;
use BitPaySDK\Model\Facade;
use BitPaySDKexamples\ClientProvider;

final class BillRequests
Expand All @@ -25,7 +26,7 @@ public function createBill(): void
$bill->setCity('MyCity');
// ...

$client->createBill($bill);
$client->createBill($bill, Facade::MERCHANT, false);
}

/**
Expand All @@ -36,9 +37,7 @@ public function getBill(): void
{
$client = ClientProvider::create();

$bill = $client->getBill('someBillId');

$bills = $client->getBills('draft');
$bill = $client->getBill('someBillId', Facade::MERCHANT, false);
}

/**
Expand Down
3 changes: 0 additions & 3 deletions examples/Merchant/SettlementRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace BitPaySDKexamples\Merchant;

use BitPaySDK\Model\Settlement\Settlement;
use BitPaySDKexamples\ClientProvider;

final class SettlementRequests
Expand All @@ -29,8 +28,6 @@ public function fetchReconciliationReport(): void
{
$client = ClientProvider::create();

$settlement = new Settlement();

$client->getSettlementReconciliationReport('settlementId', 'settlementToken');
}
}
2 changes: 1 addition & 1 deletion examples/Pos/BillRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ public function deliverBillViaEmail(): void
{
$client = ClientProvider::createPos();

$client->deliverBill('someBillId', 'myBillToken');
$result = $client->deliverBill('someBillId', 'myBillToken');
}
}
11 changes: 0 additions & 11 deletions examples/Pos/InvoiceRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,4 @@ public function getInvoice(): void

$invoiceById = $client->getInvoice('myInvoiceId');
}

/**
* @throws \BitPaySDK\Exceptions\BitPayApiException
* @throws \BitPaySDK\Exceptions\BitPayGenericException
*/
public function requestInvoiceWebhookToBeResent(): void
{
$client = ClientProvider::createPos();

$client->requestInvoiceNotification('someInvoiceId');
}
}
10 changes: 5 additions & 5 deletions src/BitPaySDK/Model/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class Currency
protected ?int $decimals = null;
protected ?string $chain = null;
protected ?string $displayCode = null;
protected ?float $maxSupply = null;
protected ?string $maxSupply = null;
protected ?int $trancheDecimals = null;
protected ?string $contractAddress = null;

Expand Down Expand Up @@ -472,17 +472,17 @@ public function setDisplayCode(?string $displayCode): void
}

/**
* @return float|null
* @return string|null
*/
public function getMaxSupply(): ?float
public function getMaxSupply(): ?string
{
return $this->maxSupply;
}

/**
* @param float|null $maxSupply
* @param string|null $maxSupply
*/
public function setMaxSupply(?float $maxSupply): void
public function setMaxSupply(?string $maxSupply): void
{
$this->maxSupply = $maxSupply;
}
Expand Down
48 changes: 48 additions & 0 deletions src/BitPaySDK/Model/Invoice/MinerFees.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class MinerFees
protected MinerFeesItem $ltc;
protected MinerFeesItem $dai;
protected MinerFeesItem $wbtc;
protected MinerFeesItem $matic;
protected MinerFeesItem $usdcM;

/**
* MinerFees constructor.
Expand All @@ -51,6 +53,8 @@ public function __construct()
$this->ltc = new MinerFeesItem();
$this->dai = new MinerFeesItem();
$this->wbtc = new MinerFeesItem();
$this->matic = new MinerFeesItem();
$this->usdcM = new MinerFeesItem();
}

/**
Expand Down Expand Up @@ -293,6 +297,48 @@ public function setWBTC(MinerFeesItem $wbtc): void
$this->wbtc = $wbtc;
}

/**
* Gets MATIC.
*
* @return MinerFeesItem
*/
public function getMATIC(): MinerFeesItem
{
return $this->matic;
}

/**
* Sets MATIC.
*
* @param MinerFeesItem $matic
* @return void
*/
public function setMATIC(MinerFeesItem $matic): void
{
$this->matic = $matic;
}

/**
* Gets USDC_m.
*
* @return MinerFeesItem
*/
public function getUsdcM(): MinerFeesItem
{
return $this->usdcM;
}

/**
* Sets USDC_m.
*
* @param MinerFeesItem $usdcM
* @return void
*/
public function setUsdcM(MinerFeesItem $usdcM): void
{
$this->usdcM = $usdcM;
}

/**
* Return array with details for currencies.
*
Expand All @@ -313,6 +359,8 @@ public function toArray(): array
'ltc' => $this->getLTC()->toArray(),
'dai' => $this->getDAI()->toArray(),
'wbtc' => $this->getWBTC()->toArray(),
'matic' => $this->getMATIC()->toArray(),
'usdc_m' => $this->getUsdcM()->toArray()
];

foreach ($elements as $key => $value) {
Expand Down
Loading

0 comments on commit d527062

Please sign in to comment.