|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Ebanx cancelRefund Request. |
|
4
|
|
|
*/ |
|
5
|
|
|
namespace Omnipay\Ebanx\Message; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Ebanx cancelRefund Request. |
|
9
|
|
|
* |
|
10
|
|
|
* To cancel a refund, you must call the API method refund. |
|
11
|
|
|
* A refund can be cancelled if, and only if, its status is requested (RE) or pending (PE). |
|
12
|
|
|
* |
|
13
|
|
|
* If everything goes well the refund will be immediately cancelled. |
|
14
|
|
|
* |
|
15
|
|
|
* If a refund is cancelled, the customer will not receive the money and the merchant will not be charged. |
|
16
|
|
|
* Customers are NOT notified about the refund cancellation. |
|
17
|
|
|
* |
|
18
|
|
|
* Example: |
|
19
|
|
|
* |
|
20
|
|
|
* <code> |
|
21
|
|
|
* // Create a gateway for the Ebanx Gateway |
|
22
|
|
|
* // (routes to GatewayFactory::create) |
|
23
|
|
|
* $gateway = Omnipay::create('Ebanx'); |
|
24
|
|
|
* |
|
25
|
|
|
* // Initialise the gateway |
|
26
|
|
|
* $gateway->initialize(array( |
|
27
|
|
|
* 'integration_key' => 'MyApiKey', |
|
28
|
|
|
* )); |
|
29
|
|
|
* |
|
30
|
|
|
* // Do a cancelRefund transaction on the gateway |
|
31
|
|
|
* $transaction = $gateway->cancelRefund(array( |
|
32
|
|
|
* 'transactionReference' => '5d5eb3389d1bce23d265b8d2376688b09a0fafc56d453252', |
|
33
|
|
|
* 'amount' => '10.00', |
|
34
|
|
|
* 'currency' => 'BRL', |
|
35
|
|
|
* 'description' => 'Description', |
|
36
|
|
|
* 'transactionId' => '32432432', |
|
37
|
|
|
* )); |
|
38
|
|
|
* |
|
39
|
|
|
* $response = $transaction->send(); |
|
40
|
|
|
* </code> |
|
41
|
|
|
* |
|
42
|
|
|
* @see \Omnipay\Ebanx\Gateway |
|
43
|
|
|
* @link https://developers.ebanxpagamentos.com/api-reference/ebanx-payment-api/ebanx-payment-guide/guide-cancel-a-refund/ |
|
44
|
|
|
*/ |
|
45
|
|
|
class CancelRefundRequest extends AbstractRequest |
|
46
|
|
|
{ |
|
47
|
3 |
|
public function getData() |
|
48
|
|
|
{ |
|
49
|
|
|
/* |
|
50
|
|
|
* As the cancel refund request the params should be passed in the query |
|
51
|
|
|
* not in the body, we return an empty array for the body, and |
|
52
|
|
|
* change the params at the getEndpoint method. |
|
53
|
|
|
*/ |
|
54
|
3 |
|
return []; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
3 |
|
public function getEndpoint() |
|
58
|
|
|
{ |
|
59
|
3 |
|
$this->validate('transactionId'); |
|
60
|
3 |
|
$data = array_merge($this->getDefaultParameters(), $this->getSplitData()); |
|
61
|
3 |
|
$data['operation'] = 'cancel'; |
|
62
|
3 |
|
$data['merchant_refund_code'] = $this->getTransactionId(); |
|
63
|
|
|
|
|
64
|
|
|
|
|
65
|
3 |
|
return parent::getEndpoint() . '/refund?' . http_build_query($data, '', '&'); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|