| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Services\Pagarme;
- use App\Data\Pagarme\Request\PagarmeTransferRequestData;
- use App\Services\Pagarme\Concerns\SendsPagarmeRequests;
- class PagarmeTransferService
- {
- use SendsPagarmeRequests;
- public function createTransfer(int $amountInCents, string $recipientId, string $idempotencyKey): array
- {
- return $this->pagarmeRequest(
- method: 'POST',
- path: '/transfers',
- payload: new PagarmeTransferRequestData(
- amount: $amountInCents,
- recipientId: $recipientId,
- ),
- idempotencyKey: $idempotencyKey,
- errorMessage: 'Erro ao criar transferencia (saque) no Pagar.me.',
- );
- }
- public function getTransfer(string $transferId): array
- {
- return $this->pagarmeRequest(
- method: 'GET',
- path: "/transfers/{$transferId}",
- payload: [],
- idempotencyKey: "get-transfer-{$transferId}",
- errorMessage: 'Erro ao consultar transferencia no Pagar.me.',
- );
- }
- }
|