From accc2aa6172a9b5071634dcda9c4bcf447bb579c Mon Sep 17 00:00:00 2001 From: Srisha Haridas Date: Mon, 24 Apr 2017 16:04:38 +0530 Subject: [PATCH] XOL-3425 Collect Stripe level 3 data to decrease IC rates - Introducing tax and discount fields for Item class --- src/Omnipay/Common/Item.php | 32 ++++++++++++++++++++++++++++ src/Omnipay/Common/ItemInterface.php | 10 +++++++++ tests/Omnipay/Common/ItemTest.php | 12 +++++++++++ 3 files changed, 54 insertions(+) diff --git a/src/Omnipay/Common/Item.php b/src/Omnipay/Common/Item.php index 02d0652d..23eec848 100644 --- a/src/Omnipay/Common/Item.php +++ b/src/Omnipay/Common/Item.php @@ -126,4 +126,36 @@ public function setPrice($value) { return $this->setParameter('price', $value); } + + /** + * {@inheritDoc} + */ + public function getTaxes() + { + return $this->getParameter('taxes'); + } + + /** + * Set the item tax amount + */ + public function setTaxes($value) + { + return $this->setParameter('taxes', $value); + } + + /** + * {@inheritDoc} + */ + public function getDiscount() + { + return $this->getParameter('discount'); + } + + /** + * Set the item discount + */ + public function setDiscount($value) + { + return $this->setParameter('discount', $value); + } } diff --git a/src/Omnipay/Common/ItemInterface.php b/src/Omnipay/Common/ItemInterface.php index 9380e65c..14446a34 100644 --- a/src/Omnipay/Common/ItemInterface.php +++ b/src/Omnipay/Common/ItemInterface.php @@ -32,4 +32,14 @@ public function getQuantity(); * Price of the item */ public function getPrice(); + + /** + * Discount for the item + */ + public function getDiscount(); + + /** + * Taxes for the item + */ + public function getTaxes(); } diff --git a/tests/Omnipay/Common/ItemTest.php b/tests/Omnipay/Common/ItemTest.php index 8c008b51..614bb354 100644 --- a/tests/Omnipay/Common/ItemTest.php +++ b/tests/Omnipay/Common/ItemTest.php @@ -52,4 +52,16 @@ public function testPrice() $this->item->setPrice('10.01'); $this->assertSame('10.01', $this->item->getPrice()); } + + public function testTaxes() + { + $this->item->setTaxes('50.55'); + $this->assertSame('50.55', $this->item->getTaxes()); + } + + public function testDiscount() + { + $this->item->setDiscount('10.57'); + $this->assertSame('10.57', $this->item->getDiscount()); + } }