diff --git a/lib/PayPal/Api/Payout.php b/lib/PayPal/Api/Payout.php new file mode 100644 index 0000000..3492e91 --- /dev/null +++ b/lib/PayPal/Api/Payout.php @@ -0,0 +1,191 @@ +sender_batch_header = $sender_batch_header; + return $this; + } + + /** + * The original batch header as provided by the payment sender. + * + * @return \PayPal\Api\PayoutSenderBatchHeader + */ + public function getSenderBatchHeader() + { + return $this->sender_batch_header; + } + + /** + * The original batch header as provided by the payment sender. + * + * @deprecated Instead use setSenderBatchHeader + * + * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header + * @return $this + */ + public function setSender_batch_header($sender_batch_header) + { + $this->sender_batch_header = $sender_batch_header; + return $this; + } + + /** + * The original batch header as provided by the payment sender. + * @deprecated Instead use getSenderBatchHeader + * + * @return \PayPal\Api\PayoutSenderBatchHeader + */ + public function getSender_batch_header() + { + return $this->sender_batch_header; + } + + /** + * An array of payout items (that is, a set of individual payouts). + * + * @param \PayPal\Api\PayoutItem[] $items + * + * @return $this + */ + public function setItems($items) + { + $this->items = $items; + return $this; + } + + /** + * An array of payout items (that is, a set of individual payouts). + * + * @return \PayPal\Api\PayoutItem[] + */ + public function getItems() + { + return $this->items; + } + + /** + * Append Items to the list. + * + * @param \PayPal\Api\PayoutItem $payoutItem + * @return $this + */ + public function addItem($payoutItem) + { + if (!$this->getItems()) { + return $this->setItems(array($payoutItem)); + } else { + return $this->setItems( + array_merge($this->getItems(), array($payoutItem)) + ); + } + } + + /** + * Remove Items from the list. + * + * @param \PayPal\Api\PayoutItem $payoutItem + * @return $this + */ + public function removeItem($payoutItem) + { + return $this->setItems( + array_diff($this->getItems(), array($payoutItem)) + ); + } + + /** + * Create a payout batch resource by passing a sender_batch_header and an items array to the request URI. The sender_batch_header contains payout parameters that describe the handling of a batch resource while the items array conatins payout items. + * + * @param array $params + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @return PayoutBatch + */ + public function create($params = array(), $apiContext = null, $restCall = null) + { + $params = $params ? $params : array(); + ArgumentValidator::validate($params, 'params'); + $payLoad = $this->toJSON(); + $allowedParams = array( + 'sync_mode' => 1, + ); + $json = self::executeCall( + "/v1/payments/payouts" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), + "POST", + $payLoad, + null, + $apiContext, + $restCall + ); + $ret = new PayoutBatch(); + $ret->fromJson($json); + return $ret; + } + + /** + * You can submit a payout with a synchronous API call, which immediately returns the results of a PayPal payment. + * + * @param ApiContext $apiContext + * @param PayPalRestCall $restCall + * @return PayoutBatch + */ + public function createSynchronous($apiContext = null, $restCall = null) + { + $params = array('sync_mode' => 'true'); + return $this->create($params, $apiContext, $restCall); + } + + /** + * Obtain the status of a specific batch resource by passing the payout batch ID to the request URI. You can issue this call multiple times to get the current status. + * + * @param string $payoutBatchId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @return PayoutBatch + */ + public static function get($payoutBatchId, $apiContext = null, $restCall = null) + { + ArgumentValidator::validate($payoutBatchId, 'payoutBatchId'); + $payLoad = ""; + $json = self::executeCall( + "/v1/payments/payouts/$payoutBatchId", + "GET", + $payLoad, + null, + $apiContext, + $restCall + ); + $ret = new PayoutBatch(); + $ret->fromJson($json); + return $ret; + } + +} diff --git a/lib/PayPal/Api/PayoutBatch.php b/lib/PayPal/Api/PayoutBatch.php new file mode 100644 index 0000000..2d01d1a --- /dev/null +++ b/lib/PayPal/Api/PayoutBatch.php @@ -0,0 +1,145 @@ +batch_header = $batch_header; + return $this; + } + + /** + * A batch header that includes the generated batch status. + * + * @return \PayPal\Api\PayoutBatchHeader + */ + public function getBatchHeader() + { + return $this->batch_header; + } + + /** + * A batch header that includes the generated batch status. + * + * @deprecated Instead use setBatchHeader + * + * @param \PayPal\Api\PayoutBatchHeader $batch_header + * @return $this + */ + public function setBatch_header($batch_header) + { + $this->batch_header = $batch_header; + return $this; + } + + /** + * A batch header that includes the generated batch status. + * @deprecated Instead use getBatchHeader + * + * @return \PayPal\Api\PayoutBatchHeader + */ + public function getBatch_header() + { + return $this->batch_header; + } + + /** + * Array of the items in a batch payout. + * + * @param \PayPal\Api\PayoutItemDetails[] $items + * + * @return $this + */ + public function setItems($items) + { + $this->items = $items; + return $this; + } + + /** + * Array of the items in a batch payout. + * + * @return \PayPal\Api\PayoutItemDetails[] + */ + public function getItems() + { + return $this->items; + } + + /** + * Append Items to the list. + * + * @param \PayPal\Api\PayoutItemDetails $payoutItemDetails + * @return $this + */ + public function addItem($payoutItemDetails) + { + if (!$this->getItems()) { + return $this->setItems(array($payoutItemDetails)); + } else { + return $this->setItems( + array_merge($this->getItems(), array($payoutItemDetails)) + ); + } + } + + /** + * Remove Items from the list. + * + * @param \PayPal\Api\PayoutItemDetails $payoutItemDetails + * @return $this + */ + public function removeItem($payoutItemDetails) + { + return $this->setItems( + array_diff($this->getItems(), array($payoutItemDetails)) + ); + } + + + /** + * Sets Links + * + * @param \PayPal\Api\Links[] $links + * + * @return $this + */ + public function setLinks($links) + { + $this->links = $links; + return $this; + } + + /** + * Gets Links + * + * @return \PayPal\Api\Links[] + */ + public function getLinks() + { + return $this->links; + } + +} diff --git a/lib/PayPal/Api/PayoutBatchHeader.php b/lib/PayPal/Api/PayoutBatchHeader.php new file mode 100644 index 0000000..ddcfdee --- /dev/null +++ b/lib/PayPal/Api/PayoutBatchHeader.php @@ -0,0 +1,388 @@ +payout_batch_id = $payout_batch_id; + return $this; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * + * @return string + */ + public function getPayoutBatchId() + { + return $this->payout_batch_id; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * + * @deprecated Instead use setPayoutBatchId + * + * @param string $payout_batch_id + * @return $this + */ + public function setPayout_batch_id($payout_batch_id) + { + $this->payout_batch_id = $payout_batch_id; + return $this; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * @deprecated Instead use getPayoutBatchId + * + * @return string + */ + public function getPayout_batch_id() + { + return $this->payout_batch_id; + } + + /** + * Generated batch status. + * + * @param string $batch_status + * + * @return $this + */ + public function setBatchStatus($batch_status) + { + $this->batch_status = $batch_status; + return $this; + } + + /** + * Generated batch status. + * + * @return string + */ + public function getBatchStatus() + { + return $this->batch_status; + } + + /** + * Generated batch status. + * + * @deprecated Instead use setBatchStatus + * + * @param string $batch_status + * @return $this + */ + public function setBatch_status($batch_status) + { + $this->batch_status = $batch_status; + return $this; + } + + /** + * Generated batch status. + * @deprecated Instead use getBatchStatus + * + * @return string + */ + public function getBatch_status() + { + return $this->batch_status; + } + + /** + * The time the batch entered processing. + * + * @param string $time_created + * + * @return $this + */ + public function setTimeCreated($time_created) + { + $this->time_created = $time_created; + return $this; + } + + /** + * The time the batch entered processing. + * + * @return string + */ + public function getTimeCreated() + { + return $this->time_created; + } + + /** + * The time the batch entered processing. + * + * @deprecated Instead use setTimeCreated + * + * @param string $time_created + * @return $this + */ + public function setTime_created($time_created) + { + $this->time_created = $time_created; + return $this; + } + + /** + * The time the batch entered processing. + * @deprecated Instead use getTimeCreated + * + * @return string + */ + public function getTime_created() + { + return $this->time_created; + } + + /** + * The time that processing for the batch was completed. + * + * @param string $time_completed + * + * @return $this + */ + public function setTimeCompleted($time_completed) + { + $this->time_completed = $time_completed; + return $this; + } + + /** + * The time that processing for the batch was completed. + * + * @return string + */ + public function getTimeCompleted() + { + return $this->time_completed; + } + + /** + * The time that processing for the batch was completed. + * + * @deprecated Instead use setTimeCompleted + * + * @param string $time_completed + * @return $this + */ + public function setTime_completed($time_completed) + { + $this->time_completed = $time_completed; + return $this; + } + + /** + * The time that processing for the batch was completed. + * @deprecated Instead use getTimeCompleted + * + * @return string + */ + public function getTime_completed() + { + return $this->time_completed; + } + + /** + * The original batch header as provided by the payment sender. + * + * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header + * + * @return $this + */ + public function setSenderBatchHeader($sender_batch_header) + { + $this->sender_batch_header = $sender_batch_header; + return $this; + } + + /** + * The original batch header as provided by the payment sender. + * + * @return \PayPal\Api\PayoutSenderBatchHeader + */ + public function getSenderBatchHeader() + { + return $this->sender_batch_header; + } + + /** + * The original batch header as provided by the payment sender. + * + * @deprecated Instead use setSenderBatchHeader + * + * @param \PayPal\Api\PayoutSenderBatchHeader $sender_batch_header + * @return $this + */ + public function setSender_batch_header($sender_batch_header) + { + $this->sender_batch_header = $sender_batch_header; + return $this; + } + + /** + * The original batch header as provided by the payment sender. + * @deprecated Instead use getSenderBatchHeader + * + * @return \PayPal\Api\PayoutSenderBatchHeader + */ + public function getSender_batch_header() + { + return $this->sender_batch_header; + } + + /** + * Total amount, in U.S. dollars, requested for the applicable payouts. + * + * @param \PayPal\Api\Currency $amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * Total amount, in U.S. dollars, requested for the applicable payouts. + * + * @return \PayPal\Api\Currency + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Total estimate in U.S. dollars for the applicable payouts fees. + * + * @param \PayPal\Api\Currency $fees + * + * @return $this + */ + public function setFees($fees) + { + $this->fees = $fees; + return $this; + } + + /** + * Total estimate in U.S. dollars for the applicable payouts fees. + * + * @return \PayPal\Api\Currency + */ + public function getFees() + { + return $this->fees; + } + + /** + * Sets Errors + * + * @param \PayPal\Api\Error $errors + * + * @return $this + */ + public function setErrors($errors) + { + $this->errors = $errors; + return $this; + } + + /** + * Gets Errors + * + * @return \PayPal\Api\Error + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Sets Links + * + * @param \PayPal\Api\Links[] $links + * + * @return $this + */ + public function setLinks($links) + { + $this->links = $links; + return $this; + } + + /** + * Gets Links + * + * @return \PayPal\Api\Links[] + */ + public function getLinks() + { + return $this->links; + } + + /** + * Append Links to the list. + * + * @param \PayPal\Api\Links $links + * @return $this + */ + public function addLink($links) + { + if (!$this->getLinks()) { + return $this->setLinks(array($links)); + } else { + return $this->setLinks( + array_merge($this->getLinks(), array($links)) + ); + } + } + + /** + * Remove Links from the list. + * + * @param \PayPal\Api\Links $links + * @return $this + */ + public function removeLink($links) + { + return $this->setLinks( + array_diff($this->getLinks(), array($links)) + ); + } + +} diff --git a/lib/PayPal/Api/PayoutItem.php b/lib/PayPal/Api/PayoutItem.php new file mode 100644 index 0000000..88b91d4 --- /dev/null +++ b/lib/PayPal/Api/PayoutItem.php @@ -0,0 +1,215 @@ +recipient_type = $recipient_type; + return $this; + } + + /** + * The type of identification for the payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * + * @return string + */ + public function getRecipientType() + { + return $this->recipient_type; + } + + /** + * The type of identification for the payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * + * @deprecated Instead use setRecipientType + * + * @param string $recipient_type + * @return $this + */ + public function setRecipient_type($recipient_type) + { + $this->recipient_type = $recipient_type; + return $this; + } + + /** + * The type of identification for the payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * @deprecated Instead use getRecipientType + * + * @return string + */ + public function getRecipient_type() + { + return $this->recipient_type; + } + + /** + * The amount of money to pay a receiver. + * + * @param \PayPal\Api\Currency $amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * The amount of money to pay a receiver. + * + * @return \PayPal\Api\Currency + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Note for notifications. The note is provided by the payment sender. This note can be any string. 4000 characters max. + * + * @param string $note + * + * @return $this + */ + public function setNote($note) + { + $this->note = $note; + return $this; + } + + /** + * Note for notifications. The note is provided by the payment sender. This note can be any string. 4000 characters max. + * + * @return string + */ + public function getNote() + { + return $this->note; + } + + /** + * The receiver of the payment. In a call response, the format of this value corresponds to the `recipient_type` specified in the request. 127 characters max. + * + * @param string $receiver + * + * @return $this + */ + public function setReceiver($receiver) + { + $this->receiver = $receiver; + return $this; + } + + /** + * The receiver of the payment. In a call response, the format of this value corresponds to the `recipient_type` specified in the request. 127 characters max. + * + * @return string + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * A sender-specific ID number, used in an accounting system for tracking purposes. 30 characters max. + * + * @param string $sender_item_id + * + * @return $this + */ + public function setSenderItemId($sender_item_id) + { + $this->sender_item_id = $sender_item_id; + return $this; + } + + /** + * A sender-specific ID number, used in an accounting system for tracking purposes. 30 characters max. + * + * @return string + */ + public function getSenderItemId() + { + return $this->sender_item_id; + } + + /** + * A sender-specific ID number, used in an accounting system for tracking purposes. 30 characters max. + * + * @deprecated Instead use setSenderItemId + * + * @param string $sender_item_id + * @return $this + */ + public function setSender_item_id($sender_item_id) + { + $this->sender_item_id = $sender_item_id; + return $this; + } + + /** + * A sender-specific ID number, used in an accounting system for tracking purposes. 30 characters max. + * @deprecated Instead use getSenderItemId + * + * @return string + */ + public function getSender_item_id() + { + return $this->sender_item_id; + } + + /** + * Obtain the status of a payout item by passing the item ID to the request URI. + * + * @param string $payoutItemId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @return PayoutItemDetails + */ + public static function get($payoutItemId, $apiContext = null, $restCall = null) + { + ArgumentValidator::validate($payoutItemId, 'payoutItemId'); + $payLoad = ""; + $json = self::executeCall( + "/v1/payments/payouts-item/$payoutItemId", + "GET", + $payLoad, + null, + $apiContext, + $restCall + ); + $ret = new PayoutItemDetails(); + $ret->fromJson($json); + return $ret; + } + +} diff --git a/lib/PayPal/Api/PayoutItemDetails.php b/lib/PayPal/Api/PayoutItemDetails.php new file mode 100644 index 0000000..404e385 --- /dev/null +++ b/lib/PayPal/Api/PayoutItemDetails.php @@ -0,0 +1,487 @@ +payout_item_id = $payout_item_id; + return $this; + } + + /** + * An ID for an individual payout. Provided by PayPal, such as in the case of getting the status of a batch request. 30 characters max. + * + * @return string + */ + public function getPayoutItemId() + { + return $this->payout_item_id; + } + + /** + * An ID for an individual payout. Provided by PayPal, such as in the case of getting the status of a batch request. 30 characters max. + * + * @deprecated Instead use setPayoutItemId + * + * @param string $payout_item_id + * @return $this + */ + public function setPayout_item_id($payout_item_id) + { + $this->payout_item_id = $payout_item_id; + return $this; + } + + /** + * An ID for an individual payout. Provided by PayPal, such as in the case of getting the status of a batch request. 30 characters max. + * @deprecated Instead use getPayoutItemId + * + * @return string + */ + public function getPayout_item_id() + { + return $this->payout_item_id; + } + + /** + * Generated ID for the transaction. 30 characters max. + * + * @param string $transaction_id + * + * @return $this + */ + public function setTransactionId($transaction_id) + { + $this->transaction_id = $transaction_id; + return $this; + } + + /** + * Generated ID for the transaction. 30 characters max. + * + * @return string + */ + public function getTransactionId() + { + return $this->transaction_id; + } + + /** + * Generated ID for the transaction. 30 characters max. + * + * @deprecated Instead use setTransactionId + * + * @param string $transaction_id + * @return $this + */ + public function setTransaction_id($transaction_id) + { + $this->transaction_id = $transaction_id; + return $this; + } + + /** + * Generated ID for the transaction. 30 characters max. + * @deprecated Instead use getTransactionId + * + * @return string + */ + public function getTransaction_id() + { + return $this->transaction_id; + } + + /** + * Status of a transaction. + * + * @param string $transaction_status + * + * @return $this + */ + public function setTransactionStatus($transaction_status) + { + $this->transaction_status = $transaction_status; + return $this; + } + + /** + * Status of a transaction. + * + * @return string + */ + public function getTransactionStatus() + { + return $this->transaction_status; + } + + /** + * Status of a transaction. + * + * @deprecated Instead use setTransactionStatus + * + * @param string $transaction_status + * @return $this + */ + public function setTransaction_status($transaction_status) + { + $this->transaction_status = $transaction_status; + return $this; + } + + /** + * Status of a transaction. + * @deprecated Instead use getTransactionStatus + * + * @return string + */ + public function getTransaction_status() + { + return $this->transaction_status; + } + + /** + * Amount of money in U.S. dollars for fees. + * + * @param \PayPal\Api\Currency $payout_item_fee + * + * @return $this + */ + public function setPayoutItemFee($payout_item_fee) + { + $this->payout_item_fee = $payout_item_fee; + return $this; + } + + /** + * Amount of money in U.S. dollars for fees. + * + * @return \PayPal\Api\Currency + */ + public function getPayoutItemFee() + { + return $this->payout_item_fee; + } + + /** + * Amount of money in U.S. dollars for fees. + * + * @deprecated Instead use setPayoutItemFee + * + * @param \PayPal\Api\Currency $payout_item_fee + * @return $this + */ + public function setPayout_item_fee($payout_item_fee) + { + $this->payout_item_fee = $payout_item_fee; + return $this; + } + + /** + * Amount of money in U.S. dollars for fees. + * @deprecated Instead use getPayoutItemFee + * + * @return \PayPal\Api\Currency + */ + public function getPayout_item_fee() + { + return $this->payout_item_fee; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * + * @param string $payout_batch_id + * + * @return $this + */ + public function setPayoutBatchId($payout_batch_id) + { + $this->payout_batch_id = $payout_batch_id; + return $this; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * + * @return string + */ + public function getPayoutBatchId() + { + return $this->payout_batch_id; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * + * @deprecated Instead use setPayoutBatchId + * + * @param string $payout_batch_id + * @return $this + */ + public function setPayout_batch_id($payout_batch_id) + { + $this->payout_batch_id = $payout_batch_id; + return $this; + } + + /** + * An ID for the batch payout. Generated by PayPal. 30 characters max. + * @deprecated Instead use getPayoutBatchId + * + * @return string + */ + public function getPayout_batch_id() + { + return $this->payout_batch_id; + } + + /** + * Sender-created ID for tracking the batch in an accounting system. 30 characters max. + * + * @param string $sender_batch_id + * + * @return $this + */ + public function setSenderBatchId($sender_batch_id) + { + $this->sender_batch_id = $sender_batch_id; + return $this; + } + + /** + * Sender-created ID for tracking the batch in an accounting system. 30 characters max. + * + * @return string + */ + public function getSenderBatchId() + { + return $this->sender_batch_id; + } + + /** + * Sender-created ID for tracking the batch in an accounting system. 30 characters max. + * + * @deprecated Instead use setSenderBatchId + * + * @param string $sender_batch_id + * @return $this + */ + public function setSender_batch_id($sender_batch_id) + { + $this->sender_batch_id = $sender_batch_id; + return $this; + } + + /** + * Sender-created ID for tracking the batch in an accounting system. 30 characters max. + * @deprecated Instead use getSenderBatchId + * + * @return string + */ + public function getSender_batch_id() + { + return $this->sender_batch_id; + } + + /** + * The data for a payout item that the sender initially provided. + * + * @param \PayPal\Api\PayoutItem $payout_item + * + * @return $this + */ + public function setPayoutItem($payout_item) + { + $this->payout_item = $payout_item; + return $this; + } + + /** + * The data for a payout item that the sender initially provided. + * + * @return \PayPal\Api\PayoutItem + */ + public function getPayoutItem() + { + return $this->payout_item; + } + + /** + * The data for a payout item that the sender initially provided. + * + * @deprecated Instead use setPayoutItem + * + * @param \PayPal\Api\PayoutItem $payout_item + * @return $this + */ + public function setPayout_item($payout_item) + { + $this->payout_item = $payout_item; + return $this; + } + + /** + * The data for a payout item that the sender initially provided. + * @deprecated Instead use getPayoutItem + * + * @return \PayPal\Api\PayoutItem + */ + public function getPayout_item() + { + return $this->payout_item; + } + + /** + * Time of the last processing for this item. + * + * @param string $time_processed + * + * @return $this + */ + public function setTimeProcessed($time_processed) + { + $this->time_processed = $time_processed; + return $this; + } + + /** + * Time of the last processing for this item. + * + * @return string + */ + public function getTimeProcessed() + { + return $this->time_processed; + } + + /** + * Time of the last processing for this item. + * + * @deprecated Instead use setTimeProcessed + * + * @param string $time_processed + * @return $this + */ + public function setTime_processed($time_processed) + { + $this->time_processed = $time_processed; + return $this; + } + + /** + * Time of the last processing for this item. + * @deprecated Instead use getTimeProcessed + * + * @return string + */ + public function getTime_processed() + { + return $this->time_processed; + } + + /** + * Sets Error + * + * @param \PayPal\Api\Error $error + * + * @return $this + */ + public function setErrors($error) + { + $this->errors = $error; + return $this; + } + + /** + * Gets Error + * + * @return \PayPal\Api\Error + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Sets Links + * + * @param \PayPal\Api\Links[] $links + * + * @return $this + */ + public function setLinks($links) + { + $this->links = $links; + return $this; + } + + /** + * Gets Links + * + * @return \PayPal\Api\Links[] + */ + public function getLinks() + { + return $this->links; + } + + /** + * Append Links to the list. + * + * @param \PayPal\Api\Links $links + * @return $this + */ + public function addLink($links) + { + if (!$this->getLinks()) { + return $this->setLinks(array($links)); + } else { + return $this->setLinks( + array_merge($this->getLinks(), array($links)) + ); + } + } + + /** + * Remove Links from the list. + * + * @param \PayPal\Api\Links $links + * @return $this + */ + public function removeLink($links) + { + return $this->setLinks( + array_diff($this->getLinks(), array($links)) + ); + } + +} diff --git a/lib/PayPal/Api/PayoutSenderBatchHeader.php b/lib/PayPal/Api/PayoutSenderBatchHeader.php new file mode 100644 index 0000000..d9f5ac2 --- /dev/null +++ b/lib/PayPal/Api/PayoutSenderBatchHeader.php @@ -0,0 +1,164 @@ +sender_batch_id = $sender_batch_id; + return $this; + } + + /** + * Sender-created ID for tracking the batch payout in an accounting system. 30 characters max. + * + * @return string + */ + public function getSenderBatchId() + { + return $this->sender_batch_id; + } + + /** + * Sender-created ID for tracking the batch payout in an accounting system. 30 characters max. + * + * @deprecated Instead use setSenderBatchId + * + * @param string $sender_batch_id + * @return $this + */ + public function setSender_batch_id($sender_batch_id) + { + $this->sender_batch_id = $sender_batch_id; + return $this; + } + + /** + * Sender-created ID for tracking the batch payout in an accounting system. 30 characters max. + * @deprecated Instead use getSenderBatchId + * + * @return string + */ + public function getSender_batch_id() + { + return $this->sender_batch_id; + } + + /** + * The subject line text for the email that PayPal sends when a payout item is completed. (The subject line is the same for all recipients.) Maximum of 255 single-byte alphanumeric characters. + * + * @param string $email_subject + * + * @return $this + */ + public function setEmailSubject($email_subject) + { + $this->email_subject = $email_subject; + return $this; + } + + /** + * The subject line text for the email that PayPal sends when a payout item is completed. (The subject line is the same for all recipients.) Maximum of 255 single-byte alphanumeric characters. + * + * @return string + */ + public function getEmailSubject() + { + return $this->email_subject; + } + + /** + * The subject line text for the email that PayPal sends when a payout item is completed. (The subject line is the same for all recipients.) Maximum of 255 single-byte alphanumeric characters. + * + * @deprecated Instead use setEmailSubject + * + * @param string $email_subject + * @return $this + */ + public function setEmail_subject($email_subject) + { + $this->email_subject = $email_subject; + return $this; + } + + /** + * The subject line text for the email that PayPal sends when a payout item is completed. (The subject line is the same for all recipients.) Maximum of 255 single-byte alphanumeric characters. + * @deprecated Instead use getEmailSubject + * + * @return string + */ + public function getEmail_subject() + { + return $this->email_subject; + } + + /** + * The type of ID for a payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * + * @param string $recipient_type + * + * @return $this + */ + public function setRecipientType($recipient_type) + { + $this->recipient_type = $recipient_type; + return $this; + } + + /** + * The type of ID for a payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * + * @return string + */ + public function getRecipientType() + { + return $this->recipient_type; + } + + /** + * The type of ID for a payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * + * @deprecated Instead use setRecipientType + * + * @param string $recipient_type + * @return $this + */ + public function setRecipient_type($recipient_type) + { + $this->recipient_type = $recipient_type; + return $this; + } + + /** + * The type of ID for a payment receiver. If this field is provided, the payout items without a `recipient_type` will use the provided value. If this field is not provided, each payout item must include a value for the `recipient_type`. + * @deprecated Instead use getRecipientType + * + * @return string + */ + public function getRecipient_type() + { + return $this->recipient_type; + } + +} diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index fbc2bdb..041815d 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -1243,73 +1243,6 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "depth": 1, "children": [ { - "type": "file", - "data": { - "language": { - "nameMatchers": [{}, ".fbp"], - "pygmentsLexer": "php", - "singleLineComment": ["//"], - "ignorePrefix": "}", - "foldPrefix": "^", - "name": "PHP" - }, - "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/notifications/CreateWebhook.php", - "projectPath": "notifications/CreateWebhook.php", - "targetPath": "notifications/CreateWebhook", - "pageTitle": "notifications/CreateWebhook", - "title": "CreateWebhook" - }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 1, - "title": "Create Webhook Sample", - "slug": "create-webhook-sample" - }, - "depth": 1 - }, { - "type": "heading", - "data": { - "level": 1, - "title": "Basic Information", - "slug": "basic-information" - }, - "depth": 1, - "children": [ - { - "type": "heading", - "data": { - "level": 4, - "title": "NOTE: Please note that you need an https url for paypal webhooks. You can however override the url with https, and accept", - "slug": "note-please-note-that-you-need-an-https-url-for-paypal-webhooks-you-can-however-override-the-url-with-https-and-accept" - }, - "depth": 4 - } - ] - }, { - "type": "heading", - "data": { - "level": 1, - "title": "Event Types", - "slug": "event-types" - }, - "depth": 1, - "children": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Create Webhook", - "slug": "create-webhook" - }, - "depth": 3 - } - ] - } - ] - }, { "type": "file", "data": { "language": { @@ -1714,6 +1647,73 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 ] } ] + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/notifications/createWebhook.php", + "projectPath": "notifications/createWebhook.php", + "targetPath": "notifications/createWebhook", + "pageTitle": "notifications/createWebhook", + "title": "createWebhook" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Webhook Sample", + "slug": "create-webhook-sample" + }, + "depth": 1 + }, { + "type": "heading", + "data": { + "level": 1, + "title": "Basic Information", + "slug": "basic-information" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "NOTE: Please note that you need an https url for paypal webhooks. You can however override the url with https, and accept", + "slug": "note-please-note-that-you-need-an-https-url-for-paypal-webhooks-you-can-however-override-the-url-with-https-and-accept" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 1, + "title": "Event Types", + "slug": "event-types" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Create Webhook", + "slug": "create-webhook" + }, + "depth": 3 + } + ] + } + ] } ] }, { @@ -2924,6 +2924,268 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 ] } ] + }, { + "type": "folder", + "data": { + "path": "payouts", + "title": "payouts" + }, + "depth": 1, + "children": [ + { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/payouts/CreateBatchPayout.php", + "projectPath": "payouts/CreateBatchPayout.php", + "targetPath": "payouts/CreateBatchPayout", + "pageTitle": "payouts/CreateBatchPayout", + "title": "CreateBatchPayout" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Bulk Payout Sample", + "slug": "create-bulk-payout-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "NOTE:", + "slug": "note" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Batch Header Instance", + "slug": "batch-header-instance" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item", + "slug": "sender-item" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item 2", + "slug": "sender-item-2" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item 3", + "slug": "sender-item-3" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payout", + "slug": "create-payout" + }, + "depth": 3 + } + ] + } + ] + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/payouts/CreateSinglePayout.php", + "projectPath": "payouts/CreateSinglePayout.php", + "targetPath": "payouts/CreateSinglePayout", + "pageTitle": "payouts/CreateSinglePayout", + "title": "CreateSinglePayout" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Single Synchronous Payout Sample", + "slug": "create-single-synchronous-payout-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "NOTE:", + "slug": "note" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Batch Header Instance", + "slug": "batch-header-instance" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item", + "slug": "sender-item" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payout", + "slug": "create-payout" + }, + "depth": 3 + } + ] + } + ] + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/payouts/GetPayoutBatchStatus.php", + "projectPath": "payouts/GetPayoutBatchStatus.php", + "targetPath": "payouts/GetPayoutBatchStatus", + "pageTitle": "payouts/GetPayoutBatchStatus", + "title": "GetPayoutBatchStatus" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Get Payout Batch Status Sample", + "slug": "get-payout-batch-status-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 2, + "title": "Payout Batch ID", + "slug": "payout-batch-id" + }, + "depth": 2, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Get Payout Batch Status", + "slug": "get-payout-batch-status" + }, + "depth": 3 + } + ] + } + ] + } + ] + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/japatel/Documents/workspace/paypal/PayPal-PHP-SDK/sample/payouts/GetPayoutItemStatus.php", + "projectPath": "payouts/GetPayoutItemStatus.php", + "targetPath": "payouts/GetPayoutItemStatus", + "pageTitle": "payouts/GetPayoutItemStatus", + "title": "GetPayoutItemStatus" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Get Payout Item Status Sample", + "slug": "get-payout-item-status-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 2, + "title": "Payout Item ID", + "slug": "payout-item-id" + }, + "depth": 2, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Get Payout Item Status", + "slug": "get-payout-item-status" + }, + "depth": 3 + } + ] + } + ] + } + ] + } + ] }, { "type": "folder", "data": { diff --git a/sample/doc/billing/CreateBillingAgreementWithPayPal.html b/sample/doc/billing/CreateBillingAgreementWithPayPal.html index 765aadd..1e07903 100644 --- a/sample/doc/billing/CreateBillingAgreementWithPayPal.html +++ b/sample/doc/billing/CreateBillingAgreementWithPayPal.html @@ -46,13 +46,8 @@ Please note that the plan Id should be only set in this case.
Please note that as the agreement has not yet activated, we wont be receiving the ID just yet.
The API response provides the url that you must redirect -the buyer to. Retrieve the url from the $agreement->getLinks() -method
This sample code demonstrate how you can create a webhook, as documented here at: https://developer.paypal.com/webapps/developer/docs/api/#create-a-webhook API used: POST /v1/notifications/webhooks
Create a new instance of Webhook object
The API response provides the url that you must redirect the buyer to. Retrieve the url from the $payment->getLinks() -method
The API response provides the url that you must redirect -the buyer to. Retrieve the url from the $payment->getLinks() -method
This sample code demonstrate how you can create a synchronous payout sample, as documented here at: +https://developer.paypal.com/docs/integration/direct/create-batch-payout/ +API used: /v1/payments/payouts
Create a new instance of Payout object
This is how our body should look like:
You can prevent duplicate batches from being processed. If you specify a sender_batch_id that was used in the last 30 days, the batch will not be processed. For items, you can specify a sender_item_id. If the value for the sender_item_id is a duplicate of a payout item that was processed in the last 30 days, the item will not be processed.
Please note that if you are using single payout with sync mode, you can only pass one Item in the request
There are many different ways of assigning values in PayPal SDK. Here is another way where you could directly inject json string.
One more way of assigning values in constructor when creating instance of PayPalModel object. Injecting array.
For Sample Purposes Only.
This sample code demonstrate how you can create a synchronous payout sample, as documented here at: +https://developer.paypal.com/docs/integration/direct/create-single-payout/ +API used: /v1/payments/payouts?sync_mode=true
Create a new instance of Payout object
This is how our body should look like:
You can prevent duplicate batches from being processed. If you specify a sender_batch_id that was used in the last 30 days, the batch will not be processed. For items, you can specify a sender_item_id. If the value for the sender_item_id is a duplicate of a payout item that was processed in the last 30 days, the item will not be processed.
Please note that if you are using single payout with sync mode, you can only pass one Item in the request
For Sample Purposes Only.
This sample code demonstrate how you can get the batch payout status of a created batch payout, as documented here at:
+https://developer.paypal.com/docs/api/#get-the-status-of-a-batch-payout
+API used: GET /v1/payments/payouts/
You can replace this with your Payout Batch Id on already created Payout.
Use this call to get data about a payout item, including the status, without retrieving an entire batch. You can get the status of an individual payout item in a batch in order to review the current status of a previously-unclaimed, or pending, payout item.
+https://developer.paypal.com/docs/api/#get-the-status-of-a-payout-item
+API used: GET /v1/payments/payouts-item/
You can replace this with your Payout Batch Id on already created Payout.
- These examples are created to experiment with the PayPal-PHP-SDK capabilities. Each examples - are - designed to demonstrate the default use-cases in each segment. - Many examples should be executable, and should allow you to experience the default behavior - of our - sdk, to expedite your integration experience.
+ .footer-links, .footer-links li { + display: inline-block; + font-size: 110%; + padding-left: 0px; + padding-right: 0px; + } - + .fixed { + position: fixed; + } + + .nav a { + font-weight: bold; + } + + + + + + + + +
+ These examples are created to experiment with the PayPal-PHP-SDK capabilities. Each examples + are + designed to demonstrate the default use-cases in each segment. + Many examples should be executable, and should allow you to experience the default behavior + of our + sdk, to expedite your integration experience.
+ +
For Sample Purposes Only.