Consistent save = income / spend = expenditure var naming for wallet usage
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user