From 11f91adee4147e62a3f8d5e6f8fa98b8c17d9245 Mon Sep 17 00:00:00 2001 From: Ganesh Hegde <1ganesh1@facebook.com> Date: Mon, 27 May 2013 11:53:45 +0530 Subject: [PATCH] updated stubs --- lib/PayPal/Api/Address.php | 162 ++++---- lib/PayPal/Api/Amount.php | 76 ++-- lib/PayPal/Api/Authorization.php | 237 ++++++++---- lib/PayPal/Api/Capture.php | 238 +++++++----- lib/PayPal/Api/CreditCard.php | 365 +++++++++--------- lib/PayPal/Api/CreditCardHistory.php | 55 +++ lib/PayPal/Api/CreditCardToken.php | 112 ++++-- .../Api/{AmountDetails.php => Details.php} | 104 +++-- lib/PayPal/Api/FundingInstrument.php | 48 +-- lib/PayPal/Api/HyperSchema.php | 103 +++++ lib/PayPal/Api/Item.php | 154 ++++---- lib/PayPal/Api/ItemList.php | 45 +-- lib/PayPal/Api/Link.php | 60 --- lib/PayPal/Api/Links.php | 102 +++++ lib/PayPal/Api/Payee.php | 72 ++-- lib/PayPal/Api/Payer.php | 81 ++-- lib/PayPal/Api/PayerInfo.php | 126 +++--- lib/PayPal/Api/Payment.php | 311 +++++++-------- lib/PayPal/Api/PaymentExecution.php | 49 ++- lib/PayPal/Api/PaymentHistory.php | 59 ++- lib/PayPal/Api/RedirectUrls.php | 48 +-- lib/PayPal/Api/Refund.php | 232 +++++------ ...ubTransaction.php => RelatedResources.php} | 86 ++--- lib/PayPal/Api/Resource.php | 11 - lib/PayPal/Api/Sale.php | 211 +++++----- lib/PayPal/Api/ShippingAddress.php | 30 +- lib/PayPal/Api/Transaction.php | 112 +++--- lib/PayPal/Api/Transactions.php | 22 ++ 28 files changed, 1744 insertions(+), 1567 deletions(-) create mode 100644 lib/PayPal/Api/CreditCardHistory.php rename lib/PayPal/Api/{AmountDetails.php => Details.php} (54%) create mode 100644 lib/PayPal/Api/HyperSchema.php delete mode 100644 lib/PayPal/Api/Link.php create mode 100644 lib/PayPal/Api/Links.php rename lib/PayPal/Api/{SubTransaction.php => RelatedResources.php} (72%) delete mode 100644 lib/PayPal/Api/Resource.php create mode 100644 lib/PayPal/Api/Transactions.php diff --git a/lib/PayPal/Api/Address.php b/lib/PayPal/Api/Address.php index 9ba7716..e7a208e 100644 --- a/lib/PayPal/Api/Address.php +++ b/lib/PayPal/Api/Address.php @@ -1,140 +1,118 @@ -line1 = $line1; - } - + } + /** - * Getter for line1 + * Line 1 of the Address (eg. number, street, etc). * @return string - */ + */ public function getLine1() { return $this->line1; } - + /** - * Setter for line2 + * Optional line 2 of the Address (eg. suite, apt #, etc.). * @param string $line2 - */ + */ public function setLine2($line2) { $this->line2 = $line2; - } - + } + /** - * Getter for line2 + * Optional line 2 of the Address (eg. suite, apt #, etc.). * @return string - */ + */ public function getLine2() { return $this->line2; } - + /** - * Setter for city + * City name. * @param string $city - */ + */ public function setCity($city) { $this->city = $city; - } - + } + /** - * Getter for city + * City name. * @return string - */ + */ public function getCity() { return $this->city; } - + /** - * Setter for state + * 2 letter country code. + * @param string $country_code + */ + public function setCountryCode($country_code) { + $this->country_code = $country_code; + } + + /** + * 2 letter country code. + * @return string + */ + public function getCountryCode() { + return $this->country_code; + } + + /** + * 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 + */ + public function setPostalCode($postal_code) { + $this->postal_code = $postal_code; + } + + /** + * 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 + */ + public function getPostalCode() { + return $this->postal_code; + } + + /** + * 2 letter code for US states, and the equivalent for other countries. * @param string $state - */ + */ public function setState($state) { $this->state = $state; - } - + } + /** - * Getter for state + * 2 letter code for US states, and the equivalent for other countries. * @return string - */ + */ public function getState() { return $this->state; } - + /** - * Setter for postal_code - * @param string $postal_code - */ - public function setPostal_code($postal_code) { - $this->postal_code = $postal_code; - } - - /** - * Getter for postal_code - * @return string - */ - public function getPostal_code() { - return $this->postal_code; - } - - /** - * Setter for country_code - * @param string $country_code - */ - public function setCountry_code($country_code) { - $this->country_code = $country_code; - } - - /** - * Getter for country_code - * @return string - */ - public function getCountry_code() { - return $this->country_code; - } - - /** - * Setter for type - * @param string $type - */ - public function setType($type) { - $this->type = $type; - } - - /** - * Getter for type - * @return string - */ - public function getType() { - return $this->type; - } - - /** - * Setter for phone + * Phone number in E.123 format. * @param string $phone - */ + */ public function setPhone($phone) { $this->phone = $phone; - } - + } + /** - * Getter for phone + * Phone number in E.123 format. * @return string - */ + */ public function getPhone() { return $this->phone; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Amount.php b/lib/PayPal/Api/Amount.php index 673c14b..04f09dc 100644 --- a/lib/PayPal/Api/Amount.php +++ b/lib/PayPal/Api/Amount.php @@ -1,60 +1,54 @@ -total = $total; - } - - /** - * Getter for total - * @return string - */ - public function getTotal() { - return $this->total; - } - - /** - * Setter for currency + * 3 letter currency code * @param string $currency - */ + */ public function setCurrency($currency) { $this->currency = $currency; - } - + } + /** - * Getter for currency + * 3 letter currency code * @return string - */ + */ public function getCurrency() { return $this->currency; } - + /** - * Setter for details - * @param PayPal\Api\AmountDetails $details - */ + * Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account. + * @param string $total + */ + public function setTotal($total) { + $this->total = $total; + } + + /** + * Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account. + * @return string + */ + public function getTotal() { + return $this->total; + } + + /** + * Additional details of the payment amount. + * @param PayPal\Api\Details $details + */ public function setDetails($details) { $this->details = $details; - } - + } + /** - * Getter for details - * @return PayPal\Api\AmountDetails - */ + * Additional details of the payment amount. + * @return PayPal\Api\Details + */ public function getDetails() { return $this->details; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Authorization.php b/lib/PayPal/Api/Authorization.php index b7602da..17862a8 100644 --- a/lib/PayPal/Api/Authorization.php +++ b/lib/PayPal/Api/Authorization.php @@ -1,124 +1,211 @@ -id = $id; - } - + } + /** - * Getter for id + * Identifier of the authorization transaction. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for create_time + * Time the resource was created. * @param string $create_time - */ - public function setCreate_time($create_time) { + */ + public function setCreateTime($create_time) { $this->create_time = $create_time; - } - + } + /** - * Getter for create_time + * Time the resource was created. * @return string - */ - public function getCreate_time() { + */ + public function getCreateTime() { return $this->create_time; } - + /** - * Setter for update_time + * Time the resource was last updated. * @param string $update_time - */ - public function setUpdate_time($update_time) { + */ + public function setUpdateTime($update_time) { $this->update_time = $update_time; - } - + } + /** - * Getter for update_time + * Time the resource was last updated. * @return string - */ - public function getUpdate_time() { + */ + public function getUpdateTime() { return $this->update_time; } - + /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for amount + * Amount being authorized for. * @param PayPal\Api\Amount $amount - */ + */ public function setAmount($amount) { $this->amount = $amount; - } - + } + /** - * Getter for amount + * Amount being authorized for. * @return PayPal\Api\Amount - */ + */ public function getAmount() { return $this->amount; } - + /** - * Setter for parent_payment - * @param string $parent_payment - */ - public function setParent_payment($parent_payment) { - $this->parent_payment = $parent_payment; - } - + * State of the authorization transaction. + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + /** - * Getter for parent_payment + * State of the authorization transaction. * @return string - */ - public function getParent_payment() { + */ + public function getState() { + return $this->state; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + */ + public function setParentPayment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @return string + */ + public function getParentPayment() { return $this->parent_payment; } - + /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * Date/Time until which funds may be captured against this resource. + * @param string $valid_until + */ + public function setValidUntil($valid_until) { + $this->valid_until = $valid_until; + } + + /** + * Date/Time until which funds may be captured against this resource. + * @return string + */ + public function getValidUntil() { + return $this->valid_until; + } + + /** + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + + public static function get($authorizationId, $apiContext = null) { + if (($authorizationId == null) || (strlen($authorizationId) <= 0)) { + throw new \InvalidArgumentException("authorizationId cannot be null or empty"); + } + $payLoad = ""; + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/$authorizationId", "GET", $payLoad); + $ret = new Authorization(); + $ret->fromJson($json); + return $ret; + } -} \ No newline at end of file + public function capture($capture, $apiContext = null) { + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + if (($capture == null)) { + throw new \InvalidArgumentException("capture cannot be null or empty"); + } + $payLoad = $capture->toJSON(); + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/capture", "POST", $payLoad); + $ret = new Capture(); + $ret->fromJson($json); + return $ret; + } + + public function void($apiContext = null) { + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + $payLoad = ""; + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $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); + return $ret; + } + + public function reauthorize($apiContext = null) { + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + $payLoad = $this->toJSON(); + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/authorization/{$this->getId()}/reauthorize", "POST", $payLoad); + $this->fromJson($json); + return $this; + } +} diff --git a/lib/PayPal/Api/Capture.php b/lib/PayPal/Api/Capture.php index c34e37d..96d3186 100644 --- a/lib/PayPal/Api/Capture.php +++ b/lib/PayPal/Api/Capture.php @@ -1,156 +1,182 @@ -id = $id; - } - + } + /** - * Getter for id + * Identifier of the Capture transaction. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for create_time + * Time the resource was created. * @param string $create_time - */ - public function setCreate_time($create_time) { + */ + public function setCreateTime($create_time) { $this->create_time = $create_time; - } - + } + /** - * Getter for create_time + * Time the resource was created. * @return string - */ - public function getCreate_time() { + */ + public function getCreateTime() { return $this->create_time; } - + /** - * Setter for update_time + * Time the resource was last updated. * @param string $update_time - */ - public function setUpdate_time($update_time) { + */ + public function setUpdateTime($update_time) { $this->update_time = $update_time; - } - + } + /** - * Getter for update_time + * Time the resource was last updated. * @return string - */ - public function getUpdate_time() { + */ + public function getUpdateTime() { return $this->update_time; } - + /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for amount + * Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true. * @param PayPal\Api\Amount $amount - */ + */ public function setAmount($amount) { $this->amount = $amount; - } - + } + /** - * Getter for amount + * Amount being captured. If no amount is specified, amount is used from the authorization being captured. If amount is same as the amount that's authorized for, the state of the authorization changes to captured. If not, the state of the authorization changes to partially_captured. Alternatively, you could indicate a final capture by seting the is_final_capture flag to true. * @return PayPal\Api\Amount - */ + */ public function getAmount() { return $this->amount; } - + /** - * Setter for parent_payment - * @param string $parent_payment - */ - public function setParent_payment($parent_payment) { - $this->parent_payment = $parent_payment; + * 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 + */ + public function setIsFinalCapture($is_final_capture) { + $this->is_final_capture = $is_final_capture; + } + + /** + * 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 + */ + public function getIsFinalCapture() { + return $this->is_final_capture; } - + /** - * Getter for parent_payment + * State of the capture transaction. + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * State of the capture transaction. * @return string - */ - public function getParent_payment() { + */ + public function getState() { + return $this->state; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + */ + public function setParentPayment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @return string + */ + public function getParentPayment() { return $this->parent_payment; } - + /** - * Setter for authorization_id - * @param string $authorization_id - */ - public function setAuthorization_id($authorization_id) { - $this->authorization_id = $authorization_id; - } - - /** - * Getter for authorization_id - * @return string - */ - public function getAuthorization_id() { - return $this->authorization_id; - } - - /** - * Setter for description - * @param string $description - */ - public function setDescription($description) { - $this->description = $description; - } - - /** - * Getter for description - * @return string - */ - public function getDescription() { - return $this->description; - } - - /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + + public static function get($captureId, $apiContext = null) { + if (($captureId == null) || (strlen($captureId) <= 0)) { + throw new \InvalidArgumentException("captureId cannot be null or empty"); + } + $payLoad = ""; + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/capture/$captureId", "GET", $payLoad); + $ret = new Capture(); + $ret->fromJson($json); + return $ret; + } -} \ No newline at end of file + public function refund($refund, $apiContext = null) { + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + if (($refund == null)) { + throw new \InvalidArgumentException("refund cannot be null or empty"); + } + $payLoad = $refund->toJSON(); + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $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); + return $ret; + } +} diff --git a/lib/PayPal/Api/CreditCard.php b/lib/PayPal/Api/CreditCard.php index 7bcb55d..8c2582f 100644 --- a/lib/PayPal/Api/CreditCard.php +++ b/lib/PayPal/Api/CreditCard.php @@ -1,277 +1,268 @@ -id = $id; - } - + } + /** - * Getter for id + * ID of the credit card being saved for later use. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for valid_until - * @param string $valid_until - */ - public function setValid_until($valid_until) { - $this->valid_until = $valid_until; - } - - /** - * Getter for valid_until - * @return string - */ - public function getValid_until() { - return $this->valid_until; - } - - /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for payer_id - * @param string $payer_id - */ - public function setPayer_id($payer_id) { - $this->payer_id = $payer_id; - } - - /** - * Getter for payer_id - * @return string - */ - public function getPayer_id() { - return $this->payer_id; - } - - /** - * Setter for type - * @param string $type - */ - public function setType($type) { - $this->type = $type; - } - - /** - * Getter for type - * @return string - */ - public function getType() { - return $this->type; - } - - /** - * Setter for number + * Card number. * @param string $number - */ + */ public function setNumber($number) { $this->number = $number; - } - + } + /** - * Getter for number + * Card number. * @return string - */ + */ public function getNumber() { return $this->number; } - + /** - * Setter for expire_month - * @param string $expire_month - */ - public function setExpire_month($expire_month) { - $this->expire_month = $expire_month; - } - + * Type of the Card (eg. Visa, Mastercard, etc.). + * @param string $type + */ + public function setType($type) { + $this->type = $type; + } + /** - * Getter for expire_month + * Type of the Card (eg. Visa, Mastercard, etc.). * @return string - */ - public function getExpire_month() { + */ + public function getType() { + return $this->type; + } + + /** + * card expiry month with value 1 - 12. + * @param integer $expire_month + */ + public function setExpireMonth($expire_month) { + $this->expire_month = $expire_month; + } + + /** + * card expiry month with value 1 - 12. + * @return integer + */ + public function getExpireMonth() { return $this->expire_month; } - + /** - * Setter for expire_year - * @param string $expire_year - */ - public function setExpire_year($expire_year) { + * 4 digit card expiry year + * @param integer $expire_year + */ + public function setExpireYear($expire_year) { $this->expire_year = $expire_year; - } - + } + /** - * Getter for expire_year - * @return string - */ - public function getExpire_year() { + * 4 digit card expiry year + * @return integer + */ + public function getExpireYear() { return $this->expire_year; } - + /** - * Setter for cvv2 + * Card validation code. Only supported when making a Payment but not when saving a credit card for future use. * @param string $cvv2 - */ + */ public function setCvv2($cvv2) { $this->cvv2 = $cvv2; - } - + } + /** - * Getter for cvv2 + * Card validation code. Only supported when making a Payment but not when saving a credit card for future use. * @return string - */ + */ public function getCvv2() { return $this->cvv2; } - + /** - * Setter for first_name + * Card holder's first name. * @param string $first_name - */ - public function setFirst_name($first_name) { + */ + public function setFirstName($first_name) { $this->first_name = $first_name; - } - + } + /** - * Getter for first_name + * Card holder's first name. * @return string - */ - public function getFirst_name() { + */ + public function getFirstName() { return $this->first_name; } - + /** - * Setter for last_name + * Card holder's last name. * @param string $last_name - */ - public function setLast_name($last_name) { + */ + public function setLastName($last_name) { $this->last_name = $last_name; - } - + } + /** - * Getter for last_name + * Card holder's last name. * @return string - */ - public function getLast_name() { + */ + public function getLastName() { return $this->last_name; } - + /** - * Setter for billing_address + * Billing Address associated with this card. * @param PayPal\Api\Address $billing_address - */ - public function setBilling_address($billing_address) { + */ + public function setBillingAddress($billing_address) { $this->billing_address = $billing_address; - } - + } + /** - * Getter for billing_address + * Billing Address associated with this card. * @return PayPal\Api\Address - */ - public function getBilling_address() { + */ + public function getBillingAddress() { return $this->billing_address; } - + /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * 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 + */ + public function setPayerId($payer_id) { + $this->payer_id = $payer_id; + } + + /** + * 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 + */ + public function getPayerId() { + return $this->payer_id; + } + + /** + * State of the funding instrument. + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * State of the funding instrument. + * @return string + */ + public function getState() { + return $this->state; + } + + /** + * Date/Time until this resource can be used fund a payment. + * @param string $valid_until + */ + public function setValidUntil($valid_until) { + $this->valid_until = $valid_until; + } + + /** + * Date/Time until this resource can be used fund a payment. + * @return string + */ + public function getValidUntil() { + return $this->valid_until; + } + + /** + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + - - - /** - * @path /v1/vault/credit-card - * @method POST - - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public function create( $apiContext=null) { - $payLoad = $this->toJSON(); - if($apiContext == null) { + public function create($apiContext = null) { + $payLoad = $this->toJSON(); + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/vault/credit-card", - "POST", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad); $this->fromJson($json); - return $this; - } - - /** - * @path /v1/vault/credit-card/:credit-card-id - * @method GET - * @param string $creditcardid - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public static function get( $creditcardid, $apiContext=null) { - if (($creditcardid == null) || (strlen($creditcardid) <= 0)) { - throw new \InvalidArgumentException("creditcardid cannot be null or empty"); + return $this; + } + + public static function get($creditCardId, $apiContext = null) { + if (($creditCardId == null) || (strlen($creditCardId) <= 0)) { + throw new \InvalidArgumentException("creditCardId cannot be null or empty"); } $payLoad = ""; - if($apiContext == null) { + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/vault/credit-card/$creditcardid", - "GET", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad); $ret = new CreditCard(); $ret->fromJson($json); return $ret; - - } - + } + public function delete($apiContext = null) { + if ($this->getId() == null) { + throw new \InvalidArgumentException("Id cannot be null"); + } + $payLoad = ""; + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $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 new file mode 100644 index 0000000..22059e1 --- /dev/null +++ b/lib/PayPal/Api/CreditCardHistory.php @@ -0,0 +1,55 @@ +credit-cards = $credit-cards; + } + + /** + * A list of credit card resources + * @return PayPal\Api\CreditCard + */ + public function getCreditCards() { + return $this->credit-cards; + } + + /** + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. + * @param integer $count + */ + public function setCount($count) { + $this->count = $count; + } + + /** + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. + * @return integer + */ + public function getCount() { + return $this->count; + } + + /** + * Identifier of the next element to get the next range of results. + * @param string $next_id + */ + public function setNextId($next_id) { + $this->next_id = $next_id; + } + + /** + * Identifier of the next element to get the next range of results. + * @return string + */ + public function getNextId() { + return $this->next_id; + } + +} diff --git a/lib/PayPal/Api/CreditCardToken.php b/lib/PayPal/Api/CreditCardToken.php index 0dae9e6..0f748e5 100644 --- a/lib/PayPal/Api/CreditCardToken.php +++ b/lib/PayPal/Api/CreditCardToken.php @@ -1,44 +1,102 @@ -credit_card_id = $credit_card_id; - } - + } + /** - * Getter for credit_card_id + * ID of a previously saved Credit Card resource using /vault/credit-card API. * @return string - */ - public function getCredit_card_id() { + */ + public function getCreditCardId() { return $this->credit_card_id; } - + /** - * Setter for payer_id + * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. * @param string $payer_id - */ - public function setPayer_id($payer_id) { + */ + public function setPayerId($payer_id) { $this->payer_id = $payer_id; - } - + } + /** - * Getter for payer_id + * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. * @return string - */ - public function getPayer_id() { + */ + public function getPayerId() { return $this->payer_id; } - - -} \ No newline at end of file + + /** + * Last 4 digits of the card number from the saved card. + * @param string $last4 + */ + public function setLast4($last4) { + $this->last4 = $last4; + } + + /** + * Last 4 digits of the card number from the saved card. + * @return string + */ + public function getLast4() { + return $this->last4; + } + + /** + * Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display. + * @param string $type + */ + public function setType($type) { + $this->type = $type; + } + + /** + * Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display. + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * card expiry month from the saved card with value 1 - 12 + * @param integer $expire_month + */ + public function setExpireMonth($expire_month) { + $this->expire_month = $expire_month; + } + + /** + * card expiry month from the saved card with value 1 - 12 + * @return integer + */ + public function getExpireMonth() { + return $this->expire_month; + } + + /** + * 4 digit card expiry year from the saved card + * @param integer $expire_year + */ + public function setExpireYear($expire_year) { + $this->expire_year = $expire_year; + } + + /** + * 4 digit card expiry year from the saved card + * @return integer + */ + public function getExpireYear() { + return $this->expire_year; + } + +} diff --git a/lib/PayPal/Api/AmountDetails.php b/lib/PayPal/Api/Details.php similarity index 54% rename from lib/PayPal/Api/AmountDetails.php rename to lib/PayPal/Api/Details.php index 96b8a9b..e13bf4c 100644 --- a/lib/PayPal/Api/AmountDetails.php +++ b/lib/PayPal/Api/Details.php @@ -1,76 +1,70 @@ -subtotal = $subtotal; - } - - /** - * Getter for subtotal - * @return string - */ - public function getSubtotal() { - return $this->subtotal; - } - - /** - * Setter for tax - * @param string $tax - */ - public function setTax($tax) { - $this->tax = $tax; - } - - /** - * Getter for tax - * @return string - */ - public function getTax() { - return $this->tax; - } - - /** - * Setter for shipping + * Amount being charged for shipping. * @param string $shipping - */ + */ public function setShipping($shipping) { $this->shipping = $shipping; - } - + } + /** - * Getter for shipping + * Amount being charged for shipping. * @return string - */ + */ public function getShipping() { return $this->shipping; } - + /** - * Setter for fee + * Sub-total (amount) of items being paid for. + * @param string $subtotal + */ + public function setSubtotal($subtotal) { + $this->subtotal = $subtotal; + } + + /** + * Sub-total (amount) of items being paid for. + * @return string + */ + public function getSubtotal() { + return $this->subtotal; + } + + /** + * Amount being charged as tax. + * @param string $tax + */ + public function setTax($tax) { + $this->tax = $tax; + } + + /** + * Amount being charged as tax. + * @return string + */ + public function getTax() { + return $this->tax; + } + + /** + * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment. * @param string $fee - */ + */ public function setFee($fee) { $this->fee = $fee; - } - + } + /** - * Getter for fee + * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment. * @return string - */ + */ public function getFee() { return $this->fee; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/FundingInstrument.php b/lib/PayPal/Api/FundingInstrument.php index 0379245..8728794 100644 --- a/lib/PayPal/Api/FundingInstrument.php +++ b/lib/PayPal/Api/FundingInstrument.php @@ -1,44 +1,38 @@ -credit_card = $credit_card; - } - + } + /** - * Getter for credit_card + * Credit Card information. * @return PayPal\Api\CreditCard - */ - public function getCredit_card() { + */ + public function getCreditCard() { return $this->credit_card; } - + /** - * Setter for credit_card_token + * Credit Card information. * @param PayPal\Api\CreditCardToken $credit_card_token - */ - public function setCredit_card_token($credit_card_token) { + */ + public function setCreditCardToken($credit_card_token) { $this->credit_card_token = $credit_card_token; - } - + } + /** - * Getter for credit_card_token + * Credit Card information. * @return PayPal\Api\CreditCardToken - */ - public function getCredit_card_token() { + */ + public function getCreditCardToken() { return $this->credit_card_token; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/HyperSchema.php b/lib/PayPal/Api/HyperSchema.php new file mode 100644 index 0000000..b3323e3 --- /dev/null +++ b/lib/PayPal/Api/HyperSchema.php @@ -0,0 +1,103 @@ +links = $links; + } + + /** + * + * @return PayPal\Api\Links + */ + public function getLinks() { + return $this->links; + } + + /** + * + * @param string $fragmentResolution + */ + public function setFragmentResolution($fragmentResolution) { + $this->fragmentResolution = $fragmentResolution; + } + + /** + * + * @return string + */ + public function getFragmentResolution() { + return $this->fragmentResolution; + } + + /** + * + * @param boolean $readonly + */ + public function setReadonly($readonly) { + $this->readonly = $readonly; + } + + /** + * + * @return boolean + */ + public function getReadonly() { + return $this->readonly; + } + + /** + * + * @param string $contentEncoding + */ + public function setContentEncoding($contentEncoding) { + $this->contentEncoding = $contentEncoding; + } + + /** + * + * @return string + */ + public function getContentEncoding() { + return $this->contentEncoding; + } + + /** + * + * @param string $pathStart + */ + public function setPathStart($pathStart) { + $this->pathStart = $pathStart; + } + + /** + * + * @return string + */ + public function getPathStart() { + return $this->pathStart; + } + + /** + * + * @param string $mediaType + */ + public function setMediaType($mediaType) { + $this->mediaType = $mediaType; + } + + /** + * + * @return string + */ + public function getMediaType() { + return $this->mediaType; + } + +} diff --git a/lib/PayPal/Api/Item.php b/lib/PayPal/Api/Item.php index 1e88ebb..5d41685 100644 --- a/lib/PayPal/Api/Item.php +++ b/lib/PayPal/Api/Item.php @@ -1,92 +1,86 @@ -name = $name; - } - - /** - * Getter for name - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * Setter for sku - * @param string $sku - */ - public function setSku($sku) { - $this->sku = $sku; - } - - /** - * Getter for sku - * @return string - */ - public function getSku() { - return $this->sku; - } - - /** - * Setter for price - * @param string $price - */ - public function setPrice($price) { - $this->price = $price; - } - - /** - * Getter for price - * @return string - */ - public function getPrice() { - return $this->price; - } - - /** - * Setter for currency - * @param string $currency - */ - public function setCurrency($currency) { - $this->currency = $currency; - } - - /** - * Getter for currency - * @return string - */ - public function getCurrency() { - return $this->currency; - } - - /** - * Setter for quantity + * Number of items. * @param string $quantity - */ + */ public function setQuantity($quantity) { $this->quantity = $quantity; - } - + } + /** - * Getter for quantity + * Number of items. * @return string - */ + */ public function getQuantity() { return $this->quantity; } - - -} \ No newline at end of file + + /** + * Name of the item. + * @param string $name + */ + public function setName($name) { + $this->name = $name; + } + + /** + * Name of the item. + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * Cost of the item. + * @param string $price + */ + public function setPrice($price) { + $this->price = $price; + } + + /** + * Cost of the item. + * @return string + */ + public function getPrice() { + return $this->price; + } + + /** + * 3-letter Currency Code + * @param string $currency + */ + public function setCurrency($currency) { + $this->currency = $currency; + } + + /** + * 3-letter Currency Code + * @return string + */ + public function getCurrency() { + return $this->currency; + } + + /** + * Number or code to identify the item in your catalog/records. + * @param string $sku + */ + public function setSku($sku) { + $this->sku = $sku; + } + + /** + * Number or code to identify the item in your catalog/records. + * @return string + */ + public function getSku() { + return $this->sku; + } + +} diff --git a/lib/PayPal/Api/ItemList.php b/lib/PayPal/Api/ItemList.php index 232856e..1181c0b 100644 --- a/lib/PayPal/Api/ItemList.php +++ b/lib/PayPal/Api/ItemList.php @@ -1,44 +1,39 @@ -items = $items; - } - + } + /** - * Getter for items + * List of items. * @return PayPal\Api\Item - */ + */ public function getItems() { return $this->items; } - + /** - * Setter for shipping_address + * Shipping address. * @param PayPal\Api\ShippingAddress $shipping_address - */ - public function setShipping_address($shipping_address) { + */ + public function setShippingAddress($shipping_address) { $this->shipping_address = $shipping_address; - } - + } + /** - * Getter for shipping_address + * Shipping address. * @return PayPal\Api\ShippingAddress - */ - public function getShipping_address() { + */ + public function getShippingAddress() { return $this->shipping_address; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Link.php b/lib/PayPal/Api/Link.php deleted file mode 100644 index 01ac708..0000000 --- a/lib/PayPal/Api/Link.php +++ /dev/null @@ -1,60 +0,0 @@ -href = $href; - } - - /** - * Getter for href - * @return string - */ - public function getHref() { - return $this->href; - } - - /** - * Setter for rel - * @param string $rel - */ - public function setRel($rel) { - $this->rel = $rel; - } - - /** - * Getter for rel - * @return string - */ - public function getRel() { - return $this->rel; - } - - /** - * Setter for method - * @param string $method - */ - public function setMethod($method) { - $this->method = $method; - } - - /** - * Getter for method - * @return string - */ - public function getMethod() { - return $this->method; - } - - -} \ No newline at end of file diff --git a/lib/PayPal/Api/Links.php b/lib/PayPal/Api/Links.php new file mode 100644 index 0000000..3f2408d --- /dev/null +++ b/lib/PayPal/Api/Links.php @@ -0,0 +1,102 @@ +href = $href; + } + + /** + * + * @return string + */ + public function getHref() { + return $this->href; + } + + /** + * + * @param string $rel + */ + public function setRel($rel) { + $this->rel = $rel; + } + + /** + * + * @return string + */ + public function getRel() { + return $this->rel; + } + + /** + * + * @param PayPal\Api\HyperSchema $targetSchema + */ + public function setTargetSchema($targetSchema) { + $this->targetSchema = $targetSchema; + } + + /** + * + * @return PayPal\Api\HyperSchema + */ + public function getTargetSchema() { + return $this->targetSchema; + } + + /** + * + * @param string $method + */ + public function setMethod($method) { + $this->method = $method; + } + + /** + * + * @return string + */ + public function getMethod() { + return $this->method; + } + + /** + * + * @param string $enctype + */ + public function setEnctype($enctype) { + $this->enctype = $enctype; + } + + /** + * + * @return string + */ + public function getEnctype() { + return $this->enctype; + } + + /** + * + * @param PayPal\Api\HyperSchema $schema + */ + public function setSchema($schema) { + $this->schema = $schema; + } + + /** + * + * @return PayPal\Api\HyperSchema + */ + public function getSchema() { + return $this->schema; + } + +} diff --git a/lib/PayPal/Api/Payee.php b/lib/PayPal/Api/Payee.php index eb33dea..18188b1 100644 --- a/lib/PayPal/Api/Payee.php +++ b/lib/PayPal/Api/Payee.php @@ -1,60 +1,54 @@ -merchant_id = $merchant_id; - } - - /** - * Getter for merchant_id - * @return string - */ - public function getMerchant_id() { - return $this->merchant_id; - } - - /** - * Setter for email + * 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 - */ + */ public function setEmail($email) { $this->email = $email; - } - + } + /** - * Getter for email + * 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. * @return string - */ + */ public function getEmail() { return $this->email; } - + /** - * Setter for phone + * Encrypted PayPal Account identifier for the Payee. + * @param string $merchant_id + */ + public function setMerchantId($merchant_id) { + $this->merchant_id = $merchant_id; + } + + /** + * Encrypted PayPal Account identifier for the Payee. + * @return string + */ + public function getMerchantId() { + return $this->merchant_id; + } + + /** + * Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number 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 $phone - */ + */ public function setPhone($phone) { $this->phone = $phone; - } - + } + /** - * Getter for phone + * Phone number (in E.123 format) associated with the Payee's PayPal Account. If the provided phont number 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. * @return string - */ + */ public function getPhone() { return $this->phone; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Payer.php b/lib/PayPal/Api/Payer.php index c1fe6f2..16d91e8 100644 --- a/lib/PayPal/Api/Payer.php +++ b/lib/PayPal/Api/Payer.php @@ -1,60 +1,55 @@ -payment_method = $payment_method; - } - + } + /** - * Getter for payment_method + * Payment method being used - PayPal Wallet payment or Direct Credit card. * @return string - */ - public function getPayment_method() { + */ + public function getPaymentMethod() { return $this->payment_method; } - + /** - * Setter for payer_info - * @param PayPal\Api\PayerInfo $payer_info - */ - public function setPayer_info($payer_info) { - $this->payer_info = $payer_info; - } - - /** - * Getter for payer_info - * @return PayPal\Api\PayerInfo - */ - public function getPayer_info() { - return $this->payer_info; - } - - /** - * Setter for funding_instruments + * 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 - */ - public function setFunding_instruments($funding_instruments) { + */ + public function setFundingInstruments($funding_instruments) { $this->funding_instruments = $funding_instruments; - } - + } + /** - * Getter for funding_instruments + * List of funding instruments from where the funds of the current payment come from. Typically a credit card. * @return PayPal\Api\FundingInstrument - */ - public function getFunding_instruments() { + */ + public function getFundingInstruments() { return $this->funding_instruments; } - - -} \ No newline at end of file + + /** + * 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 + */ + public function setPayerInfo($payer_info) { + $this->payer_info = $payer_info; + } + + /** + * 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 + */ + public function getPayerInfo() { + return $this->payer_info; + } + +} diff --git a/lib/PayPal/Api/PayerInfo.php b/lib/PayPal/Api/PayerInfo.php index fe1af5c..3c9ef9d 100644 --- a/lib/PayPal/Api/PayerInfo.php +++ b/lib/PayPal/Api/PayerInfo.php @@ -1,108 +1,102 @@ -email = $email; - } - + } + /** - * Getter for email + * Email address representing the Payer. * @return string - */ + */ public function getEmail() { return $this->email; } - + /** - * Setter for first_name + * First Name of the Payer from their PayPal Account. * @param string $first_name - */ - public function setFirst_name($first_name) { + */ + public function setFirstName($first_name) { $this->first_name = $first_name; - } - + } + /** - * Getter for first_name + * First Name of the Payer from their PayPal Account. * @return string - */ - public function getFirst_name() { + */ + public function getFirstName() { return $this->first_name; } - + /** - * Setter for last_name + * Last Name of the Payer from their PayPal Account. * @param string $last_name - */ - public function setLast_name($last_name) { + */ + public function setLastName($last_name) { $this->last_name = $last_name; - } - + } + /** - * Getter for last_name + * Last Name of the Payer from their PayPal Account. * @return string - */ - public function getLast_name() { + */ + public function getLastName() { return $this->last_name; } - + /** - * Setter for payer_id + * PayPal assigned Payer ID. * @param string $payer_id - */ - public function setPayer_id($payer_id) { + */ + public function setPayerId($payer_id) { $this->payer_id = $payer_id; - } - + } + /** - * Getter for payer_id + * PayPal assigned Payer ID. * @return string - */ - public function getPayer_id() { + */ + public function getPayerId() { return $this->payer_id; } - + /** - * Setter for shipping_address - * @param PayPal\Api\Address $shipping_address - */ - public function setShipping_address($shipping_address) { - $this->shipping_address = $shipping_address; - } - - /** - * Getter for shipping_address - * @return PayPal\Api\Address - */ - public function getShipping_address() { - return $this->shipping_address; - } - - /** - * Setter for phone + * Phone number representing the Payer. * @param string $phone - */ + */ public function setPhone($phone) { $this->phone = $phone; - } - + } + /** - * Getter for phone + * Phone number representing the Payer. * @return string - */ + */ public function getPhone() { return $this->phone; } - - -} \ No newline at end of file + + /** + * Shipping address of the Payer from their PayPal Account. + * @param PayPal\Api\Address $shipping_address + */ + public function setShippingAddress($shipping_address) { + $this->shipping_address = $shipping_address; + } + + /** + * Shipping address of the Payer from their PayPal Account. + * @return PayPal\Api\Address + */ + public function getShippingAddress() { + return $this->shipping_address; + } + +} diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index a2a674d..eaef50b 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -1,271 +1,226 @@ -id = $id; - } - + } + /** - * Getter for id + * Identifier of the payment resource created. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for create_time + * Time the resource was created. * @param string $create_time - */ - public function setCreate_time($create_time) { + */ + public function setCreateTime($create_time) { $this->create_time = $create_time; - } - + } + /** - * Getter for create_time + * Time the resource was created. * @return string - */ - public function getCreate_time() { + */ + public function getCreateTime() { return $this->create_time; } - + /** - * Setter for update_time + * Time the resource was last updated. * @param string $update_time - */ - public function setUpdate_time($update_time) { + */ + public function setUpdateTime($update_time) { $this->update_time = $update_time; - } - + } + /** - * Getter for update_time + * Time the resource was last updated. * @return string - */ - public function getUpdate_time() { + */ + public function getUpdateTime() { return $this->update_time; } - + /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for intent + * Intent of the payment - Sale or Authorization or Order. * @param string $intent - */ + */ public function setIntent($intent) { $this->intent = $intent; - } - + } + /** - * Getter for intent + * Intent of the payment - Sale or Authorization or Order. * @return string - */ + */ public function getIntent() { return $this->intent; } - + /** - * Setter for payer + * Source of the funds for this payment represented by a PayPal account or a direct credit card. * @param PayPal\Api\Payer $payer - */ + */ public function setPayer($payer) { $this->payer = $payer; - } - + } + /** - * Getter for payer + * Source of the funds for this payment represented by a PayPal account or a direct credit card. * @return PayPal\Api\Payer - */ + */ public function getPayer() { return $this->payer; } - + /** - * Setter for transactions + * A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee + * @array * @param PayPal\Api\Transaction $transactions - */ + */ public function setTransactions($transactions) { $this->transactions = $transactions; - } - + } + /** - * Getter for transactions + * A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee * @return PayPal\Api\Transaction - */ + */ public function getTransactions() { return $this->transactions; } - + /** - * Setter for redirect_urls - * @param PayPal\Api\RedirectUrls $redirect_urls - */ - public function setRedirect_urls($redirect_urls) { - $this->redirect_urls = $redirect_urls; + * state of the payment + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + + /** + * state of the payment + * @return string + */ + public function getState() { + return $this->state; } - + /** - * Getter for redirect_urls + * 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 + */ + public function setRedirectUrls($redirect_urls) { + $this->redirect_urls = $redirect_urls; + } + + /** + * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. * @return PayPal\Api\RedirectUrls - */ - public function getRedirect_urls() { + */ + public function getRedirectUrls() { return $this->redirect_urls; } - + /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + - - - /** - * @path /v1/payments/payment - * @method GET - * @param array $params - * array containing the query strings with the - * following values as keys: - * count, - * start_id, - * start_index, - * start_time, - * end_time, - * payee_id, - * sort_by, - * sort_order, - * All other keys in the map are ignored by the SDK - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public static function all($params, $apiContext=null) { - $payLoad = ""; - $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1, ); - if($apiContext == null) { + public function create($apiContext = null) { + $payLoad = $this->toJSON(); + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $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); - return $ret; - - } - - /** - * @path /v1/payments/payment - * @method POST - - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public function create( $apiContext=null) { - $payLoad = $this->toJSON(); - if($apiContext == null) { - $apiContext = new ApiContext(self::$credential); - } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/payment", - "POST", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad); $this->fromJson($json); - return $this; - } - - /** - * @path /v1/payments/payment/:payment-id - * @method GET - * @param string $paymentid - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public static function get( $paymentid, $apiContext=null) { - if (($paymentid == null) || (strlen($paymentid) <= 0)) { - throw new \InvalidArgumentException("paymentid cannot be null or empty"); + return $this; + } + + public static function get($paymentId, $apiContext = null) { + if (($paymentId == null) || (strlen($paymentId) <= 0)) { + throw new \InvalidArgumentException("paymentId cannot be null or empty"); } $payLoad = ""; - if($apiContext == null) { + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/payment/$paymentid", - "GET", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad); $ret = new Payment(); $ret->fromJson($json); return $ret; - - } - - /** - * @path /v1/payments/payment/:payment-id/execute - * @method POST - * @param PaymentExecution $payment_execution - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public function execute( $payment_execution, $apiContext=null) { - if ($payment_execution == null) { - throw new \InvalidArgumentException("payment_execution cannot be null"); - } + } + + public function execute($paymentExecution, $apiContext = null) { if ($this->getId() == null) { throw new \InvalidArgumentException("Id cannot be null"); } - $payLoad = $payment_execution->toJSON(); - if($apiContext == null) { + if (($paymentExecution == null)) { + throw new \InvalidArgumentException("paymentExecution cannot be null or empty"); + } + $payLoad = $paymentExecution->toJSON(); + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/payment/{$this->getId()}/execute", - "POST", $payLoad); - $this->fromJson($json); - return $this; - } - + $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); + return $ret; + } + public static function all($params, $apiContext = null) { + if (($params == null)) { + throw new \InvalidArgumentException("params cannot be null or empty"); + } + $payLoad = ""; + $allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1, ); + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + $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); + return $ret; + } } diff --git a/lib/PayPal/Api/PaymentExecution.php b/lib/PayPal/Api/PaymentExecution.php index 4de31a5..785d1e6 100644 --- a/lib/PayPal/Api/PaymentExecution.php +++ b/lib/PayPal/Api/PaymentExecution.php @@ -1,44 +1,39 @@ -payer_id = $payer_id; - } - + } + /** - * Getter for payer_id + * PayPal assigned Payer ID returned in the approval return url. * @return string - */ - public function getPayer_id() { + */ + public function getPayerId() { return $this->payer_id; } - + /** - * Setter for transactions - * @param PayPal\Api\Amount $transactions - */ + * If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element. + * @array + * @param PayPal\Api\Transactions $transactions + */ public function setTransactions($transactions) { $this->transactions = $transactions; - } - + } + /** - * Getter for transactions - * @return PayPal\Api\Amount - */ + * If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element. + * @return PayPal\Api\Transactions + */ public function getTransactions() { return $this->transactions; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/PaymentHistory.php b/lib/PayPal/Api/PaymentHistory.php index 98735de..1b3f1df 100644 --- a/lib/PayPal/Api/PaymentHistory.php +++ b/lib/PayPal/Api/PaymentHistory.php @@ -1,60 +1,55 @@ -payments = $payments; - } - + } + /** - * Getter for payments + * A list of Payment resources * @return PayPal\Api\Payment - */ + */ public function getPayments() { return $this->payments; } - + /** - * Setter for count + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * @param integer $count - */ + */ public function setCount($count) { $this->count = $count; - } - + } + /** - * Getter for count + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. * @return integer - */ + */ public function getCount() { return $this->count; } - + /** - * Setter for next_id + * Identifier of the next element to get the next range of results. * @param string $next_id - */ - public function setNext_id($next_id) { + */ + public function setNextId($next_id) { $this->next_id = $next_id; - } - + } + /** - * Getter for next_id + * Identifier of the next element to get the next range of results. * @return string - */ - public function getNext_id() { + */ + public function getNextId() { return $this->next_id; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/RedirectUrls.php b/lib/PayPal/Api/RedirectUrls.php index 99ffb04..902f7c7 100644 --- a/lib/PayPal/Api/RedirectUrls.php +++ b/lib/PayPal/Api/RedirectUrls.php @@ -1,44 +1,38 @@ -return_url = $return_url; - } - + } + /** - * Getter for return_url + * Url where the payer would be redirected to after approving the payment. * @return string - */ - public function getReturn_url() { + */ + public function getReturnUrl() { return $this->return_url; } - + /** - * Setter for cancel_url + * Url where the payer would be redirected to after canceling the payment. * @param string $cancel_url - */ - public function setCancel_url($cancel_url) { + */ + public function setCancelUrl($cancel_url) { $this->cancel_url = $cancel_url; - } - + } + /** - * Getter for cancel_url + * Url where the payer would be redirected to after canceling the payment. * @return string - */ - public function getCancel_url() { + */ + public function getCancelUrl() { return $this->cancel_url; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Refund.php b/lib/PayPal/Api/Refund.php index ecff7b2..8728688 100644 --- a/lib/PayPal/Api/Refund.php +++ b/lib/PayPal/Api/Refund.php @@ -1,210 +1,164 @@ -id = $id; - } - + } + /** - * Getter for id + * Identifier of the refund transaction. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for create_time + * Time the resource was created. * @param string $create_time - */ - public function setCreate_time($create_time) { + */ + public function setCreateTime($create_time) { $this->create_time = $create_time; - } - + } + /** - * Getter for create_time + * Time the resource was created. * @return string - */ - public function getCreate_time() { + */ + public function getCreateTime() { return $this->create_time; } - + /** - * Setter for update_time - * @param string $update_time - */ - public function setUpdate_time($update_time) { - $this->update_time = $update_time; - } - - /** - * Getter for update_time - * @return string - */ - public function getUpdate_time() { - return $this->update_time; - } - - /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for amount + * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund. * @param PayPal\Api\Amount $amount - */ + */ public function setAmount($amount) { $this->amount = $amount; - } - + } + /** - * Getter for amount + * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund. * @return PayPal\Api\Amount - */ + */ public function getAmount() { return $this->amount; } - + /** - * Setter for sale_id - * @param string $sale_id - */ - public function setSale_id($sale_id) { - $this->sale_id = $sale_id; - } - + * State of the refund transaction. + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + /** - * Getter for sale_id + * State of the refund transaction. * @return string - */ - public function getSale_id() { + */ + public function getState() { + return $this->state; + } + + /** + * ID of the Sale transaction being refunded. + * @param string $sale_id + */ + public function setSaleId($sale_id) { + $this->sale_id = $sale_id; + } + + /** + * ID of the Sale transaction being refunded. + * @return string + */ + public function getSaleId() { return $this->sale_id; } - + /** - * Setter for capture_id + * ID of the Capture transaction being refunded. * @param string $capture_id - */ - public function setCapture_id($capture_id) { + */ + public function setCaptureId($capture_id) { $this->capture_id = $capture_id; - } - + } + /** - * Getter for capture_id + * ID of the Capture transaction being refunded. * @return string - */ - public function getCapture_id() { + */ + public function getCaptureId() { return $this->capture_id; } - + /** - * Setter for parent_payment + * ID of the Payment resource that this transaction is based on. * @param string $parent_payment - */ - public function setParent_payment($parent_payment) { + */ + public function setParentPayment($parent_payment) { $this->parent_payment = $parent_payment; - } - + } + /** - * Getter for parent_payment + * ID of the Payment resource that this transaction is based on. * @return string - */ - public function getParent_payment() { + */ + public function getParentPayment() { return $this->parent_payment; } - + /** - * Setter for description - * @param string $description - */ - public function setDescription($description) { - $this->description = $description; - } - - /** - * Getter for description - * @return string - */ - public function getDescription() { - return $this->description; - } - - /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + - - - /** - * @path /v1/payments/refund/:refund-id - * @method GET - * @param string $refundid - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public static function get( $refundid, $apiContext=null) { - if (($refundid == null) || (strlen($refundid) <= 0)) { - throw new \InvalidArgumentException("refundid cannot be null or empty"); + public static function get($refundId, $apiContext = null) { + if (($refundId == null) || (strlen($refundId) <= 0)) { + throw new \InvalidArgumentException("refundId cannot be null or empty"); } $payLoad = ""; - if($apiContext == null) { + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/refund/$refundid", - "GET", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad); $ret = new Refund(); $ret->fromJson($json); return $ret; - - } - - + } } diff --git a/lib/PayPal/Api/SubTransaction.php b/lib/PayPal/Api/RelatedResources.php similarity index 72% rename from lib/PayPal/Api/SubTransaction.php rename to lib/PayPal/Api/RelatedResources.php index 7afc5c3..f8e4fef 100644 --- a/lib/PayPal/Api/SubTransaction.php +++ b/lib/PayPal/Api/RelatedResources.php @@ -1,76 +1,70 @@ -sale = $sale; - } - + } + /** - * Getter for sale + * A sale transaction * @return PayPal\Api\Sale - */ + */ public function getSale() { return $this->sale; } - + /** - * Setter for authorization + * An authorization transaction * @param PayPal\Api\Authorization $authorization - */ + */ public function setAuthorization($authorization) { $this->authorization = $authorization; - } - + } + /** - * Getter for authorization + * An authorization transaction * @return PayPal\Api\Authorization - */ + */ public function getAuthorization() { return $this->authorization; } - + /** - * Setter for refund - * @param PayPal\Api\Refund $refund - */ - public function setRefund($refund) { - $this->refund = $refund; - } - - /** - * Getter for refund - * @return PayPal\Api\Refund - */ - public function getRefund() { - return $this->refund; - } - - /** - * Setter for capture + * A capture transaction * @param PayPal\Api\Capture $capture - */ + */ public function setCapture($capture) { $this->capture = $capture; - } - + } + /** - * Getter for capture + * A capture transaction * @return PayPal\Api\Capture - */ + */ public function getCapture() { return $this->capture; } - - -} \ No newline at end of file + + /** + * A refund transaction + * @param PayPal\Api\Refund $refund + */ + public function setRefund($refund) { + $this->refund = $refund; + } + + /** + * A refund transaction + * @return PayPal\Api\Refund + */ + public function getRefund() { + return $this->refund; + } + +} diff --git a/lib/PayPal/Api/Resource.php b/lib/PayPal/Api/Resource.php deleted file mode 100644 index 725b01c..0000000 --- a/lib/PayPal/Api/Resource.php +++ /dev/null @@ -1,11 +0,0 @@ -id = $id; - } - + } + /** - * Getter for id + * Identifier of the authorization transaction. * @return string - */ + */ public function getId() { return $this->id; } - + /** - * Setter for create_time + * Time the resource was created. * @param string $create_time - */ - public function setCreate_time($create_time) { + */ + public function setCreateTime($create_time) { $this->create_time = $create_time; - } - + } + /** - * Getter for create_time + * Time the resource was created. * @return string - */ - public function getCreate_time() { + */ + public function getCreateTime() { return $this->create_time; } - + /** - * Setter for update_time + * Time the resource was last updated. * @param string $update_time - */ - public function setUpdate_time($update_time) { + */ + public function setUpdateTime($update_time) { $this->update_time = $update_time; - } - + } + /** - * Getter for update_time + * Time the resource was last updated. * @return string - */ - public function getUpdate_time() { + */ + public function getUpdateTime() { return $this->update_time; } - + /** - * Setter for state - * @param string $state - */ - public function setState($state) { - $this->state = $state; - } - - /** - * Getter for state - * @return string - */ - public function getState() { - return $this->state; - } - - /** - * Setter for amount + * Amount being collected. * @param PayPal\Api\Amount $amount - */ + */ public function setAmount($amount) { $this->amount = $amount; - } - + } + /** - * Getter for amount + * Amount being collected. * @return PayPal\Api\Amount - */ + */ public function getAmount() { return $this->amount; } - + /** - * Setter for parent_payment - * @param string $parent_payment - */ - public function setParent_payment($parent_payment) { - $this->parent_payment = $parent_payment; - } - + * State of the sale transaction. + * @param string $state + */ + public function setState($state) { + $this->state = $state; + } + /** - * Getter for parent_payment + * State of the sale transaction. * @return string - */ - public function getParent_payment() { + */ + public function getState() { + return $this->state; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @param string $parent_payment + */ + public function setParentPayment($parent_payment) { + $this->parent_payment = $parent_payment; + } + + /** + * ID of the Payment resource that this transaction is based on. + * @return string + */ + public function getParentPayment() { return $this->parent_payment; } - + /** - * Setter for links - * @param PayPal\Api\Link $links - */ + * + * @array + * @param PayPal\Api\Links $links + */ public function setLinks($links) { $this->links = $links; - } - + } + /** - * Getter for links - * @return PayPal\Api\Link - */ + * + * @return PayPal\Api\Links + */ public function getLinks() { return $this->links; } + - - - /** - * @path /v1/payments/sale/:sale-id - * @method GET - * @param string $saleid - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public static function get( $saleid, $apiContext=null) { - if (($saleid == null) || (strlen($saleid) <= 0)) { - throw new \InvalidArgumentException("saleid cannot be null or empty"); + public static function get($saleId, $apiContext = null) { + if (($saleId == null) || (strlen($saleId) <= 0)) { + throw new \InvalidArgumentException("saleId cannot be null or empty"); } $payLoad = ""; - if($apiContext == null) { + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/sale/$saleid", - "GET", $payLoad); + $call = new \PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad); $ret = new Sale(); $ret->fromJson($json); return $ret; - - } - - /** - * @path /v1/payments/sale/:sale-id/refund - * @method POST - * @param Refund $refund - * @param PayPal\Rest\ApiContext $apiContext optional - */ - public function refund( $refund, $apiContext=null) { - if ($refund == null) { - throw new \InvalidArgumentException("refund cannot be null"); - } + } + + public function refund($refund, $apiContext = null) { if ($this->getId() == null) { throw new \InvalidArgumentException("Id cannot be null"); } - $payLoad = $refund->toJSON(); - if($apiContext == null) { + if (($refund == null)) { + throw new \InvalidArgumentException("refund cannot be null or empty"); + } + $payLoad = $refund->toJSON(); + if ($apiContext == null) { $apiContext = new ApiContext(self::$credential); } - $call = new \PPRestCall($apiContext); - $json = $call->execute( array('PayPal\Rest\RestHandler'), - "/v1/payments/sale/{$this->getId()}/refund", - "POST", $payLoad); - $this->fromJson($json); - return $this; - } - - + $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); + return $ret; + } } diff --git a/lib/PayPal/Api/ShippingAddress.php b/lib/PayPal/Api/ShippingAddress.php index 80252b6..dc42e7f 100644 --- a/lib/PayPal/Api/ShippingAddress.php +++ b/lib/PayPal/Api/ShippingAddress.php @@ -1,28 +1,22 @@ -recipient_name = $recipient_name; - } - + } + /** - * Getter for recipient_name + * Name of the recipient at this address. * @return string - */ - public function getRecipient_name() { + */ + public function getRecipientName() { return $this->recipient_name; } - - -} \ No newline at end of file + +} diff --git a/lib/PayPal/Api/Transaction.php b/lib/PayPal/Api/Transaction.php index d3749d0..dd64b00 100644 --- a/lib/PayPal/Api/Transaction.php +++ b/lib/PayPal/Api/Transaction.php @@ -1,92 +1,104 @@ -amount = $amount; - } - + } + /** - * Getter for amount + * Amount being collected. * @return PayPal\Api\Amount - */ + */ public function getAmount() { return $this->amount; } - + /** - * Setter for payee + * Recepient of the funds in this transaction. * @param PayPal\Api\Payee $payee - */ + */ public function setPayee($payee) { $this->payee = $payee; - } - + } + /** - * Getter for payee + * Recepient of the funds in this transaction. * @return PayPal\Api\Payee - */ + */ public function getPayee() { return $this->payee; } - + /** - * Setter for description + * Description of what is being paid for. * @param string $description - */ + */ public function setDescription($description) { $this->description = $description; - } - + } + /** - * Getter for description + * Description of what is being paid for. * @return string - */ + */ public function getDescription() { return $this->description; } - + /** - * Setter for item_list + * List of items being paid for. * @param PayPal\Api\ItemList $item_list - */ - public function setItem_list($item_list) { + */ + public function setItemList($item_list) { $this->item_list = $item_list; - } - + } + /** - * Getter for item_list + * List of items being paid for. * @return PayPal\Api\ItemList - */ - public function getItem_list() { + */ + public function getItemList() { return $this->item_list; } - + /** - * Setter for related_resources - * @param PayPal\Api\SubTransaction $related_resources - */ - public function setRelated_resources($related_resources) { + * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. + * @array + * @param PayPal\Api\RelatedResources $related_resources + */ + public function setRelatedResources($related_resources) { $this->related_resources = $related_resources; - } - + } + /** - * Getter for related_resources - * @return PayPal\Api\SubTransaction - */ - public function getRelated_resources() { + * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment. + * @return PayPal\Api\RelatedResources + */ + public function getRelatedResources() { return $this->related_resources; } - - -} \ No newline at end of file + + /** + * Additional transactions for complex payment (Parallel and Chained) scenarios. + * @array + * @param PayPal\Api\self $transactions + */ + public function setTransactions($transactions) { + $this->transactions = $transactions; + } + + /** + * Additional transactions for complex payment (Parallel and Chained) scenarios. + * @return PayPal\Api\self + */ + public function getTransactions() { + return $this->transactions; + } + +} diff --git a/lib/PayPal/Api/Transactions.php b/lib/PayPal/Api/Transactions.php new file mode 100644 index 0000000..3a01e14 --- /dev/null +++ b/lib/PayPal/Api/Transactions.php @@ -0,0 +1,22 @@ +amount = $amount; + } + + /** + * Amount being collected. + * @return PayPal\Api\Amount + */ + public function getAmount() { + return $this->amount; + } + +}