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

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Sep 10, 2014
1 parent 8c4c7e1 commit 80edfe3
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/main/java/com/bitpieces/shared/tools/WebTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ public static String saveCreatorPage(String id, String reqBody) {
return "Successful";

}

public static String saveCreatorYoutubeLink(String id, String reqBody) {

System.out.println(reqBody);
// Map<String, String> postMap = Tools.createMapFromAjaxPost(reqBody);
Map<String, String> postMap = Tools.createMapFromAjaxPost(reqBody);

String youtubeLink = postMap.get("youtube_link");

Creators_page_fields page = Creators_page_fields.findFirst("creators_id = ?", id);
Creator creator = Creator.findById(id);
String username = creator.getString("username");
Expand All @@ -111,21 +113,22 @@ public static String saveCreatorYoutubeLink(String id, String reqBody) {
if (page == null) {
page = Creators_page_fields.createIt("creators_id", id,
"main_body", "Nothing here yet",
"youtube_link", reqBody);
"youtube_link", youtubeLink);
} else {
page.set("youtube_link", reqBody).saveIt();
page.set("youtube_link", youtubeLink).saveIt();
}


return "Successful";

}

public static String saveCreatorDescription(String id, String reqBody) {

System.out.println(reqBody);
// Map<String, String> postMap = Tools.createMapFromAjaxPost(reqBody);
Map<String, String> postMap = Tools.createMapFromAjaxPost(reqBody);

String description = postMap.get("shortDescription");
Creators_page_fields page = Creators_page_fields.findFirst("creators_id = ?", id);
Creator creator = Creator.findById(id);
String username = creator.getString("username");
Expand All @@ -134,9 +137,9 @@ public static String saveCreatorDescription(String id, String reqBody) {
if (page == null) {
page = Creators_page_fields.createIt("creators_id", id,
"main_body", "Nothing here yet",
"description", reqBody);
"description", description);
} else {
page.set("description", reqBody).saveIt();
page.set("description", description).saveIt();
}


Expand Down Expand Up @@ -529,7 +532,7 @@ public static String makeCreatorWithdrawal(Coinbase cb, UID uid, String body, Un
String message = null;

Double feePct = Creator.findById(uid.getId()).getDouble("fee_pct");

if (!settings.getIso().equals("BTC")) {
Double spotRate = sf.getSpotRate(settings.getIso());
btcAmount = amount / spotRate;
Expand Down Expand Up @@ -588,7 +591,7 @@ public static String makeCreatorWithdrawalFake(UID uid, String body, UnitConvert
// For safety, convert the amount to BTC and make sure the user has that much
Double btcAmount = amount;
String message = null;

Double feePct = Creator.findById(uid.getId()).getDouble("fee_pct");

if (!settings.getIso().equals("BTC")) {
Expand All @@ -611,15 +614,15 @@ public static String makeCreatorWithdrawalFake(UID uid, String body, UnitConvert


if (currentFunds >= amountAfterFee) {

// Do the coinbase half, with the btc amount
Map<String, String> results;

// Do the DB side
// give this one the full amount, because it does the fee on its own
DBActions.creatorWithdrawalFake(uid.getId(), btcAmount);
// Do the coinbase half, with the btc amount
Map<String, String> results;

// Do the DB side
// give this one the full amount, because it does the fee on its own
DBActions.creatorWithdrawalFake(uid.getId(), btcAmount);



} else {
throw new NoSuchElementException("You only have " + currentFunds + " BTC, "
+ "but are trying to withdraw " + btcAmount + " BTC");
Expand Down Expand Up @@ -1044,16 +1047,16 @@ public static String getCreatorsWithdrawFeePctJson(UID uid) {
Creator creator = Creator.findById(uid.getId());

json = creator.getString("fee_pct");


} catch(NullPointerException e) {
return "0.05";
}
return json;

}


public static String getRewardsEarnedTotalByUserJson(String userName, UID uid, UnitConverter sf) {
UsersSettings settings = new UsersSettings(uid);
String json = null;
Expand Down

0 comments on commit 80edfe3

Please sign in to comment.