diff --git a/Tests/Recurly/Adjustment_Test.php b/Tests/Recurly/Adjustment_Test.php
index 654c27b8..5e7c64d1 100644
--- a/Tests/Recurly/Adjustment_Test.php
+++ b/Tests/Recurly/Adjustment_Test.php
@@ -5,7 +5,8 @@ class Recurly_AdjustmentTest extends Recurly_TestCase
{
function defaultResponses() {
return array(
- array('GET', '/adjustments/abcdef1234567890', 'adjustments/show-200.xml')
+ array('GET', '/adjustments/abcdef1234567890', 'adjustments/show-200.xml'),
+ array('GET', '/adjustments/abcdef1234567890_revrec', 'adjustments/show-200-revrec.xml'),
);
}
@@ -54,6 +55,14 @@ public function testGetAdjustment() {
$this->assertEquals(2000, $county->tax_in_cents);
}
+ public function testGetAdjustmentWithRevRec() {
+ $adjustment = Recurly_Adjustment::get('abcdef1234567890_revrec', $this->client);
+
+ $this->assertSame('100', $adjustment->liability_gl_account_code);
+ $this->assertSame('200', $adjustment->revenue_gl_account_code);
+ $this->assertSame('5', $adjustment->performance_obligation_id);
+ }
+
public function testDelete() {
$this->client->addResponse('GET', '/adjustments/abcdef1234567890', 'adjustments/show-200.xml');
$this->client->addResponse('DELETE', 'https://api.recurly.com/v2/adjustments/abcdef1234567890', 'adjustments/destroy-204.xml');
@@ -122,11 +131,14 @@ public function testXml() {
$charge->shipping_address->state = "CA";
$charge->shipping_address->zip = "94110";
$charge->shipping_address->country = "US";
+ $charge->revenue_gl_account_id = 'revenue-gl-account-id';
+ $charge->liability_gl_account_id = 'liability_gl_account_id';
+ $charge->performance_obligation_id = '6';
// This deprecated parameter should be ignored:
$charge->taxable = 0;
- $expected = "\nUSD500011.2Charge for extra bandwidthbandwidthfalsefake-tax-codeexternal_gift_cardabc123123 Main St.San FranciscoCA94110US555-555-5555verena@example.comWorkVerenaExampleRecurly Inc.123456789\n";
+ $expected = "\nUSD500011.2Charge for extra bandwidthbandwidthfalsefake-tax-codeexternal_gift_cardabc123123 Main St.San FranciscoCA94110US555-555-5555verena@example.comWorkVerenaExampleRecurly Inc.123456789revenue-gl-account-idliability_gl_account_id6\n";
$this->assertEquals($expected, $charge->xml());
}
}
diff --git a/Tests/fixtures/adjustments/show-200-revrec.xml b/Tests/fixtures/adjustments/show-200-revrec.xml
new file mode 100644
index 00000000..47650f5a
--- /dev/null
+++ b/Tests/fixtures/adjustments/show-200-revrec.xml
@@ -0,0 +1,29 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+
+
+
+
+ abcdef1234567890
+ invoiced
+ $12 Annual Subscription
+
+
+ 100
+ 200
+ 5
+
+ plan
+ 1200
+ 1
+ 0
+ 0
+ 1200
+ USD
+ false
+ 2011-04-30T07:00:00Z
+ 2011-04-30T07:00:00Z
+ 2011-08-31T03:30:00Z
+
\ No newline at end of file
diff --git a/lib/recurly/adjustment.php b/lib/recurly/adjustment.php
index 1d9ded80..f0f71098 100644
--- a/lib/recurly/adjustment.php
+++ b/lib/recurly/adjustment.php
@@ -35,6 +35,11 @@
* @property string $credit_reason_code Can be set if adjustment is a credit (unit_amount_in_cents < 0). Allowed values: [general, service, promotional, refund, gift_card, write_off]. Defaults to "general".
* @property Recurly_ShippingAddress $shipping_address The Recurly_ShippingAddress object associated with this adjustment.
* @property string $shipping_address_id The id of Recurly_ShippingAddress object associated with this adjustment.
+ * @property string (SET) $liability_gl_account_id The ID of the liability general ledger account associated with the adjustment to be created. Its associated code will be stored on the adjustment.
+ * @property string (SET) $revenue_gl_account_id The ID of the revenue general ledger account associated with the adjustment to be created. Its associated code will be stored on the adjustment.
+ * @property string $performance_obligation_id The ID of the performance obligation associated with the adjustment.
+ * @property string (GET) $liability_gl_account_code The code of the liability general ledger account associated with the adjustment. Once it is determined from the general ledger account specified in the request, it cannot be changed.
+ * @property string (GET) $revenue_gl_account_code The code of the revenue general ledger account associated with the adjustment. Once it is determined from the general ledger account specified in the request, it cannot be changed.
* @property DateTime $start_date A timestamp associated with when the adjustment began.
* @property DateTime $end_date A timestamp associated with when the adjustment ended.
* @property DateTime $created_at A timestamp associated with when the adjustment was created.
@@ -128,7 +133,8 @@ protected function getWriteableAttributes() {
'currency', 'unit_amount_in_cents', 'quantity', 'quantity_decimal', 'description',
'accounting_code', 'tax_exempt', 'tax_inclusive', 'tax_code', 'start_date', 'end_date',
'revenue_schedule_type', 'origin', 'product_code', 'credit_reason_code',
- 'shipping_address', 'shipping_address_id', 'item_code', 'external_sku', 'custom_fields'
+ 'shipping_address', 'shipping_address_id', 'item_code', 'external_sku', 'custom_fields',
+ 'revenue_gl_account_id', 'liability_gl_account_id', 'performance_obligation_id'
);
}
}