Ejemplo n.º 1
0
 public function testSerializeDeserialize()
 {
     $s1 = $this->sale;
     $s2 = new Sale();
     $s2->fromJson($s1->toJson());
     $this->assertEquals($s1, $s2);
 }
Ejemplo n.º 2
0
 /**
  * Get
  *
  * @param int                          $saleId
  * @param \PayPal\Rest\ApiContext|null $apiContext
  *
  * @return Sale
  * @throws \InvalidArgumentException
  */
 public static function get($saleId, $apiContext = null)
 {
     if ($saleId == null || strlen($saleId) <= 0) {
         throw new \InvalidArgumentException("saleId 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/sale/{$saleId}", "GET", $payLoad);
     $ret = new Sale();
     $ret->fromJson($json);
     return $ret;
 }
Ejemplo n.º 3
0
 /**
  * Obtain the Sale transaction resource for the given identifier.
  *
  * @param string $saleId
  * @param \PayPal\Rest\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 Sale
  */
 public static function get($saleId, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($saleId, 'saleId');
     $payLoad = "";
     $json = self::executeCall("/v1/payments/sale/{$saleId}", "GET", $payLoad, null, $apiContext, $restCall);
     $ret = new Sale();
     $ret->fromJson($json);
     return $ret;
 }
Ejemplo n.º 4
0
 /**
  * @path /v1/payments/sale/:sale-id
  * @method GET
  * @param string $saleid	  	 
  */
 public static function get($saleid)
 {
     if ($saleid == null || strlen($saleid) <= 0) {
         throw new \InvalidArgumentException("saleid cannot be null or empty");
     }
     $payLoad = "";
     $apiContext = new ApiContext(self::$credential);
     $call = new Call();
     $json = $call->execute("/v1/payments/sale/{$saleid}", "GET", $payLoad, $apiContext);
     $ret = new Sale();
     $ret->fromJson($json);
     return $ret;
 }