1 <?php
2
3 namespace PayPal\Api;
4
5 use PayPal\Common\PayPalModel;
6
7 /**
8 * Class PaymentExecution
9 *
10 * Let's you execute a PayPal Account based Payment resource with the payer_id obtained from web approval url.
11 *
12 * @package PayPal\Api
13 *
14 * @property string payer_id
15 * @property \PayPal\Api\Transaction[] transactions
16 */
17 class PaymentExecution extends PayPalModel
18 {
19 /**
20 * The ID of the Payer, passed in the `return_url` by PayPal.
21 *
22 * @param string $payer_id
23 *
24 * @return $this
25 */
26 public function setPayerId($payer_id)
27 {
28 $this->payer_id = $payer_id;
29 return $this;
30 }
31
32 /**
33 * The ID of the Payer, passed in the `return_url` by PayPal.
34 *
35 * @return string
36 */
37 public function getPayerId()
38 {
39 return $this->payer_id;
40 }
41
42 /**
43 * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable.
44 * @deprecated Not publicly available
45 * @param string $carrier_account_id
46 *
47 * @return $this
48 */
49 public function setCarrierAccountId($carrier_account_id)
50 {
51 $this->carrier_account_id = $carrier_account_id;
52 return $this;
53 }
54
55 /**
56 * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable.
57 * @deprecated Not publicly available
58 * @return string
59 */
60 public function getCarrierAccountId()
61 {
62 return $this->carrier_account_id;
63 }
64
65 /**
66 * Transactional details including the amount and item details.
67 *
68 * @param \PayPal\Api\Transaction[] $transactions
69 *
70 * @return $this
71 */
72 public function setTransactions($transactions)
73 {
74 $this->transactions = $transactions;
75 return $this;
76 }
77
78 /**
79 * Transactional details including the amount and item details.
80 *
81 * @return \PayPal\Api\Transaction[]
82 */
83 public function getTransactions()
84 {
85 return $this->transactions;
86 }
87
88 /**
89 * Append Transactions to the list.
90 *
91 * @param \PayPal\Api\Transaction $transaction
92 * @return $this
93 */
94 public function addTransaction($transaction)
95 {
96 if (!$this->getTransactions()) {
97 return $this->setTransactions(array($transaction));
98 } else {
99 return $this->setTransactions(
100 array_merge($this->getTransactions(), array($transaction))
101 );
102 }
103 }
104
105 /**
106 * Remove Transactions from the list.
107 *
108 * @param \PayPal\Api\Transaction $transaction
109 * @return $this
110 */
111 public function removeTransaction($transaction)
112 {
113 return $this->setTransactions(
114 array_diff($this->getTransactions(), array($transaction))
115 );
116 }
117
118 }
119