Updated stubs to support namespace

This commit is contained in:
Ganesh Hegde
2013-05-29 14:37:22 +05:30
parent 479730d1c4
commit 50d2c56f8b
37 changed files with 530 additions and 324 deletions

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Address extends \PPModel {
class Address extends PPModel {
/**
* Line 1 of the Address (eg. number, street, etc).
* @param string $line1
@@ -75,14 +76,18 @@ class Address extends \PPModel {
}
/**
* Deprecated method
* 2 letter country code.
* @param string $country_code
* @deprecated. Instead use setCountryCode
*/
public function setCountry_code($country_code) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Amount extends \PPModel {
class Amount extends PPModel {
/**
* 3 letter currency code
* @param string $currency

View File

@@ -1,17 +1,21 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\Authorization;
use PayPal\Api\Capture;
use PayPal\Transport\PPRestCall;
class Authorization extends \PPModel implements IResource {
class Authorization extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -53,14 +57,18 @@ class Authorization extends \PPModel implements IResource {
}
/**
* Deprecated method
* Time the resource was created.
* @param string $create_time
* @deprecated. Instead use setCreateTime
*/
public function setCreate_time($create_time) {
$this->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;

View File

@@ -1,17 +1,21 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\Capture;
use PayPal\Api\Refund;
use PayPal\Transport\PPRestCall;
class Capture extends \PPModel implements IResource {
class Capture extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -53,14 +57,18 @@ class Capture extends \PPModel implements IResource {
}
/**
* Deprecated method
* Time the resource was created.
* @param string $create_time
* @deprecated. Instead use setCreateTime
*/
public function setCreate_time($create_time) {
$this->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);

View File

@@ -1,17 +1,20 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\CreditCard;
use PayPal\Transport\PPRestCall;
class CreditCard extends \PPModel implements IResource {
class CreditCard extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -89,14 +92,18 @@ class CreditCard extends \PPModel implements IResource {
}
/**
* Deprecated method
* card expiry month 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 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;
}

View File

@@ -1,15 +1,16 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class CreditCardHistory extends \PPModel {
class CreditCardHistory extends PPModel {
/**
* A list of credit card resources
* @array
* @param PayPal\Api\CreditCard $credit-cards
*/
public function setCreditCards($credit_cards) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class CreditCardToken extends \PPModel {
class CreditCardToken extends PPModel {
/**
* ID of a previously saved Credit Card resource using /vault/credit-card API.
* @param string $credit_card_id
@@ -21,14 +22,18 @@ class CreditCardToken extends \PPModel {
}
/**
* Deprecated method
* ID of a previously saved Credit Card resource using /vault/credit-card API.
* @param string $credit_card_id
* @deprecated. Instead use setCreditCardId
*/
public function setCredit_card_id($credit_card_id) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Details extends \PPModel {
class Details extends PPModel {
/**
* Amount being charged for shipping.
* @param string $shipping

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class FundingInstrument extends \PPModel {
class FundingInstrument extends PPModel {
/**
* Credit Card information.
* @param PayPal\Api\CreditCard $credit_card
@@ -21,14 +22,18 @@ class FundingInstrument extends \PPModel {
}
/**
* Deprecated method
* Credit Card information.
* @param PayPal\Api\CreditCard $credit_card
* @deprecated. Instead use setCreditCard
*/
public function setCredit_card($credit_card) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class HyperSchema extends \PPModel {
class HyperSchema extends PPModel {
/**
*
* @array
@@ -39,19 +40,6 @@ class HyperSchema extends \PPModel {
return $this->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;
}
}

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Item extends \PPModel {
class Item extends PPModel {
/**
* Number of items.
* @param string $quantity

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class ItemList extends \PPModel {
class ItemList extends PPModel {
/**
* List of items.
* @array
@@ -40,14 +41,18 @@ class ItemList extends \PPModel {
}
/**
* Deprecated method
* Shipping address.
* @param PayPal\Api\ShippingAddress $shipping_address
* @deprecated. Instead use setShippingAddress
*/
public function setShipping_address($shipping_address) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Links extends \PPModel {
class Links extends PPModel {
/**
*
* @param string $href
@@ -56,19 +57,6 @@ class Links extends \PPModel {
return $this->targetSchema;
}
/**
* Deprecated method
*/
public function setTargetschema($targetSchema) {
$this->targetSchema = $targetSchema;
return $this;
}
/**
* Deprecated method
*/
public function getTargetschema() {
return $this->targetSchema;
}
/**
*

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Payee extends \PPModel {
class Payee extends PPModel {
/**
* Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements.
* @param string $email
@@ -39,14 +40,18 @@ class Payee extends \PPModel {
}
/**
* Deprecated method
* Encrypted PayPal Account identifier for the Payee.
* @param string $merchant_id
* @deprecated. Instead use setMerchantId
*/
public function setMerchant_id($merchant_id) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Payer extends \PPModel {
class Payer extends PPModel {
/**
* Payment method being used - PayPal Wallet payment or Direct Credit card.
* @param string $payment_method
@@ -21,14 +22,18 @@ class Payer extends \PPModel {
}
/**
* Deprecated method
* Payment method being used - PayPal Wallet payment or Direct Credit card.
* @param string $payment_method
* @deprecated. Instead use setPaymentMethod
*/
public function setPayment_method($payment_method) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class PayerInfo extends \PPModel {
class PayerInfo extends PPModel {
/**
* Email address representing the Payer.
* @param string $email
@@ -39,14 +40,18 @@ class PayerInfo extends \PPModel {
}
/**
* Deprecated method
* First Name of the Payer from their PayPal Account.
* @param string $first_name
* @deprecated. Instead use setFirstName
*/
public function setFirst_name($first_name) {
$this->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;

View File

@@ -1,17 +1,21 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\Payment;
use PayPal\Api\PaymentHistory;
use PayPal\Transport\PPRestCall;
class Payment extends \PPModel implements IResource {
class Payment extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -53,14 +57,18 @@ class Payment extends \PPModel implements IResource {
}
/**
* Deprecated method
* Time the resource was created.
* @param string $create_time
* @deprecated. Instead use setCreateTime
*/
public function setCreate_time($create_time) {
$this->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);

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class PaymentExecution extends \PPModel {
class PaymentExecution extends PPModel {
/**
* PayPal assigned Payer ID returned in the approval return url.
* @param string $payer_id
@@ -21,14 +22,18 @@ class PaymentExecution extends \PPModel {
}
/**
* Deprecated method
* PayPal assigned Payer ID returned in the approval return url.
* @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 returned in the approval return url.
* @return string
* @deprecated. Instead use getPayerId
*/
public function getPayer_id() {
return $this->payer_id;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class PaymentHistory extends \PPModel {
class PaymentHistory extends PPModel {
/**
* A list of Payment resources
* @array
@@ -58,14 +59,18 @@ class PaymentHistory 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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class RedirectUrls extends \PPModel {
class RedirectUrls extends PPModel {
/**
* Url where the payer would be redirected to after approving the payment.
* @param string $return_url
@@ -21,14 +22,18 @@ class RedirectUrls extends \PPModel {
}
/**
* Deprecated method
* Url where the payer would be redirected to after approving the payment.
* @param string $return_url
* @deprecated. Instead use setReturnUrl
*/
public function setReturn_url($return_url) {
$this->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;

View File

@@ -1,17 +1,20 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\Refund;
use PayPal\Transport\PPRestCall;
class Refund extends \PPModel implements IResource {
class Refund extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -53,14 +56,18 @@ class Refund extends \PPModel implements IResource {
}
/**
* Deprecated method
* Time the resource was created.
* @param string $create_time
* @deprecated. Instead use setCreateTime
*/
public function setCreate_time($create_time) {
$this->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);

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class RelatedResources extends \PPModel {
class RelatedResources extends PPModel {
/**
* A sale transaction
* @param PayPal\Api\Sale $sale

View File

@@ -1,17 +1,21 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\IResource;
use PayPal\Rest\Call;
use PayPal\Rest\ApiContext;
use PayPal\Api\Sale;
use PayPal\Api\Refund;
use PayPal\Transport\PPRestCall;
class Sale extends \PPModel implements IResource {
class Sale extends PPModel implements IResource {
private static $credential;
/**
*
* @deprected. Pass ApiContext to create/get methods instead
* @deprecated. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
@@ -53,14 +57,18 @@ class Sale extends \PPModel implements IResource {
}
/**
* Deprecated method
* Time the resource was created.
* @param string $create_time
* @deprecated. Instead use setCreateTime
*/
public function setCreate_time($create_time) {
$this->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);

View File

@@ -1,6 +1,7 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class ShippingAddress extends Address {
/**
@@ -21,14 +22,18 @@ class ShippingAddress extends Address {
}
/**
* Deprecated method
* Name of the recipient at this address.
* @param string $recipient_name
* @deprecated. Instead use setRecipientName
*/
public function setRecipient_name($recipient_name) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Transaction extends \PPModel {
class Transaction extends PPModel {
/**
* Amount being collected.
* @param PayPal\Api\Amount $amount
@@ -75,14 +76,18 @@ class Transaction extends \PPModel {
}
/**
* Deprecated method
* List of items being paid for.
* @param PayPal\Api\ItemList $item_list
* @deprecated. Instead use setItemList
*/
public function setItem_list($item_list) {
$this->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;

View File

@@ -1,8 +1,9 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
class Transactions extends \PPModel {
class Transactions extends PPModel {
/**
* Amount being collected.
* @param PayPal\Api\Amount $amount

View File

@@ -7,8 +7,12 @@ namespace PayPal\Auth;
*
*/
use PayPal\Rest\RestHandler;
use PayPal\Common\UserAgent;
use PayPal\Common\PPUserAgent;
use PayPal\Core\PPLoggingManager;
use PayPal\Core\PPConstants;
use PayPal\Core\PPHttpConfig;
use PayPal\Core\PPConnectionManager;
use PayPal\Exception\PPConfigurationException;
class OAuthTokenCredential {
@@ -57,7 +61,7 @@ class OAuthTokenCredential {
*/
public function getAccessToken($config) {
$this->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");
}
}

View File

@@ -1,12 +1,13 @@
<?php
namespace PayPal\Rest;
use PayPal\Common\PPApiContext;
/**
*
* Call level parameters such as
* request id, credentials etc
*/
class ApiContext extends \PPApiContext {
class ApiContext extends PPApiContext {
/**
* OAuth Credentials to use for this call

View File

@@ -2,12 +2,19 @@
namespace PayPal\Rest;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Handler\IPPHandler;
use PayPal\Core\PPCredentialManager;
use PayPal\Core\PPConstants;
use PayPal\Exception\PPMissingCredentialException;
use PayPal\Exception\PPInvalidCredentialException;
use PayPal\Exception\PPConfigurationException;
use PayPal\Common\PPUserAgent;
/**
*
* API handler for all REST API calls
*/
class RestHandler implements \IPPHandler {
class RestHandler implements IPPHandler {
private $apiContext;
@@ -25,15 +32,15 @@ class RestHandler implements \IPPHandler {
if($credential == NULL) {
// Try picking credentials from the config file
$credMgr = \PPCredentialManager::getInstance($config);
$credMgr = PPCredentialManager::getInstance($config);
$credValues = $credMgr->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');
}
}