095200a145a415c6b772a6b8269c938bea59ec25
[WP-Plugins/glm-member-db.git] /
1 <?php
2 namespace PayPal\Api;
3
4 use PayPal\Common\PPModel;
5 use PayPal\Rest\IResource;
6 use PayPal\Rest\Call;
7 use PayPal\Rest\ApiContext;
8 use PayPal\Api\Refund;
9 use PayPal\Transport\PPRestCall;
10
11 class Refund extends PPModel implements IResource {
12
13         private static $credential;
14
15         /**
16          *
17          * @deprecated. Pass ApiContext to create/get methods instead
18          */
19         public static function setCredential($credential) {
20                 self::$credential = $credential;
21         }
22
23         /**
24          * Identifier of the refund transaction.
25          * @param string $id
26          */
27         public function setId($id) {
28                 $this->id = $id;
29                 return $this;
30         }
31
32         /**
33          * Identifier of the refund transaction.
34          * @return string
35          */
36         public function getId() {
37                 return $this->id;
38         }
39
40
41         /**
42          * Time the resource was created.
43          * @param string $create_time
44          */
45         public function setCreateTime($create_time) {
46                 $this->create_time = $create_time;
47                 return $this;
48         }
49
50         /**
51          * Time the resource was created.
52          * @return string
53          */
54         public function getCreateTime() {
55                 return $this->create_time;
56         }
57
58         /**
59          * Time the resource was created.
60          * @param string $create_time
61          * @deprecated. Instead use setCreateTime
62          */
63         public function setCreate_time($create_time) {
64                 $this->create_time = $create_time;
65                 return $this;
66         }
67         /**
68          * Time the resource was created.
69          * @return string
70          * @deprecated. Instead use getCreateTime
71          */
72         public function getCreate_time() {
73                 return $this->create_time;
74         }
75
76         /**
77          * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
78          * @param PayPal\Api\Amount $amount
79          */
80         public function setAmount($amount) {
81                 $this->amount = $amount;
82                 return $this;
83         }
84
85         /**
86          * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
87          * @return PayPal\Api\Amount
88          */
89         public function getAmount() {
90                 return $this->amount;
91         }
92
93
94         /**
95          * State of the refund transaction.
96          * @param string $state
97          */
98         public function setState($state) {
99                 $this->state = $state;
100                 return $this;
101         }
102
103         /**
104          * State of the refund transaction.
105          * @return string
106          */
107         public function getState() {
108                 return $this->state;
109         }
110
111
112         /**
113          * ID of the Sale transaction being refunded. 
114          * @param string $sale_id
115          */
116         public function setSaleId($sale_id) {
117                 $this->sale_id = $sale_id;
118                 return $this;
119         }
120
121         /**
122          * ID of the Sale transaction being refunded. 
123          * @return string
124          */
125         public function getSaleId() {
126                 return $this->sale_id;
127         }
128
129         /**
130          * ID of the Sale transaction being refunded. 
131          * @param string $sale_id
132          * @deprecated. Instead use setSaleId
133          */
134         public function setSale_id($sale_id) {
135                 $this->sale_id = $sale_id;
136                 return $this;
137         }
138         /**
139          * ID of the Sale transaction being refunded. 
140          * @return string
141          * @deprecated. Instead use getSaleId
142          */
143         public function getSale_id() {
144                 return $this->sale_id;
145         }
146
147         /**
148          * ID of the Capture transaction being refunded. 
149          * @param string $capture_id
150          */
151         public function setCaptureId($capture_id) {
152                 $this->capture_id = $capture_id;
153                 return $this;
154         }
155
156         /**
157          * ID of the Capture transaction being refunded. 
158          * @return string
159          */
160         public function getCaptureId() {
161                 return $this->capture_id;
162         }
163
164         /**
165          * ID of the Capture transaction being refunded. 
166          * @param string $capture_id
167          * @deprecated. Instead use setCaptureId
168          */
169         public function setCapture_id($capture_id) {
170                 $this->capture_id = $capture_id;
171                 return $this;
172         }
173         /**
174          * ID of the Capture transaction being refunded. 
175          * @return string
176          * @deprecated. Instead use getCaptureId
177          */
178         public function getCapture_id() {
179                 return $this->capture_id;
180         }
181
182         /**
183          * ID of the Payment resource that this transaction is based on.
184          * @param string $parent_payment
185          */
186         public function setParentPayment($parent_payment) {
187                 $this->parent_payment = $parent_payment;
188                 return $this;
189         }
190
191         /**
192          * ID of the Payment resource that this transaction is based on.
193          * @return string
194          */
195         public function getParentPayment() {
196                 return $this->parent_payment;
197         }
198
199         /**
200          * ID of the Payment resource that this transaction is based on.
201          * @param string $parent_payment
202          * @deprecated. Instead use setParentPayment
203          */
204         public function setParent_payment($parent_payment) {
205                 $this->parent_payment = $parent_payment;
206                 return $this;
207         }
208         /**
209          * ID of the Payment resource that this transaction is based on.
210          * @return string
211          * @deprecated. Instead use getParentPayment
212          */
213         public function getParent_payment() {
214                 return $this->parent_payment;
215         }
216
217         /**
218          * 
219          * @array
220          * @param PayPal\Api\Links $links
221          */
222         public function setLinks($links) {
223                 $this->links = $links;
224                 return $this;
225         }
226
227         /**
228          * 
229          * @return PayPal\Api\Links
230          */
231         public function getLinks() {
232                 return $this->links;
233         }
234
235
236
237         public static function get($refundId, $apiContext = null) {
238                 if (($refundId == null) || (strlen($refundId) <= 0)) {
239                         throw new \InvalidArgumentException("refundId cannot be null or empty");
240                 }
241                 $payLoad = "";
242                 if ($apiContext == null) {
243                         $apiContext = new ApiContext(self::$credential);
244                 }
245                 $call = new PPRestCall($apiContext);
246                 $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
247                 $ret = new Refund();
248                 $ret->fromJson($json);
249                 return $ret;
250         }
251 }