useTransaction(TRUE); $this->ids['contact'][0] = $this->individualCreate(); $this->params = array( 'contact_id' => $this->ids['contact'][0], 'installments' => '12', 'frequency_interval' => '1', 'amount' => '500', 'contribution_status_id' => 1, 'start_date' => '2012-01-01 00:00:00', 'currency' => 'USD', 'frequency_unit' => 'day', ); } public function testCreateContributionRecur() { $result = $this->callAPIAndDocument($this->_entity, 'create', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $this->assertNotNull($result['values'][$result['id']]['id']); $this->getAndCheck($this->params, $result['id'], $this->_entity); } public function testGetContributionRecur() { $this->callAPISuccess($this->_entity, 'create', $this->params); $getParams = array( 'amount' => '500', ); $result = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); } public function testCreateContributionRecurWithToken() { // create token $this->createLoggedInUser(); $token = $this->callAPISuccess('PaymentToken', 'create', array( 'payment_processor_id' => $this->processorCreate(), 'token' => 'hhh', 'contact_id' => $this->individualCreate(), )); $params['payment_token_id'] = $token['id']; $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $this->assertEquals(1, $result['count']); $this->assertNotNull($result['values'][$result['id']]['id']); $this->getAndCheck($this->params, $result['id'], $this->_entity); } public function testDeleteContributionRecur() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => $result['id']); $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count']); } public function testGetFieldsContributionRecur() { $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create')); $this->assertEquals(12, $result['values']['start_date']['type']); } }