示例#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()));
 }
示例#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
 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());
 }
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->type)) {
         $params["type"] = $this->type;
     }
     return $params;
 }
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->customer)) {
         $params["customer"] = $this->customer;
     }
     return $params;
 }
 /**
  * @return array
  */
 public function toParams()
 {
     $params = parent::toParams();
     if (!is_null($this->charge)) {
         $params["charge"] = $this->charge;
     }
     return $params;
 }
 /**
  * @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;
 }
 /**
  * @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
 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);
     }
 }
 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);
     }
 }
 /**
  * @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);
     }
 }