mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge pull request #373 from woocommerce/pcp-333-fix-tax-mismatch
Use subtotal_tax instead of adding taxes ourselves
This commit is contained in:
commit
2638486331
2 changed files with 8 additions and 2 deletions
|
@ -64,7 +64,7 @@ class AmountFactory {
|
|||
);
|
||||
|
||||
$taxes = new Money(
|
||||
(float) $cart->get_cart_contents_tax() + (float) $cart->get_discount_tax(),
|
||||
$cart->get_subtotal_tax(),
|
||||
$currency
|
||||
);
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ class AmountFactoryTest extends TestCase
|
|||
$cart
|
||||
->shouldReceive('get_discount_tax')
|
||||
->andReturn(7);
|
||||
$cart
|
||||
->shouldReceive('get_subtotal_tax')
|
||||
->andReturn(8);
|
||||
|
||||
expect('get_woocommerce_currency')->andReturn($expectedCurrency);
|
||||
|
||||
|
@ -61,7 +64,7 @@ class AmountFactoryTest extends TestCase
|
|||
$this->assertEquals($expectedCurrency, $result->breakdown()->shipping()->currency_code());
|
||||
$this->assertEquals((float) 5, $result->breakdown()->item_total()->value());
|
||||
$this->assertEquals($expectedCurrency, $result->breakdown()->item_total()->currency_code());
|
||||
$this->assertEquals((float) 13, $result->breakdown()->tax_total()->value());
|
||||
$this->assertEquals((float) 8, $result->breakdown()->tax_total()->value());
|
||||
$this->assertEquals($expectedCurrency, $result->breakdown()->tax_total()->currency_code());
|
||||
}
|
||||
|
||||
|
@ -95,6 +98,9 @@ class AmountFactoryTest extends TestCase
|
|||
$cart
|
||||
->shouldReceive('get_discount_tax')
|
||||
->andReturn(0);
|
||||
$cart
|
||||
->shouldReceive('get_subtotal_tax')
|
||||
->andReturn(11);
|
||||
|
||||
expect('get_woocommerce_currency')->andReturn($expectedCurrency);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue