diff --git a/Tests/Recurly/Addon_Test.php b/Tests/Recurly/Addon_Test.php
index 8bd990fd..582554a6 100644
--- a/Tests/Recurly/Addon_Test.php
+++ b/Tests/Recurly/Addon_Test.php
@@ -5,7 +5,8 @@ class Recurly_AddonTest extends Recurly_TestCase
{
function defaultResponses() {
return array(
- array('GET', '/plans/gold/add_ons/ipaddresses', 'addons/show-200.xml')
+ array('GET', '/plans/gold/add_ons/ipaddresses', 'addons/show-200.xml'),
+ array('GET', '/plans/gold/add_ons/ipaddresses_revrec', 'addons/show-200-revrec.xml'),
);
}
@@ -19,6 +20,18 @@ public function testConstructor() {
$this->assertSame($client, $prop->getValue($plan));
}
+ public function testGetAddonWithRevRec() {
+ $addon = Recurly_Addon::get('gold', 'ipaddresses_revrec', $this->client);
+ $this->assertInstanceOf('Recurly_Addon', $addon);
+ $this->assertSame('ipaddresses_revrec', $addon->add_on_code);
+ $this->assertSame('IP Addresses', $addon->name);
+ $this->assertSame(200, $addon->unit_amount_in_cents->USD->amount_in_cents);
+ $this->assertSame(1, $addon->default_quantity);
+ $this->assertSame('udexyr9hjgkc', $addon->liability_gl_account_id);
+ $this->assertSame('uelq7rzkydlu', $addon->revenue_gl_account_id);
+ $this->assertSame('6', $addon->performance_obligation_id);
+ }
+
public function testDelete() {
$this->client->addResponse(
'DELETE',
@@ -48,6 +61,29 @@ public function testCreateXmlItemBackedAddOn() {
", $addon->xml());
}
+ public function testCreateXmlItemBackedAddOnWithRevRec() {
+ $item = new Recurly_Item();
+ $item->item_code = 'little_llama';
+ $addon = new Recurly_Addon();
+ $addon->plan_code = 'gold';
+ $addon->item_code = $item->item_code;
+ $addon->unit_amount_in_cents->addCurrency('USD', 400);
+ $addon->liability_gl_account_id = 'udexyr9hjgkc';
+ $addon->revenue_gl_account_id = 'uelq7rzkydlu';
+ $addon->performance_obligation_id = '6';
+
+ $this->assertXmlStringEqualsXmlString("
+
+ little_llama
+
+ 400
+
+ udexyr9hjgkc
+ uelq7rzkydlu
+ 6
+ ", $addon->xml());
+ }
+
public function testCreateXmlTieredAddOn() {
$item = new Recurly_Item();
$addon = new Recurly_Addon();
diff --git a/Tests/fixtures/addons/show-200-revrec.xml b/Tests/fixtures/addons/show-200-revrec.xml
new file mode 100644
index 00000000..21b73c45
--- /dev/null
+++ b/Tests/fixtures/addons/show-200-revrec.xml
@@ -0,0 +1,22 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+ETag: "a81253e90a4f16089b951028675c58d2"
+
+
+
+
+ ipaddresses_revrec
+ IP Addresses
+ false
+ 1
+
+ 200
+
+ 123456
+ usage
+ price
+ udexyr9hjgkc
+ uelq7rzkydlu
+ 6
+ 2011-06-28T12:34:56Z
+
diff --git a/lib/recurly/addon.php b/lib/recurly/addon.php
index 2f71fe71..e1bbf63b 100644
--- a/lib/recurly/addon.php
+++ b/lib/recurly/addon.php
@@ -21,6 +21,9 @@
* @property float $usage_percentage If add_on_type = usage and usage_type = percentage, you must set a usage_percentage. Must be between 0.0000 and 100.0000. If item_code is present, usage_percentage must be absent.
* @property string $usage_calculation_type The method of calculation used for usage-based add-ons with type 'price'. Can be 'cumulative' or 'last_in_period'. If no type is selected, type 'cumulative' will apply.
* @property string $revenue_schedule_type Optional field for setting a revenue schedule type. This will determine how revenue for the associated Plan should be recognized. When creating a Plan, if you supply an end_date and end_date available schedule types are never, evenly, at_range_start, or at_range_end. If item_code is present, revenue_schedule_type must be absent.
+ * @property string $liability_gl_account_id The ID of the liability general ledger account associated with the add on.
+ * @property string $revenue_gl_account_id The ID of the revenue general ledger account associated with the add on.
+ * @property string $performance_obligation_id The ID of the performance obligation associated with the add on.
* @property DateTime $created_at The date and time the add-on was created.
* @property DateTime $updated_at The date and time the add-on was last updated.
* @property string $plan_code Unique code to identify the plan.
@@ -70,7 +73,8 @@ protected function getWriteableAttributes() {
'add_on_code', 'item_code', 'name', 'display_quantity', 'default_quantity',
'unit_amount_in_cents', 'accounting_code', 'tax_code', 'usage_timeframe', 'usage_calculation_type',
'measured_unit_id', 'usage_type', 'usage_percentage', 'add_on_type', 'revenue_schedule_type',
- 'optional', 'display_quantity_on_hosted_page', 'tier_type', 'tiers', 'percentage_tiers'
+ 'optional', 'display_quantity_on_hosted_page', 'tier_type', 'tiers', 'percentage_tiers', 'liability_gl_account_id',
+ 'revenue_gl_account_id', 'performance_obligation_id'
);
}
}