Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SP-735 Type Review: PHP #285

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BitPaySDK/Model/Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ public function setBuyerSms(string $buyerSms): void
* This field will be populated with the refund address
* provided by the customer if you request a refund of the specific invoice.
*
* @return array|null Refund address provided by the customer
* @return array|null [[string, InvoiceRefundAddress]] Refund address provided by the customer
*/
public function getRefundAddresses(): ?array
{
Expand All @@ -901,7 +901,7 @@ public function getRefundAddresses(): ?array
* This field will be populated with the refund address
* provided by the customer if you request a refund of the specific invoice.
*
* @param array $refundAddresses Refund address provided by the customer
* @param array [[string, InvoiceRefundAddress]] $refundAddresses Refund address provided by the customer
*/
public function setRefundAddresses(array $refundAddresses): void
{
Expand Down
53 changes: 53 additions & 0 deletions src/BitPaySDK/Model/Invoice/InvoiceRefundAddresses.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace BitPaySDK\Model\Invoice;

class InvoiceRefundAddresses
{
protected string $type;
protected string $date;
protected ?int $tag;
protected ?string $email;

public function getType(): string
{
return $this->type;
}

public function setType(string $type): void
{
$this->type = $type;
}

public function getDate(): string
{
return $this->date;
}

public function setDate(string $date): void
{
$this->date = $date;
}

public function getTag(): ?int
{
return $this->tag;
}

public function setTag(?int $tag): void
{
$this->tag = $tag;
}

public function getEmail(): ?string
{
return $this->email;
}

public function setEmail(?string $email): void
{
$this->email = $email;
}
}
128 changes: 128 additions & 0 deletions src/BitPaySDK/Model/Invoice/InvoiceTransaction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php

declare(strict_types=1);

namespace BitPaySDK\Model\Invoice;

class InvoiceTransaction
{
protected string $amount;
protected int $confirmations;
protected string $time;
protected string $receivedTime;
protected string $txid ;
protected array $exRates;
protected int $outputIndex;

/**
* @return string
*/
public function getAmount(): string
{
return $this->amount;
}

/**
* @param string $amount
*/
public function setAmount(string $amount): void
{
$this->amount = $amount;
}

/**
* @return int
*/
public function getConfirmations(): int
{
return $this->confirmations;
}

/**
* @param int $confirmations
*/
public function setConfirmations(int $confirmations): void
{
$this->confirmations = $confirmations;
}

/**
* @return string
*/
public function getTime(): string
{
return $this->time;
}

/**
* @param string $time
*/
public function setTime(string $time): void
{
$this->time = $time;
}

/**
* @return string
*/
public function getReceivedTime(): string
{
return $this->receivedTime;
}

/**
* @param string $receivedTime
*/
public function setReceivedTime(string $receivedTime): void
{
$this->receivedTime = $receivedTime;
}

/**
* @return string
*/
public function getTxid(): string
{
return $this->txid;
}

/**
* @param string $txid
*/
public function setTxid(string $txid): void
{
$this->txid = $txid;
}

/**
* @return array [string => float]
*/
public function getExRates(): array
{
return $this->exRates;
}

/**
* @param array $exRates [string => float]
*/
public function setExRates(array $exRates): void
{
$this->exRates = $exRates;
}

/**
* @return int
*/
public function getOutputIndex(): int
{
return $this->outputIndex;
}

/**
* @param int $outputIndex
*/
public function setOutputIndex(int $outputIndex): void
{
$this->outputIndex = $outputIndex;
}
}
25 changes: 25 additions & 0 deletions src/BitPaySDK/Model/Invoice/InvoiceWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class InvoiceWebhook
protected ?float $amountPaid;
protected ?string $orderId;
protected ?string $transactionCurrency;
protected ?string $inInvoiceId;
protected ?string $inPaymentRequest;

public function getId(): ?string
{
Expand Down Expand Up @@ -192,4 +194,27 @@ public function setTransactionCurrency(?string $transactionCurrency): void
{
$this->transactionCurrency = $transactionCurrency;
}

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

public function setInInvoiceId(?string $inInvoiceId): void
{
$this->inInvoiceId = $inInvoiceId;
}

public function getInPaymentRequest(): ?string
{
return $this->inPaymentRequest;
}

public function setInPaymentRequest(?string $inPaymentRequest): void
{
$this->inPaymentRequest = $inPaymentRequest;
}
}
98 changes: 97 additions & 1 deletion src/BitPaySDK/Model/Invoice/RefundWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ class RefundWebhook
protected ?bool $immediate = null;
protected ?bool $buyerPaysRefundFee = null;
protected ?string $requestDate = null;
protected ?string $reference;
protected ?string $guid;
protected ?string $refundAddress;
protected ?string $type;
protected ?string $txid;
protected ?string $transactionCurrency;
protected ?float $transactionAmount;
protected ?float $transactionRefundFee;

public function getId(): ?string
{
Expand Down Expand Up @@ -140,6 +148,86 @@ public function setRequestDate(?string $requestDate): void
$this->requestDate = $requestDate;
}

public function getReference(): ?string
{
return $this->reference;
}

public function setReference(?string $reference): void
{
$this->reference = $reference;
}

public function getGuid(): ?string
{
return $this->guid;
}

public function setGuid(?string $guid): void
{
$this->guid = $guid;
}

public function getRefundAddress(): ?string
{
return $this->refundAddress;
}

public function setRefundAddress(?string $refundAddress): void
{
$this->refundAddress = $refundAddress;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(?string $type): void
{
$this->type = $type;
}

public function getTxid(): ?string
{
return $this->txid;
}

public function setTxid(?string $txid): void
{
$this->txid = $txid;
}

public function getTransactionCurrency(): ?string
{
return $this->transactionCurrency;
}

public function setTransactionCurrency(?string $transactionCurrency): void
{
$this->transactionCurrency = $transactionCurrency;
}

public function getTransactionAmount(): ?float
{
return $this->transactionAmount;
}

public function setTransactionAmount(?float $transactionAmount): void
{
$this->transactionAmount = $transactionAmount;
}

public function getTransactionRefundFee(): ?float
{
return $this->transactionRefundFee;
}

public function setTransactionRefundFee(?float $transactionRefundFee): void
{
$this->transactionRefundFee = $transactionRefundFee;
}

public function toArray(): array
{
return [
Expand All @@ -153,7 +241,15 @@ public function toArray(): array
'refundFee' => $this->getRefundFee(),
'immediate' => $this->getImmediate(),
'buyerPaysRefundFee' => $this->getBuyerPaysRefundFee(),
'requestDate' => $this->getRequestDate()
'requestDate' => $this->getRequestDate(),
'reference' => $this->getReference(),
'guid' => $this->getGuid(),
'refundAddress' => $this->getRefundAddress(),
'type' => $this->getType(),
'txid' => $this->getTxid(),
'transactionCurrency' => $this->getTransactionCurrency(),
'transactionAmount' => $this->getTransactionAmount(),
'transactionRefundFee' => $this->getTransactionRefundFee(),
];
}
}
10 changes: 5 additions & 5 deletions src/BitPaySDK/Model/Payout/PayoutTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PayoutTransaction
protected ?string $txid = null;
protected ?float $amount = null;
protected ?string $date = null;
protected ?string $confirmations = null;
protected ?int $confirmations = null;

public function __construct()
{
Expand Down Expand Up @@ -97,19 +97,19 @@ public function setDate(?string $date): void
/**
* Gets the number of confirmations the transaction has received.
*
* @return string|null
* @return int|null
*/
public function getConfirmations(): ?string
public function getConfirmations(): ?int
{
return $this->confirmations;
}

/**
* Sets the number of confirmations the transaction has received.
*
* @param string|null $confirmations
* @param int|null $confirmations
*/
public function setConfirmations(?string $confirmations): void
public function setConfirmations(?int $confirmations): void
{
$this->confirmations = $confirmations;
}
Expand Down
Loading
Loading