Passed
Pull Request — main (#3)
by Bruno
04:28
created

GetpayCaptureClient   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 31
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A placeRequest() 0 12 1
1
<?php
2
/**
3
 * Copyright © Getnet. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See LICENSE for license details.
7
 */
8
9
declare(strict_types=1);
10
11
namespace Getnet\PaymentMagento\Gateway\Http\Client;
12
13
use Getnet\PaymentMagento\Gateway\Request\ExtPaymentIdRequest;
14
use Magento\Payment\Gateway\Http\ClientInterface;
15
use Magento\Payment\Gateway\Http\TransferInterface;
16
17
/**
18
 * Class Getpay Capture Client - Returns capture authorization.
19
 *
20
 * @SuppressWarnings(PHPCPD)
21
 */
22
class GetpayCaptureClient implements ClientInterface
23
{
24
    /**
25
     * Result Code - Block name.
26
     */
27
    public const RESULT_CODE = 'RESULT_CODE';
28
29
    /**
30
     * Response Pay Payment Id - Block name.
31
     */
32
    public const RESPONSE_PAYMENT_ID = 'payment_id';
33
34
    /**
35
     * Places request to gateway.
36
     *
37
     * @param TransferInterface $transferObject
38
     *
39
     * @return array
40
     */
41
    public function placeRequest(TransferInterface $transferObject)
42
    {
43
        $request = $transferObject->getBody();
44
45
        $paymentId = $request[ExtPaymentIdRequest::GETNET_PAYMENT_ID];
46
47
        $response = [
48
            self::RESULT_CODE         => 1,
49
            self::RESPONSE_PAYMENT_ID => $paymentId,
50
        ];
51
52
        return $response;
53
    }
54
}
55