Code Duplication    Length = 24-24 lines in 2 locations

src/Message/CaptureRequest.php 1 location

@@ 49-72 (lines=24) @@
46
 * @see  \Omnipay\Ebanx\Gateway
47
 * @link https://developers.ebanxpagamentos.com/api-reference/ebanx-payment-api/ebanx-payment-guide/guide-capture-a-payment/
48
 */
49
class CaptureRequest extends AbstractRequest
50
{
51
    public function getData()
52
    {
53
        /*
54
         * As the capture request the params should be passed in the query
55
         * not in the body, we return an empty array for the body, and
56
         * change the params at the getEndpoint method.
57
         */
58
        return [];
59
    }
60
61
    public function getEndpoint()
62
    {
63
        $data                          = $this->getDefaultParameters();
64
        $data['hash']                  = $this->getTransactionReference();
65
        $data['merchant_payment_code'] = $this->getTransactionId();
66
67
        // Remove empty values to only send hash or merchant payment code
68
        $data = array_filter($data);
69
70
        return parent::getEndpoint() . '/capture?' . http_build_query($data, '', '&');
71
    }
72
}
73

src/Message/FetchTransactionRequest.php 1 location

@@ 43-66 (lines=24) @@
40
 * @see  \Omnipay\Ebanx\Gateway
41
 * @link https://developers.ebanxpagamentos.com/api-reference/ebanx-payment-api/ebanx-payment-guide/guide-capture-a-payment/
42
 */
43
class FetchTransactionRequest extends AbstractRequest
44
{
45
    public function getData()
46
    {
47
        /*
48
         * As the query request the params should be passed in the query
49
         * not in the body, we return an empty array for the body, and
50
         * change the params at the getEndpoint method.
51
         */
52
        return [];
53
    }
54
55
    public function getEndpoint()
56
    {
57
        $data                          = $this->getDefaultParameters();
58
        $data['hash']                  = $this->getTransactionReference();
59
        $data['merchant_payment_code'] = $this->getTransactionId();
60
61
        // Remove empty values to only send hash or merchant payment code
62
        $data = array_filter($data);
63
64
        return parent::getEndpoint() . '/query?' . http_build_query($data, '', '&');
65
    }
66
}
67