Example #1
0
 /**
  * List payments in any state (created, approved, failed, etc.). Payments returned are the payments made to the merchant issuing the request.
  *
  * @param array          $params
  * @param ApiContext     $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param PayPalRestCall $restCall   is the Rest Call Service that is used to make rest calls
  * @return PaymentHistory
  */
 public static function all($params, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($params, 'params');
     $payLoad = "";
     $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1);
     $json = self::executeCall("/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
     $ret = new PaymentHistory();
     $ret->fromJson($json);
     return $ret;
 }
Example #2
0
 /**
  * All
  *
  * @param array                        $params
  * @param \PayPal\Rest\ApiContext|null $apiContext
  *
  * @return PaymentHistory
  * @throws \InvalidArgumentException
  */
 public static function all($params, $apiContext = null)
 {
     if ($params == null) {
         throw new \InvalidArgumentException("params cannot be null or empty");
     }
     $payLoad = "";
     $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1);
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new PPRestCall($apiContext);
     $json = $call->execute(array('PayPal\\Rest\\RestHandler'), "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad);
     $ret = new PaymentHistory();
     $ret->fromJson($json);
     return $ret;
 }
 public function testSerializeDeserialize()
 {
     $history = new PaymentHistory();
     $history->fromJson($this->history->toJSON());
     $this->assertEquals($history, $this->history);
 }
Example #4
0
 /**
  * @path /v1/payments/payment
  * @method GET
  * @param array $params
  *			array containing the query strings with the 
  *			following values as keys:
  *			count,
  *			start_id,
  *			start_index,
  *			start_time,
  *			end_time,
  *			payee_id,
  *			sort_by,
  *			sort_order,
  *			All other keys in the map are ignored by the SDK	  	 
  */
 public static function all($params)
 {
     $payLoad = "";
     $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1);
     $apiContext = new ApiContext(self::$credential);
     $call = new Call();
     $json = $call->execute("/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, $apiContext);
     $ret = new PaymentHistory();
     $ret->fromJson($json);
     return $ret;
 }