2020-08-31 13:38:54 +03:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-09-14 07:51:45 +03:00
|
|
|
namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2020-09-14 07:51:45 +03:00
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Entity\Item;
|
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
|
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
2022-02-09 16:28:27 +02:00
|
|
|
use WooCommerce\PayPalCommerce\TestCase;
|
2020-08-31 13:38:54 +03:00
|
|
|
use Mockery;
|
2022-04-05 09:31:57 +03:00
|
|
|
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
2020-08-31 13:38:54 +03:00
|
|
|
use function Brain\Monkey\Functions\expect;
|
2021-08-13 17:09:27 +02:00
|
|
|
use function Brain\Monkey\Functions\when;
|
2020-08-31 13:38:54 +03:00
|
|
|
|
|
|
|
class AmountFactoryTest extends TestCase
|
|
|
|
{
|
2021-11-30 10:40:38 +02:00
|
|
|
private $currency = 'EUR';
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2022-02-11 12:05:21 +02:00
|
|
|
private $itemFactory;
|
|
|
|
private $moneyFactory;
|
|
|
|
private $testee;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->itemFactory = Mockery::mock(ItemFactory::class);
|
|
|
|
$this->moneyFactory = new MoneyFactory();
|
|
|
|
$this->testee = new AmountFactory($this->itemFactory, $this->moneyFactory, $this->currency);
|
|
|
|
}
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2022-02-11 12:05:21 +02:00
|
|
|
public function testFromWcCartDefault()
|
|
|
|
{
|
2020-08-31 13:38:54 +03:00
|
|
|
$cart = Mockery::mock(\WC_Cart::class);
|
|
|
|
$cart
|
|
|
|
->shouldReceive('get_total')
|
|
|
|
->withAnyArgs()
|
2022-06-15 16:30:38 +03:00
|
|
|
->andReturn(13);
|
2020-08-31 13:38:54 +03:00
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_subtotal')
|
|
|
|
->andReturn(5);
|
2020-08-31 13:38:54 +03:00
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_fee_total')
|
2020-08-31 13:38:54 +03:00
|
|
|
->andReturn(3);
|
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_discount_total')
|
|
|
|
->andReturn(1);
|
2020-08-31 13:38:54 +03:00
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_shipping_total')
|
|
|
|
->andReturn(2);
|
2021-11-19 09:10:59 +02:00
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_total_tax')
|
|
|
|
->andReturn(4);
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2021-08-13 17:09:27 +02:00
|
|
|
$woocommerce = Mockery::mock(\WooCommerce::class);
|
|
|
|
$session = Mockery::mock(\WC_Session::class);
|
|
|
|
when('WC')->justReturn($woocommerce);
|
|
|
|
$woocommerce->session = $session;
|
|
|
|
$session->shouldReceive('get')->andReturn([]);
|
|
|
|
|
2022-02-11 12:05:21 +02:00
|
|
|
$result = $this->testee->from_wc_cart($cart);
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->currency_code());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 13, $result->value());
|
|
|
|
$this->assertEquals((float) 1, $result->breakdown()->discount()->value());
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->discount()->currency_code());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 2, $result->breakdown()->shipping()->value());
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->shipping()->currency_code());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 8, $result->breakdown()->item_total()->value());
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->item_total()->currency_code());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 4, $result->breakdown()->tax_total()->value());
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->tax_total()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testFromWcCartNoDiscount()
|
|
|
|
{
|
|
|
|
$cart = Mockery::mock(\WC_Cart::class);
|
|
|
|
$cart
|
|
|
|
->shouldReceive('get_total')
|
|
|
|
->withAnyArgs()
|
2022-06-15 16:30:38 +03:00
|
|
|
->andReturn(11);
|
|
|
|
$cart
|
|
|
|
->shouldReceive('get_subtotal')
|
|
|
|
->andReturn(5);
|
|
|
|
$cart
|
|
|
|
->shouldReceive('get_fee_total')
|
|
|
|
->andReturn(0);
|
2020-08-31 13:38:54 +03:00
|
|
|
$cart
|
|
|
|
->shouldReceive('get_discount_total')
|
|
|
|
->andReturn(0);
|
|
|
|
$cart
|
|
|
|
->shouldReceive('get_shipping_total')
|
2022-06-15 16:30:38 +03:00
|
|
|
->andReturn(2);
|
2021-11-19 09:10:59 +02:00
|
|
|
$cart
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_total_tax')
|
|
|
|
->andReturn(4);
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2021-08-13 17:09:27 +02:00
|
|
|
$woocommerce = Mockery::mock(\WooCommerce::class);
|
|
|
|
$session = Mockery::mock(\WC_Session::class);
|
|
|
|
when('WC')->justReturn($woocommerce);
|
|
|
|
$woocommerce->session = $session;
|
|
|
|
$session->shouldReceive('get')->andReturn([]);
|
2022-02-11 12:05:21 +02:00
|
|
|
$result = $this->testee->from_wc_cart($cart);
|
2020-08-31 13:38:54 +03:00
|
|
|
$this->assertNull($result->breakdown()->discount());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 11, $result->value());
|
|
|
|
$this->assertEquals((float) 2, $result->breakdown()->shipping()->value());
|
|
|
|
$this->assertEquals((float) 5, $result->breakdown()->item_total()->value());
|
|
|
|
$this->assertEquals((float) 4, $result->breakdown()->tax_total()->value());
|
2020-08-31 13:38:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testFromWcOrderDefault()
|
|
|
|
{
|
|
|
|
$order = Mockery::mock(\WC_Order::class);
|
|
|
|
$unitAmount = Mockery::mock(Money::class);
|
|
|
|
$unitAmount
|
|
|
|
->shouldReceive('value')
|
|
|
|
->andReturn(3);
|
2022-06-15 16:30:38 +03:00
|
|
|
|
2020-08-31 13:38:54 +03:00
|
|
|
$item = Mockery::mock(Item::class);
|
|
|
|
$item
|
|
|
|
->shouldReceive('quantity')
|
|
|
|
->andReturn(2);
|
|
|
|
$item
|
2020-09-01 09:47:36 +03:00
|
|
|
->shouldReceive('unit_amount')
|
2020-08-31 13:38:54 +03:00
|
|
|
->andReturn($unitAmount);
|
2022-02-11 12:05:21 +02:00
|
|
|
$this->itemFactory
|
2020-09-01 09:47:36 +03:00
|
|
|
->expects('from_wc_order')
|
2020-08-31 13:38:54 +03:00
|
|
|
->with($order)
|
|
|
|
->andReturn([$item]);
|
|
|
|
|
2022-04-05 09:31:57 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_payment_method')
|
|
|
|
->andReturn(PayPalGateway::ID);
|
|
|
|
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_total')
|
|
|
|
->andReturn(100);
|
2022-06-15 16:30:38 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_subtotal')
|
|
|
|
->andReturn(6);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_currency')
|
2021-11-30 10:40:38 +02:00
|
|
|
->andReturn($this->currency);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_shipping_total')
|
|
|
|
->andReturn(1);
|
|
|
|
$order
|
2022-06-15 16:30:38 +03:00
|
|
|
->shouldReceive('get_total_tax')
|
|
|
|
->andReturn(2);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_total_discount')
|
|
|
|
->andReturn(3);
|
2022-04-25 15:24:37 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_meta')
|
|
|
|
->andReturn(null);
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2022-02-11 12:05:21 +02:00
|
|
|
$result = $this->testee->from_wc_order($order);
|
2020-08-31 13:38:54 +03:00
|
|
|
$this->assertEquals((float) 3, $result->breakdown()->discount()->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals((float) 6, $result->breakdown()->item_total()->value());
|
2022-06-15 16:30:38 +03:00
|
|
|
$this->assertEquals((float) 1, $result->breakdown()->shipping()->value());
|
2020-08-31 13:38:54 +03:00
|
|
|
$this->assertEquals((float) 100, $result->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals((float) 2, $result->breakdown()->tax_total()->value());
|
2021-11-30 10:40:38 +02:00
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->discount()->currency_code());
|
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->item_total()->currency_code());
|
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->shipping()->currency_code());
|
|
|
|
$this->assertEquals($this->currency, $result->breakdown()->tax_total()->currency_code());
|
|
|
|
$this->assertEquals($this->currency, $result->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testFromWcOrderDiscountIsNull()
|
|
|
|
{
|
|
|
|
$order = Mockery::mock(\WC_Order::class);
|
|
|
|
$unitAmount = Mockery::mock(Money::class);
|
|
|
|
$unitAmount
|
|
|
|
->shouldReceive('value')
|
|
|
|
->andReturn(3);
|
|
|
|
$item = Mockery::mock(Item::class);
|
|
|
|
$item
|
|
|
|
->shouldReceive('quantity')
|
|
|
|
->andReturn(2);
|
|
|
|
$item
|
2020-09-01 09:47:36 +03:00
|
|
|
->shouldReceive('unit_amount')
|
2020-08-31 13:38:54 +03:00
|
|
|
->andReturn($unitAmount);
|
2022-02-11 12:05:21 +02:00
|
|
|
$this->itemFactory
|
2020-09-01 09:47:36 +03:00
|
|
|
->expects('from_wc_order')
|
2020-08-31 13:38:54 +03:00
|
|
|
->with($order)
|
|
|
|
->andReturn([$item]);
|
|
|
|
|
2022-04-05 09:31:57 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_payment_method')
|
|
|
|
->andReturn(PayPalGateway::ID);
|
|
|
|
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_total')
|
|
|
|
->andReturn(100);
|
2022-06-15 16:30:38 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_subtotal')
|
|
|
|
->andReturn(6);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_currency')
|
2021-11-30 10:40:38 +02:00
|
|
|
->andReturn($this->currency);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_shipping_total')
|
|
|
|
->andReturn(1);
|
2022-06-15 16:30:38 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_total_tax')
|
|
|
|
->andReturn(2);
|
2020-08-31 13:38:54 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_total_discount')
|
|
|
|
->andReturn(0);
|
2022-04-25 15:24:37 +03:00
|
|
|
$order
|
|
|
|
->shouldReceive('get_meta')
|
|
|
|
->andReturn(null);
|
2020-08-31 13:38:54 +03:00
|
|
|
|
2022-02-11 12:05:21 +02:00
|
|
|
$result = $this->testee->from_wc_order($order);
|
2020-08-31 13:38:54 +03:00
|
|
|
$this->assertNull($result->breakdown()->discount());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider dataFromPayPalResponse
|
|
|
|
* @param $response
|
|
|
|
*/
|
|
|
|
public function testFromPayPalResponse($response, $expectsException)
|
|
|
|
{
|
|
|
|
if ($expectsException) {
|
|
|
|
$this->expectException(RuntimeException::class);
|
|
|
|
}
|
2022-02-11 12:05:21 +02:00
|
|
|
$result = $this->testee->from_paypal_response($response);
|
2020-08-31 13:38:54 +03:00
|
|
|
if ($expectsException) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$this->assertEquals($response->value, $result->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals($response->currency_code, $result->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
$breakdown = $result->breakdown();
|
|
|
|
if (! isset($response->breakdown)) {
|
|
|
|
$this->assertNull($breakdown);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($breakdown->shipping()) {
|
|
|
|
$this->assertEquals($response->breakdown->shipping->value, $breakdown->shipping()->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals($response->breakdown->shipping->currency_code, $breakdown->shipping()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->shipping));
|
|
|
|
}
|
2020-09-01 09:47:36 +03:00
|
|
|
if ($breakdown->item_total()) {
|
|
|
|
$this->assertEquals($response->breakdown->item_total->value, $breakdown->item_total()->value());
|
|
|
|
$this->assertEquals($response->breakdown->item_total->currency_code, $breakdown->item_total()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->item_total));
|
|
|
|
}
|
2020-09-01 09:47:36 +03:00
|
|
|
if ($breakdown->tax_total()) {
|
|
|
|
$this->assertEquals($response->breakdown->tax_total->value, $breakdown->tax_total()->value());
|
|
|
|
$this->assertEquals($response->breakdown->tax_total->currency_code, $breakdown->tax_total()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->tax_total));
|
|
|
|
}
|
|
|
|
if ($breakdown->handling()) {
|
|
|
|
$this->assertEquals($response->breakdown->handling->value, $breakdown->handling()->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals($response->breakdown->handling->currency_code, $breakdown->handling()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->handling));
|
|
|
|
}
|
|
|
|
if ($breakdown->insurance()) {
|
|
|
|
$this->assertEquals($response->breakdown->insurance->value, $breakdown->insurance()->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals($response->breakdown->insurance->currency_code, $breakdown->insurance()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->insurance));
|
|
|
|
}
|
2020-09-01 09:47:36 +03:00
|
|
|
if ($breakdown->shipping_discount()) {
|
|
|
|
$this->assertEquals($response->breakdown->shipping_discount->value, $breakdown->shipping_discount()->value());
|
|
|
|
$this->assertEquals($response->breakdown->shipping_discount->currency_code, $breakdown->shipping_discount()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->shipping_discount));
|
|
|
|
}
|
|
|
|
if ($breakdown->discount()) {
|
|
|
|
$this->assertEquals($response->breakdown->discount->value, $breakdown->discount()->value());
|
2020-09-01 09:47:36 +03:00
|
|
|
$this->assertEquals($response->breakdown->discount->currency_code, $breakdown->discount()->currency_code());
|
2020-08-31 13:38:54 +03:00
|
|
|
} else {
|
|
|
|
$this->assertTrue(! isset($response->breakdown->discount));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dataFromPayPalResponse() : array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'no_value' => [
|
|
|
|
(object) [
|
|
|
|
"currency_code" => "A",
|
|
|
|
],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
'no_currency_code' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
'no_value_in_breakdown' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
'no_currency_code_in_breakdown' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
'default' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_item_total' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_tax_total' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_handling' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_insurance' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_shipping_discount' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_discount' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"shipping" => (object) [
|
|
|
|
"value" => (float) 7,
|
|
|
|
"currency_code" => "G",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
'no_shipping' => [
|
|
|
|
(object) [
|
|
|
|
"value" => (float) 1,
|
|
|
|
"currency_code" => "A",
|
|
|
|
"breakdown" => (object) [
|
|
|
|
"discount" => (object) [
|
|
|
|
"value" => (float) 2,
|
|
|
|
"currency_code" => "B",
|
|
|
|
],
|
|
|
|
"shipping_discount" => (object) [
|
|
|
|
"value" => (float) 3,
|
|
|
|
"currency_code" => "C",
|
|
|
|
],
|
|
|
|
"insurance" => (object) [
|
|
|
|
"value" => (float) 4,
|
|
|
|
"currency_code" => "D",
|
|
|
|
],
|
|
|
|
"handling" => (object) [
|
|
|
|
"value" => (float) 5,
|
|
|
|
"currency_code" => "E",
|
|
|
|
],
|
|
|
|
"tax_total" => (object) [
|
|
|
|
"value" => (float) 6,
|
|
|
|
"currency_code" => "F",
|
|
|
|
],
|
|
|
|
"item_total" => (object) [
|
|
|
|
"value" => (float) 8,
|
|
|
|
"currency_code" => "H",
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|