Example #1
0
 public function testListInvoices()
 {
     $request = new ListRequest();
     $request->setLimit(1);
     $invoices = $this->invoices->listInvoices($request);
     $this->assertInstanceOf('Stripe\\Response\\Invoices\\ListInvoicesResponse', $invoices);
     $this->assertEquals(1, sizeof($invoices->getData()));
 }
 public function testListCoupons()
 {
     $request = new ListRequest();
     $request->setLimit(1);
     $listResponse = $this->coupons->listCoupons($request);
     $this->assertInstanceOf(Coupons::LIST_COUPONS_RESPONSE_CLASS, $listResponse);
     $this->assertEquals(1, sizeof($listResponse->getData()));
 }
Example #3
0
 public function testListPlans()
 {
     $this->createPlan();
     $this->createPlan();
     $this->createPlan();
     $request = new ListRequest();
     $request->setLimit(2);
     $plans = $this->plans->listPlans($request);
     $this->assertInstanceOf(Plans::LIST_PLANS_RESPONSE_CLASS, $plans);
     $this->assertEquals(2, sizeof($plans->getData()));
 }
Example #4
0
 public function testListCoupons()
 {
     $duration = 'once';
     $percentOff = 50;
     $request = $this->coupons->createCouponRequest($duration)->setPercentOff($percentOff);
     $createResponse = $this->coupons->createCoupon($request);
     $request = new ListRequest();
     $request->setLimit(1);
     $listResponse = $this->coupons->listCoupons($request);
     $this->assertInstanceOf(Coupons::LIST_COUPONS_RESPONSE_CLASS, $listResponse);
     $this->assertEquals(1, sizeof($listResponse->getData()));
     $this->client->delete('coupons/' . $createResponse->getId());
 }
 public function testListCustomers()
 {
     $customer1 = $this->customers->createCustomer();
     $customer2 = $this->customers->createCustomer();
     $this->customers->createCustomer();
     $this->customers->createCustomer();
     $request = new ListRequest();
     $request->setLimit(2);
     $list = $this->customers->listCustomers($request);
     $this->assertInstanceOf(Customers::LIST_CUSTOMERS_RESPONSE_CLASS, $list);
     $this->assertEquals(2, sizeof($list->getData()));
     $this->customers->deleteCustomer($customer1->getId());
     $this->customers->deleteCustomer($customer2->getId());
 }
Example #6
0
 public function testListAccounts()
 {
     $request = $this->accounts->createAccountRequest();
     $request->setEmail("bob" . $this->randomString() . "@loblaw.com");
     $request->setManaged(true);
     $account1 = $this->accounts->createAccount($request);
     $account2 = $this->accounts->createAccount($request);
     $account3 = $this->accounts->createAccount($request);
     $request = new ListRequest();
     $request->setLimit(2);
     $list = $this->accounts->listConnectedAccounts($request);
     $this->assertInstanceOf(Accounts::LIST_ACCOUNT_RESPONSE_CLASS, $list);
     $this->assertEquals(2, sizeof($list->getData()));
     $this->accounts->deleteConnectedAccount($account1->getId());
     $this->accounts->deleteConnectedAccount($account2->getId());
     $this->accounts->deleteConnectedAccount($account3->getId());
 }
 public function testListCharges()
 {
     $request = new ListRequest();
     $request->setLimit(1);
     $listResponse = $this->charges->listCharges($request);
     $this->assertInstanceOf(Charges::LIST_CHARGES_RESPONSE_CLASS, $listResponse);
     $this->assertEquals(1, sizeof($listResponse->getData()));
     foreach ($listResponse->getData() as $charge) {
         $this->assertInstanceOf(Charges::CHARGE_RESPONSE_CLASS, $charge);
     }
 }
 public function testListSubscriptions()
 {
     $request = new CreateSubscriptionRequest($this->planId);
     $request->setCard(new CreateCardRequest(self::VISA_1, 1, 2020, 123));
     $this->subscriptions->createSubscription($this->customerId, $request);
     $this->subscriptions->createSubscription($this->customerId, $request);
     $this->subscriptions->createSubscription($this->customerId, $request);
     $listRequest = new ListRequest();
     $listRequest->setLimit(2);
     $listResponse = $this->subscriptions->listSubscriptions($this->customerId, $listRequest);
     $this->assertInstanceOf(Subscriptions::LIST_SUBSCRIPTIONS_RESPONSE_CLASS, $listResponse);
     $this->assertEquals(2, sizeof($listResponse->getData()));
     foreach ($listResponse->getData() as $data) {
         $this->assertInstanceOf(Subscriptions::SUBSCRIPTION_RESPONSE_CLASS, $data);
     }
 }
Example #9
0
 public function testListCards()
 {
     $request = new ListRequest();
     $request->setLimit(1);
     $this->cards->createCard($this->customerId, new CreateCardRequest(self::VISA_1, 1, 2020, 123));
     $this->cards->createCard($this->customerId, new CreateCardRequest(self::MASTERCARD_1, 2, 2020, 123));
     $cards = $this->cards->listCards($this->customerId, $request);
     $this->assertInstanceOf(Cards::LIST_CARDS_RESPONSE_CLASS, $cards);
     $this->assertEquals(1, sizeof($cards->getData()));
     foreach ($cards->getData() as $card) {
         $this->assertInstanceOf('Stripe\\Response\\Cards\\CardResponse', $card);
     }
 }