updated stubs

This commit is contained in:
Ganesh Hegde
2013-05-27 11:53:45 +05:30
parent 5b32783208
commit 11f91adee4
28 changed files with 1744 additions and 1567 deletions

View File

@@ -1,140 +1,118 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Address extends Resource {
class Address extends \PPModel {
/** /**
* Setter for line1 * Line 1 of the Address (eg. number, street, etc).
* @param string $line1 * @param string $line1
*/ */
public function setLine1($line1) { public function setLine1($line1) {
$this->line1 = $line1; $this->line1 = $line1;
} }
/** /**
* Getter for line1 * Line 1 of the Address (eg. number, street, etc).
* @return string * @return string
*/ */
public function getLine1() { public function getLine1() {
return $this->line1; return $this->line1;
} }
/** /**
* Setter for line2 * Optional line 2 of the Address (eg. suite, apt #, etc.).
* @param string $line2 * @param string $line2
*/ */
public function setLine2($line2) { public function setLine2($line2) {
$this->line2 = $line2; $this->line2 = $line2;
} }
/** /**
* Getter for line2 * Optional line 2 of the Address (eg. suite, apt #, etc.).
* @return string * @return string
*/ */
public function getLine2() { public function getLine2() {
return $this->line2; return $this->line2;
} }
/** /**
* Setter for city * City name.
* @param string $city * @param string $city
*/ */
public function setCity($city) { public function setCity($city) {
$this->city = $city; $this->city = $city;
} }
/** /**
* Getter for city * City name.
* @return string * @return string
*/ */
public function getCity() { public function getCity() {
return $this->city; 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 * @param string $state
*/ */
public function setState($state) { public function setState($state) {
$this->state = $state; $this->state = $state;
} }
/** /**
* Getter for state * 2 letter code for US states, and the equivalent for other countries.
* @return string * @return string
*/ */
public function getState() { public function getState() {
return $this->state; return $this->state;
} }
/** /**
* Setter for postal_code * Phone number in E.123 format.
* @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
* @param string $phone * @param string $phone
*/ */
public function setPhone($phone) { public function setPhone($phone) {
$this->phone = $phone; $this->phone = $phone;
} }
/** /**
* Getter for phone * Phone number in E.123 format.
* @return string * @return string
*/ */
public function getPhone() { public function getPhone() {
return $this->phone; return $this->phone;
} }
}
}

View File

@@ -1,60 +1,54 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Amount extends Resource {
class Amount extends \PPModel {
/** /**
* Setter for total * 3 letter currency code
* @param string $total
*/
public function setTotal($total) {
$this->total = $total;
}
/**
* Getter for total
* @return string
*/
public function getTotal() {
return $this->total;
}
/**
* Setter for currency
* @param string $currency * @param string $currency
*/ */
public function setCurrency($currency) { public function setCurrency($currency) {
$this->currency = $currency; $this->currency = $currency;
} }
/** /**
* Getter for currency * 3 letter currency code
* @return string * @return string
*/ */
public function getCurrency() { public function getCurrency() {
return $this->currency; return $this->currency;
} }
/** /**
* Setter for 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 PayPal\Api\AmountDetails $details * @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) { public function setDetails($details) {
$this->details = $details; $this->details = $details;
} }
/** /**
* Getter for details * Additional details of the payment amount.
* @return PayPal\Api\AmountDetails * @return PayPal\Api\Details
*/ */
public function getDetails() { public function getDetails() {
return $this->details; return $this->details;
} }
}
}

View File

@@ -1,124 +1,211 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/** use PayPal\Rest\IResource;
* use PayPal\Rest\Call;
*/ use PayPal\Rest\ApiContext;
class Authorization extends Resource {
class Authorization extends \PPModel implements IResource {
private static $credential;
/** /**
* Setter for id *
* @deprected. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
}
/**
* Identifier of the authorization transaction.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * Identifier of the authorization transaction.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for create_time * Time the resource was created.
* @param string $create_time * @param string $create_time
*/ */
public function setCreate_time($create_time) { public function setCreateTime($create_time) {
$this->create_time = $create_time; $this->create_time = $create_time;
} }
/** /**
* Getter for create_time * Time the resource was created.
* @return string * @return string
*/ */
public function getCreate_time() { public function getCreateTime() {
return $this->create_time; return $this->create_time;
} }
/** /**
* Setter for update_time * Time the resource was last updated.
* @param string $update_time * @param string $update_time
*/ */
public function setUpdate_time($update_time) { public function setUpdateTime($update_time) {
$this->update_time = $update_time; $this->update_time = $update_time;
} }
/** /**
* Getter for update_time * Time the resource was last updated.
* @return string * @return string
*/ */
public function getUpdate_time() { public function getUpdateTime() {
return $this->update_time; return $this->update_time;
} }
/** /**
* Setter for state * Amount being authorized for.
* @param string $state
*/
public function setState($state) {
$this->state = $state;
}
/**
* Getter for state
* @return string
*/
public function getState() {
return $this->state;
}
/**
* Setter for amount
* @param PayPal\Api\Amount $amount * @param PayPal\Api\Amount $amount
*/ */
public function setAmount($amount) { public function setAmount($amount) {
$this->amount = $amount; $this->amount = $amount;
} }
/** /**
* Getter for amount * Amount being authorized for.
* @return PayPal\Api\Amount * @return PayPal\Api\Amount
*/ */
public function getAmount() { public function getAmount() {
return $this->amount; return $this->amount;
} }
/** /**
* Setter for parent_payment * State of the authorization transaction.
* @param string $parent_payment * @param string $state
*/ */
public function setParent_payment($parent_payment) { public function setState($state) {
$this->parent_payment = $parent_payment; $this->state = $state;
} }
/** /**
* Getter for parent_payment * State of the authorization transaction.
* @return string * @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; return $this->parent_payment;
} }
/** /**
* Setter for links * Date/Time until which funds may be captured against this resource.
* @param PayPal\Api\Link $links * @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) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; 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;
}
} 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;
}
}

View File

@@ -1,156 +1,182 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/** use PayPal\Rest\IResource;
* use PayPal\Rest\Call;
*/ use PayPal\Rest\ApiContext;
class Capture extends Resource {
class Capture extends \PPModel implements IResource {
private static $credential;
/** /**
* Setter for id *
* @deprected. Pass ApiContext to create/get methods instead
*/
public static function setCredential($credential) {
self::$credential = $credential;
}
/**
* Identifier of the Capture transaction.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * Identifier of the Capture transaction.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for create_time * Time the resource was created.
* @param string $create_time * @param string $create_time
*/ */
public function setCreate_time($create_time) { public function setCreateTime($create_time) {
$this->create_time = $create_time; $this->create_time = $create_time;
} }
/** /**
* Getter for create_time * Time the resource was created.
* @return string * @return string
*/ */
public function getCreate_time() { public function getCreateTime() {
return $this->create_time; return $this->create_time;
} }
/** /**
* Setter for update_time * Time the resource was last updated.
* @param string $update_time * @param string $update_time
*/ */
public function setUpdate_time($update_time) { public function setUpdateTime($update_time) {
$this->update_time = $update_time; $this->update_time = $update_time;
} }
/** /**
* Getter for update_time * Time the resource was last updated.
* @return string * @return string
*/ */
public function getUpdate_time() { public function getUpdateTime() {
return $this->update_time; return $this->update_time;
} }
/** /**
* Setter for state * 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 string $state
*/
public function setState($state) {
$this->state = $state;
}
/**
* Getter for state
* @return string
*/
public function getState() {
return $this->state;
}
/**
* Setter for amount
* @param PayPal\Api\Amount $amount * @param PayPal\Api\Amount $amount
*/ */
public function setAmount($amount) { public function setAmount($amount) {
$this->amount = $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 * @return PayPal\Api\Amount
*/ */
public function getAmount() { public function getAmount() {
return $this->amount; return $this->amount;
} }
/** /**
* Setter for 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 string $parent_payment * @param boolean $is_final_capture
*/ */
public function setParent_payment($parent_payment) { public function setIsFinalCapture($is_final_capture) {
$this->parent_payment = $parent_payment; $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 * @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; return $this->parent_payment;
} }
/** /**
* Setter for authorization_id *
* @param string $authorization_id * @array
*/ * @param PayPal\Api\Links $links
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
*/
public function setLinks($links) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; 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;
}
} 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;
}
}

View File

@@ -1,277 +1,268 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Rest\IResource; use PayPal\Rest\IResource;
use PayPal\Rest\Call; use PayPal\Rest\Call;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
/** class CreditCard extends \PPModel implements IResource {
*
*/
class CreditCard extends Resource implements IResource {
private static $credential; private static $credential;
/** /**
* *
* @deprected. Pass ApiContext to create/get methods instead * @deprected. Pass ApiContext to create/get methods instead
*/ */
public static function setCredential($credential) { public static function setCredential($credential) {
self::$credential = $credential; self::$credential = $credential;
} }
/** /**
* Setter for id * ID of the credit card being saved for later use.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * ID of the credit card being saved for later use.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for valid_until * Card number.
* @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
* @param string $number * @param string $number
*/ */
public function setNumber($number) { public function setNumber($number) {
$this->number = $number; $this->number = $number;
} }
/** /**
* Getter for number * Card number.
* @return string * @return string
*/ */
public function getNumber() { public function getNumber() {
return $this->number; return $this->number;
} }
/** /**
* Setter for expire_month * Type of the Card (eg. Visa, Mastercard, etc.).
* @param string $expire_month * @param string $type
*/ */
public function setExpire_month($expire_month) { public function setType($type) {
$this->expire_month = $expire_month; $this->type = $type;
} }
/** /**
* Getter for expire_month * Type of the Card (eg. Visa, Mastercard, etc.).
* @return string * @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; return $this->expire_month;
} }
/** /**
* Setter for expire_year * 4 digit card expiry year
* @param string $expire_year * @param integer $expire_year
*/ */
public function setExpire_year($expire_year) { public function setExpireYear($expire_year) {
$this->expire_year = $expire_year; $this->expire_year = $expire_year;
} }
/** /**
* Getter for expire_year * 4 digit card expiry year
* @return string * @return integer
*/ */
public function getExpire_year() { public function getExpireYear() {
return $this->expire_year; 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 * @param string $cvv2
*/ */
public function setCvv2($cvv2) { public function setCvv2($cvv2) {
$this->cvv2 = $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 * @return string
*/ */
public function getCvv2() { public function getCvv2() {
return $this->cvv2; return $this->cvv2;
} }
/** /**
* Setter for first_name * Card holder's first name.
* @param string $first_name * @param string $first_name
*/ */
public function setFirst_name($first_name) { public function setFirstName($first_name) {
$this->first_name = $first_name; $this->first_name = $first_name;
} }
/** /**
* Getter for first_name * Card holder's first name.
* @return string * @return string
*/ */
public function getFirst_name() { public function getFirstName() {
return $this->first_name; return $this->first_name;
} }
/** /**
* Setter for last_name * Card holder's last name.
* @param string $last_name * @param string $last_name
*/ */
public function setLast_name($last_name) { public function setLastName($last_name) {
$this->last_name = $last_name; $this->last_name = $last_name;
} }
/** /**
* Getter for last_name * Card holder's last name.
* @return string * @return string
*/ */
public function getLast_name() { public function getLastName() {
return $this->last_name; return $this->last_name;
} }
/** /**
* Setter for billing_address * Billing Address associated with this card.
* @param PayPal\Api\Address $billing_address * @param PayPal\Api\Address $billing_address
*/ */
public function setBilling_address($billing_address) { public function setBillingAddress($billing_address) {
$this->billing_address = $billing_address; $this->billing_address = $billing_address;
} }
/** /**
* Getter for billing_address * Billing Address associated with this card.
* @return PayPal\Api\Address * @return PayPal\Api\Address
*/ */
public function getBilling_address() { public function getBillingAddress() {
return $this->billing_address; return $this->billing_address;
} }
/** /**
* Setter for 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 PayPal\Api\Link $links * @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) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; return $this->links;
} }
public function create($apiContext = null) {
$payLoad = $this->toJSON();
/** if ($apiContext == null) {
* @path /v1/vault/credit-card
* @method POST
* @param PayPal\Rest\ApiContext $apiContext optional
*/
public function create( $apiContext=null) {
$payLoad = $this->toJSON();
if($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card", "POST", $payLoad);
"/v1/vault/credit-card",
"POST", $payLoad);
$this->fromJson($json); $this->fromJson($json);
return $this; return $this;
} }
/** public static function get($creditCardId, $apiContext = null) {
* @path /v1/vault/credit-card/:credit-card-id if (($creditCardId == null) || (strlen($creditCardId) <= 0)) {
* @method GET throw new \InvalidArgumentException("creditCardId cannot be null or empty");
* @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");
} }
$payLoad = ""; $payLoad = "";
if($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/vault/credit-card/$creditCardId", "GET", $payLoad);
"/v1/vault/credit-card/$creditcardid",
"GET", $payLoad);
$ret = new CreditCard(); $ret = new CreditCard();
$ret->fromJson($json); $ret->fromJson($json);
return $ret; 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;
}
} }

View File

@@ -0,0 +1,55 @@
<?php
namespace PayPal\Api;
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;
}
/**
* 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;
}
}

View File

@@ -1,44 +1,102 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class CreditCardToken extends Resource {
class CreditCardToken extends \PPModel {
/** /**
* Setter for credit_card_id * ID of a previously saved Credit Card resource using /vault/credit-card API.
* @param string $credit_card_id * @param string $credit_card_id
*/ */
public function setCredit_card_id($credit_card_id) { public function setCreditCardId($credit_card_id) {
$this->credit_card_id = $credit_card_id; $this->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 * @return string
*/ */
public function getCredit_card_id() { public function getCreditCardId() {
return $this->credit_card_id; 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 * @param string $payer_id
*/ */
public function setPayer_id($payer_id) { public function setPayerId($payer_id) {
$this->payer_id = $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 * @return string
*/ */
public function getPayer_id() { public function getPayerId() {
return $this->payer_id; return $this->payer_id;
} }
/**
} * 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;
}
}

View File

@@ -1,76 +1,70 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class AmountDetails extends Resource {
class Details extends \PPModel {
/** /**
* Setter for subtotal * Amount being charged for shipping.
* @param string $subtotal
*/
public function setSubtotal($subtotal) {
$this->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
* @param string $shipping * @param string $shipping
*/ */
public function setShipping($shipping) { public function setShipping($shipping) {
$this->shipping = $shipping; $this->shipping = $shipping;
} }
/** /**
* Getter for shipping * Amount being charged for shipping.
* @return string * @return string
*/ */
public function getShipping() { public function getShipping() {
return $this->shipping; 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 * @param string $fee
*/ */
public function setFee($fee) { public function setFee($fee) {
$this->fee = $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 * @return string
*/ */
public function getFee() { public function getFee() {
return $this->fee; return $this->fee;
} }
}
}

View File

@@ -1,44 +1,38 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class FundingInstrument extends Resource {
class FundingInstrument extends \PPModel {
/** /**
* Setter for credit_card * Credit Card information.
* @param PayPal\Api\CreditCard $credit_card * @param PayPal\Api\CreditCard $credit_card
*/ */
public function setCredit_card($credit_card) { public function setCreditCard($credit_card) {
$this->credit_card = $credit_card; $this->credit_card = $credit_card;
} }
/** /**
* Getter for credit_card * Credit Card information.
* @return PayPal\Api\CreditCard * @return PayPal\Api\CreditCard
*/ */
public function getCredit_card() { public function getCreditCard() {
return $this->credit_card; return $this->credit_card;
} }
/** /**
* Setter for credit_card_token * Credit Card information.
* @param PayPal\Api\CreditCardToken $credit_card_token * @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; $this->credit_card_token = $credit_card_token;
} }
/** /**
* Getter for credit_card_token * Credit Card information.
* @return PayPal\Api\CreditCardToken * @return PayPal\Api\CreditCardToken
*/ */
public function getCredit_card_token() { public function getCreditCardToken() {
return $this->credit_card_token; return $this->credit_card_token;
} }
}
}

View File

@@ -0,0 +1,103 @@
<?php
namespace PayPal\Api;
class HyperSchema extends \PPModel {
/**
*
* @array
* @param PayPal\Api\Links $links
*/
public function setLinks($links) {
$this->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;
}
}

View File

@@ -1,92 +1,86 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Item extends Resource {
class Item extends \PPModel {
/** /**
* Setter for name * Number of items.
* @param string $name
*/
public function setName($name) {
$this->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
* @param string $quantity * @param string $quantity
*/ */
public function setQuantity($quantity) { public function setQuantity($quantity) {
$this->quantity = $quantity; $this->quantity = $quantity;
} }
/** /**
* Getter for quantity * Number of items.
* @return string * @return string
*/ */
public function getQuantity() { public function getQuantity() {
return $this->quantity; return $this->quantity;
} }
/**
} * 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;
}
}

View File

@@ -1,44 +1,39 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class ItemList extends Resource {
class ItemList extends \PPModel {
/** /**
* Setter for items * List of items.
* @array
* @param PayPal\Api\Item $items * @param PayPal\Api\Item $items
*/ */
public function setItems($items) { public function setItems($items) {
$this->items = $items; $this->items = $items;
} }
/** /**
* Getter for items * List of items.
* @return PayPal\Api\Item * @return PayPal\Api\Item
*/ */
public function getItems() { public function getItems() {
return $this->items; return $this->items;
} }
/** /**
* Setter for shipping_address * Shipping address.
* @param PayPal\Api\ShippingAddress $shipping_address * @param PayPal\Api\ShippingAddress $shipping_address
*/ */
public function setShipping_address($shipping_address) { public function setShippingAddress($shipping_address) {
$this->shipping_address = $shipping_address; $this->shipping_address = $shipping_address;
} }
/** /**
* Getter for shipping_address * Shipping address.
* @return PayPal\Api\ShippingAddress * @return PayPal\Api\ShippingAddress
*/ */
public function getShipping_address() { public function getShippingAddress() {
return $this->shipping_address; return $this->shipping_address;
} }
}
}

View File

@@ -1,60 +0,0 @@
<?php
namespace PayPal\Api;
/**
*
*/
class Link extends Resource {
/**
* Setter for href
* @param string $href
*/
public function setHref($href) {
$this->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;
}
}

102
lib/PayPal/Api/Links.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
namespace PayPal\Api;
class Links extends \PPModel {
/**
*
* @param string $href
*/
public function setHref($href) {
$this->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;
}
}

View File

@@ -1,60 +1,54 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Payee extends Resource {
class Payee extends \PPModel {
/** /**
* Setter for merchant_id * 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 $merchant_id
*/
public function setMerchant_id($merchant_id) {
$this->merchant_id = $merchant_id;
}
/**
* Getter for merchant_id
* @return string
*/
public function getMerchant_id() {
return $this->merchant_id;
}
/**
* Setter for email
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email) {
$this->email = $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 * @return string
*/ */
public function getEmail() { public function getEmail() {
return $this->email; 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 * @param string $phone
*/ */
public function setPhone($phone) { public function setPhone($phone) {
$this->phone = $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 * @return string
*/ */
public function getPhone() { public function getPhone() {
return $this->phone; return $this->phone;
} }
}
}

View File

@@ -1,60 +1,55 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Payer extends Resource {
class Payer extends \PPModel {
/** /**
* Setter for payment_method * Payment method being used - PayPal Wallet payment or Direct Credit card.
* @param string $payment_method * @param string $payment_method
*/ */
public function setPayment_method($payment_method) { public function setPaymentMethod($payment_method) {
$this->payment_method = $payment_method; $this->payment_method = $payment_method;
} }
/** /**
* Getter for payment_method * Payment method being used - PayPal Wallet payment or Direct Credit card.
* @return string * @return string
*/ */
public function getPayment_method() { public function getPaymentMethod() {
return $this->payment_method; return $this->payment_method;
} }
/** /**
* Setter for payer_info * List of funding instruments from where the funds of the current payment come from. Typically a credit card.
* @param PayPal\Api\PayerInfo $payer_info * @array
*/
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
* @param PayPal\Api\FundingInstrument $funding_instruments * @param PayPal\Api\FundingInstrument $funding_instruments
*/ */
public function setFunding_instruments($funding_instruments) { public function setFundingInstruments($funding_instruments) {
$this->funding_instruments = $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 * @return PayPal\Api\FundingInstrument
*/ */
public function getFunding_instruments() { public function getFundingInstruments() {
return $this->funding_instruments; return $this->funding_instruments;
} }
/**
} * 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;
}
}

View File

@@ -1,108 +1,102 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class PayerInfo extends Resource {
class PayerInfo extends \PPModel {
/** /**
* Setter for email * Email address representing the Payer.
* @param string $email * @param string $email
*/ */
public function setEmail($email) { public function setEmail($email) {
$this->email = $email; $this->email = $email;
} }
/** /**
* Getter for email * Email address representing the Payer.
* @return string * @return string
*/ */
public function getEmail() { public function getEmail() {
return $this->email; return $this->email;
} }
/** /**
* Setter for first_name * First Name of the Payer from their PayPal Account.
* @param string $first_name * @param string $first_name
*/ */
public function setFirst_name($first_name) { public function setFirstName($first_name) {
$this->first_name = $first_name; $this->first_name = $first_name;
} }
/** /**
* Getter for first_name * First Name of the Payer from their PayPal Account.
* @return string * @return string
*/ */
public function getFirst_name() { public function getFirstName() {
return $this->first_name; return $this->first_name;
} }
/** /**
* Setter for last_name * Last Name of the Payer from their PayPal Account.
* @param string $last_name * @param string $last_name
*/ */
public function setLast_name($last_name) { public function setLastName($last_name) {
$this->last_name = $last_name; $this->last_name = $last_name;
} }
/** /**
* Getter for last_name * Last Name of the Payer from their PayPal Account.
* @return string * @return string
*/ */
public function getLast_name() { public function getLastName() {
return $this->last_name; return $this->last_name;
} }
/** /**
* Setter for payer_id * PayPal assigned Payer ID.
* @param string $payer_id * @param string $payer_id
*/ */
public function setPayer_id($payer_id) { public function setPayerId($payer_id) {
$this->payer_id = $payer_id; $this->payer_id = $payer_id;
} }
/** /**
* Getter for payer_id * PayPal assigned Payer ID.
* @return string * @return string
*/ */
public function getPayer_id() { public function getPayerId() {
return $this->payer_id; return $this->payer_id;
} }
/** /**
* Setter for shipping_address * Phone number representing the Payer.
* @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
* @param string $phone * @param string $phone
*/ */
public function setPhone($phone) { public function setPhone($phone) {
$this->phone = $phone; $this->phone = $phone;
} }
/** /**
* Getter for phone * Phone number representing the Payer.
* @return string * @return string
*/ */
public function getPhone() { public function getPhone() {
return $this->phone; return $this->phone;
} }
/**
} * 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;
}
}

View File

@@ -1,271 +1,226 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Rest\IResource; use PayPal\Rest\IResource;
use PayPal\Rest\Call; use PayPal\Rest\Call;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
/** class Payment extends \PPModel implements IResource {
*
*/
class Payment extends Resource implements IResource {
private static $credential; private static $credential;
/** /**
* *
* @deprected. Pass ApiContext to create/get methods instead * @deprected. Pass ApiContext to create/get methods instead
*/ */
public static function setCredential($credential) { public static function setCredential($credential) {
self::$credential = $credential; self::$credential = $credential;
} }
/** /**
* Setter for id * Identifier of the payment resource created.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * Identifier of the payment resource created.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for create_time * Time the resource was created.
* @param string $create_time * @param string $create_time
*/ */
public function setCreate_time($create_time) { public function setCreateTime($create_time) {
$this->create_time = $create_time; $this->create_time = $create_time;
} }
/** /**
* Getter for create_time * Time the resource was created.
* @return string * @return string
*/ */
public function getCreate_time() { public function getCreateTime() {
return $this->create_time; return $this->create_time;
} }
/** /**
* Setter for update_time * Time the resource was last updated.
* @param string $update_time * @param string $update_time
*/ */
public function setUpdate_time($update_time) { public function setUpdateTime($update_time) {
$this->update_time = $update_time; $this->update_time = $update_time;
} }
/** /**
* Getter for update_time * Time the resource was last updated.
* @return string * @return string
*/ */
public function getUpdate_time() { public function getUpdateTime() {
return $this->update_time; return $this->update_time;
} }
/** /**
* Setter for state * Intent of the payment - Sale or Authorization or Order.
* @param string $state
*/
public function setState($state) {
$this->state = $state;
}
/**
* Getter for state
* @return string
*/
public function getState() {
return $this->state;
}
/**
* Setter for intent
* @param string $intent * @param string $intent
*/ */
public function setIntent($intent) { public function setIntent($intent) {
$this->intent = $intent; $this->intent = $intent;
} }
/** /**
* Getter for intent * Intent of the payment - Sale or Authorization or Order.
* @return string * @return string
*/ */
public function getIntent() { public function getIntent() {
return $this->intent; 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 * @param PayPal\Api\Payer $payer
*/ */
public function setPayer($payer) { public function setPayer($payer) {
$this->payer = $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 * @return PayPal\Api\Payer
*/ */
public function getPayer() { public function getPayer() {
return $this->payer; 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 * @param PayPal\Api\Transaction $transactions
*/ */
public function setTransactions($transactions) { public function setTransactions($transactions) {
$this->transactions = $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 * @return PayPal\Api\Transaction
*/ */
public function getTransactions() { public function getTransactions() {
return $this->transactions; return $this->transactions;
} }
/** /**
* Setter for redirect_urls * state of the payment
* @param PayPal\Api\RedirectUrls $redirect_urls * @param string $state
*/ */
public function setRedirect_urls($redirect_urls) { public function setState($state) {
$this->redirect_urls = $redirect_urls; $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 * @return PayPal\Api\RedirectUrls
*/ */
public function getRedirect_urls() { public function getRedirectUrls() {
return $this->redirect_urls; return $this->redirect_urls;
} }
/** /**
* Setter for links *
* @param PayPal\Api\Link $links * @array
*/ * @param PayPal\Api\Links $links
*/
public function setLinks($links) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; return $this->links;
} }
public function create($apiContext = null) {
$payLoad = $this->toJSON();
/** if ($apiContext == null) {
* @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) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment", "POST", $payLoad);
"/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);
$this->fromJson($json); $this->fromJson($json);
return $this; return $this;
} }
/** public static function get($paymentId, $apiContext = null) {
* @path /v1/payments/payment/:payment-id if (($paymentId == null) || (strlen($paymentId) <= 0)) {
* @method GET throw new \InvalidArgumentException("paymentId cannot be null or empty");
* @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");
} }
$payLoad = ""; $payLoad = "";
if($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/$paymentId", "GET", $payLoad);
"/v1/payments/payment/$paymentid",
"GET", $payLoad);
$ret = new Payment(); $ret = new Payment();
$ret->fromJson($json); $ret->fromJson($json);
return $ret; return $ret;
}
}
public function execute($paymentExecution, $apiContext = null) {
/**
* @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");
}
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
$payLoad = $payment_execution->toJSON(); if (($paymentExecution == null)) {
if($apiContext == null) { throw new \InvalidArgumentException("paymentExecution cannot be null or empty");
}
$payLoad = $paymentExecution->toJSON();
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad);
"/v1/payments/payment/{$this->getId()}/execute", $ret = new Payment();
"POST", $payLoad); $ret->fromJson($json);
$this->fromJson($json); return $ret;
return $this; }
}
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;
}
} }

View File

@@ -1,44 +1,39 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class PaymentExecution extends Resource {
class PaymentExecution extends \PPModel {
/** /**
* Setter for payer_id * PayPal assigned Payer ID returned in the approval return url.
* @param string $payer_id * @param string $payer_id
*/ */
public function setPayer_id($payer_id) { public function setPayerId($payer_id) {
$this->payer_id = $payer_id; $this->payer_id = $payer_id;
} }
/** /**
* Getter for payer_id * PayPal assigned Payer ID returned in the approval return url.
* @return string * @return string
*/ */
public function getPayer_id() { public function getPayerId() {
return $this->payer_id; return $this->payer_id;
} }
/** /**
* Setter for transactions * If the amount needs to be updated after obtaining the PayPal Payer info (eg. shipping address), it can be updated using this element.
* @param PayPal\Api\Amount $transactions * @array
*/ * @param PayPal\Api\Transactions $transactions
*/
public function setTransactions($transactions) { public function setTransactions($transactions) {
$this->transactions = $transactions; $this->transactions = $transactions;
} }
/** /**
* Getter for transactions * 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\Amount * @return PayPal\Api\Transactions
*/ */
public function getTransactions() { public function getTransactions() {
return $this->transactions; return $this->transactions;
} }
}
}

View File

@@ -1,60 +1,55 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class PaymentHistory extends Resource {
class PaymentHistory extends \PPModel {
/** /**
* Setter for payments * A list of Payment resources
* @array
* @param PayPal\Api\Payment $payments * @param PayPal\Api\Payment $payments
*/ */
public function setPayments($payments) { public function setPayments($payments) {
$this->payments = $payments; $this->payments = $payments;
} }
/** /**
* Getter for payments * A list of Payment resources
* @return PayPal\Api\Payment * @return PayPal\Api\Payment
*/ */
public function getPayments() { public function getPayments() {
return $this->payments; 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 * @param integer $count
*/ */
public function setCount($count) { public function setCount($count) {
$this->count = $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 * @return integer
*/ */
public function getCount() { public function getCount() {
return $this->count; return $this->count;
} }
/** /**
* Setter for next_id * Identifier of the next element to get the next range of results.
* @param string $next_id * @param string $next_id
*/ */
public function setNext_id($next_id) { public function setNextId($next_id) {
$this->next_id = $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 * @return string
*/ */
public function getNext_id() { public function getNextId() {
return $this->next_id; return $this->next_id;
} }
}
}

View File

@@ -1,44 +1,38 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class RedirectUrls extends Resource {
class RedirectUrls extends \PPModel {
/** /**
* Setter for return_url * Url where the payer would be redirected to after approving the payment.
* @param string $return_url * @param string $return_url
*/ */
public function setReturn_url($return_url) { public function setReturnUrl($return_url) {
$this->return_url = $return_url; $this->return_url = $return_url;
} }
/** /**
* Getter for return_url * Url where the payer would be redirected to after approving the payment.
* @return string * @return string
*/ */
public function getReturn_url() { public function getReturnUrl() {
return $this->return_url; return $this->return_url;
} }
/** /**
* Setter for cancel_url * Url where the payer would be redirected to after canceling the payment.
* @param string $cancel_url * @param string $cancel_url
*/ */
public function setCancel_url($cancel_url) { public function setCancelUrl($cancel_url) {
$this->cancel_url = $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 * @return string
*/ */
public function getCancel_url() { public function getCancelUrl() {
return $this->cancel_url; return $this->cancel_url;
} }
}
}

View File

@@ -1,210 +1,164 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Rest\IResource; use PayPal\Rest\IResource;
use PayPal\Rest\Call; use PayPal\Rest\Call;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
/** class Refund extends \PPModel implements IResource {
*
*/
class Refund extends Resource implements IResource {
private static $credential; private static $credential;
/** /**
* *
* @deprected. Pass ApiContext to the get method instead * @deprected. Pass ApiContext to create/get methods instead
*/ */
public static function setCredential($credential) { public static function setCredential($credential) {
self::$credential = $credential; self::$credential = $credential;
} }
/** /**
* Setter for id * Identifier of the refund transaction.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * Identifier of the refund transaction.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for create_time * Time the resource was created.
* @param string $create_time * @param string $create_time
*/ */
public function setCreate_time($create_time) { public function setCreateTime($create_time) {
$this->create_time = $create_time; $this->create_time = $create_time;
} }
/** /**
* Getter for create_time * Time the resource was created.
* @return string * @return string
*/ */
public function getCreate_time() { public function getCreateTime() {
return $this->create_time; return $this->create_time;
} }
/** /**
* Setter for update_time * 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 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
* @param PayPal\Api\Amount $amount * @param PayPal\Api\Amount $amount
*/ */
public function setAmount($amount) { public function setAmount($amount) {
$this->amount = $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 * @return PayPal\Api\Amount
*/ */
public function getAmount() { public function getAmount() {
return $this->amount; return $this->amount;
} }
/** /**
* Setter for sale_id * State of the refund transaction.
* @param string $sale_id * @param string $state
*/ */
public function setSale_id($sale_id) { public function setState($state) {
$this->sale_id = $sale_id; $this->state = $state;
} }
/** /**
* Getter for sale_id * State of the refund transaction.
* @return string * @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; return $this->sale_id;
} }
/** /**
* Setter for capture_id * ID of the Capture transaction being refunded.
* @param string $capture_id * @param string $capture_id
*/ */
public function setCapture_id($capture_id) { public function setCaptureId($capture_id) {
$this->capture_id = $capture_id; $this->capture_id = $capture_id;
} }
/** /**
* Getter for capture_id * ID of the Capture transaction being refunded.
* @return string * @return string
*/ */
public function getCapture_id() { public function getCaptureId() {
return $this->capture_id; return $this->capture_id;
} }
/** /**
* Setter for parent_payment * ID of the Payment resource that this transaction is based on.
* @param string $parent_payment * @param string $parent_payment
*/ */
public function setParent_payment($parent_payment) { public function setParentPayment($parent_payment) {
$this->parent_payment = $parent_payment; $this->parent_payment = $parent_payment;
} }
/** /**
* Getter for parent_payment * ID of the Payment resource that this transaction is based on.
* @return string * @return string
*/ */
public function getParent_payment() { public function getParentPayment() {
return $this->parent_payment; return $this->parent_payment;
} }
/** /**
* Setter for description *
* @param string $description * @array
*/ * @param PayPal\Api\Links $links
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
*/
public function setLinks($links) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; return $this->links;
} }
public static function get($refundId, $apiContext = null) {
if (($refundId == null) || (strlen($refundId) <= 0)) {
/** throw new \InvalidArgumentException("refundId cannot be null or empty");
* @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");
} }
$payLoad = ""; $payLoad = "";
if($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
"/v1/payments/refund/$refundid",
"GET", $payLoad);
$ret = new Refund(); $ret = new Refund();
$ret->fromJson($json); $ret->fromJson($json);
return $ret; return $ret;
}
}
} }

View File

@@ -1,76 +1,70 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class SubTransaction extends Resource {
class RelatedResources extends \PPModel {
/** /**
* Setter for sale * A sale transaction
* @param PayPal\Api\Sale $sale * @param PayPal\Api\Sale $sale
*/ */
public function setSale($sale) { public function setSale($sale) {
$this->sale = $sale; $this->sale = $sale;
} }
/** /**
* Getter for sale * A sale transaction
* @return PayPal\Api\Sale * @return PayPal\Api\Sale
*/ */
public function getSale() { public function getSale() {
return $this->sale; return $this->sale;
} }
/** /**
* Setter for authorization * An authorization transaction
* @param PayPal\Api\Authorization $authorization * @param PayPal\Api\Authorization $authorization
*/ */
public function setAuthorization($authorization) { public function setAuthorization($authorization) {
$this->authorization = $authorization; $this->authorization = $authorization;
} }
/** /**
* Getter for authorization * An authorization transaction
* @return PayPal\Api\Authorization * @return PayPal\Api\Authorization
*/ */
public function getAuthorization() { public function getAuthorization() {
return $this->authorization; return $this->authorization;
} }
/** /**
* Setter for refund * A capture transaction
* @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
* @param PayPal\Api\Capture $capture * @param PayPal\Api\Capture $capture
*/ */
public function setCapture($capture) { public function setCapture($capture) {
$this->capture = $capture; $this->capture = $capture;
} }
/** /**
* Getter for capture * A capture transaction
* @return PayPal\Api\Capture * @return PayPal\Api\Capture
*/ */
public function getCapture() { public function getCapture() {
return $this->capture; return $this->capture;
} }
/**
} * 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;
}
}

View File

@@ -1,11 +0,0 @@
<?php
namespace PayPal\Api;
/**
*
*/
class Resource extends \PPModel {
}

View File

@@ -1,187 +1,166 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Rest\IResource; use PayPal\Rest\IResource;
use PayPal\Rest\Call; use PayPal\Rest\Call;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
/** class Sale extends \PPModel implements IResource {
*
*/
class Sale extends Resource implements IResource {
private static $credential; private static $credential;
/** /**
* *
* @deprected. Pass ApiContext to refund/get methods instead * @deprected. Pass ApiContext to create/get methods instead
*/ */
public static function setCredential($credential) { public static function setCredential($credential) {
self::$credential = $credential; self::$credential = $credential;
} }
/** /**
* Setter for id * Identifier of the authorization transaction.
* @param string $id * @param string $id
*/ */
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
/** /**
* Getter for id * Identifier of the authorization transaction.
* @return string * @return string
*/ */
public function getId() { public function getId() {
return $this->id; return $this->id;
} }
/** /**
* Setter for create_time * Time the resource was created.
* @param string $create_time * @param string $create_time
*/ */
public function setCreate_time($create_time) { public function setCreateTime($create_time) {
$this->create_time = $create_time; $this->create_time = $create_time;
} }
/** /**
* Getter for create_time * Time the resource was created.
* @return string * @return string
*/ */
public function getCreate_time() { public function getCreateTime() {
return $this->create_time; return $this->create_time;
} }
/** /**
* Setter for update_time * Time the resource was last updated.
* @param string $update_time * @param string $update_time
*/ */
public function setUpdate_time($update_time) { public function setUpdateTime($update_time) {
$this->update_time = $update_time; $this->update_time = $update_time;
} }
/** /**
* Getter for update_time * Time the resource was last updated.
* @return string * @return string
*/ */
public function getUpdate_time() { public function getUpdateTime() {
return $this->update_time; return $this->update_time;
} }
/** /**
* Setter for state * Amount being collected.
* @param string $state
*/
public function setState($state) {
$this->state = $state;
}
/**
* Getter for state
* @return string
*/
public function getState() {
return $this->state;
}
/**
* Setter for amount
* @param PayPal\Api\Amount $amount * @param PayPal\Api\Amount $amount
*/ */
public function setAmount($amount) { public function setAmount($amount) {
$this->amount = $amount; $this->amount = $amount;
} }
/** /**
* Getter for amount * Amount being collected.
* @return PayPal\Api\Amount * @return PayPal\Api\Amount
*/ */
public function getAmount() { public function getAmount() {
return $this->amount; return $this->amount;
} }
/** /**
* Setter for parent_payment * State of the sale transaction.
* @param string $parent_payment * @param string $state
*/ */
public function setParent_payment($parent_payment) { public function setState($state) {
$this->parent_payment = $parent_payment; $this->state = $state;
} }
/** /**
* Getter for parent_payment * State of the sale transaction.
* @return string * @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; return $this->parent_payment;
} }
/** /**
* Setter for links *
* @param PayPal\Api\Link $links * @array
*/ * @param PayPal\Api\Links $links
*/
public function setLinks($links) { public function setLinks($links) {
$this->links = $links; $this->links = $links;
} }
/** /**
* Getter for links *
* @return PayPal\Api\Link * @return PayPal\Api\Links
*/ */
public function getLinks() { public function getLinks() {
return $this->links; return $this->links;
} }
public static function get($saleId, $apiContext = null) {
if (($saleId == null) || (strlen($saleId) <= 0)) {
/** throw new \InvalidArgumentException("saleId cannot be null or empty");
* @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");
} }
$payLoad = ""; $payLoad = "";
if($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/$saleId", "GET", $payLoad);
"/v1/payments/sale/$saleid",
"GET", $payLoad);
$ret = new Sale(); $ret = new Sale();
$ret->fromJson($json); $ret->fromJson($json);
return $ret; return $ret;
}
}
public function refund($refund, $apiContext = null) {
/**
* @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");
}
if ($this->getId() == null) { if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null"); throw new \InvalidArgumentException("Id cannot be null");
} }
$payLoad = $refund->toJSON(); if (($refund == null)) {
if($apiContext == null) { throw new \InvalidArgumentException("refund cannot be null or empty");
}
$payLoad = $refund->toJSON();
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new \PPRestCall($apiContext); $call = new \PPRestCall($apiContext);
$json = $call->execute( array('PayPal\Rest\RestHandler'), $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/sale/{$this->getId()}/refund", "POST", $payLoad);
"/v1/payments/sale/{$this->getId()}/refund", $ret = new Refund();
"POST", $payLoad); $ret->fromJson($json);
$this->fromJson($json); return $ret;
return $this; }
}
} }

View File

@@ -1,28 +1,22 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class ShippingAddress extends Address { class ShippingAddress extends Address {
/** /**
* Setter for recipient_name * Name of the recipient at this address.
* @param string $recipient_name * @param string $recipient_name
*/ */
public function setRecipient_name($recipient_name) { public function setRecipientName($recipient_name) {
$this->recipient_name = $recipient_name; $this->recipient_name = $recipient_name;
} }
/** /**
* Getter for recipient_name * Name of the recipient at this address.
* @return string * @return string
*/ */
public function getRecipient_name() { public function getRecipientName() {
return $this->recipient_name; return $this->recipient_name;
} }
}
}

View File

@@ -1,92 +1,104 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
/**
*
*/
class Transaction extends Resource {
class Transaction extends \PPModel {
/** /**
* Setter for amount * Amount being collected.
* @param PayPal\Api\Amount $amount * @param PayPal\Api\Amount $amount
*/ */
public function setAmount($amount) { public function setAmount($amount) {
$this->amount = $amount; $this->amount = $amount;
} }
/** /**
* Getter for amount * Amount being collected.
* @return PayPal\Api\Amount * @return PayPal\Api\Amount
*/ */
public function getAmount() { public function getAmount() {
return $this->amount; return $this->amount;
} }
/** /**
* Setter for payee * Recepient of the funds in this transaction.
* @param PayPal\Api\Payee $payee * @param PayPal\Api\Payee $payee
*/ */
public function setPayee($payee) { public function setPayee($payee) {
$this->payee = $payee; $this->payee = $payee;
} }
/** /**
* Getter for payee * Recepient of the funds in this transaction.
* @return PayPal\Api\Payee * @return PayPal\Api\Payee
*/ */
public function getPayee() { public function getPayee() {
return $this->payee; return $this->payee;
} }
/** /**
* Setter for description * Description of what is being paid for.
* @param string $description * @param string $description
*/ */
public function setDescription($description) { public function setDescription($description) {
$this->description = $description; $this->description = $description;
} }
/** /**
* Getter for description * Description of what is being paid for.
* @return string * @return string
*/ */
public function getDescription() { public function getDescription() {
return $this->description; return $this->description;
} }
/** /**
* Setter for item_list * List of items being paid for.
* @param PayPal\Api\ItemList $item_list * @param PayPal\Api\ItemList $item_list
*/ */
public function setItem_list($item_list) { public function setItemList($item_list) {
$this->item_list = $item_list; $this->item_list = $item_list;
} }
/** /**
* Getter for item_list * List of items being paid for.
* @return PayPal\Api\ItemList * @return PayPal\Api\ItemList
*/ */
public function getItem_list() { public function getItemList() {
return $this->item_list; return $this->item_list;
} }
/** /**
* Setter for related_resources * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
* @param PayPal\Api\SubTransaction $related_resources * @array
*/ * @param PayPal\Api\RelatedResources $related_resources
public function setRelated_resources($related_resources) { */
public function setRelatedResources($related_resources) {
$this->related_resources = $related_resources; $this->related_resources = $related_resources;
} }
/** /**
* Getter for related_resources * List of financial transactions (Sale, Authorization, Capture, Refund) related to the payment.
* @return PayPal\Api\SubTransaction * @return PayPal\Api\RelatedResources
*/ */
public function getRelated_resources() { public function getRelatedResources() {
return $this->related_resources; return $this->related_resources;
} }
/**
} * 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;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace PayPal\Api;
class Transactions extends \PPModel {
/**
* Amount being collected.
* @param PayPal\Api\Amount $amount
*/
public function setAmount($amount) {
$this->amount = $amount;
}
/**
* Amount being collected.
* @return PayPal\Api\Amount
*/
public function getAmount() {
return $this->amount;
}
}