Completed
Push — master ( 56783c...93285e )
by Antony
10:57
created

UnleashedOrderTest::testTaxRounding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 45
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 33
nc 1
nop 0
dl 0
loc 45
rs 9.392
c 0
b 0
f 0
1
<?php
2
3
namespace AntonyThorpe\SilverShopUnleashed\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\Core\Config\Config;
7
use SilverShop\Page\Product;
8
use SilverShop\Model\Product\OrderItem;
9
use SilverShop\Model\Modifiers\OrderModifier;
10
use SilverShop\Model\Order;
11
use SilverShop\Checkout\OrderProcessor;
12
use SilverShop\Cart\ShoppingCart;
13
use SilverShop\Tests\ShopTest;
14
use SilverShop\Model\Modifiers\Shipping\Simple;
15
use SilverShop\Model\Modifiers\Tax\FlatTax;
16
use SilverShop\Shipping\Model\DistanceShippingMethod;
17
use AntonyThorpe\SilverShopUnleashed\OrderBulkLoader;
18
use AntonyThorpe\SilverShopUnleashed\Defaults;
19
20
class UnleashedOrderTest extends SapphireTest
21
{
22
    protected static $fixture_file = [
23
        'vendor/silvershop/core/tests/php/Fixtures/ShopMembers.yml',
24
        'vendor/silvershop/core/tests/php/Fixtures/shop.yml',
25
        'vendor/silvershop/shipping/tests/DistanceShippingMethod.yml',
26
        'vendor/silvershop/shipping/tests/Warehouses.yml',
27
        'fixtures/models.yml'
28
    ];
29
30
    public function setUp()
31
    {
32
        Defaults::config()->send_sales_orders_to_unleashed = false;
33
        Defaults::config()->tax_modifier_class_name = 'SilverShop\Model\Modifiers\Tax\FlatTax';
34
        Defaults::config()->shipping_modifier_class_name = 'SilverShop\Model\Modifiers\Shipping\Simple';
35
        parent::setUp();
36
        ShoppingCart::singleton()->clear();
37
        ShopTest::setConfiguration(); //reset config
38
        Config::modify()
39
            ->set(Simple::class, 'default_charge', 8.95)
40
            ->set(Simple::class, 'product_code', 'Freight')
41
            ->set(FlatTax::class, 'rate', 0.15)
42
            ->set(FlatTax::class, 'exclusive', true)
43
            ->set(FlatTax::class, 'name', 'GST')
44
            ->set(FlatTax::class, 'tax_code', 'OUTPUT2')
45
            ->merge(Order::class, 'modifiers', [Simple::class, FlatTax::class]);
46
    }
47
48
    protected $order_status_map = [
49
        'Open' => 'Unpaid',
50
        'Parked' => 'Paid',
51
        'Backordered' => 'Processing',
52
        'Placed' => 'Processing',
53
        'Picking' => 'Processing',
54
        'Picked' => 'Processing',
55
        'Packed' => 'Processing',
56
        'Dispatched' => 'Sent',
57
        'Complete' => 'Complete',
58
        'Deleted' => 'MemberCancelled'
59
    ];
60
61
    public function testChangeOrderStatus()
62
    {
63
        $apidata_array = json_decode($this->jsondata, true);
64
        $apidata_array = reset($apidata_array);
65
        $apidata = $apidata_array['Items'];
66
67
        $loader = OrderBulkLoader::create('SilverShop\Model\Order');
68
        $loader->transforms = [
69
            'Status' => [
70
                'callback' => function ($value, &$placeholder) {
0 ignored issues
show
Unused Code introduced by
The parameter $placeholder is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

70
                'callback' => function ($value, /** @scrutinizer ignore-unused */ &$placeholder) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
71
                    // convert from Unleashed Sales Order status to Silvershop
72
                    return $this->order_status_map[$value];
73
                }
74
            ]
75
        ];
76
        $results = $loader->updateRecords($apidata);
77
78
        // Check Results
79
        $this->assertEquals($results->CreatedCount(), 0);
80
        $this->assertEquals($results->UpdatedCount(), 2);
81
        $this->assertEquals($results->DeletedCount(), 0);
82
        $this->assertEquals($results->SkippedCount(), 0);
83
        $this->assertEquals($results->Count(), 2);
84
85
        // Check Dataobjects
86
        $order1 = Order::get()->find('Reference', 'O1');
87
        //print_r($order1);
88
        $this->assertEquals(
89
            'Processing',
90
            $order1->Status,
91
            'OrderStatus of reference O1 is "Processing"'
92
        );
93
94
        $order2 = Order::get()->find('Reference', 'O2');
95
        $this->assertEquals(
96
            'Sent',
97
            $order2->Status,
98
            'OrderStatus of reference O1 is "Sent"'
99
        );
100
    }
101
102
    public function testSetBodyAddress()
103
    {
104
        $body = [
105
            'Addresses' => []
106
        ];
107
        $order = $this->objFromFixture(Order::class, "payablecart");
108
        OrderProcessor::create($order)->placeOrder();
109
        $body = $order->setBodyAddress($body, $order, 'Postal');
110
        $result = implode('|', array_values($body['Addresses'][0]));
111
        $this->assertSame(
112
            $result,
113
            '12 Foo Street Bar Farmville|Postal|Farmville|United States||New Sandwich|12 Foo Street|Bar',
114
            'Postal Address added to $body["Address"]'
115
        );
116
117
        $body = $order->setBodyAddress($body, $order, 'Physical');
118
        $result = implode('|', array_values($body['Addresses'][1]));
119
        $this->assertSame(
120
            $result,
121
            '12 Foo Street Bar Farmville|Physical|Farmville|United States||New Sandwich|12 Foo Street|Bar',
122
            'Physical Address added to $body["Address"]'
123
        );
124
        $result = implode('|', array_values($body['Addresses'][2]));
125
        $this->assertSame(
126
            $result,
127
            '12 Foo Street Bar Farmville|Shipping|Farmville|United States||New Sandwich|12 Foo Street|Bar',
128
            'Shipping Address added to $body["Address"]'
129
        );
130
131
        $result = $body['DeliveryCity'] . '|' . $body['DeliveryCountry'] . '|' . $body['DeliveryPostCode'] . '|' . $body['DeliveryRegion'] . '|' . $body['DeliveryStreetAddress'] . '|' . $body['DeliveryStreetAddress2'];
132
        $this->assertSame(
133
            $result,
134
            'Farmville|United States||New Sandwich|12 Foo Street|Bar',
135
            'Delivery Address added to $body'
136
        );
137
    }
138
139
    public function testSetBodyCurrencyCode()
140
    {
141
        $body = [
142
            'Currency' => []
143
        ];
144
        $order = $this->objFromFixture(Order::class, "payablecart");
145
        OrderProcessor::create($order)->placeOrder();
146
        $body = $order->setBodyCurrencyCode($body, $order);
147
148
        $this->assertSame(
149
            'NZD',
150
            $body['Currency']['CurrencyCode'],
151
            'Currency Code added to $body'
152
        );
153
    }
154
155
    public function testSetBodyCustomerCodeAndName()
156
    {
157
        $body = [];
158
        $order = $this->objFromFixture(Order::class, "payablecart");
159
        OrderProcessor::create($order)->placeOrder();
160
        $body = $order->setBodyCustomerCodeAndName($body, $order);
161
        $result = implode('|', array_values($body));
162
        $this->assertSame(
163
            $result,
164
            'Payable Smith|Payable Smith',
165
            'Set BodyCustomerCodeAndName'
166
        );
167
168
        $order->BillingAddress()->Company = 'Test Company';
169
        $body = $order->setBodyCustomerCodeAndName($body, $order);
170
        $result = implode('|', array_values($body));
171
        $this->assertSame(
172
            $result,
173
            'Test Company|Test Company',
174
            'Set BodyCustomerCodeAndName with Company name'
175
        );
176
    }
177
178
    public function testSetBodySalesOrderLines()
179
    {
180
        $body = [
181
            'Tax' => [
182
                'TaxCode' => 'OUTPUT2'
183
            ]
184
        ];
185
        $order = $this->objFromFixture(Order::class, "paid1");
186
        OrderProcessor::create($order)->placeOrder();
187
        $order->write();
188
        $order->calculate();
189
        $body = $order->setBodySalesOrderLines($body, $order, 'SilverShop\Model\Modifiers\Tax\FlatTax', 2);
190
        $result = json_encode($body);
191
        $this->assertContains(
192
            'SalesOrderLines',
193
            $result,
194
            'Contains SalesOrderLines'
195
        );
196
        $this->assertContains(
197
            '"LineType":null,"LineTotal":8,"OrderQuantity":1,"Product":{"Guid":"G11"},"UnitPrice":8,"LineTax":1.2,"LineTaxCode":"OUTPUT2"}',
198
            $result,
199
            'Set SetBodySalesOrderLines line 1',
200
        );
201
202
        $this->assertContains(
203
            '"LineType":null,"LineTotal":400,"OrderQuantity":2,"Product":{"Guid":"G15"},"UnitPrice":200,"LineTax":60,"LineTaxCode":"OUTPUT2"}',
204
            $result,
205
            'Set SetBodySalesOrderLines line 2'
206
        );
207
    }
208
209
    public function testSetBodySalesOrderLinesWithModifiers()
210
    {
211
        $body = [
212
            'Tax' => [
213
                'TaxCode' => 'OUTPUT2'
214
            ]
215
        ];
216
        $order = Order::create();
217
        $urntap = $this->objFromFixture(Product::class, 'urntap');
218
        $urntap->publishSingle();
219
        $order->Items()->add($urntap->createItem(1));
220
        $order->write();
221
        OrderProcessor::create($order)->placeOrder();
222
        $total = $order->calculate();
223
224
        $this->assertEquals(1, $order->Items()->count());
225
        $this->assertEquals(2, $order->Modifiers()->count()); // Shipping & GST
226
        $this->assertEquals(85.79, $total, 'Total equals $85.79');
227
        $body = $order->setBodySalesOrderLines($body, $order, 'SilverShop\Model\Modifiers\Tax\FlatTax', 2);
228
        $freight_modifier = $body['SalesOrderLines'][1];
229
        $result = $freight_modifier['DiscountRate'] . '|' . $freight_modifier['LineNumber'] . '|' . $freight_modifier['LineTotal'] . '|' . $freight_modifier['LineType'] . '|' . $freight_modifier['OrderQuantity'] . '|' . $freight_modifier['UnitPrice'] . '|' . $freight_modifier['LineTax'] . '|' . $freight_modifier['LineTaxCode'];
230
        $this->assertSame(
231
            $result,
232
            '0|2|8.95||1|8.95|1.34|OUTPUT2',
233
            'Modifiers in the SalesOrderLines added to $body'
234
        );
235
        $this->assertSame(
236
            $freight_modifier['Product']['ProductCode'],
237
            'Freight',
238
            'ProductCode of the Freight Modifier in $body is "Freight"'
239
        );
240
    }
241
242
    public function testSetBodySubTotalAndTax()
243
    {
244
        $order = Order::create();
245
        $urntap = $this->objFromFixture(Product::class, 'urntap');
246
        $urntap->publishSingle();
247
        $order->Items()->add($urntap->createItem(1));
248
        $order->write();
249
        OrderProcessor::create($order)->placeOrder();
250
        $order->calculate();
251
252
        $body = $order->setBodyTaxCode(
253
            [],
254
            $order,
255
            'SilverShop\Model\Modifiers\Tax\FlatTax'
256
        );
257
        $body = $order->setBodySalesOrderLines(
258
            $body,
259
            $order,
260
            'SilverShop\Model\Modifiers\Tax\FlatTax',
261
            2
262
        );
263
        $body = $order->setBodySubTotalAndTax(
264
            $body,
265
            $order,
266
            'SilverShop\Model\Modifiers\Tax\FlatTax',
267
            2
268
        );
269
        $result = $body['Taxable'] . '|' . $body['TaxTotal'] . '|' . $body['SubTotal'];
270
271
        $this->assertSame(
272
            $result,
273
            '1|11.19|74.60',
274
            'Taxable, TaxTotal & SubTotal added to $body'
275
        );
276
        $this->assertSame(
277
            $body['Tax']['TaxCode'],
278
            'OUTPUT2',
279
            'TaxCode set in $body'
280
        );
281
    }
282
283
    public function testTaxRounding()
284
    {
285
        $tax_total = 0;
0 ignored issues
show
Unused Code introduced by
The assignment to $tax_total is dead and can be removed.
Loading history...
286
        $tax_modifier_class_name = 'SilverShop\Model\Modifiers\Tax\FlatTax';
287
        $order = Order::create();
288
        $filter = $this->objFromFixture(Product::class, 'filter');
289
        $filter->publishSingle();
290
        $order->Items()->add($filter->createItem(1));
291
        $order->write();
292
        OrderProcessor::create($order)->placeOrder();
293
        $total = $order->calculate();
294
295
        $body = $order->setBodyTaxCode(
296
            [],
297
            $order,
298
            $tax_modifier_class_name
299
        );
300
        $body = $order->setBodySalesOrderLines(
301
            $body,
302
            $order,
303
            $tax_modifier_class_name,
304
            2
305
        );
306
        $body = $order->setBodySubTotalAndTax(
307
            $body,
308
            $order,
309
            $tax_modifier_class_name,
310
            2
311
        );
312
        $result = $body['Taxable'] . '|' . $body['TaxTotal'] . '|' . $body['SubTotal'];
313
314
        $this->assertSame(
315
            $result,
316
            '1|8.39|55.91',
317
            'Taxable, TaxTotal & SubTotal added to $body'
318
        );
319
        $this->assertSame(
320
            $total,
321
            64.3,
322
            'Total equals $64.30'
323
        );
324
        $this->assertSame(
325
            round(floatval($body['TaxTotal'] + $body['SubTotal']), 2),
326
            64.3,
327
            'TaxTotal plus SubTotal equals $64.30'
328
        );
329
    }
330
331
    public function testSetBodyDeliveryMethodAndDeliveryName()
332
    {
333
        Defaults::config()->shipping_modifier_class_name = 'SilverShop\Shipping\ShippingFrameworkModifier';
334
        Config::modify()->set('SilverShop\Shipping\ShippingFrameworkModifier', 'product_code', 'Freight');
335
        $body = [];
336
        $defaults = Defaults::config();
337
        $order = $this->objFromFixture(Order::class, "payablecart");
338
        $body = $order->setBodyDeliveryMethodAndDeliveryName($body, $order, $defaults->shipping_modifier_class_name);
339
        $result = implode('|', array_values($body));
340
        $this->assertSame(
341
            $result,
342
            'Freight|Freight',
343
            'Set BodyDeliveryMethodAndDeliveryName'
344
        );
345
    }
346
347
    /**
348
     * JSON data for test
349
     *
350
     * @link (Unleashed Software API Documentation, https://apidocs.unleashedsoftware.com/Products)
351
     * @var string
352
     */
353
    protected $jsondata = '[
354
        {
355
          "Pagination": {
356
            "NumberOfItems": 2,
357
            "PageSize": 200,
358
            "PageNumber": 1,
359
            "NumberOfPages": 1
360
          },
361
          "Items": [
362
            {
363
              "SalesOrderLines": [
364
                {
365
                  "LineNumber": 1,
366
                  "LineType": null,
367
                  "Product": {
368
                    "Guid": "G11",
369
                    "ProductCode": "IIID1",
370
                    "ProductDescription": "Socks"
371
                  },
372
                  "DueDate": "/Date(1473099415000)/",
373
                  "OrderQuantity": 1,
374
                  "UnitPrice": 8,
375
                  "DiscountRate": 0,
376
                  "LineTotal": 8,
377
                  "Volume": null,
378
                  "Weight": null,
379
                  "Comments": null,
380
                  "AverageLandedPriceAtTimeOfSale": 8,
381
                  "TaxRate": 0,
382
                  "LineTax": 0,
383
                  "XeroTaxCode": "G.S.T.",
384
                  "BCUnitPrice": 8,
385
                  "BCLineTotal": 8,
386
                  "BCLineTax": 0,
387
                  "LineTaxCode": "G.S.T.",
388
                  "XeroSalesAccount": null,
389
                  "SerialNumbers": null,
390
                  "BatchNumbers": null,
391
                  "Guid": "G401",
392
                  "LastModifiedOn": "/Date(1473149768263)/"
393
                },
394
                {
395
                  "LineNumber": 2,
396
                  "LineType": null,
397
                  "Product": {
398
                    "Guid": "G15",
399
                    "ProductCode": "IIID5",
400
                    "ProductDescription": "Mp3 Player"
401
                  },
402
                  "DueDate": "/Date(1473099415000)/",
403
                  "OrderQuantity": 2,
404
                  "UnitPrice": 200,
405
                  "DiscountRate": 0,
406
                  "LineTotal": 400,
407
                  "Volume": null,
408
                  "Weight": null,
409
                  "Comments": null,
410
                  "AverageLandedPriceAtTimeOfSale": 200,
411
                  "TaxRate": 0,
412
                  "LineTax": 0,
413
                  "XeroTaxCode": "G.S.T.",
414
                  "BCUnitPrice": 200,
415
                  "BCLineTotal": 400,
416
                  "BCLineTax": 0,
417
                  "LineTaxCode": "G.S.T.",
418
                  "XeroSalesAccount": null,
419
                  "SerialNumbers": null,
420
                  "BatchNumbers": null,
421
                  "Guid": "G402",
422
                  "LastModifiedOn": "/Date(1473149768279)/"
423
                }
424
              ],
425
              "OrderNumber": "O1",
426
              "OrderDate": "/Date(1473116400000)/",
427
              "RequiredDate": "/Date(1473548400000)/",
428
              "OrderStatus": "Placed",
429
              "Customer": {
430
                "CustomerCode": "Jeremy Peremy",
431
                "CustomerName": "Jeremy Peremy",
432
                "CurrencyId": 110,
433
                "Guid": "test",
434
                "LastModifiedOn": "/Date(1472624588017)/"
435
              },
436
              "CustomerRef": null,
437
              "Comments": "Test",
438
              "Warehouse": {
439
                "WarehouseCode": "test",
440
                "WarehouseName": "Queen St",
441
                "IsDefault": true,
442
                "StreetNo": "1",
443
                "AddressLine1": "Queen St",
444
                "AddressLine2": null,
445
                "City": "Invercargill",
446
                "Region": "Southland",
447
                "Country": "New Zealand",
448
                "PostCode": "9999",
449
                "PhoneNumber": "1234 567",
450
                "FaxNumber": null,
451
                "MobileNumber": null,
452
                "DDINumber": null,
453
                "ContactName": "Ed Hillary",
454
                "Obsolete": false,
455
                "Guid": "test",
456
                "LastModifiedOn": "/Date(1471582972964)/"
457
              },
458
              "ReceivedDate": "/Date(1473099415000)/",
459
              "DeliveryName": null,
460
              "DeliveryStreetAddress": "15 Ray St",
461
              "DeliverySuburb": "",
462
              "DeliveryCity": "Kaitaia",
463
              "DeliveryRegion": "Northland",
464
              "DeliveryCountry": "New Zealand",
465
              "DeliveryPostCode": "1111",
466
              "Currency": {
467
                "CurrencyCode": "NZD",
468
                "Description": "New Zealand, Dollars",
469
                "Guid": "test",
470
                "LastModifiedOn": "/Date(1415058050647)/"
471
              },
472
              "ExchangeRate": 1,
473
              "DiscountRate": 0,
474
              "Tax": {
475
                "TaxCode": "G.S.T.",
476
                "Description": null,
477
                "TaxRate": 0,
478
                "CanApplyToExpenses": false,
479
                "CanApplyToRevenue": false,
480
                "Obsolete": false,
481
                "Guid": "00000000-0000-0000-0000-000000000000",
482
                "LastModifiedOn": null
483
              },
484
              "TaxRate": 0,
485
              "XeroTaxCode": "G.S.T.",
486
              "SubTotal": 408,
487
              "TaxTotal": 0,
488
              "Total": 408,
489
              "TotalVolume": 0,
490
              "TotalWeight": 0,
491
              "BCSubTotal": 408,
492
              "BCTaxTotal": 0,
493
              "BCTotal": 408,
494
              "PaymentDueDate": "/Date(1473106568169)/",
495
              "SalesOrderGroup": null,
496
              "DeliveryMethod": null,
497
              "SalesPerson": null,
498
              "SendAccountingJournalOnly": false,
499
              "SourceId": "web",
500
              "CreatedBy": "[email protected]",
501
              "Guid": "G201",
502
              "LastModifiedOn": "/Date(1473149768310)/"
503
            },
504
            {
505
              "SalesOrderLines": [
506
                {
507
                  "LineNumber": 1,
508
                  "LineType": null,
509
                  "Product": {
510
                    "Guid": "G11",
511
                    "ProductCode": "IIID1",
512
                    "ProductDescription": "Socks"
513
                  },
514
                  "DueDate": "/Date(1473099415000)/",
515
                  "OrderQuantity": 1,
516
                  "UnitPrice": 8,
517
                  "DiscountRate": 0,
518
                  "LineTotal": 8,
519
                  "Volume": null,
520
                  "Weight": null,
521
                  "Comments": null,
522
                  "AverageLandedPriceAtTimeOfSale": 8,
523
                  "TaxRate": 0,
524
                  "LineTax": 0,
525
                  "XeroTaxCode": "G.S.T.",
526
                  "BCUnitPrice": 8,
527
                  "BCLineTotal": 8,
528
                  "BCLineTax": 0,
529
                  "LineTaxCode": "G.S.T.",
530
                  "XeroSalesAccount": null,
531
                  "SerialNumbers": null,
532
                  "BatchNumbers": null,
533
                  "Guid": "G403",
534
                  "LastModifiedOn": "/Date(1473149768263)/"
535
                },
536
                {
537
                  "LineNumber": 2,
538
                  "LineType": null,
539
                  "Product": {
540
                    "Guid": "G15",
541
                    "ProductCode": "IIID5",
542
                    "ProductDescription": "Mp3 Player"
543
                  },
544
                  "DueDate": "/Date(1473099415000)/",
545
                  "OrderQuantity": 2,
546
                  "UnitPrice": 200,
547
                  "DiscountRate": 0,
548
                  "LineTotal": 400,
549
                  "Volume": null,
550
                  "Weight": null,
551
                  "Comments": null,
552
                  "AverageLandedPriceAtTimeOfSale": 200,
553
                  "TaxRate": 0,
554
                  "LineTax": 0,
555
                  "XeroTaxCode": "G.S.T.",
556
                  "BCUnitPrice": 200,
557
                  "BCLineTotal": 400,
558
                  "BCLineTax": 0,
559
                  "LineTaxCode": "G.S.T.",
560
                  "XeroSalesAccount": null,
561
                  "SerialNumbers": null,
562
                  "BatchNumbers": null,
563
                  "Guid": "G404",
564
                  "LastModifiedOn": "/Date(1473149768279)/"
565
                }
566
              ],
567
              "OrderNumber": "O2",
568
              "OrderDate": "/Date(1473116400000)/",
569
              "RequiredDate": "/Date(1473548400000)/",
570
              "OrderStatus": "Dispatched",
571
              "Customer": {
572
                "CustomerCode": "Jeremy Peremy",
573
                "CustomerName": "Jeremy Peremy",
574
                "CurrencyId": 110,
575
                "Guid": "test",
576
                "LastModifiedOn": "/Date(1472624588017)/"
577
              },
578
              "CustomerRef": null,
579
              "Comments": "Test",
580
              "Warehouse": {
581
                "WarehouseCode": "test",
582
                "WarehouseName": "Queen St",
583
                "IsDefault": true,
584
                "StreetNo": "1",
585
                "AddressLine1": "Queen St",
586
                "AddressLine2": null,
587
                "City": "Invercargill",
588
                "Region": "Southland",
589
                "Country": "New Zealand",
590
                "PostCode": "9999",
591
                "PhoneNumber": "1234 567",
592
                "FaxNumber": null,
593
                "MobileNumber": null,
594
                "DDINumber": null,
595
                "ContactName": "Ed Hillary",
596
                "Obsolete": false,
597
                "Guid": "test",
598
                "LastModifiedOn": "/Date(1471582972964)/"
599
              },
600
              "ReceivedDate": "/Date(1473099415000)/",
601
              "DeliveryName": null,
602
              "DeliveryStreetAddress": "15 Ray St",
603
              "DeliverySuburb": "",
604
              "DeliveryCity": "Kaitaia",
605
              "DeliveryRegion": "Northland",
606
              "DeliveryCountry": "New Zealand",
607
              "DeliveryPostCode": "1111",
608
              "Currency": {
609
                "CurrencyCode": "NZD",
610
                "Description": "New Zealand, Dollars",
611
                "Guid": "test",
612
                "LastModifiedOn": "/Date(1415058050647)/"
613
              },
614
              "ExchangeRate": 1,
615
              "DiscountRate": 0,
616
              "Tax": {
617
                "TaxCode": "G.S.T.",
618
                "Description": null,
619
                "TaxRate": 0,
620
                "CanApplyToExpenses": false,
621
                "CanApplyToRevenue": false,
622
                "Obsolete": false,
623
                "Guid": "00000000-0000-0000-0000-000000000000",
624
                "LastModifiedOn": null
625
              },
626
              "TaxRate": 0,
627
              "XeroTaxCode": "G.S.T.",
628
              "SubTotal": 408,
629
              "TaxTotal": 0,
630
              "Total": 408,
631
              "TotalVolume": 0,
632
              "TotalWeight": 0,
633
              "BCSubTotal": 408,
634
              "BCTaxTotal": 0,
635
              "BCTotal": 408,
636
              "PaymentDueDate": "/Date(1473106568169)/",
637
              "SalesOrderGroup": null,
638
              "DeliveryMethod": null,
639
              "SalesPerson": null,
640
              "SendAccountingJournalOnly": false,
641
              "SourceId": "web",
642
              "CreatedBy": "[email protected]",
643
              "Guid": "G202",
644
              "LastModifiedOn": "/Date(1473149768310)/"
645
            }
646
          ]
647
        }
648
      ]';
649
}
650