4 use PayPal\Common\PPModel;
5 use PayPal\Rest\IResource;
7 use PayPal\Rest\ApiContext;
9 use PayPal\Transport\PPRestCall;
11 class Refund extends PPModel implements IResource {
13 private static $credential;
17 * @deprecated. Pass ApiContext to create/get methods instead
19 public static function setCredential($credential) {
20 self::$credential = $credential;
24 * Identifier of the refund transaction.
27 public function setId($id) {
33 * Identifier of the refund transaction.
36 public function getId() {
42 * Time the resource was created.
43 * @param string $create_time
45 public function setCreateTime($create_time) {
46 $this->create_time = $create_time;
51 * Time the resource was created.
54 public function getCreateTime() {
55 return $this->create_time;
59 * Time the resource was created.
60 * @param string $create_time
61 * @deprecated. Instead use setCreateTime
63 public function setCreate_time($create_time) {
64 $this->create_time = $create_time;
68 * Time the resource was created.
70 * @deprecated. Instead use getCreateTime
72 public function getCreate_time() {
73 return $this->create_time;
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
80 public function setAmount($amount) {
81 $this->amount = $amount;
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
89 public function getAmount() {
95 * State of the refund transaction.
96 * @param string $state
98 public function setState($state) {
99 $this->state = $state;
104 * State of the refund transaction.
107 public function getState() {
113 * ID of the Sale transaction being refunded.
114 * @param string $sale_id
116 public function setSaleId($sale_id) {
117 $this->sale_id = $sale_id;
122 * ID of the Sale transaction being refunded.
125 public function getSaleId() {
126 return $this->sale_id;
130 * ID of the Sale transaction being refunded.
131 * @param string $sale_id
132 * @deprecated. Instead use setSaleId
134 public function setSale_id($sale_id) {
135 $this->sale_id = $sale_id;
139 * ID of the Sale transaction being refunded.
141 * @deprecated. Instead use getSaleId
143 public function getSale_id() {
144 return $this->sale_id;
148 * ID of the Capture transaction being refunded.
149 * @param string $capture_id
151 public function setCaptureId($capture_id) {
152 $this->capture_id = $capture_id;
157 * ID of the Capture transaction being refunded.
160 public function getCaptureId() {
161 return $this->capture_id;
165 * ID of the Capture transaction being refunded.
166 * @param string $capture_id
167 * @deprecated. Instead use setCaptureId
169 public function setCapture_id($capture_id) {
170 $this->capture_id = $capture_id;
174 * ID of the Capture transaction being refunded.
176 * @deprecated. Instead use getCaptureId
178 public function getCapture_id() {
179 return $this->capture_id;
183 * ID of the Payment resource that this transaction is based on.
184 * @param string $parent_payment
186 public function setParentPayment($parent_payment) {
187 $this->parent_payment = $parent_payment;
192 * ID of the Payment resource that this transaction is based on.
195 public function getParentPayment() {
196 return $this->parent_payment;
200 * ID of the Payment resource that this transaction is based on.
201 * @param string $parent_payment
202 * @deprecated. Instead use setParentPayment
204 public function setParent_payment($parent_payment) {
205 $this->parent_payment = $parent_payment;
209 * ID of the Payment resource that this transaction is based on.
211 * @deprecated. Instead use getParentPayment
213 public function getParent_payment() {
214 return $this->parent_payment;
220 * @param PayPal\Api\Links $links
222 public function setLinks($links) {
223 $this->links = $links;
229 * @return PayPal\Api\Links
231 public function getLinks() {
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");
242 if ($apiContext == null) {
243 $apiContext = new ApiContext(self::$credential);
245 $call = new PPRestCall($apiContext);
246 $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payments/refund/$refundId", "GET", $payLoad);
248 $ret->fromJson($json);