diff --git a/Tests/Recurly/Purchase_Test.php b/Tests/Recurly/Purchase_Test.php index 338b1514..fafb7ec4 100644 --- a/Tests/Recurly/Purchase_Test.php +++ b/Tests/Recurly/Purchase_Test.php @@ -53,6 +53,7 @@ public function mockPurchase() { $adjustment->currency = 'USD'; $adjustment->quantity = 1; $adjustment->revenue_schedule_type = 'at_invoice'; + $adjustment->custom_fields[] = new Recurly_CustomField('size', 'small'); $purchase->adjustments[] = $adjustment; @@ -63,7 +64,7 @@ public function testXml() { $purchase = $this->mockPurchase(); $this->assertEquals( - "\naba9209a-aa61-4790-8e61-0a2692435fee7z6furn4jvb9
123 Main St.San FranciscoCA94110US555-555-5555
1234abcd
USD10001at_invoiceabcd123automaticUSDCustomer NotesTerms and ConditionsVAT Reverse Charge Notes400 Dolores StSan FranciscoCA94110USHomeDoloresDu MondeaBcD1234moto
\n", + "\naba9209a-aa61-4790-8e61-0a2692435fee7z6furn4jvb9
123 Main St.San FranciscoCA94110US555-555-5555
1234abcd
USD10001at_invoiceabcd123sizesmallautomaticUSDCustomer NotesTerms and ConditionsVAT Reverse Charge Notes400 Dolores StSan FranciscoCA94110USHomeDoloresDu MondeaBcD1234moto
\n", $purchase->xml() ); } diff --git a/Tests/fixtures/adjustments/show-200.xml b/Tests/fixtures/adjustments/show-200.xml index 78cae3a2..b509ac53 100644 --- a/Tests/fixtures/adjustments/show-200.xml +++ b/Tests/fixtures/adjustments/show-200.xml @@ -12,6 +12,12 @@ Content-Type: application/xml; charset=utf-8 $12 Annual Subscription + + + size + small + + plan 1200 1 diff --git a/Tests/fixtures/purchases/authorize-200.xml b/Tests/fixtures/purchases/authorize-200.xml index ca2b8699..7f01701e 100644 --- a/Tests/fixtures/purchases/authorize-200.xml +++ b/Tests/fixtures/purchases/authorize-200.xml @@ -58,6 +58,12 @@ Location: https://api.recurly.com/v2/invoices at_invoice + + + size + small + + diff --git a/Tests/fixtures/purchases/cancel-200.xml b/Tests/fixtures/purchases/cancel-200.xml index d0159979..f8bbce00 100644 --- a/Tests/fixtures/purchases/cancel-200.xml +++ b/Tests/fixtures/purchases/cancel-200.xml @@ -58,6 +58,12 @@ Location: https://api.recurly.com/v2/invoices at_invoice + + + size + small + + diff --git a/Tests/fixtures/purchases/capture-200.xml b/Tests/fixtures/purchases/capture-200.xml index e59dfdeb..285fc16e 100644 --- a/Tests/fixtures/purchases/capture-200.xml +++ b/Tests/fixtures/purchases/capture-200.xml @@ -58,6 +58,12 @@ Location: https://api.recurly.com/v2/invoices at_invoice + + + size + small + + diff --git a/Tests/fixtures/purchases/create-201.xml b/Tests/fixtures/purchases/create-201.xml index ab7db846..2de95487 100644 --- a/Tests/fixtures/purchases/create-201.xml +++ b/Tests/fixtures/purchases/create-201.xml @@ -70,6 +70,12 @@ Location: https://api.recurly.com/v2/invoices/3704 US Home + + + size + small + + diff --git a/Tests/fixtures/purchases/pending-200.xml b/Tests/fixtures/purchases/pending-200.xml index cd9e9114..70dc5ef3 100644 --- a/Tests/fixtures/purchases/pending-200.xml +++ b/Tests/fixtures/purchases/pending-200.xml @@ -58,6 +58,12 @@ Location: https://api.recurly.com/v2/invoices at_invoice + + + size + small + + diff --git a/Tests/fixtures/purchases/preview-200.xml b/Tests/fixtures/purchases/preview-200.xml index cd9e9114..70dc5ef3 100644 --- a/Tests/fixtures/purchases/preview-200.xml +++ b/Tests/fixtures/purchases/preview-200.xml @@ -58,6 +58,12 @@ Location: https://api.recurly.com/v2/invoices at_invoice + + + size + small + + diff --git a/lib/recurly/adjustment.php b/lib/recurly/adjustment.php index 796ed14d..1d9ded80 100644 --- a/lib/recurly/adjustment.php +++ b/lib/recurly/adjustment.php @@ -38,9 +38,15 @@ * @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. + * @property Recurly_CustomFieldList $custom_fields Optional custom fields for the adjustment. */ class Recurly_Adjustment extends Recurly_Resource { + public function __construct($href = null, $client = null) { + parent::__construct($href, $client); + $this->custom_fields = new Recurly_CustomFieldList(); + } + public static function get($adjustment_uuid, $client = null) { return Recurly_Base::_get(self::_safeUri(Recurly_Client::PATH_ADJUSTMENTS, $adjustment_uuid), $client); } @@ -122,7 +128,7 @@ 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' + 'shipping_address', 'shipping_address_id', 'item_code', 'external_sku', 'custom_fields' ); } }