From 7647f7d2b535718b197532d4c3ee6eb914ad0458 Mon Sep 17 00:00:00 2001 From: "Marco A. Rossi Jr" <30436086+marcorossijr@users.noreply.github.com> Date: Tue, 20 Nov 2018 21:03:38 -0200 Subject: [PATCH] Update Payment.php Change to return the payment events --- src/Resource/Payment.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Resource/Payment.php b/src/Resource/Payment.php index 89f99df..5d26fce 100644 --- a/src/Resource/Payment.php +++ b/src/Resource/Payment.php @@ -2,6 +2,7 @@ namespace Moip\Resource; +use ArrayIterator; use Requests; use stdClass; @@ -169,6 +170,16 @@ public function getId() { return $this->getIfSet('id'); } + + /** + * Get releases associated with the request. + * + * @return ArrayIterator + */ + public function getEventIterator() + { + return new ArrayIterator($this->data->events); + } /** * Mount payment structure. @@ -192,6 +203,7 @@ protected function populate(stdClass $response) $payment->data->payments = $this->getIfSet('payments', $response); $payment->data->escrows = $this->getIfSet('escrows', $response); $payment->data->fees = $this->getIfSet('fees', $response); + $payment->data->events = $this->getIfSet('events', $response); $payment->data->refunds = $this->getIfSet('refunds', $response); $payment->data->_links = $this->getIfSet('_links', $response); $payment->data->createdAt = $this->getIfSetDateTime('createdAt', $response);