From 66ce04a150849b0bf5783d30b7656b028ab6a0b5 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 6 Feb 2022 19:53:14 +0100 Subject: [PATCH 1/7] Update CanBeBought.php --- src/CanBeBought.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/CanBeBought.php b/src/CanBeBought.php index eb9810f..888b0aa 100644 --- a/src/CanBeBought.php +++ b/src/CanBeBought.php @@ -54,4 +54,16 @@ trait CanBeBought return 0; } + + /** + * Get the taxRate of the Buyable item. + */ + public function getBuyableTaxRate($options = null): float + { + if (($taxRate = $this->getAttribute('taxRate'))) { + return $taxRate; + } + + return config('cart.tax', 0.21); + } } From 3f246caf1a40bd111bf7d33f6e209787d0134710 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 6 Feb 2022 19:53:45 +0100 Subject: [PATCH 2/7] Update Buyable.php --- src/Contracts/Buyable.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Contracts/Buyable.php b/src/Contracts/Buyable.php index 675e378..d086d22 100644 --- a/src/Contracts/Buyable.php +++ b/src/Contracts/Buyable.php @@ -28,4 +28,9 @@ interface Buyable * Get the weight of the Buyable item. */ public function getBuyableWeight(CartItemOptions $options): int; + + /** + * Get the taxRate of the Buyable item. + */ + public function getBuyableTaxRate(CartItemOptions $options): float } From 04fb9004687b364638d40a5c9fbd441a7fe52011 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 6 Feb 2022 19:54:13 +0100 Subject: [PATCH 3/7] Update CanBeBought.php --- src/CanBeBought.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CanBeBought.php b/src/CanBeBought.php index 888b0aa..e4c3c51 100644 --- a/src/CanBeBought.php +++ b/src/CanBeBought.php @@ -58,7 +58,7 @@ trait CanBeBought /** * Get the taxRate of the Buyable item. */ - public function getBuyableTaxRate($options = null): float + public function getBuyableTaxRate(CartItemOptions $options): float { if (($taxRate = $this->getAttribute('taxRate'))) { return $taxRate; From bd1487f5a9adc07b841b2213304d88144be5f65d Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 6 Feb 2022 19:54:59 +0100 Subject: [PATCH 4/7] Update CanBeBought.php --- src/CanBeBought.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CanBeBought.php b/src/CanBeBought.php index e4c3c51..d3e52cc 100644 --- a/src/CanBeBought.php +++ b/src/CanBeBought.php @@ -54,7 +54,7 @@ trait CanBeBought return 0; } - + /** * Get the taxRate of the Buyable item. */ From e0bf453eb20ea908535bb843e150e6dfb8150282 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Thu, 3 Mar 2022 21:34:02 -0600 Subject: [PATCH 5/7] fix missing semicolon --- src/Contracts/Buyable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Contracts/Buyable.php b/src/Contracts/Buyable.php index d086d22..006adfe 100644 --- a/src/Contracts/Buyable.php +++ b/src/Contracts/Buyable.php @@ -32,5 +32,5 @@ interface Buyable /** * Get the taxRate of the Buyable item. */ - public function getBuyableTaxRate(CartItemOptions $options): float + public function getBuyableTaxRate(CartItemOptions $options): float; } From 56a87ae8862afec4f6fac8d9f0a398685e73f348 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Thu, 3 Mar 2022 21:34:47 -0600 Subject: [PATCH 6/7] fix for styleci --- src/Contracts/Buyable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Contracts/Buyable.php b/src/Contracts/Buyable.php index 006adfe..3ebdb24 100644 --- a/src/Contracts/Buyable.php +++ b/src/Contracts/Buyable.php @@ -28,7 +28,7 @@ interface Buyable * Get the weight of the Buyable item. */ public function getBuyableWeight(CartItemOptions $options): int; - + /** * Get the taxRate of the Buyable item. */ From f5b9900949b5ec6fee0440471324153a3b009173 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Thu, 3 Mar 2022 21:41:01 -0600 Subject: [PATCH 7/7] add missing text fixture method Followup to 3f246caf1a40bd111bf7d33f6e209787d0134710 --- tests/Fixtures/BuyableProduct.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Fixtures/BuyableProduct.php b/tests/Fixtures/BuyableProduct.php index 9265aab..18de007 100644 --- a/tests/Fixtures/BuyableProduct.php +++ b/tests/Fixtures/BuyableProduct.php @@ -68,4 +68,9 @@ class BuyableProduct extends Model implements Buyable { return $this->weight; } + + public function getBuyableTaxRate(CartItemOptions $options): float + { + return $this->tax_rate; + } }