IpagClient::voucher()   A
last analyzed

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\ChargeEndpoint;
7
use Ipag\Sdk\Endpoint\CheckoutEndpoint;
8
use Ipag\Sdk\Endpoint\CustomerEndpoint;
9
use Ipag\Sdk\Endpoint\EstablishmentEndpoint;
10
use Ipag\Sdk\Endpoint\PaymentEndpoint;
11
use Ipag\Sdk\Endpoint\PaymentLinksEndpoint;
12
use Ipag\Sdk\Endpoint\SellerEndpoint;
13
use Ipag\Sdk\Endpoint\SplitRulesEndpoint;
14
use Ipag\Sdk\Endpoint\SubscriptionEndpoint;
15
use Ipag\Sdk\Endpoint\SubscriptionPlanEndpoint;
16
use Ipag\Sdk\Endpoint\TokenEndpoint;
17
use Ipag\Sdk\Endpoint\TransactionEndpoint;
18
use Ipag\Sdk\Endpoint\TransferEndpoint;
19
use Ipag\Sdk\Endpoint\VoucherEndpoint;
20
use Ipag\Sdk\Endpoint\WebhookEndpoint;
21
use Ipag\Sdk\Http\Client\GuzzleHttpClient;
22
use Ipag\Sdk\IO\JsonSerializer;
23
use Psr\Log\LoggerInterface;
24
25
/**
26
 * IpagClient Class
27
 *
28
 * Classe principal do SDK. Responsável por instanciar os endpoint da API do IPag.
29
 */
30
class IpagClient extends Client
31
{
32
33
    public function IpagClient()
34
    {
35
    }
36
37
    /**
38
     * @param string $apiID API ID é a identificação do usuário.
39
     * @param string $apiKey API Key é a chave de acesso do usuário.
40
     * @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...
41
     * @param string $version Versão da API (valor padrão = '2').
42
     */
43
    public function __construct(string $apiID, string $apiKey, string $environment, ?LoggerInterface $logger = null, string $version = IpagEnvironment::VERSION)
44
    {
45
        parent::__construct(
46
            new IpagEnvironment($environment),
47
            new GuzzleHttpClient(
48
                [
49
                    'headers' => [
50
                        'x-api-version' => $version,
51
                    ],
52
                    'auth' => [$apiID, $apiKey]
53
                ]
54
            ),
55
            new JsonSerializer(),
56
            $logger
57
        );
58
    }
59
60
    public function customer(): CustomerEndpoint
61
    {
62
        return CustomerEndpoint::make($this, $this);
63
    }
64
65
    public function subscriptionPlan(): SubscriptionPlanEndpoint
66
    {
67
        return SubscriptionPlanEndpoint::make($this, $this);
68
    }
69
70
    public function subscription(): SubscriptionEndpoint
71
    {
72
        return SubscriptionEndpoint::make($this, $this);
73
    }
74
75
    public function transaction(): TransactionEndpoint
76
    {
77
        return TransactionEndpoint::make($this, $this);
78
    }
79
80
    public function token(): TokenEndpoint
81
    {
82
        return TokenEndpoint::make($this, $this);
83
    }
84
85
    public function charge(): ChargeEndpoint
86
    {
87
        return ChargeEndpoint::make($this, $this);
88
    }
89
90
    public function establishment(): EstablishmentEndpoint
91
    {
92
        return EstablishmentEndpoint::make($this, $this);
93
    }
94
95
    public function transfer(): TransferEndpoint
96
    {
97
        return TransferEndpoint::make($this, $this);
98
    }
99
100
    public function paymentLinks(): PaymentLinksEndpoint
101
    {
102
        return PaymentLinksEndpoint::make($this, $this);
103
    }
104
105
    public function webhook(): WebhookEndpoint
106
    {
107
        return WebhookEndpoint::make($this, $this);
108
    }
109
110
    public function seller(): SellerEndpoint
111
    {
112
        return SellerEndpoint::make($this, $this);
113
    }
114
115
    public function splitRules(): SplitRulesEndpoint
116
    {
117
        return SplitRulesEndpoint::make($this, $this);
118
    }
119
120
    public function voucher(): VoucherEndpoint
121
    {
122
        return VoucherEndpoint::make($this, $this);
123
    }
124
125
    public function checkout(): CheckoutEndpoint
126
    {
127
        return CheckoutEndpoint::make($this, $this);
128
    }
129
130
    public function payment(): PaymentEndpoint
131
    {
132
        return PaymentEndpoint::make($this, $this);
133
    }
134
135
}