Esempio n. 1
0
 function testResponseToListConversion()
 {
     $list = new ChargeBee_ListResult(ChargeBee_SampleData::listSubscriptions(), NULL);
     $this->assertEqual($list->count(), 2);
     foreach ($list as $l) {
         $this->assertEqual($l->subscription()->id, "sample_subscription");
     }
 }
 function testWebhookSerializing()
 {
     $event = ChargeBee_Event::deserialize(ChargeBee_SampleData::webhookData());
     $content = $event->content();
     $this->assertNotEqual($content->customer(), null);
     $this->assertNotEqual($content->subscription(), null);
     $this->assertNotEqual($content->card(), null);
     $this->assertNotEqual($content->invoice(), null);
 }
 function testParamError()
 {
     $respJson = null;
     try {
         $respJson = ChargeBee_Curl::processResponse(ChargeBee_SampleData::sampleParamError(), 400);
     } catch (ChargeBee_APIError $e) {
         $this->assertEqual($e->getMessage(), 'param card[gateway] cannot be blank');
     }
 }
 function testEventResponseToObjectConversion()
 {
     $result = new ChargeBee_Result(ChargeBee_SampleData::sampleEvent());
     $event = $result->event();
     $content = $event->content();
     $s = $content->subscription();
     $this->assertEqual($s->id, "unpaid_cancelled");
     $c = $content->customer();
     $this->assertEqual($c->email, "*****@*****.**");
     $card = $content->card();
     $this->assertEqual($card->cardType, "visa");
 }