Passed
Pull Request — master (#7)
by Lucas
02:44
created

IpagClient::receivable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Ipag\Sdk\Core;
4
5
use Ipag\Sdk\Core\IpagEnvironment;
6
use Ipag\Sdk\Endpoint\AccountEndpoint;
7
use Ipag\Sdk\Endpoint\ChargeEndpoint;
8
use Ipag\Sdk\Endpoint\ChargeEndpointV2;
9
use Ipag\Sdk\Endpoint\CheckoutEndpoint;
10
use Ipag\Sdk\Endpoint\CheckoutEndpointV2;
11
use Ipag\Sdk\Endpoint\CustomerEndpoint;
12
use Ipag\Sdk\Endpoint\EstablishmentEndpoint;
13
use Ipag\Sdk\Endpoint\PaymentEndpoint;
14
use Ipag\Sdk\Endpoint\PaymentLinksEndpoint;
15
use Ipag\Sdk\Endpoint\PaymentLinksEndpointV2;
16
use Ipag\Sdk\Endpoint\ReceivableEndpoint;
17
use Ipag\Sdk\Endpoint\SellerEndpoint;
18
use Ipag\Sdk\Endpoint\SplitRulesEndpoint;
19
use Ipag\Sdk\Endpoint\SubscriptionEndpoint;
20
use Ipag\Sdk\Endpoint\SubscriptionEndpointV2;
21
use Ipag\Sdk\Endpoint\SubscriptionPlanEndpoint;
22
use Ipag\Sdk\Endpoint\TokenEndpoint;
23
use Ipag\Sdk\Endpoint\TransactionEndpoint;
24
use Ipag\Sdk\Endpoint\TransferEndpoint;
25
use Ipag\Sdk\Endpoint\VoucherEndpoint;
26
use Ipag\Sdk\Endpoint\WebhookEndpoint;
27
use Ipag\Sdk\Http\Client\GuzzleHttpClient;
28
use Ipag\Sdk\IO\JsonSerializer;
29
use Psr\Log\LoggerInterface;
30
31
/**
32
 * IpagClient Class
33
 *
34
 * Classe principal do SDK. Responsável por instanciar os endpoint da API do IPag.
35
 */
36
class IpagClient extends Client
37
{
38
39
    public function IpagClient()
40
    {
41
    }
42
43
    /**
44
     * @param string $apiID API ID é a identificação do usuário.
45
     * @param string $apiKey API Key é a chave de acesso do usuário.
46
     * @param string Ambiente de execução (IpagEnvironment::SANDBOX | IpagEnvironment::PRODUCTION).
0 ignored issues
show
Bug introduced by
The type Ipag\Sdk\Core\Ambiente was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
     * @param string $version Versão da API (valor padrão = '2').
48
     */
49
    public function __construct(string $apiID, string $apiKey, string $environment, ?LoggerInterface $logger = null, string $version = IpagEnvironment::VERSION)
50
    {
51
        parent::__construct(
52
            new IpagEnvironment($environment),
53
            new GuzzleHttpClient(
54
                [
55
                    'headers' => [
56
                        'x-api-version' => $version,
57
                    ],
58
                    'auth' => [$apiID, $apiKey]
59
                ]
60
            ),
61
            new JsonSerializer(),
62
            $logger
63
        );
64
    }
65
66
    public function customer(): CustomerEndpoint
67
    {
68
        return CustomerEndpoint::make($this, $this);
69
    }
70
71
    public function subscriptionPlan(): SubscriptionPlanEndpoint
72
    {
73
        return SubscriptionPlanEndpoint::make($this, $this);
74
    }
75
76
    public function subscription(): SubscriptionEndpoint
77
    {
78
        return SubscriptionEndpoint::make($this, $this);
79
    }
80
81
    public function subscriptionV2(): SubscriptionEndpointV2
82
    {
83
        return SubscriptionEndpointV2::make($this, $this);
84
    }
85
86
    public function transaction(): TransactionEndpoint
87
    {
88
        return TransactionEndpoint::make($this, $this);
89
    }
90
91
    public function token(): TokenEndpoint
92
    {
93
        return TokenEndpoint::make($this, $this);
94
    }
95
96
    public function charge(): ChargeEndpoint
97
    {
98
        return ChargeEndpoint::make($this, $this);
99
    }
100
101
    public function chargeV2(): ChargeEndpointV2
102
    {
103
        return ChargeEndpointV2::make($this, $this);
104
    }
105
106
    public function establishment(): EstablishmentEndpoint
107
    {
108
        return EstablishmentEndpoint::make($this, $this);
109
    }
110
111
    public function transfer(): TransferEndpoint
112
    {
113
        return TransferEndpoint::make($this, $this);
114
    }
115
116
    public function paymentLinks(): PaymentLinksEndpoint
117
    {
118
        return PaymentLinksEndpoint::make($this, $this);
119
    }
120
121
    public function paymentLinksV2(): PaymentLinksEndpointV2
122
    {
123
        return PaymentLinksEndpointV2::make($this, $this);
124
    }
125
126
    public function webhook(): WebhookEndpoint
127
    {
128
        return WebhookEndpoint::make($this, $this);
129
    }
130
131
    public function seller(): SellerEndpoint
132
    {
133
        return SellerEndpoint::make($this, $this);
134
    }
135
136
    public function splitRules(): SplitRulesEndpoint
137
    {
138
        return SplitRulesEndpoint::make($this, $this);
139
    }
140
141
    public function voucher(): VoucherEndpoint
142
    {
143
        return VoucherEndpoint::make($this, $this);
144
    }
145
146
    public function checkout(): CheckoutEndpoint
147
    {
148
        return CheckoutEndpoint::make($this, $this);
149
    }
150
151
    public function checkoutV2(): CheckoutEndpointV2
152
    {
153
        return CheckoutEndpointV2::make($this, $this);
154
    }
155
156
    public function payment(): PaymentEndpoint
157
    {
158
        return PaymentEndpoint::make($this, $this);
159
    }
160
161
    public function account(): AccountEndpoint
162
    {
163
        return AccountEndpoint::make($this, $this);
164
    }
165
166
    public function receivable(): ReceivableEndpoint
167
    {
168
        return ReceivableEndpoint::make($this, $this);
169
    }
170
}