Skip to content

Instantly share code, notes, and snippets.

@msulima
Last active December 21, 2015 04:58
Show Gist options
  • Save msulima/6252901 to your computer and use it in GitHub Desktop.
Save msulima/6252901 to your computer and use it in GitHub Desktop.
public void processSales(List<Sale> sales, Customer customer) {
boolean foreignCurrencyFound = false;
List<Transaction> transactions = new LinkedList<Transaction>();
for (Sale sale : sales) {
Transaction transaction = createTransaction(sale, customer);
transactions.add(transaction);
if (!foreignCurrencyFound && isInForeignCurrency(transaction))
foreignCurrencyFound = true;
}
if (foreignCurrencyFound)
notifyForeignOffice(customer);
saveInDatabase(transactions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment