Skip to content

Commit 7197416

Browse files
committed
fix:
1 parent 09b5057 commit 7197416

5 files changed

Lines changed: 28 additions & 60 deletions

File tree

src/API/Customer.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function create(array $params): array
1818
{
1919
$options = new CustomerOptions\CreateOptions($params);
2020

21-
$response = $this->httpClient->post('/customer', [
22-
'json' => json_encode($options->all()),
23-
]);
21+
$response = $this->httpClient->post('/customer', body: json_encode($options->all()));
2422

2523
return ResponseMediator::getContent($response);
2624
}
@@ -36,7 +34,7 @@ public function all(array $params): array
3634
$options = new CustomerOptions\ReadAllOptions($params);
3735

3836
$response = $this->httpClient->get('/customer', [
39-
'json' => json_encode($options->all())
37+
'query' => $options->all()
4038
]);
4139

4240
return ResponseMediator::getContent($response);
@@ -66,9 +64,7 @@ public function update(string $id, array $params): array
6664
{
6765
$options = new CustomerOptions\UpdateOptions($params);
6866

69-
$response = $this->httpClient->put("/customer/{$id}", [
70-
'json' => json_encode($options->all()),
71-
]);
67+
$response = $this->httpClient->put("/customer/{$id}", body: json_encode($options->all()));
7268

7369
return ResponseMediator::getContent($response);
7470
}
@@ -84,9 +80,7 @@ public function validate(string $code, array $params): array
8480
{
8581
$options = new CustomerOptions\ValidateOptions($params);
8682

87-
$response = $this->httpClient->post("/customer/{$code}/identification", [
88-
'json' => json_encode($options->all()),
89-
]);
83+
$response = $this->httpClient->post("/customer/{$code}/identification", body: json_encode($options->all()));
9084

9185
return ResponseMediator::getContent($response);
9286
}
@@ -100,9 +94,7 @@ public function validate(string $code, array $params): array
10094
*/
10195
public function setRiskAction(string $code, string $riskAction = 'default'): array
10296
{
103-
$response = $this->httpClient->post("/customer/set_risk_action", [
104-
'json' => json_encode(['code' => $code, 'risk_action' => $riskAction]),
105-
]);
97+
$response = $this->httpClient->post("/customer/set_risk_action", body: json_encode(['code' => $code, 'risk_action' => $riskAction]));
10698

10799
return ResponseMediator::getContent($response);
108100
}
@@ -115,9 +107,7 @@ public function setRiskAction(string $code, string $riskAction = 'default'): arr
115107
*/
116108
public function deactivateAuthorization(string $authorizationCode): array
117109
{
118-
$response = $this->httpClient->post("/customer/deactivate_authorization", [
119-
'json' => json_encode(['authorization_code' => $authorizationCode]),
120-
]);
110+
$response = $this->httpClient->post("/customer/deactivate_authorization", body: json_encode(['authorization_code' => $authorizationCode]));
121111

122112
return ResponseMediator::getContent($response);
123113
}

src/API/Invoice.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function create(array $params): array
1818
{
1919
$options = new InvoiceOptions\CreateOptions($params);
2020

21-
$response = $this->httpClient->post('/paymentrequest', [
22-
'json' => json_encode($options->all()),
23-
]);
21+
$response = $this->httpClient->post('/paymentrequest', body: json_encode($options->all()));
2422

2523
return ResponseMediator::getContent($response);
2624
}
@@ -36,7 +34,7 @@ public function all(array $params): array
3634
$options = new InvoiceOptions\ReadAllOptions($params);
3735

3836
$response = $this->httpClient->get('/paymentrequest', [
39-
'json' => json_encode($options->all())
37+
'query' => $options->all()
4038
]);
4139

4240
return ResponseMediator::getContent($response);
@@ -130,9 +128,7 @@ public function update(string $id, array $params): array
130128
{
131129
$options = new InvoiceOptions\UpdateOptions($params);
132130

133-
$response = $this->httpClient->put("/paymentrequest/{$id}", [
134-
'json' => json_encode($options->all()),
135-
]);
131+
$response = $this->httpClient->put("/paymentrequest/{$id}", body: json_encode($options->all()));
136132

137133
return ResponseMediator::getContent($response);
138134
}

src/API/Plan.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function create(array $params): array
1818
{
1919
$options = new PlanOptions\CreateOptions($params);
2020

21-
$response = $this->httpClient->post('/plan', [
22-
'json' => json_encode($options->all()),
23-
]);
21+
$response = $this->httpClient->post('/plan', body: json_encode($options->all()));
2422

2523
return ResponseMediator::getContent($response);
2624
}
@@ -36,7 +34,7 @@ public function all(array $params): array
3634
$options = new PlanOptions\ReadAllOptions($params);
3735

3836
$response = $this->httpClient->get('/plan', [
39-
'json' => json_encode($options->all())
37+
'query' => $options->all()
4038
]);
4139

4240
return ResponseMediator::getContent($response);
@@ -66,9 +64,7 @@ public function update(string $id, array $params): array
6664
{
6765
$options = new PlanOptions\UpdateOptions($params);
6866

69-
$response = $this->httpClient->put("/plan/{$id}", [
70-
'json' => json_encode($options->all()),
71-
]);
67+
$response = $this->httpClient->put("/plan/{$id}", body: json_encode($options->all()));
7268

7369
return ResponseMediator::getContent($response);
7470
}

src/API/Subscription.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function create(array $params): array
1818
{
1919
$options = new SubscriptionOptions\CreateOptions($params);
2020

21-
$response = $this->httpClient->post('/subscription', [
22-
'json' => json_encode($options->all()),
23-
]);
21+
$response = $this->httpClient->post('/subscription', body: json_encode($options->all()));
2422

2523
return ResponseMediator::getContent($response);
2624
}
@@ -36,7 +34,7 @@ public function all(array $params): array
3634
$options = new SubscriptionOptions\ReadAllOptions($params);
3735

3836
$response = $this->httpClient->get('/subscription', [
39-
'json' => json_encode($options->all())
37+
'query' => $options->all()
4038
]);
4139

4240
return ResponseMediator::getContent($response);
@@ -65,9 +63,7 @@ public function find(string $id): array
6563
*/
6664
public function enable(string $code, string $token): array
6765
{
68-
$response = $this->httpClient->post("/subscription/enable", [
69-
'json' => json_encode(['code' => $code, 'token' => $token]),
70-
]);
66+
$response = $this->httpClient->post("/subscription/enable", body: json_encode(['code' => $code, 'token' => $token]));
7167

7268
return ResponseMediator::getContent($response);
7369
}
@@ -81,9 +77,7 @@ public function enable(string $code, string $token): array
8177
*/
8278
public function disable(string $code, string $token): array
8379
{
84-
$response = $this->httpClient->post("/subscription/disable", [
85-
'json' => json_encode(['code' => $code, 'token' => $token]),
86-
]);
80+
$response = $this->httpClient->post("/subscription/disable", body: json_encode(['code' => $code, 'token' => $token]));
8781

8882
return ResponseMediator::getContent($response);
8983
}

src/API/Transaction.php

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function initialize(array $params): array
1818
{
1919
$options = new TransactionOptions\InitializeOptions($params);
2020

21-
$response = $this->httpClient->post('/transaction/initialize', [
22-
'json' => json_encode($options->all()),
23-
]);
21+
$response = $this->httpClient->post('/transaction/initialize', body: json_encode($options->all()));
2422

2523
return ResponseMediator::getContent($response);
2624
}
@@ -49,7 +47,7 @@ public function all(array $params): array
4947
$options = new TransactionOptions\ReadAllOptions($params);
5048

5149
$response = $this->httpClient->get('/transaction', [
52-
'json' => json_encode($options->all())
50+
'query' => $options->all()
5351
]);
5452

5553
return ResponseMediator::getContent($response);
@@ -78,9 +76,7 @@ public function charge(array $params): array
7876
{
7977
$options = new TransactionOptions\ChargeOptions($params);
8078

81-
$response = $this->httpClient->post('/transaction/charge_authorization', [
82-
'json' => json_encode($options->all()),
83-
]);
79+
$response = $this->httpClient->post('/transaction/charge_authorization', body: json_encode($options->all()));
8480

8581
return ResponseMediator::getContent($response);
8682
}
@@ -96,14 +92,12 @@ public function charge(array $params): array
9692
*/
9793
public function checkAuthorization(string $amount, string $email, string $authorizationCode, string $currency)
9894
{
99-
$response = $this->httpClient->post('/transaction/check_authorization', [
100-
'json' => json_encode([
101-
'amount' => $amount,
102-
'email' => $email,
103-
'authorization_code' => $authorizationCode,
104-
'currency' => $currency,
105-
]),
106-
]);
95+
$response = $this->httpClient->post('/transaction/check_authorization', body: json_encode([
96+
'amount' => $amount,
97+
'email' => $email,
98+
'authorization_code' => $authorizationCode,
99+
'currency' => $currency,
100+
]));
107101

108102
return ResponseMediator::getContent($response);
109103
}
@@ -132,7 +126,7 @@ public function stats(array $params): array
132126
$options = new TransactionOptions\StatsOptions($params);
133127

134128
$response = $this->httpClient->get('/transaction/totals', [
135-
'json' => json_encode($options->all())
129+
'query' => $options->all()
136130
]);
137131

138132
return ResponseMediator::getContent($response);
@@ -149,7 +143,7 @@ public function export(array $params): array
149143
$options = new TransactionOptions\StatsOptions($params);
150144

151145
$response = $this->httpClient->get('/transaction/export', [
152-
'json' => json_encode($options->all())
146+
'query' => $options->all()
153147
]);
154148

155149
return ResponseMediator::getContent($response);
@@ -165,9 +159,7 @@ public function debitPartially(array $params): array
165159
{
166160
$options = new TransactionOptions\PartialDebitOptions($params);
167161

168-
$response = $this->httpClient->post('/transaction/partial_debit', [
169-
'json' => json_encode($options->all()),
170-
]);
162+
$response = $this->httpClient->post('/transaction/partial_debit', body: json_encode($options->all()));
171163

172164
return ResponseMediator::getContent($response);
173165
}

0 commit comments

Comments
 (0)