Skip to content

Commit

Permalink
updated fio bank reader for automatic payments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lung committed Nov 16, 2024
1 parent 3e0af78 commit c7d0011
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 53 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"doctrine/annotations": "^1.8",
"endroid/qr-code": "^4.4",
"guzzlehttp/guzzle": "^7.8",
"h4kuna/fio": "^2.0",
"h4kuna/fio": "^3.0",
"league/csv": "^9.15",
"middlewares/negotiation": "^2.0",
"middlewares/trailing-slash": "^2.0",
Expand Down
199 changes: 158 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/BankPayment/BankPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace kissj\BankPayment;

use DateTimeInterface;
use h4kuna\Fio\Response\Read\Transaction;
use h4kuna\Fio\Read\Transaction;
use kissj\Event\Event;
use kissj\Orm\EntityDatetime;

Expand Down Expand Up @@ -42,7 +42,7 @@ public function mapTransactionInto(Transaction $t, Event $event): self
$this->event = $event;
$this->bankId = (string)$t->moveId;
$this->moveDate = $t->moveDate;
$this->price = (string)$t->volume;
$this->price = (string)$t->amount;
$this->variableSymbol = $t->variableSymbol;
$this->accountNumber = $t->toAccount . '/' . $t->bankCode;
$this->constantSymbol = $t->constantSymbol;
Expand Down
6 changes: 3 additions & 3 deletions src/BankPayment/FioBankPaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace kissj\BankPayment;

use h4kuna\Fio\Response\Read\Transaction;
use h4kuna\Fio\Read\Transaction;
use kissj\Event\Event;

readonly class FioBankPaymentService implements IBankPaymentService
Expand All @@ -28,10 +28,10 @@ public function getAndSafeFreshPaymentsFromBank(Event $event): int

$savedBankPaymentsCount = 0;
foreach ($freshPayments as $freshPayment) {
if ($freshPayment->volume > 0) { // get only incomes
if ($freshPayment->amount > 0) { // get only incomes
$bankPayment = new BankPayment();
$bankPayment = $bankPayment->mapTransactionInto($freshPayment, $event);
// TODO optimalize
// TODO optimize
$this->bankPaymentRepository->persist($bankPayment);
$savedBankPaymentsCount++;
}
Expand Down
Loading

0 comments on commit c7d0011

Please sign in to comment.