Skip to content

Commit

Permalink
Merge pull request #159 from rikless/invoices
Browse files Browse the repository at this point in the history
Add invoice notification node
  • Loading branch information
drewish committed Jun 4, 2015
2 parents f6fe53d + f7c24a8 commit 6f99651
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [#153](https://github.com/recurly/recurly-client-php/pull/153)
* Added `ip_address` attribute to `Recurly_Transaction`[#157](https://github.com/recurly/recurly-client-php/pull/157)
* Added `bank_account_authorized_at` to `Recurly_Subscription` [#156](https://github.com/recurly/recurly-client-php/pull/156)
* Add invoice node to `Recurly_PushNotification` to read data on *_invoice_notification [#159](https://github.com/recurly/recurly-client-php/pull/159)

## Version 2.4.2 (Apr 14th, 2015)

Expand Down
13 changes: 10 additions & 3 deletions lib/recurly/push_notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,31 @@ class Recurly_PushNotification
* failed_payment_notification
* successful_refund_notification
* void_payment_notification
* new_invoice_notification
* closed_invoice_notification
* past_due_invoice_notification
*/
var $type;

var $account;
var $subscription;
var $transaction;
var $invoice;

function __construct($post_xml)
{
$this->parseXml($post_xml);
}

function parseXml($post_xml)
{
if (!@simplexml_load_string ($post_xml)) {
return;
}
$xml = new SimpleXMLElement ($post_xml);

$this->type = $xml->getName();

foreach ($xml->children() as $child_node)
{
switch ($child_node->getName())
Expand All @@ -55,6 +59,9 @@ function parseXml($post_xml)
case 'transaction':
$this->transaction = $child_node;
break;
case 'invoice':
$this->invoice = $child_node;
break;
}
}
}
Expand Down

0 comments on commit 6f99651

Please sign in to comment.