diff --git a/Tests/Recurly/GiftCard_Test.php b/Tests/Recurly/GiftCard_Test.php
index 6042e0f8..617be48c 100644
--- a/Tests/Recurly/GiftCard_Test.php
+++ b/Tests/Recurly/GiftCard_Test.php
@@ -15,6 +15,37 @@ public function testGetGiftCard() {
$this->assertInstanceOf('Recurly_Stub', $giftCard->gifter_account);
$this->assertInstanceOf('Recurly_Delivery', $giftCard->delivery);
$this->assertEquals($giftCard->getHref(),'https://api.recurly.com/v2/gift_cards/1988596967980562362');
+ $this->assertEquals($giftCard->redemption_code,'AI4VOVO1RC74H9E2');
+ $this->assertEquals($giftCard->product_code,'gift_card');
+ $this->assertEquals($giftCard->unit_amount_in_cents,'2000');
+ $this->assertEquals($giftCard->currency,'USD');
+ $this->assertEquals($giftCard->balance_in_cents,'2000');
+ $this->assertInstanceOf('DateTime', $giftCard->created_at);
+ $this->assertInstanceOf('DateTime', $giftCard->updated_at);
+ $this->assertInstanceOf('DateTime', $giftCard->redeemed_at);
+ $this->assertInstanceOf('DateTime', $giftCard->delivered_at);
+ }
+
+ public function testGetGiftCardWithRevRec() {
+ $this->client->addResponse('GET', '/gift_cards/1988596967980562362', 'gift_cards/show-200-revrec.xml');
+ $giftCard = Recurly_GiftCard::get(1988596967980562362, $this->client);
+
+ $this->assertInstanceOf('Recurly_GiftCard', $giftCard);
+ $this->assertInstanceOf('Recurly_Stub', $giftCard->gifter_account);
+ $this->assertInstanceOf('Recurly_Delivery', $giftCard->delivery);
+ $this->assertEquals($giftCard->getHref(),'https://api.recurly.com/v2/gift_cards/1988596967980562362');
+ $this->assertEquals($giftCard->redemption_code,'AI4VOVO1RC74H9E2');
+ $this->assertEquals($giftCard->product_code,'gift_card');
+ $this->assertEquals($giftCard->unit_amount_in_cents,'2000');
+ $this->assertEquals($giftCard->currency,'USD');
+ $this->assertEquals($giftCard->balance_in_cents,'2000');
+ $this->assertEquals($giftCard->liability_gl_account_id,'t5ejtge1xw0x');
+ $this->assertEquals($giftCard->revenue_gl_account_id,'t5ejtgf1vxh1');
+ $this->assertEquals($giftCard->performance_obligation_id,'4');
+ $this->assertInstanceOf('DateTime', $giftCard->created_at);
+ $this->assertInstanceOf('DateTime', $giftCard->updated_at);
+ $this->assertInstanceOf('DateTime', $giftCard->redeemed_at);
+ $this->assertInstanceOf('DateTime', $giftCard->delivered_at);
}
public function testRedeemGiftCard() {
diff --git a/Tests/Recurly/Item_Test.php b/Tests/Recurly/Item_Test.php
index b0931ffa..e2f7764f 100644
--- a/Tests/Recurly/Item_Test.php
+++ b/Tests/Recurly/Item_Test.php
@@ -27,6 +27,19 @@ public function testGetItem() {
$this->assertEquals('Sleek Plastic', $item->description);
}
+ public function testGetItemWithRevRec() {
+ $this->client->addResponse('GET', '/items/plastic_gloves', 'items/show-200-revrec.xml');
+ $item = Recurly_Item::get('plastic_gloves', $this->client);
+
+ $this->assertInstanceOf('Recurly_Item', $item);
+ $this->assertEquals('plastic_gloves', $item->item_code);
+ $this->assertEquals('Awesome Plastic Gloves', $item->name);
+ $this->assertEquals('Sleek Plastic', $item->description);
+ $this->assertEquals($item->liability_gl_account_id,'t5ejtge1xw0x');
+ $this->assertEquals($item->revenue_gl_account_id,'t5ejtgf1vxh1');
+ $this->assertEquals($item->performance_obligation_id,'5');
+ }
+
public function testNestedCustomFields() {
$item = Recurly_Item::get('plastic_gloves', $this->client);
$item->custom_fields[] = new Recurly_CustomField('size', 'small');
@@ -72,9 +85,12 @@ public function testCreateXml() {
$item->name = 'Little Llama';
$item->description = 'A description about llamas';
$item->custom_fields[] = new Recurly_CustomField('size', 'small');
+ $item->liability_gl_account_id = 't5ejtge1xw0x';
+ $item->revenue_gl_account_id = 't5ejtgf1vxh1';
+ $item->performance_obligation_id = '5';
$this->assertEquals(
- "\n- little_llamaLittle LlamaA description about llamassizesmall
\n",
+ "\n- little_llamaLittle LlamaA description about llamassizesmallt5ejtge1xw0xt5ejtgf1vxh15
\n",
$item->xml()
);
}
diff --git a/Tests/fixtures/gift_cards/show-200-revrec.xml b/Tests/fixtures/gift_cards/show-200-revrec.xml
new file mode 100644
index 00000000..58afe463
--- /dev/null
+++ b/Tests/fixtures/gift_cards/show-200-revrec.xml
@@ -0,0 +1,41 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+
+
+
+
+ 1988596967980562362
+ AI4VOVO1RC74H9E2
+ gift_card
+ 2000
+ USD
+ 2000
+
+ email
+
+ john@example.com
+ John
+ Smith
+
+
+
+
+
+
+
+
+
+ Sally
+ Hi John, Happy Birthday! I hope you have a great day! Love, Sally
+
+ t5ejtge1xw0x
+ t5ejtgf1vxh1
+ 4
+ 2016-04-15T07:00:00Z
+ 2016-12-27T07:00:00Z
+ 2016-12-25T07:00:05Z
+ 2016-12-27T07:00:00Z
+
+
diff --git a/Tests/fixtures/items/show-200-revrec.xml b/Tests/fixtures/items/show-200-revrec.xml
new file mode 100644
index 00000000..36593f9b
--- /dev/null
+++ b/Tests/fixtures/items/show-200-revrec.xml
@@ -0,0 +1,27 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+-
+ plastic_gloves
+ Awesome Plastic Gloves
+ Sleek Plastic
+ awesome-plastic-gloves
+ 1569273944
+ never
+ true
+
+ active
+
+
+ color
+ blue
+
+
+ t5ejtge1xw0x
+ t5ejtgf1vxh1
+ 5
+ 2019-09-23T21:25:45Z
+ 2019-09-23T21:25:45Z
+
+
diff --git a/lib/recurly/gift_card.php b/lib/recurly/gift_card.php
index dd86826c..ab25aa0b 100644
--- a/lib/recurly/gift_card.php
+++ b/lib/recurly/gift_card.php
@@ -14,6 +14,9 @@
* @property string $currency The currency of the unit_amount_in_cents and balance_in_cents.
* @property string $product_code The product code or SKU of the gift card product.
* @property int $unit_amount_in_cents The amount of the gift card, which is the amount of the charge to the gifter_account and the amount of credit that is applied to the recipient_account upon successful redemption.
+ * @property string $liability_gl_account_id The ID of the liability general ledger account associated with the gift card product.
+ * @property string $revenue_gl_account_id The ID of the revenue general ledger account associated with the gift card product.
+ * @property string $performance_obligation_id The ID of the performance obligation associated with the gift card product.
* @property Recurly_Delivery $delivery Block of delivery information.
* @property DateTime $created_at The date and time the gift card was created in Recurly.
* @property DateTime $updated_at The date and time the gift card was last updated.
diff --git a/lib/recurly/item.php b/lib/recurly/item.php
index 1166262c..75f871ef 100644
--- a/lib/recurly/item.php
+++ b/lib/recurly/item.php
@@ -9,6 +9,9 @@
* @property string $accounting_code Accounting code for invoice line items.
* @property string $revenue_schedule_type The revenue schedule type for the item.
* @property string $state The state of the item.
+ * @property string $liability_gl_account_id The ID of the liability general ledger account associated with the item.
+ * @property string $revenue_gl_account_id The ID of the revenue general ledger account associated with the item.
+ * @property string $performance_obligation_id The ID of the performance obligation associated with the item.
* @property Recurly_CustomFieldList $custom_fields Optional custom fields for the item.
*/
@@ -71,7 +74,8 @@ protected function getNodeName() {
protected function getWriteableAttributes() {
return array(
'item_code', 'name', 'description', 'external_sku',
- 'accounting_code', 'revenue', 'state', 'custom_fields'
+ 'accounting_code', 'revenue', 'state', 'custom_fields',
+ 'liability_gl_account_id', 'revenue_gl_account_id', 'performance_obligation_id'
);
}
}