public function testSerializeDeserialize()
 {
     $c1 = $this->cards['full'];
     $json = $c1->toJson();
     $c2 = new CreditCard();
     $c2->fromJson($json);
     $this->assertEquals($c1, $c2);
 }
Пример #2
0
 public static function get($creditCardId, $apiContext = null)
 {
     if ($creditCardId == null || strlen($creditCardId) <= 0) {
         throw new \InvalidArgumentException("creditCardId 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/vault/credit-card/{$creditCardId}", "GET", $payLoad);
     $ret = new CreditCard();
     $ret->fromJson($json);
     return $ret;
 }
Пример #3
0
 /**
  * Obtain the Credit Card resource for the given identifier.
  *
  * @param string         $creditCardId
  * @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 CreditCard
  */
 public static function get($creditCardId, $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($creditCardId, 'creditCardId');
     $payLoad = "";
     $json = self::executeCall("/v1/vault/credit-cards/{$creditCardId}", "GET", $payLoad, null, $apiContext, $restCall);
     $ret = new CreditCard();
     $ret->fromJson($json);
     return $ret;
 }
Пример #4
0
 /**
  * @path /v1/vault/credit-card/:credit-card-id
  * @method GET
  * @param string $creditcardid	  	 
  */
 public static function get($creditcardid)
 {
     if ($creditcardid == null || strlen($creditcardid) <= 0) {
         throw new \InvalidArgumentException("creditcardid cannot be null or empty");
     }
     $payLoad = "";
     $apiContext = new ApiContext(self::$credential);
     $call = new Call();
     $json = $call->execute("/v1/vault/credit-card/{$creditcardid}", "GET", $payLoad, $apiContext);
     $ret = new CreditCard();
     $ret->fromJson($json);
     return $ret;
 }