forked from LiveCarta/PayPal-PHP-SDK
96 lines
2.2 KiB
PHP
96 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace PayPal\Api;
|
|
|
|
use PayPal\Common\PayPalModel;
|
|
|
|
/**
|
|
* Class PaymentExecution
|
|
*
|
|
* Let's you execute a PayPal Account based Payment resource with the payer_id obtained from web approval url.
|
|
*
|
|
* @package PayPal\Api
|
|
*
|
|
* @property string payer_id
|
|
* @property \PayPal\Api\Transaction[] transactions
|
|
*/
|
|
class PaymentExecution extends PayPalModel
|
|
{
|
|
/**
|
|
* PayPal assigned Payer ID returned in the approval return url.
|
|
*
|
|
* @param string $payer_id
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setPayerId($payer_id)
|
|
{
|
|
$this->payer_id = $payer_id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* PayPal assigned Payer ID returned in the approval return url.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getPayerId()
|
|
{
|
|
return $this->payer_id;
|
|
}
|
|
|
|
/**
|
|
* Transaction information to be used at the time of execute payment. Only amount and shipping_address can be updated in execute payment
|
|
*
|
|
* @param \PayPal\Api\Transaction[] $transactions
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setTransactions($transactions)
|
|
{
|
|
$this->transactions = $transactions;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Transaction information to be used at the time of execute payment. Only amount and shipping_address can be updated in execute payment
|
|
*
|
|
* @return \PayPal\Api\Transaction[]
|
|
*/
|
|
public function getTransactions()
|
|
{
|
|
return $this->transactions;
|
|
}
|
|
|
|
/**
|
|
* Append Transactions to the list.
|
|
*
|
|
* @param \PayPal\Api\Transaction $transaction
|
|
* @return $this
|
|
*/
|
|
public function addTransaction($transaction)
|
|
{
|
|
if (!$this->getTransactions()) {
|
|
return $this->setTransactions(array($transaction));
|
|
} else {
|
|
return $this->setTransactions(
|
|
array_merge($this->getTransactions(), array($transaction))
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Remove Transactions from the list.
|
|
*
|
|
* @param \PayPal\Api\Transaction $transaction
|
|
* @return $this
|
|
*/
|
|
public function removeTransaction($transaction)
|
|
{
|
|
return $this->setTransactions(
|
|
array_diff($this->getTransactions(), array($transaction))
|
|
);
|
|
}
|
|
|
|
}
|