Andrew Wallo 4 місяці тому
джерело
коміт
9fd8b809a9

+ 3
- 1
app/Livewire/Company/Service/ConnectedAccount/ListInstitutions.php Переглянути файл

@@ -89,7 +89,9 @@ class ListInstitutions extends Component implements HasActions, HasForms
89 89
                 DatePicker::make('start_date')
90 90
                     ->label('Start date')
91 91
                     ->required()
92
-                    ->placeholder('Select a start date for importing transactions.'),
92
+                    ->placeholder('Select a start date for importing transactions.')
93
+                    ->minDate(now()->subDays(PlaidService::TRANSACTION_DAYS_REQUESTED)->toDateString())
94
+                    ->maxDate(now()->toDateString()),
93 95
             ])
94 96
             ->action(function (array $data, ConnectedBankAccount $connectedBankAccount) {
95 97
                 $selectedBankAccountId = $data['bank_account_id'] ?? $connectedBankAccount->bank_account_id;

+ 8
- 0
app/Services/PlaidService.php Переглянути файл

@@ -15,6 +15,8 @@ class PlaidService
15 15
 {
16 16
     public const API_VERSION = '2020-09-14';
17 17
 
18
+    public const TRANSACTION_DAYS_REQUESTED = 730;
19
+
18 20
     protected ?string $clientId;
19 21
 
20 22
     protected ?string $clientSecret;
@@ -204,6 +206,12 @@ class PlaidService
204 206
 
205 207
         if ($products) {
206 208
             $data['products'] = $products;
209
+
210
+            if (in_array('transactions', $products, true)) {
211
+                $data['transactions'] = [
212
+                    'days_requested' => self::TRANSACTION_DAYS_REQUESTED,
213
+                ];
214
+            }
207 215
         }
208 216
 
209 217
         if (! empty($this->webhookUrl)) {

Завантаження…
Відмінити
Зберегти