Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing possible childnode names #368

Merged
merged 1 commit into from
Sep 17, 2018
Merged

Add missing possible childnode names #368

merged 1 commit into from
Sep 17, 2018

Conversation

aaron-junot
Copy link

@aaron-junot aaron-junot commented Sep 17, 2018

Allows you to access all the data in a webhook. Updates the notes to reflect current state of Recurly webhooks.

Below is the playground script to test the new functionality. Note that a new_credit_payment_notification does not actually contain all of the possible nodes, so I added them from the examples on the docs page

<?php
include './scripts/php/stub.php';

$xml=<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<new_credit_payment_notification>
  <account>
    <account_code>1234</account_code>
    <username></username>
    <email></email>
    <first_name></first_name>
    <last_name></last_name>
    <company_name></company_name>
    <phone></phone>
  </account>
  <subscription>
    <plan>
      <plan_code>bronze</plan_code>
      <name>Bronze Plan</name>
    </plan>
    <uuid>8047cb4fd5f874b14d713d785436ebd3</uuid>
    <state>active</state>
    <quantity type="integer">2</quantity>
    <total_amount_in_cents type="integer">17000</total_amount_in_cents>
    <subscription_add_ons type="array">
      <subscription_add_on>
        <add_on_code>premium_support</add_on_code>
        <name>Premium Support</name>
        <quantity type="integer">1</quantity>
        <unit_amount_in_cents type="integer">15000</unit_amount_in_cents>
        <add_on_type>fixed</add_on_type>
        <usage_percentage nil="true"></usage_percentage>
        <measured_unit_id nil="true"></measured_unit_id>
      </subscription_add_on>
      <subscription_add_on>
        <add_on_code>email_blasts</add_on_code>
        <name>Email Blasts</name>
        <quantity type="integer">1</quantity>
        <unit_amount_in_cents type="integer">50</unit_amount_in_cents>
        <add_on_type>usage</add_on_type>
        <usage_percentage nil="true"></usage_percentage>
        <measured_unit_id type="integer">394681687402874853</measured_unit_id>
      </subscription_add_on>
      <subscription_add_on>
        <add_on_code>donations</add_on_code>
        <name>Donations</name>
        <quantity type="integer">1</quantity>
        <unit_amount_in_cents nil="true"></unit_amount_in_cents>
        <add_on_type>usage</add_on_type>
        <usage_percentage>0.6</usage_percentage>
        <measured_unit_id type="integer">394681920153192422</measured_unit_id>
      </subscription_add_on>
    </subscription_add_ons>
    <activated_at type="datetime">2009-11-22T13:10:38Z</activated_at>
    <canceled_at type="datetime"></canceled_at>
    <expires_at type="datetime"></expires_at>
    <current_period_started_at type="datetime">2009-11-22T13:10:38Z</current_period_started_at>
    <current_period_ends_at type="datetime">2009-11-29T13:10:38Z</current_period_ends_at>
    <trial_started_at type="datetime">2009-11-22T13:10:38Z</trial_started_at>
    <trial_ends_at type="datetime">2009-11-29T13:10:38Z</trial_ends_at>
    <collection_method>automatic</collection_method>
  </subscription>
  <transaction>
    <id>a5143c1d3a6f4a8287d0e2cc1d4c0427</id>
    <invoice_id>1974a09kj90s0789dsf099798326881c</invoice_id>
    <invoice_number_prefix></invoice_number_prefix>
    <invoice_number type="integer">2059</invoice_number>
    <subscription_id>1974a098jhlkjasdfljkha898326881c</subscription_id>
    <action>purchase</action>
    <date type="datetime">2009-11-22T13:10:38Z</date>
    <amount_in_cents type="integer">1000</amount_in_cents>
    <status>scheduled</status>
    <message>Bogus Gateway: Forced success</message>
    <reference></reference>
    <source>subscription</source>
    <cvv_result code=""></cvv_result>
    <avs_result code=""></avs_result>
    <avs_result_street></avs_result_street>
    <avs_result_postal></avs_result_postal>
    <test type="boolean">true</test>
    <voidable type="boolean">true</voidable>
    <refundable type="boolean">true</refundable>
  </transaction>
  <invoice>
    <uuid>424a9d4a2174b4f39bc776426aa19c32</uuid>
    <state>past_due</state>
    <origin>renewal</origin>
    <invoice_number_prefix></invoice_number_prefix>
    <invoice_number type="integer">1813</invoice_number>
    <address>
      <address1></address1>
      <address2></address2>
      <city></city>
      <state></state>
      <zip></zip>
      <country></country>
      <phone></phone>
    </address>
    <vat_number></vat_number>
    <currency>USD</currency>
    <balance_in_cents type="integer">4000</balance_in_cents>
    <total_in_cents type="integer">4500</total_in_cents>
    <tax_in_cents type="integer">0</tax_in_cents>
    <subtotal_in_cents type="integer">4500</subtotal_in_cents>
    <subtotal_before_discount_in_cents type="integer">4500</subtotal_before_discount_in_cents>
    <discount_in_cents type="integer">0</discount_in_cents>
    <subscription_ids type="array">
      <subscription_id>4110792b3b01967d854f674b7282f542</subscription_id>
    </subscription_ids>
    <customer_notes>Thanks for your business!</customer_notes>
    <created_at type="datetime">2018-01-09T16:47:43Z</created_at>
    <updated_at type="datetime">2018-02-12T16:50:23Z</updated_at>
    <closed_at type="datetime" nil="true"></closed_at>
    <po_number></po_number>
    <terms_and_conditions></terms_and_conditions>
    <due_on type="dateTime">2018-02-09T16:47:43Z</due_on>
    <dunning_events_count type="integer">2</dunning_events_count>
    <final_dunning_event type="boolean">false</final_dunning_event>
    <net_terms type="integer">30</net_terms>
    <collection_method>manual</collection_method>
  </invoice>
  <credit_payment>
    <uuid>42fa2a56dfeca2ace39b0e4a9198f835</uuid>
    <action type="symbol">payment</action>
    <currency>USD</currency>
    <amount_in_cents type="integer">3579</amount_in_cents>
    <original_nvoice_number type="integer">2389</original_nvoice_number>
    <applied_to_invoice_number type="integer">2390</applied_to_invoice_number>
    <original_credit_payment_uuid nil="true"></original_credit_payment_uuid>
    <refund_transaction_uuid nil="true"></refund_transaction_uuid>
    <created_at type="datetime">2018-02-12T18:55:20Z</created_at>
    <updated_at type="datetime">2018-02-12T18:55:20Z</updated_at>
    <voided_at type="datetime" nil="true"></voided_at>
  </credit_payment>
  <gift_card>
    <redemption_code>1A5069E266AED435</redemption_code>
    <id type="integer">2008976331180115114</id>
    <product_code>gift_card</product_code>
    <unit_amount_in_cents type="integer">1000</unit_amount_in_cents>
    <currency>USD</currency>
    <gifter_account_code>84395</gifter_account_code>
    <recipient_account_code nil="true"></recipient_account_code>
    <invoice_number type="integer">1105</invoice_number>
    <delivery>
      <method>email</method>
      <email_address>john@example.com</email_address>
      <deliver_at nil="true"></deliver_at>
      <first_name>John</first_name>
      <last_name>Smith</last_name>
      <address>
        <address1 nil="true"></address1>
        <address2 nil="true"></address2>
        <city nil="true"></city>
        <state nil="true"></state>
        <zip nil="true"></zip>
        <country nil="true"></country>
        <phone nil="true"></phone>
      </address>
      <gifter_name>Sally</gifter_name>
      <personal_message>
        Hi John, Happy Birthday! I hope you have a great day! Love, Sally</personal_message>
    </delivery>
    <created_at type="datetime">2016-08-03T20:37:21Z</created_at>
    <updated_at type="datetime">2016-08-03T20:37:21Z</updated_at>
    <delivered_at type="datetime" nil="true"></delivered_at>
    <redeemed_at type="datetime" nil="true"></redeemed_at>
    <canceled_at type="datetime" nil="true"></canceled_at>
  </gift_card>
  <shipping_address>
    <id type="integer">2019760742762202549</id>
    <nickname>Steven</nickname>
    <first_name>Steven</first_name>
    <last_name>Smith</last_name>
    <company_name></company_name>
    <vat_number></vat_number>
    <street1>231 Oregon Street</street1>
    <street2></street2>
    <city>Portland</city>
    <state>OR</state>
    <zip>97201</zip>
    <country>US</country>
    <email>stevensmith@example.com</email>
    <phone></phone>
  </shipping_address>
  <usage>
    <id type="integer">394729929104688227</id>
    <subscription_id>35cda8d4ae0a214f69779e4ddbbc2ebd</subscription_id>
    <add_on_code>video_storage</add_on_code>
    <measured_unit_id type="integer">394681920153192422</measured_unit_id>
    <amount type="integer">-40</amount>
    <merchant_tag nil="true"></merchant_tag>
    <recording_timestamp type="datetime">2016-04-28T21:57:53+00:00</recording_timestamp>
    <usage_timestamp type="datetime">2016-04-28T21:57:53+00:00</usage_timestamp>
    <created_at type="datetime">2016-04-28T21:57:54+00:00</created_at>
    <modified_at type="datetime" nil="true"></modified_at>
    <billed_at type="datetime">2016-04-28T21:57:54+00:00</billed_at>
    <usage_type>PRICE</usage_type>
    <unit_amount_in_cents nil="true">50</unit_amount_in_cents>
    <usage_percentage type="float"></usage_percentage>
  </usage>
</new_credit_payment_notification>
XML;

$notification = new Recurly_PushNotification($xml);

var_dump($notification);

Copy link
Contributor

@bhelx bhelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bhelx bhelx merged commit 3bb0c4d into master Sep 17, 2018
@bhelx bhelx deleted the fix-webhooks branch September 17, 2018 18:47
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants