# FazzFinancial Platform Engineering Interview Questions
## 1. Deposit & Withdrawal
Given the following Ruby on Rails program, talk about:
```ruby
class TransactionController < ActionController::Base
def deposit
TransactionJob.perform_later(
account_id: params[:account_id],
amount: BigDecimal(params[:amount]),
)
render json: {"ok" => true}
end
def withdrawal
TransactionJob.perform_later(
account_id: params[:account_id],
amount: BigDecimal(params[:amount]) * -1,
)
render json: {"ok" => true}
end
end
class TransactionJob < ActiveJob::Base
def perform(account_id:, amount:)
account = Account.find(account_id)
if account.balance + amount >= 0
account.balance += amount
account.save
end
end
end
# CREATE TABLE `accounts` (
# `id` INT,
# `balance` DECIMAL
# );
class Account < ActiveRecord::Base
end
```
### performance issues
TODO
### concurrency issues
TODO
### user experience issues
TODO
## 2. Distributed Transaction
> A distributed transaction is a set of operations on data that is performed across two or more databases.
Create a microservice supporting distributed transaction and the following operations:
1. deposit(account_id:, amount:)
2. withdrawal(account_id:, amount:)
3. transfer(sender_account_id:, recipient_account_id:, amount:)
Please consider the following topics:
### the tools you would use to create such service
TODO
### performance & user experience
TODO
### maintainability
TODO
### development time estimation
TODO