diff --git a/Tests/Recurly/PerformanceObligation_List_Test.php b/Tests/Recurly/PerformanceObligation_List_Test.php new file mode 100644 index 00000000..969d5c86 --- /dev/null +++ b/Tests/Recurly/PerformanceObligation_List_Test.php @@ -0,0 +1,20 @@ +client->addResponse( + 'GET', + '/performance_obligations', + 'performance_obligations/list-200.xml' + ); + + $performance_obligations = Recurly_PerformanceObligationList::get(null, $this->client); + $this->assertInstanceOf('Recurly_PerformanceObligationList', $performance_obligations); + + $performance_obligation = $performance_obligations->current(); + $this->assertInstanceOf('Recurly_PerformanceObligation', $performance_obligation); + + $this->assertEquals(iterator_count($performance_obligations), 3); + } +} diff --git a/Tests/Recurly/PerformanceObligation_Test.php b/Tests/Recurly/PerformanceObligation_Test.php new file mode 100644 index 00000000..446c36bc --- /dev/null +++ b/Tests/Recurly/PerformanceObligation_Test.php @@ -0,0 +1,19 @@ +client); + + $this->assertInstanceOf('Recurly_PerformanceObligation', $pob); + $this->assertEquals('Over Time (Daily)', $pob->name); + $this->assertEquals('6', $pob->id); + $this->assertInstanceOf('DateTime', $pob->created_at); + } +} diff --git a/Tests/fixtures/performance_obligations/list-200.xml b/Tests/fixtures/performance_obligations/list-200.xml new file mode 100644 index 00000000..258eb06a --- /dev/null +++ b/Tests/fixtures/performance_obligations/list-200.xml @@ -0,0 +1,24 @@ +HTTP/1.1 200 OK +Content-Type: application/xml; charset=utf-8 + + + + + 6 + Over Time (Daily) + 2023-08-11T18:57:57Z + 2023-08-11T18:57:57Z + + + 5 + Over Time (Partial Monthly) + 2023-08-11T18:57:57Z + 2023-08-11T18:57:57Z + + + 4 + Point in Time + 2023-08-11T18:57:57Z + 2023-08-11T18:57:57Z + + \ No newline at end of file diff --git a/Tests/fixtures/performance_obligations/show-200.xml b/Tests/fixtures/performance_obligations/show-200.xml new file mode 100644 index 00000000..73af9fa1 --- /dev/null +++ b/Tests/fixtures/performance_obligations/show-200.xml @@ -0,0 +1,10 @@ +HTTP/1.1 200 OK +Content-Type: application/xml; charset=utf-8 + + + + 6 + Over Time (Daily) + 2023-08-11T18:57:57Z + 2023-08-11T18:57:57Z + \ No newline at end of file diff --git a/lib/recurly.php b/lib/recurly.php index 4e429fe7..60d37841 100644 --- a/lib/recurly.php +++ b/lib/recurly.php @@ -77,6 +77,8 @@ require_once(__DIR__ . '/recurly/note.php'); require_once(__DIR__ . '/recurly/note_list.php'); require_once(__DIR__ . '/recurly/percentage_tier.php'); +require_once(__DIR__ . '/recurly/performance_obligation.php'); +require_once(__DIR__ . '/recurly/performance_obligation_list.php'); require_once(__DIR__ . '/recurly/plan.php'); require_once(__DIR__ . '/recurly/plan_list.php'); require_once(__DIR__ . '/recurly/ramp_interval.php'); diff --git a/lib/recurly/client.php b/lib/recurly/client.php index bd499fa9..a162bcff 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -94,6 +94,7 @@ class Recurly_Client const PATH_EXTERNAL_ACCOUNTS = 'external_accounts'; const PATH_BUSINESS_ENTITIES = 'business_entities'; const PATH_GENERAL_LEDGER_ACCOUNTS = 'general_ledger_accounts'; + const PATH_PERFORMANCE_OBLIGATIONS = 'performance_obligations'; /** * Create a new Recurly Client diff --git a/lib/recurly/performance_obligation.php b/lib/recurly/performance_obligation.php new file mode 100644 index 00000000..766ec85b --- /dev/null +++ b/lib/recurly/performance_obligation.php @@ -0,0 +1,34 @@ + 'Recurly_MeasuredUnitList', 'note' => 'Recurly_Note', 'notes' => 'Recurly_NoteList', + 'performance_obligation' => 'Recurly_PerformanceObligation', + 'performance_obligations' => 'Recurly_PerformanceObligationList', 'plan' => 'Recurly_Plan', 'plans' => 'Recurly_PlanList', 'plan_code' => 'string',