diff --git a/src/BitPaySDK/Model/Settlement/InvoiceData.php b/src/BitPaySDK/Model/Settlement/InvoiceData.php index 43c1b821..749239c8 100644 --- a/src/BitPaySDK/Model/Settlement/InvoiceData.php +++ b/src/BitPaySDK/Model/Settlement/InvoiceData.php @@ -24,7 +24,7 @@ class InvoiceData protected ?string $currency = null; protected ?string $transactionCurrency = null; protected ?float $overPaidAmount = null; - protected ?float $payoutPercentage = null; + protected ?array $payoutPercentage = null; protected ?RefundInfo $refundInfo = null; public function __construct() @@ -154,9 +154,9 @@ public function setOverPaidAmount(float $overPaidAmount): void /** * Gets The payout percentage defined by the merchant on his BitPay account settings * - * @return float|null the payout percentage + * @return array|null the payout percentage */ - public function getPayoutPercentage(): ?float + public function getPayoutPercentage(): ?array { return $this->payoutPercentage; } @@ -164,9 +164,9 @@ public function getPayoutPercentage(): ?float /** * Sets The payout percentage defined by the merchant on his BitPay account settings * - * @param float $payoutPercentage the payout percentage + * @param array $payoutPercentage the payout percentage */ - public function setPayoutPercentage(float $payoutPercentage): void + public function setPayoutPercentage(array $payoutPercentage): void { $this->payoutPercentage = $payoutPercentage; } diff --git a/test/unit/BitPaySDK/Model/Settlement/InvoiceDataTest.php b/test/unit/BitPaySDK/Model/Settlement/InvoiceDataTest.php index 0550c914..498b1150 100644 --- a/test/unit/BitPaySDK/Model/Settlement/InvoiceDataTest.php +++ b/test/unit/BitPaySDK/Model/Settlement/InvoiceDataTest.php @@ -70,7 +70,7 @@ public function testGetOverPaidAmount() public function testGetPayoutPercentage() { - $expectedPayoutPercentage = 15; + $expectedPayoutPercentage = ['USD' => 15.12]; $invoiceData = $this->createClassObject(); $invoiceData->setPayoutPercentage($expectedPayoutPercentage); @@ -108,7 +108,7 @@ public function testToArray() self::assertEquals(12.9, $invoiceDataArray['price']); self::assertEquals('BTC', $invoiceDataArray['currency']); self::assertEquals('BTC', $invoiceDataArray['transactionCurrency']); - self::assertEquals(15, $invoiceDataArray['payoutPercentage']); + self::assertEquals(15.12, $invoiceDataArray['payoutPercentage']['USD']); self::assertEquals([], $invoiceDataArray['refundInfo']); } @@ -124,7 +124,7 @@ private function setSetters(InvoiceData $invoiceData) $invoiceData->setPrice(12.9); $invoiceData->setCurrency('BTC'); $invoiceData->setTransactionCurrency('BTC'); - $invoiceData->setPayoutPercentage(15); + $invoiceData->setPayoutPercentage(['USD' => 15.12]); $invoiceData->setRefundInfo($this->getMockBuilder(RefundInfo::class)->getMock()); } }