Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
81 changes: 0 additions & 81 deletions bench.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class Product {
@SerializedName("price")
private BigDecimal price;

@SerializedName("price_locale")
private String price_locale;

@SerializedName("old_price")
private BigDecimal oldPrice;

Expand All @@ -44,13 +47,28 @@ public class Product {

public Product() { }

public Product(long id, long organizationId, long productCategoryId, String name, String description, BigDecimal price, BigDecimal oldPrice, long totalAmount, long soldAmount, Logo photo, ProductCategory productCategory, Organization organization) {
public Product(
long id,
long organizationId,
long productCategoryId,
String name,
String description,
BigDecimal price,
String price_locale,
BigDecimal oldPrice,
long totalAmount,
long soldAmount,
Logo photo,
ProductCategory productCategory,
Organization organization
) {
this.id = id;
this.organizationId = organizationId;
this.productCategoryId = productCategoryId;
this.name = name;
this.description = description;
this.price = price;
this.price_locale = price_locale;
this.oldPrice = oldPrice;
this.totalAmount = totalAmount;
this.soldAmount = soldAmount;
Expand Down Expand Up @@ -102,6 +120,9 @@ public void setDescription(String description) {
public BigDecimal getPrice() {
return price;
}
public String getPriceLocale() {
return price_locale;
}

public void setPrice(BigDecimal price) {
this.price = price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ public class Transaction {
@SerializedName("amount")
private BigDecimal amount;

@SerializedName("amount_locale")
private String amount_locale;

@SerializedName("amount_extra_cash")
private BigDecimal amount_extra_cash;

@SerializedName("amount_extra_cash_locale")
private String amount_extra_cash_locale;

@SerializedName("address")
private String address;

Expand Down Expand Up @@ -56,14 +62,17 @@ public class Transaction {

public Transaction() { }

public Transaction(Long id, Long organizationId, Long productId, BigDecimal amount, BigDecimal amount_extra_cash,
public Transaction(Long id, Long organizationId, Long productId, BigDecimal amount, String amount_locale, BigDecimal amount_extra_cash,
String amount_extra_cash_locale,
String address, Date createdAt, Date updatedAt, String date, Long timestamp,
Organization organization, Product product, Fund fund, String state, String note) {
this.id = id;
this.organizationId = organizationId;
this.productId = productId;
this.amount = amount;
this.amount_locale = amount_locale;
this.amount_extra_cash = amount_extra_cash;
this.amount_extra_cash_locale = amount_extra_cash_locale;
this.address = address;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
Expand Down Expand Up @@ -104,6 +113,10 @@ public BigDecimal getAmount() {
return amount;
}

public String getAmountLocale() {
return amount_locale;
}

public void setAmount(BigDecimal amount) {
this.amount = amount;
}
Expand Down Expand Up @@ -184,6 +197,10 @@ public BigDecimal getAmount_extra_cash() {
return amount_extra_cash;
}

public String getAmountExtraCashLocale() {
return amount_extra_cash_locale;
}


public void setAmount_extra_cash(BigDecimal amount_extra_cash) {
this.amount_extra_cash = amount_extra_cash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public enum Type {
@SerializedName("amount")
private BigDecimal amount;

@SerializedName("amount_locale")
private String amount_locale;

@SerializedName("fund")
private Fund fund;

Expand All @@ -78,13 +81,31 @@ public enum Type {
@SerializedName("amount_visible")
private boolean amount_visible;

public Voucher() { }

public Voucher(Long fundId, String identityAddress, String address, Date createdAt, String createdAtLocale,
boolean expired, String expireAtLocale, Long timestamp, Type type, Product product, BigDecimal amount,
Fund fund, List<Transaction> transactions, List<Organization> allowedOrganizations, List<ProductCategory> allowedProductCategories,
List<Product> allowedProducts, List<Voucher> childVouchers, List<Office> offices,
boolean amount_visible) {
public Voucher() {
}

public Voucher(
Long fundId,
String identityAddress,
String address,
Date createdAt,
String createdAtLocale,
boolean expired,
String expireAtLocale,
Long timestamp,
Type type,
Product product,
BigDecimal amount,
String amount_locale,
Fund fund,
List<Transaction> transactions,
List<Organization> allowedOrganizations,
List<ProductCategory> allowedProductCategories,
List<Product> allowedProducts,
List<Voucher> childVouchers,
List<Office> offices,
boolean amount_visible
) {
this.fundId = fundId;
this.identityAddress = identityAddress;
this.address = address;
Expand All @@ -96,6 +117,7 @@ public Voucher(Long fundId, String identityAddress, String address, Date created
this.type = type;
this.product = product;
this.amount = amount;
this.amount_locale = amount_locale;
this.fund = fund;
this.transactions = transactions;
this.allowedOrganizations = allowedOrganizations;
Expand Down Expand Up @@ -181,6 +203,9 @@ public void setProduct(Product product) {
public BigDecimal getAmount() {
return amount;
}
public String getAmountLocale() {
return amount_locale;
}

public void setAmount(BigDecimal amount) {
this.amount = amount;
Expand Down Expand Up @@ -262,11 +287,11 @@ public void setUsed(boolean used) {
this.used = used;
}

public void setAmountVisible(boolean amount_visible){
public void setAmountVisible(boolean amount_visible) {
this.amount_visible = amount_visible;
}

public boolean getAmountVisible(){
public boolean getAmountVisible() {
return amount_visible;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,15 @@ public <T> T createRetrofitService(final Class<T> clazz, final String endPoint)
}

public <T> T createRetrofitService(final Class<T> clazz, final String endPoint, final String customAccessToken) throws Exception{

okhttp3.OkHttpClient.Builder httpClient = new okhttp3.OkHttpClient.Builder();

MeHttpLoggingInterceptor logging = new MeHttpLoggingInterceptor(HttpLoggingInterceptor.Logger.DEFAULT);
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
logging.setLogAccessToken(false);
httpClient.addInterceptor(logging);
httpClient.addInterceptor(chain -> {

Request original = chain.request();

HttpUrl url = original.url()
.newBuilder()
.build();


HttpUrl url = original.url().newBuilder().build();

String userAgent = getUserAgent();
Log.d("forus","userAgent="+userAgent);
Expand Down Expand Up @@ -134,7 +127,6 @@ private String getUserAgent(){
e.printStackTrace();
}


return String.format(Locale.US,
"%s/%s (Android %s; %s; %s %s; %s)",
appName,
Expand All @@ -145,8 +137,4 @@ private String getUserAgent(){
Build.DEVICE,
Locale.getDefault().getLanguage());
}




}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.forus.me.android.data.net.common

import io.forus.me.android.data.entity.common.Success
import io.forus.me.android.data.entity.records.request.*
import io.forus.me.android.data.entity.records.response.*
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.http.*
Expand All @@ -11,12 +8,6 @@ import retrofit2.http.*
* Created by maestrovs on 03.05.2020
*/
interface CommonService {



@GET("api/v1/status")
fun status() : Observable<ResponseBody>



}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ import io.forus.me.android.data.repository.common.datasource.CommonDataSource
import io.forus.me.android.domain.repository.common.CommonRepository
import io.reactivex.Observable


class CommonRepository(private val commonDataSource: CommonDataSource) : CommonRepository {


override fun status(): Observable<Boolean> {
return commonDataSource.status()
.map {
it
}
return commonDataSource.status().map { it }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.forus.me.android.data.repository.common.datasource

import com.gigawatt.android.data.net.sign.models.request.SignUp
import io.reactivex.Observable

interface CommonDataSource {

fun status(): Observable<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import io.forus.me.android.data.net.common.CommonService
import io.forus.me.android.data.repository.datasource.RemoteDataSource
import io.reactivex.Observable

class CommonRemoteDataSource(f: () -> CommonService) : CommonDataSource, RemoteDataSource<CommonService>(f) {
class CommonRemoteDataSource(f: () -> CommonService) : CommonDataSource,
RemoteDataSource<CommonService>(f) {
override fun status(): Observable<Boolean> {
return service.status()
.map {
val result = it.string();
result == "1"||result.isEmpty()

}
return service.status().map {
val json = it.string()
json.contains("\"success\":true")
}
}
}

Loading