| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Data\Pagarme\Anticipation;
- use App\Data\Pagarme\PagarmeResponseData;
- final readonly class AnticipationLimitData extends PagarmeResponseData
- {
- public function __construct(
- public int $amount,
- public int $anticipationFee,
- public int $fee,
- public int $fraudCoverageFee,
- ) {}
- public static function fromArray(array $payload): static
- {
- return new self(
- amount: static::arrInt($payload, 'amount') ?? 0,
- anticipationFee: static::arrInt($payload, 'anticipation_fee') ?? 0,
- fee: static::arrInt($payload, 'fee') ?? 0,
- fraudCoverageFee: static::arrInt($payload, 'fraud_coverage_fee') ?? 0,
- );
- }
- public function toArray(): array
- {
- return [
- 'amount' => $this->amount,
- 'anticipation_fee' => $this->anticipationFee,
- 'fee' => $this->fee,
- 'fraud_coverage_fee' => $this->fraudCoverageFee,
- ];
- }
- }
|