Completed
Branch master (c642f0)
by Antony
02:45
created

UnleashedOrderTest::testSetBodyAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 26
nc 1
nop 0
dl 0
loc 34
rs 9.504
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
        $this->logInWithPermission('ADMIN');
39
        Config::modify()
40
            ->set(Simple::class, 'default_charge', 8.95)
41
            ->set(Simple::class, 'product_code', 'Freight')
42
            ->set(FlatTax::class, 'rate', 0.15)
43
            ->set(FlatTax::class, 'exclusive', true)
44
            ->set(FlatTax::class, 'name', 'GST')
45
            ->set(FlatTax::class, 'tax_code', 'OUTPUT2')
46
            ->merge(Order::class, 'modifiers', [Simple::class, FlatTax::class]);
47
    }
48
49
    protected $order_status_map = [
50
        'Open' => 'Unpaid',
51
        'Parked' => 'Paid',
52
        'Backordered' => 'Processing',
53
        'Placed' => 'Processing',
54
        'Picking' => 'Processing',
55
        'Picked' => 'Processing',
56
        'Packed' => 'Processing',
57
        'Dispatched' => 'Sent',
58
        'Complete' => 'Complete',
59
        'Deleted' => 'MemberCancelled'
60
    ];
61
62
    public function testChangeOrderStatus()
63
    {
64
        $apidata_array = json_decode($this->jsondata, true);
65
        $apidata_array = reset($apidata_array);
66
        $apidata = $apidata_array['Items'];
67
68
        $loader = OrderBulkLoader::create('SilverShop\Model\Order');
69
        $loader->transforms = [
70
            'Status' => [
71
                '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

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