Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
551175e
Created model and prepared job to working with currency for a shop
top802 Dec 15, 2020
e2fbb7a
Parsed json array for creating CurrencyDTO
top802 Dec 17, 2020
431321d
wip set currency list to shop
top802 Dec 17, 2020
6666802
A prepared place for select currency on the admin side
top802 Dec 18, 2020
c1ab550
A prepared for checking array
top802 Dec 19, 2020
96d516a
wip currency: rewrite updating CurrencyDTO in job
top802 Dec 21, 2020
93988f1
wip currency for shop: fixed updating currency
top802 Dec 22, 2020
93adcf2
added currency to admin in profile page
top802 Dec 23, 2020
626f7ef
Changed label in currency container
top802 Dec 23, 2020
9ae39e2
prepared currency
top802 Dec 23, 2020
727de55
get info about currency sign from class
top802 Dec 23, 2020
4eba428
fixed currency format for the correct sign
top802 Dec 24, 2020
c9932aa
added drop button changeCurrency in shop header
top802 Dec 24, 2020
c2d96b0
show currency correct on shop pages
top802 Dec 24, 2020
2b0c22b
fixed selected currencyDTO
top802 Dec 24, 2020
6f20c44
added first functionals for changing price to according currency
top802 Dec 29, 2020
43f7f84
fixed calucating price according currency
top802 Dec 30, 2020
1667829
fixed exchange currency
top802 Jan 4, 2021
7056d0c
fixed formation of product price depending on the currency
top802 Jan 11, 2021
dd65416
styled price
top802 Jan 11, 2021
54c1d8d
fixed currency for products in shop and category pages
top802 Jan 12, 2021
51500c3
wip currency
top802 Jan 12, 2021
f2e38b0
transfred currency to shopping cart
top802 Jan 12, 2021
9ba6a68
changed job execution GetDailyCurrency
top802 Jan 12, 2021
1cd174d
added sout in LiqPaySer
top802 Jan 12, 2021
3f9fe2d
added sout in LiqPaySer
top802 Jan 13, 2021
a9481ad
added currency to admin in profile page (unsaved work commit)
top802 Jan 13, 2021
8402b55
added currency in wizard page
top802 Jan 14, 2021
4f9b737
changed field name "currencyShop" to "currency" of CurrencyShopDTO ob…
top802 Jan 15, 2021
d13c683
fixed currency validation
top802 Jan 15, 2021
350cbca
currency select dropdown prototype
ReverieSylve Jan 18, 2021
c7a27b2
added currency selected in shop setting page
top802 Jan 18, 2021
41ab0a4
fixed selecting currency for shop
top802 Jan 18, 2021
42494ce
converted usd product price to uah
top802 Jan 19, 2021
2154e24
changed login in currency math operation
top802 Jan 20, 2021
d57df7a
fixed math operation in selecting currency for shop
top802 Jan 20, 2021
3e966a9
fixed language and currency elements at setting paig
top802 Jan 22, 2021
099016c
created dev branch
top802 Jan 26, 2021
9eaa8eb
merged from addCurrency branch
top802 Jan 26, 2021
cf59d50
Merge branch 'master' of https://github.com/WiseHands/WiseShop into dev
top802 Jan 26, 2021
3e7c852
fixed styles at shop and product page
top802 Jan 26, 2021
238c572
added currency configuration to shopping cart
top802 Jan 27, 2021
beb670e
fixed link for qr&currency in shop page
top802 Jan 27, 2021
1dca68c
fixed link to product page
top802 Jan 28, 2021
76dd49e
fixed price message
top802 Jan 28, 2021
2bd3db8
fixed link into category page
top802 Jan 29, 2021
b3b7c2a
fixed exchanging for default addition in product page
top802 Feb 2, 2021
fe30208
fixed currency label on admin side
top802 Feb 2, 2021
437d0ee
wip fixing exchanging
top802 Feb 3, 2021
1ce189b
fixed exchange currency
top802 Feb 4, 2021
7c82d8d
fixed round to additional total price
top802 Feb 4, 2021
3125f4e
fixed price in selected currency
top802 Feb 4, 2021
e98e555
fixed currency value
top802 Feb 4, 2021
b328df5
wip currency - added zloty to shop, fixed translation in shop-header
top802 Feb 9, 2021
ed74ad7
fixed updating plz currency
top802 Feb 15, 2021
bdcc983
wip test currency, fixed total price in order
top802 Feb 16, 2021
6d682b7
wip currency, fixed exchange price in additions
top802 Feb 18, 2021
202e3aa
wip currency, fixed exchange price in additions again
top802 Feb 21, 2021
b6e10b5
fixed rounding price in product page
top802 Feb 24, 2021
3341a59
wip currency, fixed exchange price in additions
top802 Feb 24, 2021
42ff64f
wip currency, fixed rounding price in product and category pages
top802 Feb 24, 2021
d8c360b
wip currency, fixed exchange price before pass to shopping cart
top802 Feb 25, 2021
3a7d167
wip currency, fixed exchange price in shop and category pages
top802 Feb 25, 2021
203f93d
wip currency, fixed exchange price in shop, need testing)
top802 Feb 26, 2021
96a9f44
testing exchanging currency in additions: fixed default additions
top802 Mar 2, 2021
e82c2cb
fixed analytic for payment type
top802 Mar 4, 2021
94a6654
test exchange currency: fixed delivery price - exchanging to selected…
top802 Mar 5, 2021
9ea0527
test exchange currency: fixed exchanging currency in product page
top802 Mar 10, 2021
aa35d28
test exchange currency: fixed exchanging currency in additions
top802 Mar 10, 2021
0223792
testing currency sign in admin side: fixed showing currency in produc…
top802 Mar 11, 2021
cde0e85
testing currency sign in admin side: fixed showing currency in order …
top802 Mar 11, 2021
50f22ee
add new product page - cropper WIP
ReverieSylve May 12, 2021
ede8f85
add new product page - cropper WIP 0.0.1
ReverieSylve May 12, 2021
f5c68e2
add new product page - cropper WIP 0.0.2
ReverieSylve May 15, 2021
a90e22c
add new product page - cropper WIP 0.0.3
ReverieSylve May 17, 2021
873640a
add new product page - cropper WIP 0.0.4
ReverieSylve May 17, 2021
4817654
add new product page - cropper WIP 0.0.5
ReverieSylve May 18, 2021
38c1ee8
add new product page - cropper WIP 0.0.6
ReverieSylve May 18, 2021
0f9e63c
add new product page - cropper WIP 0.0.7
ReverieSylve May 18, 2021
cc2e429
add new product page - cropper WIP 0.0.8
ReverieSylve May 19, 2021
31e0f6f
add new product page - cropper WIP 0.0.9
ReverieSylve May 22, 2021
cf2666d
wip Carousel 0.0.1
ReverieSylve May 25, 2021
2498918
wip Carousel 0.0.2
ReverieSylve May 25, 2021
d9d5103
wip Carousel 0.0.2
ReverieSylve May 25, 2021
848a5cb
wip Carousel 0.0.3
ReverieSylve May 25, 2021
169405b
wip Carousel 0.0.4
ReverieSylve May 25, 2021
85907bc
wip Carousel 0.0.5
ReverieSylve May 25, 2021
b094508
slideshow logic a bit improved (more relations with data model, not w…
ReverieSylve May 27, 2021
ca7bbd9
slideshow logic a bit improved (more relations with data model, not w…
ReverieSylve May 28, 2021
9eb254d
fix product page UI bugs
toluene5019 May 28, 2021
cfbf293
fixed currencyShopDto in selectedLanguageChooser in Application.java
top802 Aug 2, 2021
3a08e42
Merge remote-tracking branch 'origin/image_validation_try_hard' into dev
top802 Aug 20, 2021
6e75cdc
merged branch validation_images... to dev.
top802 Aug 20, 2021
da0b57f
wip currency
top802 Nov 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 159 additions & 83 deletions app/controllers/Application.java

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions app/controllers/BalanceAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,34 @@ public class BalanceAPI extends AuthController {
static MailSender mailSender = new MailSenderImpl();
static LiqPayService liqPay = LiqPayServiceImpl.getInstance();

public static void getCurrencyList(String client) throws Exception {
ShopDTO shop = ShopDTO.find("byDomain", client).first();
if (shop == null) {
shop = ShopDTO.find("byDomain", "localhost").first();
}
checkAuthentification(shop);

if (shop.currencyShop != null) {
renderJSON(json(shop.currencyShop.currencyList));
}
}

public static void setCurrency(String client, String currency) throws Exception {

ShopDTO shop = ShopDTO.find("byDomain", client).first();
if (shop == null) {
shop = ShopDTO.find("byDomain", "localhost").first();
}
checkAuthentification(shop);

if (!currency.isEmpty()){
shop.currencyShop = Application.setCurrencyToShop(shop);
shop.currencyShop.currency = currency;
shop.currencyShop.save();
}

renderJSON(json(shop));
}

public static void getBalance(String client, String email) throws Exception {
ShopDTO shop = ShopDTO.find("byDomain", client).first();
Expand Down
35 changes: 22 additions & 13 deletions app/controllers/OrderAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ private static OrderItemListResult _parseOrderItemsList(List<LineItem> items, Or
orderItem.additionsList = additionList;
orderItem.save();
orderItemList.add(orderItem);
if (product.priceInCurrency != 0) {
product.price = product.priceInCurrency;
}
totalCost += product.price * orderItem.quantity;
}

Expand All @@ -128,20 +131,22 @@ private static String getLanguagePartWithoutLocale(String language) {
}

public static String getTranslatedShopName(ShopDTO shop, String language) {
List<TranslationItemDTO> translationList = null;
if (shop.shopNameTextTranslationBucket != null) {
translationList = shop.shopNameTextTranslationBucket.translationList;
} else {
if (shop.shopNameTextTranslationBucket == null) {
return shop.shopName;
}
TranslationItemDTO adminTranslationItemDTO = translationList.stream().filter(shopTranslate -> shopTranslate.language.equals(language)).collect(Collectors.toList()).get(0);
if (!translationList.isEmpty() && !adminTranslationItemDTO.content.isEmpty()) {
} else {
List<TranslationItemDTO> translationList = shop.shopNameTextTranslationBucket.translationList;
TranslationItemDTO adminTranslationItemDTO = translationList
.stream()
.filter(shopTranslate -> shopTranslate.language.equals(language))
.collect(Collectors.toList()).get(0);

return adminTranslationItemDTO.content;
}
return shop.shopName;

}

public static void create(String client, String chosenLanguage) throws Exception {

String jsonCart = "";
if (request.params.get("cart") != null) {
jsonCart = request.params.get("cart");
Expand Down Expand Up @@ -169,11 +174,11 @@ public static void create(String client, String chosenLanguage) throws Exception
String languageFromAccept = languageList.get(0).getRange();
String[] strings = languageFromAccept.split("-");
clientLanguage = strings[0];

}


OrderDTO order = new OrderDTO(shoppingCart, shop, agent, ip);
String currency = shop.currencyShop.selectedCurrency != null ? shop.currencyShop.selectedCurrency : shop.currencyShop. currency;
order.currency = currency;
order.clientLanguage = clientLanguage;
order.chosenClientLanguage = chosenLanguage;
order.save();
Expand Down Expand Up @@ -242,6 +247,7 @@ public static void create(String client, String chosenLanguage) throws Exception
json.put("reason", "Total amount is less than minimum order amount");
error(403, json.toString());
}

order.feedbackRequestState = FeedbackRequestState.REQUEST_NOT_SEND;
order = order.save();

Expand Down Expand Up @@ -748,6 +754,7 @@ public static void success(String client, String data) throws Exception {


}

private static String generateHtmlEmailForOrderPaymentError(ShopDTO shop, OrderDTO order, String changeLanguage) {
String templateString = MailSenderImpl.readAllBytesJava7("app/emails/email_notification_payment_error.html");
Template template = Template.parse(templateString);
Expand All @@ -770,6 +777,7 @@ private static String generateHtmlEmailForOrderPaymentError(ShopDTO shop, OrderD
String rendered = template.render(map);
return rendered;
}

private static String generateHtmlEmailForOrderPaymentDone(ShopDTO shop, OrderDTO order, String changeLanguage) {
String templateString = MailSenderImpl.readAllBytesJava7("app/emails/email_notification_payment_done.html");
Template template = Template.parse(templateString);
Expand All @@ -792,6 +800,7 @@ private static String generateHtmlEmailForOrderPaymentDone(ShopDTO shop, OrderDT
String rendered = template.render(map);
return rendered;
}

private static String generateHtmlEmailForOrderPaymentWaitAccept(ShopDTO shop, OrderDTO order, String changeLanguage) {
String templateString = MailSenderImpl.readAllBytesJava7("app/emails/email_notification_payment_wait_accept.html");
Template template = Template.parse(templateString);
Expand All @@ -814,6 +823,7 @@ private static String generateHtmlEmailForOrderPaymentWaitAccept(ShopDTO shop, O
String rendered = template.render(map);
return rendered;
}

private static String generateHtmlEmailForFeedbackToOrder(ShopDTO shop, OrderDTO order, String changeLanguage) {
String templateString = MailSenderImpl.readAllBytesJava7("app/emails/email_feedback_to_order.html");
Template template = Template.parse(templateString);
Expand Down Expand Up @@ -841,14 +851,13 @@ private static String generateHtmlEmailForFeedbackToOrder(ShopDTO shop, OrderDTO
return rendered;

}

private static String generateHtmlEmailForNewOrder(ShopDTO shop, OrderDTO order, String language) {

Filter.registerFilter(new Filter("total"){
@Override
public Object apply(Object value, Object... params) {

DecimalFormat format = new DecimalFormat("0.##");

return format.format(value);
}
});
Expand Down Expand Up @@ -953,7 +962,7 @@ public Object apply(Object value, Object... params) {
String creditCardDeliveryPaymentType = Messages.get("mail.label.creditCardDeliveryPaymentType");
map.put("creditCardDeliveryPaymentType", creditCardDeliveryPaymentType);

String labelCurrencyUah = Messages.get("mail.label.currency.uah");
String labelCurrencyUah = Messages.get("mail.label.currencyShop.uah");
map.put("labelCurrencyUah", labelCurrencyUah);

String rendered = template.render(map);
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/ProductAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void create(String client, String name, String description,
}

CategoryDTO cat = CategoryDTO.findById(category);
ProductDTO product = new ProductDTO(name, description, price, images, shop, cat, wholesaleCount, wholesalePrice);
ProductDTO product = new ProductDTO(nameUk, descriptionUk, price, images, shop, cat, wholesaleCount, wholesalePrice);
product.mainImage = images.get(mainPhotoIndex);
product.isActive = isActive;
product.sortOrder = sortOrder;
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/ShopAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public static void details(String client) throws Exception { // /shop/details
shop = ShopDTO.find("byDomain", "localhost").first();
}
checkAuthentification(shop);
CurrencyShopDTO currencyShop = CurrencyShopDTO.find("byShop", shop).first();
if (currencyShop != null) {
shop.currencyShop = currencyShop;
}
renderJSON(json(shop));
}

Expand Down
16 changes: 10 additions & 6 deletions app/controllers/UserDashBoardAPI.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package controllers;

import jobs.GetDailyCurrency;
import models.*;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import play.i18n.Lang;
import play.mvc.Before;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

Expand Down Expand Up @@ -70,20 +67,27 @@ public static void createShop() throws Exception{
BalanceDTO balance = new BalanceDTO();
VisualSettingsDTO visualSettings = new VisualSettingsDTO();

CurrencyShopDTO currencyShop = new CurrencyShopDTO();
currencyShop.currency = user.wizard.shopCurrency;

ShopDTO shop = new ShopDTO(users, paymentSettings, delivery,
contact, balance, visualSettings, user.wizard.shopName,
"public liqpay key here", "private liqpay key here", user.wizard.shopDomain, "uk_UA"
);
"public liqpay key here", "private liqpay key here", user.wizard.shopDomain,
"uk_UA");
shop.googleStaticMapsApiKey = "AIzaSyCcBhIqH-XMcNu99hnEKvWIZTrazd9XgXg";
shop.googleMapsApiKey = "AIzaSyAuKg9jszEEgoGfUlIqmd4n9czbQsgcYRM";
visualSettings.shop = shop;
currencyShop.shop = shop;
shop.currencyShop = currencyShop;
currencyShop.save();

_appendDomainToList(user.wizard.shopDomain);
shop.save();
renderJSON(json(shop));

}


private static void setTranslationForCashPaymentLabel(PaymentSettingsDTO payment) {
if (payment.manualPaymentTitleTranslationBucket == null){
System.out.println("delivery.selfTakeTranslationBucket is null and will be creating NEW");
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/WayForPayAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public WayForPayRequestParams(String merchantAccount, String merchantDomainName,
this.serviceUrl = serviceUrl;
}




}

static String merchantAccount = "wisehands_me";
Expand Down Expand Up @@ -176,6 +173,7 @@ public static void generateSignatureWayForPay(String client) throws Exception{
ShopDTO shop = ShopDTO.findById(shopUuid);

String productName = "Поповнення власного рахунку для магазину " + shop.shopName;
// TODO check url
String serviceUrl = "https://wstore.pro/wayforpay/payment-confirmation";
Double amount = Double.valueOf(request.params.get("amount"));
String formatDecimal = formatDecimal(amount);
Expand Down
16 changes: 16 additions & 0 deletions app/controllers/WizardAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ public static void setVariantsOfDeliveryAndPaymentTypes() throws Exception{
boolean courierDelivery = (boolean) jsonBody.get("courierDelivery");
boolean postDepartment = (boolean) jsonBody.get("postDepartment");
boolean selfTake = (boolean) jsonBody.get("selfTake");

boolean uah = (boolean) jsonBody.get("uahCurrency");
boolean usd = (boolean) jsonBody.get("usdCurrency");
boolean eur = (boolean) jsonBody.get("eurCurrency");

boolean payCash = true;
boolean payOnline = false;

Expand All @@ -159,12 +164,23 @@ public static void setVariantsOfDeliveryAndPaymentTypes() throws Exception{
user.wizard.selfTake = selfTake;
user.wizard.payCash = payCash;
user.wizard.payOnline = payOnline;
user.wizard.shopCurrency = setCurrencyToShop(uah, usd, eur);

user.wizard.save();
renderJSON(json(user.wizard));

}

private static String setCurrencyToShop(boolean uah, boolean usd, boolean eur) {
if (uah){
return "UAH";
} else if (usd) {
return "USD";
} else {
return "EUR";
}
}

public static void setSocialNetworkInfo() throws Exception{

String facebookLink = request.params.get("facebook");
Expand Down
30 changes: 15 additions & 15 deletions app/jobs/AdditionalSettingForShop.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,38 @@ public AdditionalSettingForShop(){

}

public void setWorkkingTime(ShopDTO shop){
public void setWorkingTime(ShopDTO shop){

if(shop.monStartTime == null) {
shop.monStartTime = "1970-01-01T05:00:00.000Z";
shop.monEndTime = "1970-01-01T15:00:00.000Z";
shop.monStartTime = "04:20";
shop.monEndTime = "16:21";
}

if(shop.tueStartTime == null) {
shop.tueStartTime = "1970-01-01T05:00:00.000Z";
shop.tueEndTime = "1970-01-01T15:00:00.000Z";
shop.tueStartTime = "04:20";
shop.tueEndTime = "16:21";
}

if(shop.wedStartTime == null) {
shop.wedStartTime = "1970-01-01T05:00:00.000Z";
shop.wedEndTime = "1970-01-01T15:00:00.000Z";
shop.wedStartTime = "04:20";
shop.wedEndTime = "16:21";
}

if(shop.thuStartTime == null) {
shop.thuStartTime = "1970-01-01T05:00:00.000Z";
shop.thuEndTime = "1970-01-01T15:00:00.000Z";
shop.thuStartTime = "04:20";
shop.thuEndTime = "16:21";
}
if(shop.friStartTime == null) {
shop.friStartTime = "1970-01-01T05:00:00.000Z";
shop.friEndTime = "1970-01-01T15:00:00.000Z";
shop.friStartTime = "04:20";
shop.friEndTime = "16:21";
}
if(shop.satStartTime == null) {
shop.satStartTime = "1970-01-01T05:00:00.000Z";
shop.satEndTime = "1970-01-01T15:00:00.000Z";
shop.satStartTime = "04:20";
shop.satEndTime = "16:21";
}
if(shop.sunStartTime == null) {
shop.sunStartTime = "1970-01-01T05:00:00.000Z";
shop.sunEndTime = "1970-01-01T15:00:00.000Z";
shop.sunStartTime = "04:20";
shop.sunEndTime = "16:21";
}
}

Expand Down
Loading