Passed
Push — master ( d94137...519b06 )
by Bruce Pinheiro de
02:30
created
src/Customer/CustomerClient.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
     protected $options = [];
25 25
 
26 26
     /**
27
-	 * CheckoutClientInterface constructor.
28
-	 * @param ContextInterface $context
27
+     * CheckoutClientInterface constructor.
28
+     * @param ContextInterface $context
29 29
      * @param array $options
30 30
      */
31 31
     public function __construct(ContextInterface $context, ?array $options = [])
32
-	{
33
-		$this->context = $context;
32
+    {
33
+        $this->context = $context;
34 34
         $this->options = $options;
35
-	}
35
+    }
36 36
 
37 37
     /**
38 38
      * @inheritDoc
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
     }
75 75
 
76 76
     public function setContext(ContextInterface $context): CustomerClientInterface
77
-	{
78
-		$this->context = $context;
79
-	}
77
+    {
78
+        $this->context = $context;
79
+    }
80 80
 
81 81
     /**
82 82
      * @inheritDoc
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
         ];
89 89
     }
90 90
 
91
-	function getLastResponse(): ResponseInterface
92
-	{
93
-		return $this->lastResponse;
94
-	}
91
+    function getLastResponse(): ResponseInterface
92
+    {
93
+        return $this->lastResponse;
94
+    }
95 95
 
96 96
 
97
-	/**
98
-	 * return the context used to created the client.
99
-	 * @return ContextInterface
100
-	 */
101
-	function getContext(): ContextInterface
102
-	{
97
+    /**
98
+     * return the context used to created the client.
99
+     * @return ContextInterface
100
+     */
101
+    function getContext(): ContextInterface
102
+    {
103 103
         return $this->context;
104 104
     }
105 105
 
@@ -182,5 +182,5 @@  discard block
 block discarded – undo
182 182
     function getToken():? AccessToken
183 183
     {
184 184
         return $this->token;
185
-	}
185
+    }
186 186
 }
Please login to merge, or discard this patch.
src/Checkout/CheckoutClient.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -22,71 +22,71 @@  discard block
 block discarded – undo
22 22
         request as protected traitRequest;
23 23
     }
24 24
 
25
-	protected $context;
26
-	protected $lastResponse;
25
+    protected $context;
26
+    protected $lastResponse;
27 27
     protected $options = [];
28 28
     protected $currentToken;
29 29
 
30 30
     function __construct(ContextInterface $context, ?array $options = [])
31
-	{
32
-		$this->context = $context;
31
+    {
32
+        $this->context = $context;
33 33
         $this->options = $options;
34
-	}
34
+    }
35 35
 
36
-	/**
37
-	 * @inheritDoc
38
-	 * @throws BadResponseException
39
-	 * @throws ConnectException
40
-	 */
36
+    /**
37
+     * @inheritDoc
38
+     * @throws BadResponseException
39
+     * @throws ConnectException
40
+     */
41 41
     function create(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface
42
-	{
42
+    {
43 43
         return $this->request('post', $checkout) ? $checkout : null;
44
-	}
44
+    }
45 45
 
46
-	/**
47
-	 * @inheritDoc
48
-	 * @throws BadResponseException
49
-	 * @throws ConnectException
50
-	 */
46
+    /**
47
+     * @inheritDoc
48
+     * @throws BadResponseException
49
+     * @throws ConnectException
50
+     */
51 51
     function complete(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface
52
-	{
52
+    {
53 53
         return $this->request('put', $checkout) ? $checkout : null;
54
-	}
54
+    }
55 55
 
56
-	/**
57
-	 * @param string $action
58
-	 * @param CheckoutInterface $checkout
56
+    /**
57
+     * @param string $action
58
+     * @param CheckoutInterface $checkout
59 59
      * @param string|null $endpoint
60
-	 * @return bool|null
61
-	 */
60
+     * @return bool|null
61
+     */
62 62
     function request(string $action, $checkout, string $endpoint = null):? bool
63
-	{
63
+    {
64 64
         if (!$checkout->isValid()) {
65 65
             throw new InvalidCheckoutException($checkout);
66
-		}
66
+        }
67 67
 
68 68
         return $this->traitRequest($action, $checkout);
69
-	}
70
-
71
-	/**
72
-	 * Generate a body to create a new checkout
73
-	 *
74
-	 * @param CheckoutInterface $checkout
75
-	 * @return array
76
-	 */
69
+    }
70
+
71
+    /**
72
+     * Generate a body to create a new checkout
73
+     *
74
+     * @param CheckoutInterface $checkout
75
+     * @return array
76
+     */
77 77
     protected static function getCheckoutBody(CheckoutInterface $checkout): array
78
-	{
79
-		return [
80
-			"checkout_reference" => $checkout->getReference(),
81
-			"amount" => $checkout->getAmount(),
82
-			"currency" => $checkout->getCurrency(),
83
-			"fee_amount" => $checkout->getFeeAmount(),
84
-			"pay_to_email" => $checkout->getPayToEmail(),
85
-			"pay_from_email" => $checkout->getPayFromEmail(),
86
-			"description" => $checkout->getDescription(),
87
-			"return_url" => $checkout->getRedirectUrl(),
88
-		];
89
-	}
78
+    {
79
+        return [
80
+            "checkout_reference" => $checkout->getReference(),
81
+            "amount" => $checkout->getAmount(),
82
+            "currency" => $checkout->getCurrency(),
83
+            "fee_amount" => $checkout->getFeeAmount(),
84
+            "pay_to_email" => $checkout->getPayToEmail(),
85
+            "pay_from_email" => $checkout->getPayFromEmail(),
86
+            "description" => $checkout->getDescription(),
87
+            "return_url" => $checkout->getRedirectUrl(),
88
+        ];
89
+    }
90 90
 
91 91
     /**
92 92
      * @param CheckoutInterface $checkout
@@ -94,74 +94,74 @@  discard block
 block discarded – undo
94 94
      * @return array
95 95
      */
96 96
     static function getBody($checkout, string $type = null): array
97
-	{
98
-		$defaultBody = self::getCheckoutBody($checkout);
99
-		switch ($checkout->getType()) {
100
-			case 'card':
101
-				$completeBody = self::getCardBody($checkout);
102
-				break;
103
-
104
-			case 'boleto':
105
-				$completeBody = self::getBoletoBody($checkout);
106
-				break;
107
-
108
-			default:
109
-				$completeBody = [];
110
-		}
111
-
112
-		return array_merge($defaultBody, $completeBody);
113
-	}
114
-
115
-	private static function getCardBody(CheckoutInterface $checkout): array
116
-	{
117
-		return [
118
-			'payment_type' => $checkout->getType(),
119
-			'token' => $checkout->getCard()->getToken(),
120
-			'customer_id' => $checkout->getCustomer()->getCustomerId()
121
-		];
122
-	}
123
-
124
-	private static function getBoletoBody(CheckoutInterface $checkout): array
125
-	{
126
-		$customer = $checkout->getCustomer();
127
-		return [
128
-			'payment_type' => $checkout->getType(),
129
-			'description' => $checkout->getDescription(),
130
-			'boleto_details' => [
97
+    {
98
+        $defaultBody = self::getCheckoutBody($checkout);
99
+        switch ($checkout->getType()) {
100
+            case 'card':
101
+                $completeBody = self::getCardBody($checkout);
102
+                break;
103
+
104
+            case 'boleto':
105
+                $completeBody = self::getBoletoBody($checkout);
106
+                break;
107
+
108
+            default:
109
+                $completeBody = [];
110
+        }
111
+
112
+        return array_merge($defaultBody, $completeBody);
113
+    }
114
+
115
+    private static function getCardBody(CheckoutInterface $checkout): array
116
+    {
117
+        return [
118
+            'payment_type' => $checkout->getType(),
119
+            'token' => $checkout->getCard()->getToken(),
120
+            'customer_id' => $checkout->getCustomer()->getCustomerId()
121
+        ];
122
+    }
123
+
124
+    private static function getBoletoBody(CheckoutInterface $checkout): array
125
+    {
126
+        $customer = $checkout->getCustomer();
127
+        return [
128
+            'payment_type' => $checkout->getType(),
129
+            'description' => $checkout->getDescription(),
130
+            'boleto_details' => [
131 131
 //				'cpf_cnpj' => $customer->getCpfCnpj(),
132
-				'payer_name' => $customer->getName(),
133
-				'payer_address' => $customer->getAddress(),
134
-				'payer_city' => $customer->getAddress()->getCity(),
135
-				'payer_state_code' => $customer->getAddress()->getState(),
136
-				'payer_post_code' => $customer->getAddress()->getPostalCode()
137
-			],
138
-		];
139
-	}
140
-
141
-	/**
142
-	 * @inheritDoc
143
-	 */
132
+                'payer_name' => $customer->getName(),
133
+                'payer_address' => $customer->getAddress(),
134
+                'payer_city' => $customer->getAddress()->getCity(),
135
+                'payer_state_code' => $customer->getAddress()->getState(),
136
+                'payer_post_code' => $customer->getAddress()->getPostalCode()
137
+            ],
138
+        ];
139
+    }
140
+
141
+    /**
142
+     * @inheritDoc
143
+     */
144 144
     static function getScopes(): array
145
-	{
146
-		return [
147
-			'payments',
148
-			'boleto'
149
-		];
150
-	}
151
-
152
-	function getLastResponse(): ResponseInterface
153
-	{
154
-		return $this->lastResponse;
155
-	}
156
-
157
-	/**
158
-	 * return the context used to created the client.
159
-	 * @return ContextInterface
160
-	 */
161
-	function getContext(): ContextInterface
162
-	{
163
-		return $this->context;
164
-	}
145
+    {
146
+        return [
147
+            'payments',
148
+            'boleto'
149
+        ];
150
+    }
151
+
152
+    function getLastResponse(): ResponseInterface
153
+    {
154
+        return $this->lastResponse;
155
+    }
156
+
157
+    /**
158
+     * return the context used to created the client.
159
+     * @return ContextInterface
160
+     */
161
+    function getContext(): ContextInterface
162
+    {
163
+        return $this->context;
164
+    }
165 165
 
166 166
     function getOptions(): array
167 167
     {
Please login to merge, or discard this patch.
src/Checkout/CheckoutInterface.php 1 patch
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -10,211 +10,211 @@
 block discarded – undo
10 10
  */
11 11
 interface CheckoutInterface
12 12
 {
13
-	/**
14
-	 * @return null|string
15
-	 */
16
-	function getId(): ?string;
17
-
18
-	/**
19
-	 * @param string $id
20
-	 * @return CheckoutInterface
21
-	 */
22
-	function setId(string $id): self;
23
-
24
-	/**
25
-	 * @return null|string
26
-	 */
27
-	function getStatus(): ?string;
28
-
29
-	/**
30
-	 * @param string $status
31
-	 * @return CheckoutInterface
32
-	 */
33
-	function setStatus(string $status): self;
34
-
35
-
36
-	/**
37
-	 * @param float $amount
38
-	 * @return CheckoutInterface
39
-	 */
40
-	function setAmount(float $amount): self;
41
-
42
-	/**
43
-	 * @return float
44
-	 */
45
-	function getAmount():? float;
46
-
47
-	/**
48
-	 * @return float|null
49
-	 */
13
+    /**
14
+     * @return null|string
15
+     */
16
+    function getId(): ?string;
17
+
18
+    /**
19
+     * @param string $id
20
+     * @return CheckoutInterface
21
+     */
22
+    function setId(string $id): self;
23
+
24
+    /**
25
+     * @return null|string
26
+     */
27
+    function getStatus(): ?string;
28
+
29
+    /**
30
+     * @param string $status
31
+     * @return CheckoutInterface
32
+     */
33
+    function setStatus(string $status): self;
34
+
35
+
36
+    /**
37
+     * @param float $amount
38
+     * @return CheckoutInterface
39
+     */
40
+    function setAmount(float $amount): self;
41
+
42
+    /**
43
+     * @return float
44
+     */
45
+    function getAmount():? float;
46
+
47
+    /**
48
+     * @return float|null
49
+     */
50 50
     function getFeeAmount():? float;
51 51
 
52
-	/**
53
-	 * @param float $amount
54
-	 * @return CheckoutInterface
55
-	 */
56
-	function setFeeAmount(float $amount): self;
57
-
58
-	/**
59
-	 * @return null|string
60
-	 */
61
-	function getCurrency(): ?string;
62
-
63
-	/**
64
-	 * @param string $currency
65
-	 * @return CheckoutInterface
66
-	 */
67
-	function setCurrency(string $currency): self;
68
-
69
-	/**
70
-	 * @return CustomerInterface|null
71
-	 */
72
-	function getCustomer(): ?CustomerInterface;
73
-
74
-	/**
75
-	 * @param CustomerInterface $customer
76
-	 * @return CheckoutInterface
77
-	 */
78
-	function setCustomer(CustomerInterface $customer): self;
79
-
80
-	/**
52
+    /**
53
+     * @param float $amount
54
+     * @return CheckoutInterface
55
+     */
56
+    function setFeeAmount(float $amount): self;
57
+
58
+    /**
59
+     * @return null|string
60
+     */
61
+    function getCurrency(): ?string;
62
+
63
+    /**
64
+     * @param string $currency
65
+     * @return CheckoutInterface
66
+     */
67
+    function setCurrency(string $currency): self;
68
+
69
+    /**
70
+     * @return CustomerInterface|null
71
+     */
72
+    function getCustomer(): ?CustomerInterface;
73
+
74
+    /**
75
+     * @param CustomerInterface $customer
76
+     * @return CheckoutInterface
77
+     */
78
+    function setCustomer(CustomerInterface $customer): self;
79
+
80
+    /**
81 81
      * @return PaymentInstrumentInterface|null
82
-	 */
82
+     */
83 83
     function getCard(): ?PaymentInstrumentInterface;
84 84
 
85
-	/**
85
+    /**
86 86
      * @param PaymentInstrumentInterface $card
87
-	 * @return CheckoutInterface
88
-	 */
87
+     * @return CheckoutInterface
88
+     */
89 89
     function setCard(PaymentInstrumentInterface $card): self;
90 90
 
91
-	/**
92
-	 * @return null|string
93
-	 */
94
-	function getPayToEmail(): ?string;
95
-
96
-	/**
97
-	 * @param string $email
98
-	 * @return CheckoutInterface
99
-	 */
100
-	function setPayToEmail(string $email): self;
101
-
102
-	/**
103
-	 * @return null|string
104
-	 */
105
-	function getPayFromEmail(): ?string;
106
-
107
-	/**
108
-	 * @param string $email
109
-	 * @return CheckoutInterface
110
-	 */
111
-	function setPayFromEmail(string $email): self;
112
-
113
-	/**
114
-	 * @return null|string
115
-	 */
116
-	function getReference(): ?string;
117
-
118
-	/**
119
-	 * @param string $reference
120
-	 * @return CheckoutInterface
121
-	 */
122
-	function setReference(string $reference): self;
123
-
124
-	/**
125
-	 * @return null|string
126
-	 */
127
-	function getDescription(): ?string;
128
-
129
-	/**
130
-	 * @param string $description
131
-	 * @return CheckoutInterface
132
-	 */
133
-	function setDescription(string $description): self;
134
-
135
-	/**
136
-	 * @return null|string
137
-	 */
138
-	function getRedirectUrl(): ?string;
139
-
140
-	/**
141
-	 * @param string $url
142
-	 * @return CheckoutInterface
143
-	 */
144
-	function setRedirectUrl(string $url): self;
145
-
146
-	/**
147
-	 * @return string
148
-	 */
149
-	function getValidUntil():? string;
150
-
151
-	/**
152
-	 * @param string $timestamp
153
-	 * @return CheckoutInterface
154
-	 */
155
-	function setValidUntil(string $timestamp): self;
156
-
157
-	/**
158
-	 * @return null|string
159
-	 */
160
-	function getTransactionCode(): ?string;
161
-
162
-	/**
163
-	 * @param string $code
164
-	 * @return CheckoutInterface
165
-	 */
166
-	function setTransactionCode(string $code): self;
167
-
168
-	/**
169
-	 * @return null|string
170
-	 */
171
-	function getTransactionId(): ?string;
172
-
173
-	/**
174
-	 * @param string $id
175
-	 * @return CheckoutInterface
176
-	 */
177
-	function setTransactionId(string $id): self;
178
-
179
-	/**
180
-	 * @return array|null
181
-	 */
182
-	function getTransactions(): ?array;
183
-
184
-	/**
185
-	 * @param array $transactions
186
-	 * @return CheckoutInterface
187
-	 */
188
-	function setTransactions(array $transactions): self;
189
-
190
-	/**
191
-	 * @return null|string
192
-	 */
193
-	function getToken(): ?string;
194
-
195
-	/**
196
-	 * @param string $token
197
-	 * @return CheckoutInterface
198
-	 */
199
-	function setToken(string $token): self;
200
-
201
-	/**
91
+    /**
92
+     * @return null|string
93
+     */
94
+    function getPayToEmail(): ?string;
95
+
96
+    /**
97
+     * @param string $email
98
+     * @return CheckoutInterface
99
+     */
100
+    function setPayToEmail(string $email): self;
101
+
102
+    /**
103
+     * @return null|string
104
+     */
105
+    function getPayFromEmail(): ?string;
106
+
107
+    /**
108
+     * @param string $email
109
+     * @return CheckoutInterface
110
+     */
111
+    function setPayFromEmail(string $email): self;
112
+
113
+    /**
114
+     * @return null|string
115
+     */
116
+    function getReference(): ?string;
117
+
118
+    /**
119
+     * @param string $reference
120
+     * @return CheckoutInterface
121
+     */
122
+    function setReference(string $reference): self;
123
+
124
+    /**
125
+     * @return null|string
126
+     */
127
+    function getDescription(): ?string;
128
+
129
+    /**
130
+     * @param string $description
131
+     * @return CheckoutInterface
132
+     */
133
+    function setDescription(string $description): self;
134
+
135
+    /**
136
+     * @return null|string
137
+     */
138
+    function getRedirectUrl(): ?string;
139
+
140
+    /**
141
+     * @param string $url
142
+     * @return CheckoutInterface
143
+     */
144
+    function setRedirectUrl(string $url): self;
145
+
146
+    /**
147
+     * @return string
148
+     */
149
+    function getValidUntil():? string;
150
+
151
+    /**
152
+     * @param string $timestamp
153
+     * @return CheckoutInterface
154
+     */
155
+    function setValidUntil(string $timestamp): self;
156
+
157
+    /**
158
+     * @return null|string
159
+     */
160
+    function getTransactionCode(): ?string;
161
+
162
+    /**
163
+     * @param string $code
164
+     * @return CheckoutInterface
165
+     */
166
+    function setTransactionCode(string $code): self;
167
+
168
+    /**
169
+     * @return null|string
170
+     */
171
+    function getTransactionId(): ?string;
172
+
173
+    /**
174
+     * @param string $id
175
+     * @return CheckoutInterface
176
+     */
177
+    function setTransactionId(string $id): self;
178
+
179
+    /**
180
+     * @return array|null
181
+     */
182
+    function getTransactions(): ?array;
183
+
184
+    /**
185
+     * @param array $transactions
186
+     * @return CheckoutInterface
187
+     */
188
+    function setTransactions(array $transactions): self;
189
+
190
+    /**
191
+     * @return null|string
192
+     */
193
+    function getToken(): ?string;
194
+
195
+    /**
196
+     * @param string $token
197
+     * @return CheckoutInterface
198
+     */
199
+    function setToken(string $token): self;
200
+
201
+    /**
202 202
      * @return bool
203
-	 */
203
+     */
204 204
     function isValid(): bool;
205 205
 
206
-	/**
207
-	 * @param string|null $type
208
-	 * @return CheckoutInterface
209
-	 */
210
-	function setType(string $type = null): self;
206
+    /**
207
+     * @param string|null $type
208
+     * @return CheckoutInterface
209
+     */
210
+    function setType(string $type = null): self;
211 211
 
212
-	/**
213
-	 * @return null|string
214
-	 */
215
-	function getType():? string;
212
+    /**
213
+     * @return null|string
214
+     */
215
+    function getType():? string;
216 216
 
217
-	function setInstallments(?string $installments):? self;
218
-	function getInstallments():? string;
217
+    function setInstallments(?string $installments):? self;
218
+    function getInstallments():? string;
219 219
 
220 220
 }
Please login to merge, or discard this patch.