getItems() public method

List of items.
public getItems ( ) : Item[]
return Item[]
コード例 #1
0
 /**
  * Create the Payment request and process
  * @return null|string The approval url to which the user has to be redirected
  */
 public function createPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod("paypal");
     $this->validateData();
     if (!is_null($this->details)) {
         $this->getAmount()->setDetails($this->details);
     }
     $transaction = new Transaction();
     $transaction->setAmount($this->getAmount())->setDescription($this->getDescription())->setInvoiceNumber($this->getInvoiceNumber());
     if (count($this->itemList->getItems())) {
         $transaction->setItemList($this->itemList);
     }
     $redirectUrls = new RedirectUrls();
     $redirectUrls->setReturnUrl($this->getSuccessUrl(self::paymentMethod))->setCancelUrl($this->getCancelUrl(self::paymentMethod));
     $payment = new Payment();
     $payment->setIntent(self::ACTION)->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions(array($transaction));
     try {
         $payment->create($this->getApiContext($this->clientId, $this->clientSecret));
     } catch (\Exception $ex) {
         $this->container->get('logger')->error($ex);
         return null;
     }
     $approvalUrl = $payment->getApprovalLink();
     return $approvalUrl;
 }
コード例 #2
0
 public function testRemoveItemMethod()
 {
     $itemList = new ItemList();
     $item1 = ItemTest::createItem();
     $item1->setName("Name1");
     $item2 = ItemTest::createItem();
     $itemList->addItem($item1);
     $itemList->addItem($item2);
     $itemList->removeItem($item2);
     $this->assertEquals(sizeof($itemList->getItems()), 1);
     $remainingElements = $itemList->getItems();
     $this->assertEquals($remainingElements[0]->getName(), "Name1");
 }
コード例 #3
0
ファイル: ItemListTest.php プロジェクト: bontiv/intrateb
 /**
  * @depends testSerializationDeserialization
  * @param ItemList $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getItems(), ItemTest::getObject());
     $this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
     $this->assertEquals($obj->getShippingMethod(), "TestSample");
     $this->assertEquals($obj->getShippingPhoneNumber(), "TestSample");
 }