Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Commit

Permalink
Making sure to only update the status on deposits
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Sep 26, 2014
1 parent 953005c commit 4c37803
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/bitpieces/dev/init/InitializeTables.java
Expand Up @@ -186,19 +186,19 @@ private static void user_deposit() {
User terry = User.findFirst("username like 'Terry%'");


DBActions.makeOrUpdateOrder("fake1", "ofake1");
DBActions.makeOrUpdateCoinbaseOrder("fake1", "ofake1");
DBActions.makeDepositFake(dick.getId().toString(), .15d, "fake1");

// an exact amount, or a straight up pieces buy
DBActions.makeOrUpdateOrder("fake2", "ofake2");
DBActions.makeOrUpdateCoinbaseOrder("fake2", "ofake2");
DBActions.makeDepositFake(john.getId().toString(), .17d, "fake2");


DBActions.makeOrUpdateOrder("fake3", "ofake3");
DBActions.makeOrUpdateCoinbaseOrder("fake3", "ofake3");
DBActions.makeDepositFake(bill.getId().toString(), .015d, "fake3");


DBActions.makeOrUpdateOrder("fake4", "ofake4");
DBActions.makeOrUpdateCoinbaseOrder("fake4", "ofake4");
DBActions.makeDepositFake(terry.getId().toString(), .3d, "fake4");


Expand Down
9 changes: 3 additions & 6 deletions src/main/java/com/bitpieces/shared/tools/DBActions.java
Expand Up @@ -430,7 +430,7 @@ public static Users_deposits makeDepositFake(String usersId, Double btc_amount,
}


public static Users_deposits makeOrUpdateDeposit(String userId, Double btc_amount, String cb_tid, String status) {
public static Users_deposits makeOrUpdateCoinbaseDeposit(String userId, Double btc_amount, String cb_tid, String status) {

String timeStr = SDF.format(new Date());

Expand All @@ -446,10 +446,7 @@ public static Users_deposits makeOrUpdateDeposit(String userId, Double btc_amoun
"status", status);

} else {
dep.set("users_id", userId,
"cb_tid", cb_tid,
"time_", timeStr,
"btc_amount", btc_amount,
dep.set(
"status", status).saveIt();
return dep;
}
Expand All @@ -461,7 +458,7 @@ public static Users_deposits makeOrUpdateDeposit(String userId, Double btc_amoun



public static Orders makeOrUpdateOrder(String cb_tid, String order_number) {
public static Orders makeOrUpdateCoinbaseOrder(String cb_tid, String order_number) {

Orders order = Orders.findFirst("cb_tid=?", cb_tid);

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/bitpieces/shared/tools/WebTools.java
Expand Up @@ -407,7 +407,7 @@ public static String makeDepositFake(UID uid, String body, UnitConverter sf) {

String timeStr = Tools.SDF.get().format(new Date());

DBActions.makeOrUpdateOrder("fakeCbTid" + timeStr, "ofake1"+ timeStr);
DBActions.makeOrUpdateCoinbaseOrder("fakeCbTid" + timeStr, "ofake1"+ timeStr);
DBActions.makeDepositFake(uid.getId(),btcAmount, "fakeCbTid" + timeStr);

return message;
Expand Down Expand Up @@ -458,10 +458,10 @@ public static void makeDepositFromCoinbaseCallback(String userId, String body) {

System.out.println(bitcents + "|" + btcAmount + "|" + "cb_tid");

DBActions.makeOrUpdateOrder(cb_tid, orderNumber);
DBActions.makeOrUpdateCoinbaseOrder(cb_tid, orderNumber);


DBActions.makeOrUpdateDeposit(userId,btcAmount,cb_tid, status);
DBActions.makeOrUpdateCoinbaseDeposit(userId,btcAmount,cb_tid, status);



Expand Down

0 comments on commit 4c37803

Please sign in to comment.