Skip to content

Commit

Permalink
More trace updates
Browse files Browse the repository at this point in the history
This is the version used to generate the logs in D4
  • Loading branch information
BDavis56 committed Dec 2, 2014
1 parent 7f517b0 commit 199a8b8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
22 changes: 20 additions & 2 deletions Banker/MonthlyUpdateOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace Operations{

if ( account.Balance - payment < 0 ){


ENTER("Bank::FailedPayment&freezingCustomerCard");
Logger::error() << "Card Frozen." << endl;

if(Io::fileExists(user->Name+".creditcard.dat.payments.dat")){
Expand Down Expand Up @@ -99,10 +101,15 @@ namespace Operations{
}


EXIT("Bank::FailedPayment&freezingCustomerCard");


} else {
account.withdraw( payment );
context.getData().storeAccount( *user, account );

ENTER("customer::SuccessfulPayment");

if(Io::fileExists(user->Name+".creditcard.dat.payments.dat")){


Expand Down Expand Up @@ -159,7 +166,7 @@ namespace Operations{
}

}
EXIT("customer::SuccessfulPayment");
}


Expand All @@ -175,7 +182,10 @@ namespace Operations{

if ( account.Balance - payment < 0 ){

Logger::error() << "Invalid. The balance will be less than 0. Overdraft is not enabled" << endl;

ENTER("Bank::FailedPayment&freezingCustomerCard");

Logger::error() << "Card frozen." << endl;

if(Io::fileExists(user->Name+".creditcard.dat.payments.dat")){

Expand Down Expand Up @@ -230,11 +240,15 @@ namespace Operations{

}

EXIT("Bank::FailedPayment&freezingCustomerCard");


} else {
account.withdraw( payment );
context.getData().storeAccount( *user, account );

ENTER("customer::SuccessfulPayment");

if(Io::fileExists(user->Name+".creditcard.dat.payments.dat")){


Expand Down Expand Up @@ -292,6 +306,8 @@ namespace Operations{

}

EXIT("customer::SuccessfulPayment");

}


Expand All @@ -314,6 +330,8 @@ namespace Operations{

}

EXIT("MonthlyUpdateOperation::Execute");

}


Expand Down
14 changes: 10 additions & 4 deletions Banker/Vendor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Vendors{
ENTER("Vendor::checkPin");
// User customer = context.getData().getUser(inputUsername);

if (data.checkPin(customer, inputPin) ) { // CHANGE THIS TO APPROPRIATE MODIFIER
if (data.checkPin(customer, inputPin) ) {

EXIT("Vendor::checkPin-true");
return true;
Expand All @@ -53,7 +53,7 @@ namespace Vendors{
return false;
}

EXIT("Vendor::checkPin"); //May not be reached.
//EXIT("Vendor::checkPin"); not reached.
}

bool Vendor::isCardFrozen (FilesystemData data, User customer){
Expand All @@ -62,6 +62,9 @@ namespace Vendors{


if(Io::fileExists(customer.Name+".creditcard.frozen.dat")){
ENTER("customer::isNotifiedOfFrozen");
EXIT("customer::isNotifiedOfFrozen");

EXIT("Vendor::isCardFrozen-true");
return true;
}
Expand Down Expand Up @@ -99,7 +102,6 @@ namespace Vendors{

ENTER("Vendor::purchaseSession");

// You did a lot of -> without checking whether you should in this one.

/* Real date function adapted from http://stackoverflow.com/questions/16357999/current-date-and-time-as-string . This one suited my purpose by providing a simple, streamlined way to get the real date. I didn't feel it should be controlled by the vendor. */

Expand Down Expand Up @@ -182,7 +184,10 @@ namespace Vendors{
creditAccount.withdraw( purchasePrice );

// Collectively, these three statements will add a transaction history.
//ENTER("Vendor::updateCustomer");
_transferData->storeAccount( customer, creditAccount );
// EXIT("Vendor::updateCustomer");
// ENTER("Vendor::notifyBank");
_transferData->storeTransaction ( inputUsername, CreditCard, thisVendor.updateCustomer(purchasePrice) );
thisVendor.updateVendor(purchasePrice, inputUsername);

Expand Down Expand Up @@ -221,6 +226,7 @@ namespace Vendors{
void Vendor::updateVendor (double purchasePrice, string clientName ){

ENTER("Vendor::updateVendor");
ENTER("Vendor::notifyBank");

time_t timeVar;
struct tm * timeinfo;
Expand Down Expand Up @@ -296,7 +302,7 @@ namespace Vendors{




EXIT("Vendor::notifyBank");
EXIT("Vendor::updateVendor");
/*myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
Expand Down

0 comments on commit 199a8b8

Please sign in to comment.