Code Duplication    Length = 37-37 lines in 2 locations

src/Message/AuthorizeRequest.php 1 location

@@ 13-49 (lines=37) @@
10
/**
11
 * @method Response send()
12
 */
13
class AuthorizeRequest extends AbstractRequest
14
{
15
    use HasGateway, HasPaymentMethodData, HasGatewaySpecificFields, HasOwnerData;
16
17
    /**
18
     * @return array
19
     * @throws \Omnipay\Common\Exception\InvalidCreditCardException
20
     * @throws \Omnipay\Common\Exception\InvalidRequestException
21
     * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException
22
     */
23
    public function getData()
24
    {
25
        $this->validate('amount', 'currency');
26
27
        $data = $this->validateAndGetPaymentMethodData();
28
29
        $data = $this->fillGatewaySpecificFields($data);
30
31
        $data = $this->fillExistingParameters($data, array(
32
            'amount' => 'amount_integer',
33
            'currency_code' => 'currency',
34
            'email' => 'email',
35
            'retain_on_success' => 'retain_on_success',
36
        ));
37
38
        return array('transaction' => $data);
39
    }
40
41
    /**
42
     * @return string
43
     * @throws \Omnipay\Common\Exception\InvalidRequestException
44
     */
45
    public function getEndpoint()
46
    {
47
        return $this->getGatewayEndpoint() . 'authorize';
48
    }
49
}
50

src/Message/PurchaseRequest.php 1 location

@@ 13-49 (lines=37) @@
10
/**
11
 * @method Response send()
12
 */
13
class PurchaseRequest extends AbstractRequest
14
{
15
    use HasGateway, HasPaymentMethodData, HasGatewaySpecificFields, HasOwnerData;
16
17
    /**
18
     * @return array
19
     * @throws \Omnipay\Common\Exception\InvalidCreditCardException
20
     * @throws \Omnipay\Common\Exception\InvalidRequestException
21
     * @throws \Omnipay\Spreedly\Exception\InvalidPaymentMethodException
22
     */
23
    public function getData()
24
    {
25
        $this->validate('amount', 'currency');
26
27
        $data = $this->validateAndGetPaymentMethodData();
28
29
        $data = $this->fillGatewaySpecificFields($data);
30
31
        $data = $this->fillExistingParameters($data, array(
32
            'amount' => 'amount_integer',
33
            'currency_code' => 'currency',
34
            'email' => 'email',
35
            'retain_on_success' => 'retain_on_success',
36
        ));
37
38
        return array('transaction' => $data);
39
    }
40
41
    /**
42
     * @return string
43
     * @throws \Omnipay\Common\Exception\InvalidRequestException
44
     */
45
    public function getEndpoint()
46
    {
47
        return $this->getGatewayEndpoint() . 'purchase';
48
    }
49
}
50