コード例 #1
0
ファイル: CaptureTest.php プロジェクト: Lucerin/Yii-projects
 public function testSerializeDeserialize()
 {
     $c1 = $this->captures['partial'];
     $c2 = new Capture();
     $c2->fromJson($c1->toJson());
     $this->assertEquals($c1, $c2);
 }
コード例 #2
0
ファイル: Order.php プロジェクト: r8filipe/LAPR
 /**
  * Capture a payment. In addition, include the amount of the payment and indicate whether this is a final capture for the given authorization in the body of the request JSON.
  *
  * @param Capture        $capture
  * @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 Capture
  */
 public function capture($capture, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($this->getId(), "Id");
     ArgumentValidator::validate($capture, 'capture');
     $payLoad = $capture->toJSON();
     $json = self::executeCall("/v1/payments/orders/{$this->getId()}/capture", "POST", $payLoad, null, $apiContext, $restCall);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }
コード例 #3
0
ファイル: Capture.php プロジェクト: fengyeno/fille
 /**
  * Retrieve details about a captured payment by passing the capture_id in the request URI.
  *
  * @param string $captureId
  * @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 Capture
  */
 public static function get($captureId, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($captureId, 'captureId');
     $payLoad = "";
     $json = self::executeCall("/v1/payments/capture/{$captureId}", "GET", $payLoad, null, $apiContext, $restCall);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }
コード例 #4
0
ファイル: Capture.php プロジェクト: ewwgit/eptri
 /**
  * Get
  *
  * @param int                          $captureId
  * @param \PayPal\Rest\ApiContext|null $apiContext
  *
  * @return Capture
  * @throws \InvalidArgumentException
  */
 public static function get($captureId, $apiContext = null)
 {
     if ($captureId == null || strlen($captureId) <= 0) {
         throw new \InvalidArgumentException("captureId cannot be null or empty");
     }
     $payLoad = "";
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new PPRestCall($apiContext);
     $json = $call->execute(array('PayPal\\Rest\\RestHandler'), "/v1/payments/capture/{$captureId}", "GET", $payLoad);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }
コード例 #5
0
 /**
  * Creates (and processes) a new Capture Transaction added as a related resource.
  *
  * @param Capture $capture
  * @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @return Capture
  */
 public function capture($capture, $apiContext = null)
 {
     ArgumentValidator::validate($this->getId(), "Id");
     ArgumentValidator::validate($capture, 'capture');
     $payLoad = $capture->toJSON();
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new PayPalRestCall($apiContext);
     $json = $call->execute(array('PayPal\\Handler\\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }
コード例 #6
0
 /**
  * Capture
  *
  * @param \Paypal\Api\Capture          $capture
  * @param \PayPal\Rest\ApiContext|null $apiContext
  *
  * @return Capture
  * @throws \InvalidArgumentException
  */
 public function capture($capture, $apiContext = null)
 {
     if ($this->getId() == null) {
         throw new \InvalidArgumentException("Id cannot be null");
     }
     if ($capture == null) {
         throw new \InvalidArgumentException("capture cannot be null or empty");
     }
     $payLoad = $capture->toJSON();
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new PPRestCall($apiContext);
     $json = $call->execute(array('PayPal\\Rest\\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }
コード例 #7
0
ファイル: Capture.php プロジェクト: johnmicahmiguel/yodaphp
 /**
  * Obtain the Capture transaction resource for the given identifier.
  *
  * @param string $captureId
  * @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @return Capture
  */
 public static function get($captureId, $apiContext = null)
 {
     ArgumentValidator::validate($captureId, 'captureId');
     $payLoad = "";
     if ($apiContext == null) {
         $apiContext = new ApiContext(self::$credential);
     }
     $call = new PayPalRestCall($apiContext);
     $json = $call->execute(array('PayPal\\Handler\\RestHandler'), "/v1/payments/capture/{$captureId}", "GET", $payLoad);
     $ret = new Capture();
     $ret->fromJson($json);
     return $ret;
 }