@@ -118,6 +118,7 @@ protected function initialize()
118
118
$ this ->data ->amount ->subtotals = new stdClass ();
119
119
$ this ->data ->items = [];
120
120
$ this ->data ->receivers = [];
121
+ $ this ->data ->shippingAddress = new stdClass ();
121
122
$ this ->data ->checkoutPreferences = new stdClass ();
122
123
$ this ->data ->checkoutPreferences ->redirectUrls = new stdClass ();
123
124
$ this ->data ->checkoutPreferences ->installments = [];
@@ -145,24 +146,36 @@ protected function populate(stdClass $response)
145
146
$ this ->orders = clone $ this ;
146
147
$ this ->orders ->data ->id = $ response ->id ;
147
148
$ this ->orders ->data ->ownId = $ response ->ownId ;
149
+ $ this ->orders ->data ->createdAt = $ response ->createdAt ;
150
+ $ this ->orders ->data ->updatedAt = $ response ->updatedAt ;
151
+ $ this ->orders ->data ->amount ->paid = $ response ->amount ->paid ;
148
152
$ this ->orders ->data ->amount ->total = $ response ->amount ->total ;
149
153
$ this ->orders ->data ->amount ->fees = $ response ->amount ->fees ;
150
154
$ this ->orders ->data ->amount ->refunds = $ response ->amount ->refunds ;
151
155
$ this ->orders ->data ->amount ->liquid = $ response ->amount ->liquid ;
152
156
$ this ->orders ->data ->amount ->otherReceivers = $ response ->amount ->otherReceivers ;
153
157
$ this ->orders ->data ->amount ->subtotals = $ response ->amount ->subtotals ;
154
-
158
+ $ this -> orders -> data -> items = $ response -> items ;
155
159
$ customer = new Customer ($ this ->moip );
156
160
$ this ->orders ->data ->customer = $ customer ->populate ($ response ->customer );
157
161
158
162
$ this ->orders ->data ->payments = $ this ->structure ($ response , Payment::PATH , Payment::class);
163
+ $ this ->orders ->data ->escrows = $ this ->structure ($ response , Payment::PATH , Escrow::class);
159
164
$ this ->orders ->data ->refunds = $ this ->structure ($ response , Refund::PATH , Refund::class);
160
165
$ this ->orders ->data ->entries = $ this ->structure ($ response , Entry::PATH , Entry::class);
161
166
$ this ->orders ->data ->events = $ this ->structure ($ response , Event::PATH , Event::class);
162
167
163
- $ this ->orders ->data ->items = $ response ->items ;
164
168
$ this ->orders ->data ->receivers = $ this ->getIfSet ('receivers ' , $ response );
165
- $ this ->orders ->data ->createdAt = $ response ->createdAt ;
169
+
170
+ $ this ->orders ->data ->shippingAddress ->zipCode = $ response ->shippingAddress ->zipCode ;
171
+ $ this ->orders ->data ->shippingAddress ->street = $ response ->shippingAddress ->street ;
172
+ $ this ->orders ->data ->shippingAddress ->streetNumber = $ response ->shippingAddress ->streetNumber ;
173
+ $ this ->orders ->data ->shippingAddress ->complement = $ response ->shippingAddress ->complement ;
174
+ $ this ->orders ->data ->shippingAddress ->city = $ response ->shippingAddress ->city ;
175
+ $ this ->orders ->data ->shippingAddress ->district = $ response ->shippingAddress ->district ;
176
+ $ this ->orders ->data ->shippingAddress ->state = $ response ->shippingAddress ->state ;
177
+ $ this ->orders ->data ->shippingAddress ->country = $ response ->shippingAddress ->country ;
178
+
166
179
$ this ->orders ->data ->status = $ response ->status ;
167
180
$ this ->orders ->data ->_links = $ response ->_links ;
168
181
@@ -234,6 +247,16 @@ public function getOwnId()
234
247
return $ this ->getIfSet ('ownId ' );
235
248
}
236
249
250
+ /**
251
+ * Get paid value of order.
252
+ *
253
+ * @return int|float
254
+ */
255
+ public function getAmountPaid ()
256
+ {
257
+ return $ this ->getIfSet ('paid ' , $ this ->data ->amount );
258
+ }
259
+
237
260
/**
238
261
* Get total value of order.
239
262
*
@@ -362,6 +385,86 @@ public function getCustomer()
362
385
return $ this ->data ->customer ;
363
386
}
364
387
388
+ /**
389
+ * Get zipCode of shippingAddress.
390
+ *
391
+ * @return string
392
+ */
393
+ public function getShippingAddressZipCode ()
394
+ {
395
+ return $ this ->getIfSet ('zipCode ' , $ this ->data ->shippingAddress );
396
+ }
397
+
398
+ /**
399
+ * Get street of shippingAddress.
400
+ *
401
+ * @return string
402
+ */
403
+ public function getShippingAddressStreet ()
404
+ {
405
+ return $ this ->getIfSet ('street ' , $ this ->data ->shippingAddress );
406
+ }
407
+
408
+ /**
409
+ * Get streetNumber of shippingAddress.
410
+ *
411
+ * @return string
412
+ */
413
+ public function getShippingAddressStreetNumber ()
414
+ {
415
+ return $ this ->getIfSet ('streetNumber ' , $ this ->data ->shippingAddress );
416
+ }
417
+
418
+ /**
419
+ * Get complement of shippingAddress.
420
+ *
421
+ * @return string
422
+ */
423
+ public function getShippingAddressComplement ()
424
+ {
425
+ return $ this ->getIfSet ('complement ' , $ this ->data ->shippingAddress );
426
+ }
427
+
428
+ /**
429
+ * Get city of shippingAddress.
430
+ *
431
+ * @return string
432
+ */
433
+ public function getShippingAddressCity ()
434
+ {
435
+ return $ this ->getIfSet ('city ' , $ this ->data ->shippingAddress );
436
+ }
437
+
438
+ /**
439
+ * Get district of shippingAddress.
440
+ *
441
+ * @return string
442
+ */
443
+ public function getShippingAddressDistrict ()
444
+ {
445
+ return $ this ->getIfSet ('district ' , $ this ->data ->shippingAddress );
446
+ }
447
+
448
+ /**
449
+ * Get state of shippingAddress.
450
+ *
451
+ * @return string
452
+ */
453
+ public function getShippingAddressState ()
454
+ {
455
+ return $ this ->getIfSet ('state ' , $ this ->data ->shippingAddress );
456
+ }
457
+
458
+ /**
459
+ * Get country of shippingAddress.
460
+ *
461
+ * @return string
462
+ */
463
+ public function getShippingAddressCountry ()
464
+ {
465
+ return $ this ->getIfSet ('country ' , $ this ->data ->shippingAddress );
466
+ }
467
+
365
468
/**
366
469
* Get payments associated with the request.
367
470
*
@@ -373,13 +476,33 @@ public function getPaymentIterator()
373
476
}
374
477
375
478
/**
376
- * Get recipient structure of payments .
479
+ * Get escrows associated with the request .
377
480
*
378
481
* @return ArrayIterator
379
482
*/
380
- public function getReceiverIterator ()
483
+ public function getEscrowIterator ()
381
484
{
382
- return new ArrayIterator ($ this ->data ->receivers );
485
+ return new ArrayIterator ($ this ->data ->escrows );
486
+ }
487
+
488
+ /**
489
+ * Get refunds associated with the request.
490
+ *
491
+ * @return ArrayIterator
492
+ */
493
+ public function getRefundIterator ()
494
+ {
495
+ return new ArrayIterator ($ this ->data ->refunds );
496
+ }
497
+
498
+ /**
499
+ * Get entries associated with the request.
500
+ *
501
+ * @return ArrayIterator
502
+ */
503
+ public function getEntryIterator ()
504
+ {
505
+ return new ArrayIterator ($ this ->data ->entries );
383
506
}
384
507
385
508
/**
@@ -393,13 +516,13 @@ public function getEventIterator()
393
516
}
394
517
395
518
/**
396
- * Get repayments associated with the request .
519
+ * Get recipient structure of payments .
397
520
*
398
521
* @return ArrayIterator
399
522
*/
400
- public function getRefundIterator ()
523
+ public function getReceiverIterator ()
401
524
{
402
- return new ArrayIterator ($ this ->data ->refunds );
525
+ return new ArrayIterator ($ this ->data ->receivers );
403
526
}
404
527
405
528
/**
0 commit comments