1 <?php
2 /**
3 * Pagarme Refund Request
4 */
5
6 namespace Omnipay\Pagarme\Message;
7
8 /**
9 * Pagarme Refund Request
10 *
11 * This route is used when you want to reverse a transaction
12 * performed by a charge via credit card.
13 * In case of reversal a transaction, only the id of the transaction
14 * is required to effect the reversal.
15 *
16 * Example -- note this example assumes that the purchase has been successful
17 * and that the transaction ID returned from the purchase is held in $sale_id.
18 * See PurchaseRequest for the first part of this example transaction:
19 *
20 * <code>
21 * // Do a refund transaction on the gateway
22 * $transaction = $gateway->refund(array(
23 * 'transactionReference' => $sale_id,
24 * ));
25 * $response = $transaction->send();
26 * if ($response->isSuccessful()) {
27 * echo "Refund transaction was successful!\n";
28 * $refund_id = $response->getTransactionReference();
29 * echo "Transaction reference = " . $refund_id . "\n";
30 * }
31 * </code>
32 *
33 * @see PurchaseRequest
34 * @see Omnipay\Pagarme\Gateway
35 * @link https://docs.pagar.me/api/?shell#estorno-de-transao
36 */
37 class RefundRequest extends AbstractRequest
38 {
39 public function getData()
40 {
41 $this->validate('transactionReference');
42
43 $data = array();
44
45 return $data;
46 }
47
48 public function getEndpoint()
49 {
50 return $this->endpoint.'transactions/'.$this->getTransactionReference().'/refund';
51 }
52 }
53