Consistent save = income / spend = expenditure var naming for wallet usage

This commit is contained in:
2024-11-19 14:52:15 +01:00
parent af4c7cb4a2
commit b4dcd9571c
2 changed files with 7 additions and 11 deletions
@@ -21,7 +21,7 @@ final class WalletTransactionsListener
) {}
/**
* Generates a WalletStatement for User-received Transactions.
* Generates an income statement for User-received Transactions.
*/
public function processTransaction(
Transaction $transaction,
@@ -31,13 +31,13 @@ final class WalletTransactionsListener
return;
}
$statement = $this->wallet->save($transaction);
$income = $this->wallet->save($transaction);
if ($statement->getId() !== null) {
if ($income->getId() !== null) {
return;
}
$event->getObjectManager()->persist($statement);
$event->getObjectManager()->persist($income);
$event->getObjectManager()->flush();
}
}
+3 -7
View File
@@ -52,18 +52,14 @@ class WalletGateway implements GatewayInterface
$transaction->setOrigin($origin);
$transaction->setTarget($charge->getTarget());
$outgoing = new WalletStatement();
$outgoing->setTransaction($transaction);
$outgoing->setDirection(StatementDirection::Outgoing);
$expenditure = $this->wallet->spend($transaction);
$outgoing = $this->wallet->spend($transaction);
$this->entityManager->persist($expenditure);
$this->entityManager->flush();
}
$checkout = $this->checkoutService->chargeCheckout($checkout);
$this->entityManager->persist($checkout);
$this->entityManager->flush();
return $checkout;
}