예제 #1
0
 /**
  * Get the card.
  *
  * @param \OptimalPayments\CustomerVault\Card $card
  * @return bool
  * @throws OptimalException
  * @throws NetbanxException
  */
 public function getCard(CustomerVault\Card $card)
 {
     $card->setRequiredFields(array('profileID', 'id'));
     $card->checkRequiredFields();
     $request = new Request(array('method' => Request::GET, 'uri' => $this->prepareURI("/profiles/" . $card->profileID . "/cards/" . $card->id)));
     $response = $this->client->processRequest($request);
     $response['profileID'] = $card->profileID;
     return new CustomerVault\Card($response);
 }
 /**
  * Go to the next element
  */
 public function next()
 {
     $this->position++;
     if (!$this->valid() && $this->nextPage) {
         $request = new \OptimalPayments\Request($this->nextPage);
         $this->nextPage = null;
         $response = $this->client->processRequest($request);
         $this->parseResponse($response);
     }
 }
 /**
  * Get matching orders
  *
  * @param int $count
  * @return HostedPayment\Order[]
  * @throws OptimalException
  * @throws NetbanxException
  */
 public function getOrders($count = 0)
 {
     $queryStr = array();
     if (!is_int($count) || $count < 0) {
         throw new OptimalException("Invalid count {$count}. Positive integer expected.");
     }
     if ($count) {
         $queryStr['num'] = $count;
     }
     $request = new Request(array('method' => Request::GET, 'uri' => $this->prepareURI("/orders"), 'queryStr' => $queryStr));
     $response = $this->client->processRequest($request);
     return new HostedPayment\Pagerator($this->client, $response, '\\OptimalPayments\\HostedPayment\\Order');
 }
 /**
  * Get matching verifications.
  *
  * @param CardPayments\Verification $verify
  * @param CardPayments\Filter $filter
  * @return CardPayments\Verification[] iterator
  * @throws OptimalException
  * @throws NetbanxException
  */
 public function getVerifications(CardPayments\Verification $verify = null, CardPayments\Filter $filter = null)
 {
     $queryStr = array();
     if ($verify && $verify->merchantRefNum) {
         $queryStr['merchantRefNum'] = $verify->merchantRefNum;
     }
     if ($filter) {
         if (isset($filter->limit)) {
             $queryStr['limit'] = $filter->limit;
         }
         if (isset($filter->offset)) {
             $queryStr['offset'] = $filter->offset;
         }
         if (isset($filter->startDate)) {
             $queryStr['startDate'] = $filter->startDate;
         }
         if (isset($filter->endDate)) {
             $queryStr['endDate'] = $filter->endDate;
         }
     }
     $request = new Request(array('method' => Request::GET, 'uri' => $this->prepareURI("/verifications"), 'queryStr' => $queryStr));
     $response = $this->client->processRequest($request);
     return new CardPayments\Pagerator($this->client, $response, '\\OptimalPayments\\CardPayments\\Verification');
 }