From 50d2c56f8be5efa2349be6c6cac4ff30a9f5f346 Mon Sep 17 00:00:00 2001 From: Ganesh Hegde <1ganesh1@facebook.com> Date: Wed, 29 May 2013 14:37:22 +0530 Subject: [PATCH] Updated stubs to support namespace --- lib/PayPal/Api/Address.php | 19 +++-- lib/PayPal/Api/Amount.php | 3 +- lib/PayPal/Api/Authorization.php | 48 +++++++---- lib/PayPal/Api/Capture.php | 44 +++++++--- lib/PayPal/Api/CreditCard.php | 69 ++++++++++----- lib/PayPal/Api/CreditCardHistory.php | 28 +++++-- lib/PayPal/Api/CreditCardToken.php | 35 ++++++-- lib/PayPal/Api/Details.php | 3 +- lib/PayPal/Api/FundingInstrument.php | 19 +++-- lib/PayPal/Api/HyperSchema.php | 55 +----------- lib/PayPal/Api/Item.php | 3 +- lib/PayPal/Api/ItemList.php | 11 ++- lib/PayPal/Api/Links.php | 16 +--- lib/PayPal/Api/Payee.php | 11 ++- lib/PayPal/Api/Payer.php | 28 +++++-- lib/PayPal/Api/PayerInfo.php | 35 ++++++-- lib/PayPal/Api/Payment.php | 40 ++++++--- lib/PayPal/Api/PaymentExecution.php | 11 ++- lib/PayPal/Api/PaymentHistory.php | 11 ++- lib/PayPal/Api/RedirectUrls.php | 19 +++-- lib/PayPal/Api/Refund.php | 41 ++++++--- lib/PayPal/Api/RelatedResources.php | 3 +- lib/PayPal/Api/Sale.php | 36 +++++--- lib/PayPal/Api/ShippingAddress.php | 9 +- lib/PayPal/Api/Transaction.php | 20 +++-- lib/PayPal/Api/Transactions.php | 3 +- lib/PayPal/Auth/OAuthTokenCredential.php | 24 +++--- lib/PayPal/Rest/ApiContext.php | 3 +- lib/PayPal/Rest/RestHandler.php | 25 ++++-- .../Test/Auth/OAuthTokenCredentialTest.php | 9 +- tests/PayPal/Test/Common/ArrayClass.php | 29 +++++++ tests/PayPal/Test/Common/ArrayUtilTest.php | 6 +- tests/PayPal/Test/Common/ChildClass.php | 6 ++ tests/PayPal/Test/Common/ModelTest.php | 84 ++----------------- tests/PayPal/Test/Common/NestedClass.php | 27 ++++++ tests/PayPal/Test/Common/SimpleClass.php | 19 +++++ tests/PayPal/Test/Common/UserAgentTest.php | 2 +- 37 files changed, 530 insertions(+), 324 deletions(-) create mode 100644 tests/PayPal/Test/Common/ArrayClass.php create mode 100644 tests/PayPal/Test/Common/ChildClass.php create mode 100644 tests/PayPal/Test/Common/NestedClass.php create mode 100644 tests/PayPal/Test/Common/SimpleClass.php diff --git a/lib/PayPal/Api/Address.php b/lib/PayPal/Api/Address.php index 46129a1..fa9300e 100644 --- a/lib/PayPal/Api/Address.php +++ b/lib/PayPal/Api/Address.php @@ -1,8 +1,9 @@ country_code = $country_code; return $this; } /** - * Deprecated method + * 2 letter country code. + * @return string + * @deprecated. Instead use getCountryCode */ public function getCountry_code() { return $this->country_code; @@ -106,14 +111,18 @@ class Address extends \PPModel { } /** - * Deprecated method + * Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code. + * @param string $postal_code + * @deprecated. Instead use setPostalCode */ public function setPostal_code($postal_code) { $this->postal_code = $postal_code; return $this; } /** - * Deprecated method + * Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code. + * @return string + * @deprecated. Instead use getPostalCode */ public function getPostal_code() { return $this->postal_code; diff --git a/lib/PayPal/Api/Amount.php b/lib/PayPal/Api/Amount.php index 8618690..8c7cfe2 100644 --- a/lib/PayPal/Api/Amount.php +++ b/lib/PayPal/Api/Amount.php @@ -1,8 +1,9 @@ create_time = $create_time; return $this; } /** - * Deprecated method + * Time the resource was created. + * @return string + * @deprecated. Instead use getCreateTime */ public function getCreate_time() { return $this->create_time; @@ -84,14 +92,18 @@ class Authorization extends \PPModel implements IResource { } /** - * Deprecated method + * Time the resource was last updated. + * @param string $update_time + * @deprecated. Instead use setUpdateTime */ public function setUpdate_time($update_time) { $this->update_time = $update_time; return $this; } /** - * Deprecated method + * Time the resource was last updated. + * @return string + * @deprecated. Instead use getUpdateTime */ public function getUpdate_time() { return $this->update_time; @@ -151,14 +163,18 @@ class Authorization extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + * @deprecated. Instead use setParentPayment */ public function setParent_payment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @return string + * @deprecated. Instead use getParentPayment */ public function getParent_payment() { return $this->parent_payment; @@ -182,14 +198,18 @@ class Authorization extends \PPModel implements IResource { } /** - * Deprecated method + * Date/Time until which funds may be captured against this resource. + * @param string $valid_until + * @deprecated. Instead use setValidUntil */ public function setValid_until($valid_until) { $this->valid_until = $valid_until; return $this; } /** - * Deprecated method + * Date/Time until which funds may be captured against this resource. + * @return string + * @deprecated. Instead use getValidUntil */ public function getValid_until() { return $this->valid_until; @@ -223,7 +243,7 @@ class Authorization extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/$authorizationId", "GET", $payLoad); $ret = new Authorization(); $ret->fromJson($json); @@ -241,7 +261,7 @@ class Authorization extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $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); @@ -256,7 +276,7 @@ class Authorization extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/void", "POST", $payLoad); $ret = new Authorization(); $ret->fromJson($json); @@ -271,7 +291,7 @@ class Authorization extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad); $this->fromJson($json); return $this; diff --git a/lib/PayPal/Api/Capture.php b/lib/PayPal/Api/Capture.php index 038a310..773f952 100644 --- a/lib/PayPal/Api/Capture.php +++ b/lib/PayPal/Api/Capture.php @@ -1,17 +1,21 @@ create_time = $create_time; return $this; } /** - * Deprecated method + * Time the resource was created. + * @return string + * @deprecated. Instead use getCreateTime */ public function getCreate_time() { return $this->create_time; @@ -84,14 +92,18 @@ class Capture extends \PPModel implements IResource { } /** - * Deprecated method + * Time the resource was last updated. + * @param string $update_time + * @deprecated. Instead use setUpdateTime */ public function setUpdate_time($update_time) { $this->update_time = $update_time; return $this; } /** - * Deprecated method + * Time the resource was last updated. + * @return string + * @deprecated. Instead use getUpdateTime */ public function getUpdate_time() { return $this->update_time; @@ -133,14 +145,18 @@ class Capture extends \PPModel implements IResource { } /** - * Deprecated method + * whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument. + * @param boolean $is_final_capture + * @deprecated. Instead use setIsFinalCapture */ public function setIs_final_capture($is_final_capture) { $this->is_final_capture = $is_final_capture; return $this; } /** - * Deprecated method + * whether this is a final capture for the given authorization or not. If it's final, all the remaining funds held by the authorization, will be released in the funding instrument. + * @return boolean + * @deprecated. Instead use getIsFinalCapture */ public function getIs_final_capture() { return $this->is_final_capture; @@ -182,14 +198,18 @@ class Capture extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + * @deprecated. Instead use setParentPayment */ public function setParent_payment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @return string + * @deprecated. Instead use getParentPayment */ public function getParent_payment() { return $this->parent_payment; @@ -223,7 +243,7 @@ class Capture extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/$captureId", "GET", $payLoad); $ret = new Capture(); $ret->fromJson($json); @@ -241,7 +261,7 @@ class Capture extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/{$this->getId()}/refund", "POST", $payLoad); $ret = new Refund(); $ret->fromJson($json); diff --git a/lib/PayPal/Api/CreditCard.php b/lib/PayPal/Api/CreditCard.php index b5e7020..7e13b7d 100644 --- a/lib/PayPal/Api/CreditCard.php +++ b/lib/PayPal/Api/CreditCard.php @@ -1,17 +1,20 @@ expire_month = $expire_month; return $this; } /** - * Deprecated method + * card expiry month with value 1 - 12. + * @return integer + * @deprecated. Instead use getExpireMonth */ public function getExpire_month() { return $this->expire_month; @@ -120,14 +127,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * 4 digit card expiry year + * @param integer $expire_year + * @deprecated. Instead use setExpireYear */ public function setExpire_year($expire_year) { $this->expire_year = $expire_year; return $this; } /** - * Deprecated method + * 4 digit card expiry year + * @return integer + * @deprecated. Instead use getExpireYear */ public function getExpire_year() { return $this->expire_year; @@ -169,14 +180,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * Card holder's first name. + * @param string $first_name + * @deprecated. Instead use setFirstName */ public function setFirst_name($first_name) { $this->first_name = $first_name; return $this; } /** - * Deprecated method + * Card holder's first name. + * @return string + * @deprecated. Instead use getFirstName */ public function getFirst_name() { return $this->first_name; @@ -200,14 +215,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * Card holder's last name. + * @param string $last_name + * @deprecated. Instead use setLastName */ public function setLast_name($last_name) { $this->last_name = $last_name; return $this; } /** - * Deprecated method + * Card holder's last name. + * @return string + * @deprecated. Instead use getLastName */ public function getLast_name() { return $this->last_name; @@ -231,14 +250,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * Billing Address associated with this card. + * @param PayPal\Api\Address $billing_address + * @deprecated. Instead use setBillingAddress */ public function setBilling_address($billing_address) { $this->billing_address = $billing_address; return $this; } /** - * Deprecated method + * Billing Address associated with this card. + * @return PayPal\Api\Address + * @deprecated. Instead use getBillingAddress */ public function getBilling_address() { return $this->billing_address; @@ -262,14 +285,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument. + * @param string $payer_id + * @deprecated. Instead use setPayerId */ public function setPayer_id($payer_id) { $this->payer_id = $payer_id; return $this; } /** - * Deprecated method + * A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument. + * @return string + * @deprecated. Instead use getPayerId */ public function getPayer_id() { return $this->payer_id; @@ -311,14 +338,18 @@ class CreditCard extends \PPModel implements IResource { } /** - * Deprecated method + * Date/Time until this resource can be used fund a payment. + * @param string $valid_until + * @deprecated. Instead use setValidUntil */ public function setValid_until($valid_until) { $this->valid_until = $valid_until; return $this; } /** - * Deprecated method + * Date/Time until this resource can be used fund a payment. + * @return string + * @deprecated. Instead use getValidUntil */ public function getValid_until() { return $this->valid_until; @@ -349,7 +380,7 @@ class CreditCard extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad); $this->fromJson($json); return $this; @@ -363,7 +394,7 @@ class CreditCard extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad); $ret = new CreditCard(); $ret->fromJson($json); @@ -378,7 +409,7 @@ class CreditCard extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/{$this->getId()}", "POST", $payLoad); return true; } diff --git a/lib/PayPal/Api/CreditCardHistory.php b/lib/PayPal/Api/CreditCardHistory.php index a7e300d..19607d6 100644 --- a/lib/PayPal/Api/CreditCardHistory.php +++ b/lib/PayPal/Api/CreditCardHistory.php @@ -1,15 +1,16 @@ credit_cards = $credit_cards; + public function setCreditCards($credit-cards) { + $this->credit-cards = $credit-cards; return $this; } @@ -22,14 +23,19 @@ class CreditCardHistory extends \PPModel { } /** - * Deprecated method + * A list of credit card resources + * @array + * @param PayPal\Api\CreditCard $credit-cards + * @deprecated. Instead use setCreditCards */ - public function setCredit_cards($credit_cards) { - $this->credit_cards = $credit_cards; + public function setCredit_cards($credit-cards) { + $this->credit-cards = $credit-cards; return $this; } /** - * Deprecated method + * A list of credit card resources + * @return PayPal\Api\CreditCard + * @deprecated. Instead use getCreditCards */ public function getCredit_cards() { return $this->credit-cards; @@ -71,14 +77,18 @@ class CreditCardHistory extends \PPModel { } /** - * Deprecated method + * Identifier of the next element to get the next range of results. + * @param string $next_id + * @deprecated. Instead use setNextId */ public function setNext_id($next_id) { $this->next_id = $next_id; return $this; } /** - * Deprecated method + * Identifier of the next element to get the next range of results. + * @return string + * @deprecated. Instead use getNextId */ public function getNext_id() { return $this->next_id; diff --git a/lib/PayPal/Api/CreditCardToken.php b/lib/PayPal/Api/CreditCardToken.php index b763302..13430dd 100644 --- a/lib/PayPal/Api/CreditCardToken.php +++ b/lib/PayPal/Api/CreditCardToken.php @@ -1,8 +1,9 @@ credit_card_id = $credit_card_id; return $this; } /** - * Deprecated method + * ID of a previously saved Credit Card resource using /vault/credit-card API. + * @return string + * @deprecated. Instead use getCreditCardId */ public function getCredit_card_id() { return $this->credit_card_id; @@ -52,14 +57,18 @@ class CreditCardToken extends \PPModel { } /** - * Deprecated method + * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. + * @param string $payer_id + * @deprecated. Instead use setPayerId */ public function setPayer_id($payer_id) { $this->payer_id = $payer_id; return $this; } /** - * Deprecated method + * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. + * @return string + * @deprecated. Instead use getPayerId */ public function getPayer_id() { return $this->payer_id; @@ -119,14 +128,18 @@ class CreditCardToken extends \PPModel { } /** - * Deprecated method + * card expiry month from the saved card with value 1 - 12 + * @param integer $expire_month + * @deprecated. Instead use setExpireMonth */ public function setExpire_month($expire_month) { $this->expire_month = $expire_month; return $this; } /** - * Deprecated method + * card expiry month from the saved card with value 1 - 12 + * @return integer + * @deprecated. Instead use getExpireMonth */ public function getExpire_month() { return $this->expire_month; @@ -150,14 +163,18 @@ class CreditCardToken extends \PPModel { } /** - * Deprecated method + * 4 digit card expiry year from the saved card + * @param integer $expire_year + * @deprecated. Instead use setExpireYear */ public function setExpire_year($expire_year) { $this->expire_year = $expire_year; return $this; } /** - * Deprecated method + * 4 digit card expiry year from the saved card + * @return integer + * @deprecated. Instead use getExpireYear */ public function getExpire_year() { return $this->expire_year; diff --git a/lib/PayPal/Api/Details.php b/lib/PayPal/Api/Details.php index 2a18fa1..ab38367 100644 --- a/lib/PayPal/Api/Details.php +++ b/lib/PayPal/Api/Details.php @@ -1,8 +1,9 @@ credit_card = $credit_card; return $this; } /** - * Deprecated method + * Credit Card information. + * @return PayPal\Api\CreditCard + * @deprecated. Instead use getCreditCard */ public function getCredit_card() { return $this->credit_card; @@ -52,14 +57,18 @@ class FundingInstrument extends \PPModel { } /** - * Deprecated method + * Credit Card information. + * @param PayPal\Api\CreditCardToken $credit_card_token + * @deprecated. Instead use setCreditCardToken */ public function setCredit_card_token($credit_card_token) { $this->credit_card_token = $credit_card_token; return $this; } /** - * Deprecated method + * Credit Card information. + * @return PayPal\Api\CreditCardToken + * @deprecated. Instead use getCreditCardToken */ public function getCredit_card_token() { return $this->credit_card_token; diff --git a/lib/PayPal/Api/HyperSchema.php b/lib/PayPal/Api/HyperSchema.php index 661b8a5..a09ee92 100644 --- a/lib/PayPal/Api/HyperSchema.php +++ b/lib/PayPal/Api/HyperSchema.php @@ -1,8 +1,9 @@ fragmentResolution; } - /** - * Deprecated method - */ - public function setFragmentresolution($fragmentResolution) { - $this->fragmentResolution = $fragmentResolution; - return $this; - } - /** - * Deprecated method - */ - public function getFragmentresolution() { - return $this->fragmentResolution; - } /** * @@ -88,19 +76,6 @@ class HyperSchema extends \PPModel { return $this->contentEncoding; } - /** - * Deprecated method - */ - public function setContentencoding($contentEncoding) { - $this->contentEncoding = $contentEncoding; - return $this; - } - /** - * Deprecated method - */ - public function getContentencoding() { - return $this->contentEncoding; - } /** * @@ -119,19 +94,6 @@ class HyperSchema extends \PPModel { return $this->pathStart; } - /** - * Deprecated method - */ - public function setPathstart($pathStart) { - $this->pathStart = $pathStart; - return $this; - } - /** - * Deprecated method - */ - public function getPathstart() { - return $this->pathStart; - } /** * @@ -150,18 +112,5 @@ class HyperSchema extends \PPModel { return $this->mediaType; } - /** - * Deprecated method - */ - public function setMediatype($mediaType) { - $this->mediaType = $mediaType; - return $this; - } - /** - * Deprecated method - */ - public function getMediatype() { - return $this->mediaType; - } } diff --git a/lib/PayPal/Api/Item.php b/lib/PayPal/Api/Item.php index fbd12b9..4a40632 100644 --- a/lib/PayPal/Api/Item.php +++ b/lib/PayPal/Api/Item.php @@ -1,8 +1,9 @@ shipping_address = $shipping_address; return $this; } /** - * Deprecated method + * Shipping address. + * @return PayPal\Api\ShippingAddress + * @deprecated. Instead use getShippingAddress */ public function getShipping_address() { return $this->shipping_address; diff --git a/lib/PayPal/Api/Links.php b/lib/PayPal/Api/Links.php index 927b035..9cbd85e 100644 --- a/lib/PayPal/Api/Links.php +++ b/lib/PayPal/Api/Links.php @@ -1,8 +1,9 @@ targetSchema; } - /** - * Deprecated method - */ - public function setTargetschema($targetSchema) { - $this->targetSchema = $targetSchema; - return $this; - } - /** - * Deprecated method - */ - public function getTargetschema() { - return $this->targetSchema; - } /** * diff --git a/lib/PayPal/Api/Payee.php b/lib/PayPal/Api/Payee.php index 355946d..d0ccea3 100644 --- a/lib/PayPal/Api/Payee.php +++ b/lib/PayPal/Api/Payee.php @@ -1,8 +1,9 @@ merchant_id = $merchant_id; return $this; } /** - * Deprecated method + * Encrypted PayPal Account identifier for the Payee. + * @return string + * @deprecated. Instead use getMerchantId */ public function getMerchant_id() { return $this->merchant_id; diff --git a/lib/PayPal/Api/Payer.php b/lib/PayPal/Api/Payer.php index a0d2f07..d21d238 100644 --- a/lib/PayPal/Api/Payer.php +++ b/lib/PayPal/Api/Payer.php @@ -1,8 +1,9 @@ payment_method = $payment_method; return $this; } /** - * Deprecated method + * Payment method being used - PayPal Wallet payment or Direct Credit card. + * @return string + * @deprecated. Instead use getPaymentMethod */ public function getPayment_method() { return $this->payment_method; @@ -53,14 +58,19 @@ class Payer extends \PPModel { } /** - * Deprecated method + * List of funding instruments from where the funds of the current payment come from. Typically a credit card. + * @array + * @param PayPal\Api\FundingInstrument $funding_instruments + * @deprecated. Instead use setFundingInstruments */ public function setFunding_instruments($funding_instruments) { $this->funding_instruments = $funding_instruments; return $this; } /** - * Deprecated method + * List of funding instruments from where the funds of the current payment come from. Typically a credit card. + * @return PayPal\Api\FundingInstrument + * @deprecated. Instead use getFundingInstruments */ public function getFunding_instruments() { return $this->funding_instruments; @@ -84,14 +94,18 @@ class Payer extends \PPModel { } /** - * Deprecated method + * Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet. + * @param PayPal\Api\PayerInfo $payer_info + * @deprecated. Instead use setPayerInfo */ public function setPayer_info($payer_info) { $this->payer_info = $payer_info; return $this; } /** - * Deprecated method + * Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet. + * @return PayPal\Api\PayerInfo + * @deprecated. Instead use getPayerInfo */ public function getPayer_info() { return $this->payer_info; diff --git a/lib/PayPal/Api/PayerInfo.php b/lib/PayPal/Api/PayerInfo.php index 9a0e06b..a9ff596 100644 --- a/lib/PayPal/Api/PayerInfo.php +++ b/lib/PayPal/Api/PayerInfo.php @@ -1,8 +1,9 @@ first_name = $first_name; return $this; } /** - * Deprecated method + * First Name of the Payer from their PayPal Account. + * @return string + * @deprecated. Instead use getFirstName */ public function getFirst_name() { return $this->first_name; @@ -70,14 +75,18 @@ class PayerInfo extends \PPModel { } /** - * Deprecated method + * Last Name of the Payer from their PayPal Account. + * @param string $last_name + * @deprecated. Instead use setLastName */ public function setLast_name($last_name) { $this->last_name = $last_name; return $this; } /** - * Deprecated method + * Last Name of the Payer from their PayPal Account. + * @return string + * @deprecated. Instead use getLastName */ public function getLast_name() { return $this->last_name; @@ -101,14 +110,18 @@ class PayerInfo extends \PPModel { } /** - * Deprecated method + * PayPal assigned Payer ID. + * @param string $payer_id + * @deprecated. Instead use setPayerId */ public function setPayer_id($payer_id) { $this->payer_id = $payer_id; return $this; } /** - * Deprecated method + * PayPal assigned Payer ID. + * @return string + * @deprecated. Instead use getPayerId */ public function getPayer_id() { return $this->payer_id; @@ -150,14 +163,18 @@ class PayerInfo extends \PPModel { } /** - * Deprecated method + * Shipping address of the Payer from their PayPal Account. + * @param PayPal\Api\Address $shipping_address + * @deprecated. Instead use setShippingAddress */ public function setShipping_address($shipping_address) { $this->shipping_address = $shipping_address; return $this; } /** - * Deprecated method + * Shipping address of the Payer from their PayPal Account. + * @return PayPal\Api\Address + * @deprecated. Instead use getShippingAddress */ public function getShipping_address() { return $this->shipping_address; diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index 144d7a0..cf223f0 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -1,17 +1,21 @@ create_time = $create_time; return $this; } /** - * Deprecated method + * Time the resource was created. + * @return string + * @deprecated. Instead use getCreateTime */ public function getCreate_time() { return $this->create_time; @@ -84,14 +92,18 @@ class Payment extends \PPModel implements IResource { } /** - * Deprecated method + * Time the resource was last updated. + * @param string $update_time + * @deprecated. Instead use setUpdateTime */ public function setUpdate_time($update_time) { $this->update_time = $update_time; return $this; } /** - * Deprecated method + * Time the resource was last updated. + * @return string + * @deprecated. Instead use getUpdateTime */ public function getUpdate_time() { return $this->update_time; @@ -188,14 +200,18 @@ class Payment extends \PPModel implements IResource { } /** - * Deprecated method + * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. + * @param PayPal\Api\RedirectUrls $redirect_urls + * @deprecated. Instead use setRedirectUrls */ public function setRedirect_urls($redirect_urls) { $this->redirect_urls = $redirect_urls; return $this; } /** - * Deprecated method + * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. + * @return PayPal\Api\RedirectUrls + * @deprecated. Instead use getRedirectUrls */ public function getRedirect_urls() { return $this->redirect_urls; @@ -226,7 +242,7 @@ class Payment extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad); $this->fromJson($json); return $this; @@ -240,7 +256,7 @@ class Payment extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad); $ret = new Payment(); $ret->fromJson($json); @@ -258,7 +274,7 @@ class Payment extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad); $ret = new Payment(); $ret->fromJson($json); @@ -274,7 +290,7 @@ class Payment extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $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); diff --git a/lib/PayPal/Api/PaymentExecution.php b/lib/PayPal/Api/PaymentExecution.php index a61e00c..b7048eb 100644 --- a/lib/PayPal/Api/PaymentExecution.php +++ b/lib/PayPal/Api/PaymentExecution.php @@ -1,8 +1,9 @@ payer_id = $payer_id; return $this; } /** - * Deprecated method + * PayPal assigned Payer ID returned in the approval return url. + * @return string + * @deprecated. Instead use getPayerId */ public function getPayer_id() { return $this->payer_id; diff --git a/lib/PayPal/Api/PaymentHistory.php b/lib/PayPal/Api/PaymentHistory.php index 485a40b..e9f28af 100644 --- a/lib/PayPal/Api/PaymentHistory.php +++ b/lib/PayPal/Api/PaymentHistory.php @@ -1,8 +1,9 @@ next_id = $next_id; return $this; } /** - * Deprecated method + * Identifier of the next element to get the next range of results. + * @return string + * @deprecated. Instead use getNextId */ public function getNext_id() { return $this->next_id; diff --git a/lib/PayPal/Api/RedirectUrls.php b/lib/PayPal/Api/RedirectUrls.php index 84b34ee..c954b49 100644 --- a/lib/PayPal/Api/RedirectUrls.php +++ b/lib/PayPal/Api/RedirectUrls.php @@ -1,8 +1,9 @@ return_url = $return_url; return $this; } /** - * Deprecated method + * Url where the payer would be redirected to after approving the payment. + * @return string + * @deprecated. Instead use getReturnUrl */ public function getReturn_url() { return $this->return_url; @@ -52,14 +57,18 @@ class RedirectUrls extends \PPModel { } /** - * Deprecated method + * Url where the payer would be redirected to after canceling the payment. + * @param string $cancel_url + * @deprecated. Instead use setCancelUrl */ public function setCancel_url($cancel_url) { $this->cancel_url = $cancel_url; return $this; } /** - * Deprecated method + * Url where the payer would be redirected to after canceling the payment. + * @return string + * @deprecated. Instead use getCancelUrl */ public function getCancel_url() { return $this->cancel_url; diff --git a/lib/PayPal/Api/Refund.php b/lib/PayPal/Api/Refund.php index 75baeb8..095200a 100644 --- a/lib/PayPal/Api/Refund.php +++ b/lib/PayPal/Api/Refund.php @@ -1,17 +1,20 @@ create_time = $create_time; return $this; } /** - * Deprecated method + * Time the resource was created. + * @return string + * @deprecated. Instead use getCreateTime */ public function getCreate_time() { return $this->create_time; @@ -120,14 +127,18 @@ class Refund extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Sale transaction being refunded. + * @param string $sale_id + * @deprecated. Instead use setSaleId */ public function setSale_id($sale_id) { $this->sale_id = $sale_id; return $this; } /** - * Deprecated method + * ID of the Sale transaction being refunded. + * @return string + * @deprecated. Instead use getSaleId */ public function getSale_id() { return $this->sale_id; @@ -151,14 +162,18 @@ class Refund extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Capture transaction being refunded. + * @param string $capture_id + * @deprecated. Instead use setCaptureId */ public function setCapture_id($capture_id) { $this->capture_id = $capture_id; return $this; } /** - * Deprecated method + * ID of the Capture transaction being refunded. + * @return string + * @deprecated. Instead use getCaptureId */ public function getCapture_id() { return $this->capture_id; @@ -182,14 +197,18 @@ class Refund extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + * @deprecated. Instead use setParentPayment */ public function setParent_payment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @return string + * @deprecated. Instead use getParentPayment */ public function getParent_payment() { return $this->parent_payment; @@ -223,7 +242,7 @@ class Refund extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad); $ret = new Refund(); $ret->fromJson($json); diff --git a/lib/PayPal/Api/RelatedResources.php b/lib/PayPal/Api/RelatedResources.php index 98085f7..7e97776 100644 --- a/lib/PayPal/Api/RelatedResources.php +++ b/lib/PayPal/Api/RelatedResources.php @@ -1,8 +1,9 @@ create_time = $create_time; return $this; } /** - * Deprecated method + * Time the resource was created. + * @return string + * @deprecated. Instead use getCreateTime */ public function getCreate_time() { return $this->create_time; @@ -84,14 +92,18 @@ class Sale extends \PPModel implements IResource { } /** - * Deprecated method + * Time the resource was last updated. + * @param string $update_time + * @deprecated. Instead use setUpdateTime */ public function setUpdate_time($update_time) { $this->update_time = $update_time; return $this; } /** - * Deprecated method + * Time the resource was last updated. + * @return string + * @deprecated. Instead use getUpdateTime */ public function getUpdate_time() { return $this->update_time; @@ -151,14 +163,18 @@ class Sale extends \PPModel implements IResource { } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + * @deprecated. Instead use setParentPayment */ public function setParent_payment($parent_payment) { $this->parent_payment = $parent_payment; return $this; } /** - * Deprecated method + * ID of the Payment resource that this transaction is based on. + * @return string + * @deprecated. Instead use getParentPayment */ public function getParent_payment() { return $this->parent_payment; @@ -192,7 +208,7 @@ class Sale extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad); $ret = new Sale(); $ret->fromJson($json); @@ -210,7 +226,7 @@ class Sale extends \PPModel implements IResource { if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); + $call = new PPRestCall($apiContext); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad); $ret = new Refund(); $ret->fromJson($json); diff --git a/lib/PayPal/Api/ShippingAddress.php b/lib/PayPal/Api/ShippingAddress.php index e1595f4..a7f4de9 100644 --- a/lib/PayPal/Api/ShippingAddress.php +++ b/lib/PayPal/Api/ShippingAddress.php @@ -1,6 +1,7 @@ recipient_name = $recipient_name; return $this; } /** - * Deprecated method + * Name of the recipient at this address. + * @return string + * @deprecated. Instead use getRecipientName */ public function getRecipient_name() { return $this->recipient_name; diff --git a/lib/PayPal/Api/Transaction.php b/lib/PayPal/Api/Transaction.php index 0b3c1f7..d8420aa 100644 --- a/lib/PayPal/Api/Transaction.php +++ b/lib/PayPal/Api/Transaction.php @@ -1,8 +1,9 @@ item_list = $item_list; return $this; } /** - * Deprecated method + * List of items being paid for. + * @return PayPal\Api\ItemList + * @deprecated. Instead use getItemList */ public function getItem_list() { return $this->item_list; @@ -107,14 +112,19 @@ class Transaction extends \PPModel { } /** - * Deprecated method + * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. + * @array + * @param PayPal\Api\RelatedResources $related_resources + * @deprecated. Instead use setRelatedResources */ public function setRelated_resources($related_resources) { $this->related_resources = $related_resources; return $this; } /** - * Deprecated method + * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. + * @return PayPal\Api\RelatedResources + * @deprecated. Instead use getRelatedResources */ public function getRelated_resources() { return $this->related_resources; diff --git a/lib/PayPal/Api/Transactions.php b/lib/PayPal/Api/Transactions.php index 6c86384..2219837 100644 --- a/lib/PayPal/Api/Transactions.php +++ b/lib/PayPal/Api/Transactions.php @@ -1,8 +1,9 @@ logger = new \PPLoggingManager(__CLASS__, $config); + $this->logger = new PPLoggingManager(__CLASS__, $config); // Check if Access Token is not null and has not expired. // The API returns expiry time as a relative time unit // We use a buffer time when checking for token expiry to account @@ -81,14 +85,14 @@ class OAuthTokenCredential { $base64ClientID = base64_encode($this->clientId . ":" . $this->clientSecret); $headers = array( - "User-Agent" => \PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion), + "User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion), "Authorization" => "Basic " . $base64ClientID, "Accept" => "*/*" ); $httpConfiguration = $this->getOAuthHttpConfiguration($config); $httpConfiguration->setHeaders($headers); - $connection = \PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config); + $connection = PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config); $res = $connection->execute("grant_type=client_credentials"); $jsonResponse = json_decode($res, true); if($jsonResponse == NULL || @@ -115,19 +119,19 @@ class OAuthTokenCredential { } else if (isset($config['mode'])) { switch (strtoupper($config['mode'])) { case 'SANDBOX': - $baseEndpoint = \PPConstants::REST_SANDBOX_ENDPOINT; + $baseEndpoint = PPConstants::REST_SANDBOX_ENDPOINT; break; case 'LIVE': - $baseEndpoint = \PPConstants::REST_LIVE_ENDPOINT; + $baseEndpoint = PPConstants::REST_LIVE_ENDPOINT; break; default: - throw new \PPConfigurationException('The mode config parameter must be set to either sandbox/live'); + throw new PPConfigurationException('The mode config parameter must be set to either sandbox/live'); } } else { - throw new \PPConfigurationException('You must set one of service.endpoint or mode parameters in your configuration'); + throw new PPConfigurationException('You must set one of service.endpoint or mode parameters in your configuration'); } $baseEndpoint = rtrim(trim($baseEndpoint), '/'); - return new \PPHttpConfig($baseEndpoint . "/v1/oauth2/token", "POST"); + return new PPHttpConfig($baseEndpoint . "/v1/oauth2/token", "POST"); } } diff --git a/lib/PayPal/Rest/ApiContext.php b/lib/PayPal/Rest/ApiContext.php index 8cf1ae9..a485897 100644 --- a/lib/PayPal/Rest/ApiContext.php +++ b/lib/PayPal/Rest/ApiContext.php @@ -1,12 +1,13 @@ getCredentialObject(); if(!is_array($credValues)) { - throw new \PPMissingCredentialException("Empty or invalid credentials passed"); + throw new PPMissingCredentialException("Empty or invalid credentials passed"); } $credential = new OAuthTokenCredential($credValues['clientId'], $credValues['clientSecret']); } if($credential == NULL || ! ($credential instanceof OAuthTokenCredential) ) { - throw new \PPInvalidCredentialException("Invalid credentials passed"); + throw new PPInvalidCredentialException("Invalid credentials passed"); } @@ -43,7 +50,7 @@ class RestHandler implements \IPPHandler { ); if(!array_key_exists("User-Agent", $httpConfig->getHeaders())) { - $httpConfig->addHeader("User-Agent", \PPUserAgent::getValue(self::$sdkName, self::$sdkVersion)); + $httpConfig->addHeader("User-Agent", PPUserAgent::getValue(self::$sdkName, self::$sdkVersion)); } if(!is_null($credential) && $credential instanceof OAuthTokenCredential) { $httpConfig->addHeader('Authorization', "Bearer " . $credential->getAccessToken($config)); @@ -60,17 +67,17 @@ class RestHandler implements \IPPHandler { } else if (isset($config['mode'])) { switch (strtoupper($config['mode'])) { case 'SANDBOX': - return \PPConstants::REST_SANDBOX_ENDPOINT; + return PPConstants::REST_SANDBOX_ENDPOINT; break; case 'LIVE': - return \PPConstants::REST_LIVE_ENDPOINT; + return PPConstants::REST_LIVE_ENDPOINT; break; default: - throw new \PPConfigurationException('The mode config parameter must be set to either sandbox/live'); + throw new PPConfigurationException('The mode config parameter must be set to either sandbox/live'); break; } } else { - throw new \PPConfigurationException('You must set one of service.endpoint or mode parameters in your configuration'); + throw new PPConfigurationException('You must set one of service.endpoint or mode parameters in your configuration'); } } diff --git a/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php b/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php index 5597d03..5dfe13e 100644 --- a/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php +++ b/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php @@ -4,12 +4,13 @@ use PayPal\Auth\OAuthTokenCredential; use PayPal\Test\Constants; - +use PayPal\Core\PPConfigManager; +use PayPal\Exception\PPConnectionException; class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase { public function testGetAccessToken() { $cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET); - $config = \PPConfigManager::getInstance()->getConfigHashmap(); + $config = PPConfigManager::getInstance()->getConfigHashmap(); $token = $cred->getAccessToken($config); $this->assertNotNull($token); @@ -27,8 +28,8 @@ class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase { } public function testInvalidCredentials() { - $this->setExpectedException('\PPConnectionException'); + $this->setExpectedException('PayPal\Exception\PPConnectionException'); $cred = new OAuthTokenCredential('dummy', 'secret'); - $this->assertNull($cred->getAccessToken(\PPConfigManager::getInstance()->getConfigHashmap())); + $this->assertNull($cred->getAccessToken(PPConfigManager::getInstance()->getConfigHashmap())); } } \ No newline at end of file diff --git a/tests/PayPal/Test/Common/ArrayClass.php b/tests/PayPal/Test/Common/ArrayClass.php new file mode 100644 index 0000000..3470847 --- /dev/null +++ b/tests/PayPal/Test/Common/ArrayClass.php @@ -0,0 +1,29 @@ +name = $name; + } + public function getName() { + return $this->name; + } + + public function setDescription($desc) { + $this->desc = $desc; + } + public function getDescription() { + return $this->desc; + } + + public function setTags($tags) { + if(!is_array($tags)) { + $tags = array($tags); + } + $this->tags = $tags; + } + public function getTags() { + return $this->tags; + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Common/ArrayUtilTest.php b/tests/PayPal/Test/Common/ArrayUtilTest.php index 6dd2930..824b684 100644 --- a/tests/PayPal/Test/Common/ArrayUtilTest.php +++ b/tests/PayPal/Test/Common/ArrayUtilTest.php @@ -1,8 +1,8 @@ name = $name; - } - public function getName() { - return $this->name; - } - - public function setDescription($desc) { - $this->desc = $desc; - } - public function getDescription() { - return $this->desc; - } -} - -class ArrayClass extends \PPModel { - - public function setName($name) { - $this->name = $name; - } - public function getName() { - return $this->name; - } - - public function setDescription($desc) { - $this->desc = $desc; - } - public function getDescription() { - return $this->desc; - } - - public function setTags($tags) { - if(!is_array($tags)) { - $tags = array($tags); - } - $this->tags = $tags; - } - public function getTags() { - return $this->tags; - } -} - -class NestedClass extends \PPModel { - - public function setId($id) { - $this->id = $id; - } - public function getId() { - return $this->id; - } - - /** - * - * @param ArrayClass $info - */ - public function setInfo($info) { - $this->info = $info; - } - /** - * - * @return ArrayClass - */ - public function getInfo() { - return $this->info; - } -} - -class ChildClass extends SimpleClass { - -} - -class ModelTest extends PHPUnit_Framework_TestCase { +namespace PayPal\Test\Common; +use PayPal\Common\PPModel; +use PayPal\Test\Common\ArrayClass; +use PayPal\Test\Common\SimpleClass; +use PayPal\Test\Common\NestedClass; +class ModelTest extends \PHPUnit_Framework_TestCase { public function testSimpleClassConversion() { $o = new SimpleClass(); diff --git a/tests/PayPal/Test/Common/NestedClass.php b/tests/PayPal/Test/Common/NestedClass.php new file mode 100644 index 0000000..06e5e00 --- /dev/null +++ b/tests/PayPal/Test/Common/NestedClass.php @@ -0,0 +1,27 @@ +id = $id; + } + public function getId() { + return $this->id; + } + + /** + * + * @param PayPal\Test\Common\ArrayClass $info + */ + public function setInfo($info) { + $this->info = $info; + } + /** + * + * @return PayPal\Test\Common\ArrayClass + */ + public function getInfo() { + return $this->info; + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Common/SimpleClass.php b/tests/PayPal/Test/Common/SimpleClass.php new file mode 100644 index 0000000..86732b1 --- /dev/null +++ b/tests/PayPal/Test/Common/SimpleClass.php @@ -0,0 +1,19 @@ +name = $name; + } + public function getName() { + return $this->name; + } + + public function setDescription($desc) { + $this->desc = $desc; + } + public function getDescription() { + return $this->desc; + } +} \ No newline at end of file diff --git a/tests/PayPal/Test/Common/UserAgentTest.php b/tests/PayPal/Test/Common/UserAgentTest.php index 5bf8765..d945374 100644 --- a/tests/PayPal/Test/Common/UserAgentTest.php +++ b/tests/PayPal/Test/Common/UserAgentTest.php @@ -1,6 +1,6 @@