コード例 #1
0
ファイル: InvoicesTest.php プロジェクト: jlinn/stripe-api-php
 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()));
 }
コード例 #2
0
 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()));
 }
コード例 #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()));
 }
コード例 #4
0
ファイル: CouponsTest.php プロジェクト: jlinn/stripe-api-php
 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());
 }
コード例 #5
0
 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());
 }
コード例 #6
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->type)) {
         $params["type"] = $this->type;
     }
     return $params;
 }
コード例 #7
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->customer)) {
         $params["customer"] = $this->customer;
     }
     return $params;
 }
コード例 #8
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->charge)) {
         $params["charge"] = $this->charge;
     }
     return $params;
 }
コード例 #9
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_nan($this->type)) {
         $params["type"] = $this->type;
     }
     if (!is_null($this->verified)) {
         $params["verified"] = $this->verified;
     }
     return $params;
 }
コード例 #10
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->date)) {
         $params = array_merge($params, $this->date->toParams());
     }
     if (!is_null($this->recipient)) {
         $params["recipient"] = $this->recipient;
     }
     if (!is_null($this->status)) {
         $params["status"] = $this->status;
     }
     return $params;
 }
コード例 #11
0
ファイル: AccountsTest.php プロジェクト: jlinn/stripe-api-php
 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());
 }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
 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);
     }
 }
コード例 #14
0
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->availableOn)) {
         if ($this->availableOn instanceof AvailableOn) {
             $params = array_merge($params, $this->availableOn->toParams());
         } else {
             $params["available_on"] = $this->availableOn;
         }
     }
     if (!is_null($this->currency)) {
         $params["currency"] = $this->currency;
     }
     if (!is_null($this->source)) {
         $params["source"] = $this->source;
     }
     if (!is_null($this->transfer)) {
         $params["transfer"] = $this->transfer;
     }
     if (!is_null($this->type)) {
         $params["type"] = $this->type;
     }
     return $params;
 }
コード例 #15
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);
     }
 }