Example #1
0
 public function testExecuteWithDefaultCredentials()
 {
     $data = '"request":"test message"';
     $call = new Call();
     $ret = $call->execute('/v1/payments/echo', "POST", $data);
     $this->assertEquals($data, $ret);
 }
Example #2
0
 /**
  * @path /v1/payments/payment/:payment-id/execute
  * @method POST
  * @param PaymentExecution $payment_execution	  
  * @param PayPal\Rest\ApiContext $apiContext optional	  	 
  */
 public function execute($payment_execution, $apiContext = null)
 {
     if ($payment_execution == null) {
         throw new \InvalidArgumentException("payment_execution cannot be null");
     }
     if ($this->getId() == null) {
         throw new \InvalidArgumentException("Id cannot be null");
     }
     $payLoad = $payment_execution->toJSON();
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new Call();
     $json = $call->execute("/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad, $apiContext);
     $this->fromJson($json);
     return $this;
 }
Example #3
0
 /**
  * @path /v1/payments/refund/:refund-id
  * @method GET
  * @param string $refundid	  	 
  */
 public static function get($refundid)
 {
     if ($refundid == null || strlen($refundid) <= 0) {
         throw new \InvalidArgumentException("refundid cannot be null or empty");
     }
     $payLoad = "";
     $apiContext = new ApiContext(self::$credential);
     $call = new Call();
     $json = $call->execute("/v1/payments/refund/{$refundid}", "GET", $payLoad, $apiContext);
     $ret = new Refund();
     $ret->fromJson($json);
     return $ret;
 }