Exemple #1
0
 /**
  * @depends testSerializationDeserialization
  * @param Plan $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getId(), "TestSample");
     $this->assertEquals($obj->getName(), "TestSample");
     $this->assertEquals($obj->getDescription(), "TestSample");
     $this->assertEquals($obj->getType(), "TestSample");
     $this->assertEquals($obj->getState(), "TestSample");
     $this->assertEquals($obj->getCreateTime(), "TestSample");
     $this->assertEquals($obj->getUpdateTime(), "TestSample");
     $this->assertEquals($obj->getPaymentDefinitions(), PaymentDefinitionTest::getObject());
     $this->assertEquals($obj->getTerms(), TermsTest::getObject());
     $this->assertEquals($obj->getMerchantPreferences(), MerchantPreferencesTest::getObject());
     $this->assertEquals($obj->getLinks(), LinksTest::getObject());
 }
Exemple #2
0
    /**
     * @param $createdPlan
     * @return Plan
     */
    function activate(Plan $createdPlan)
    {
        $patch = new Patch();
        $value = new PayPalModel('{
	       "state":"ACTIVE"
	     }');
        $patch->setOp('replace')->setPath('/')->setValue($value);
        $patchRequest = new PatchRequest();
        $patchRequest->addPatch($patch);
        $createdPlan->update($patchRequest, $this->getAdapter()->getApiContext());
        $result = Plan::get($createdPlan->getId(), $this->getAdapter()->getApiContext());
        if ($result) {
            return ['plan' => $result, 'id' => $result->getId(), 'state' => $result->getState(), 'created' => $result->getCreateTime()];
        }
    }