Skip to content

Commit

Permalink
Merge pull request #260 from teamforus/release/v0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Visser authored Dec 30, 2020
2 parents 873ddd1 + 2fded57 commit 63182af
Show file tree
Hide file tree
Showing 123 changed files with 3,171 additions and 720 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ allprojects {
jcenter()
}
ext {
androidVersionCode = 40
androidVersionName = "0.4.1"
androidVersionCode = 42
androidVersionName = "0.4.2"
androidBuildNumber = 1
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'io.forus.me.test'
Expand Down
3 changes: 2 additions & 1 deletion buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ext {
//Android
androidBuildToolsVersion = "28.0.3"
androidMinSdkVersion = 18
androidTargetSdkVersion = 28
androidTargetSdkVersion = 29
androidCompileSdkVersion = 28

//Libraries
Expand Down Expand Up @@ -108,6 +108,7 @@ ext {
]

presentationTestDependencies = [
junit: "junit:junit:${jUnitVersion}",
mockito: "org.mockito:mockito-core:${mockitoVersion}",
dexmaker: "com.google.dexmaker:dexmaker:${dexmakerVersion}",
dexmakerMockito: "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class Errors {
@SerializedName("value")
private List<String> value;

@SerializedName("email")
private List<String> email;

public List<String> getName() {
return name;
}
Expand All @@ -51,5 +54,13 @@ public List<String> getValue() {
public void setValue(List<String> value) {
this.value = value;
}

public List<String> getEmail() {
return email;
}

public void setEmail(List<String> email) {
this.email = email;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.gigawatt.android.data.net.sign.models.request

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import io.forus.me.android.data.entity.sign.request.SignRecords
import java.io.Serializable



class EmailValidateRequest : Serializable{

@SerializedName("email")
@Expose
var email: String? = null



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.forus.me.android.data.entity.sign.response;

import com.google.gson.annotations.SerializedName;

public class ValidateEmail {

@SerializedName("used")
private Boolean used;

@SerializedName("valid")
private Boolean valid;

public Boolean getUsed() {
return used;
}

public void setUsed(Boolean used) {
this.used = used;
}

public Boolean getValid() {
return valid;
}

public void setValid(Boolean valid) {
this.valid = valid;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.forus.me.android.data.entity.sign.response;

import com.google.gson.annotations.SerializedName;

public class ValidateEmailResult {

@SerializedName("email")
private ValidateEmail email;


public ValidateEmail getEmail() {
return email;
}

public void setEmail(ValidateEmail email) {
this.email = email;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,21 @@ public class ProductAction implements Serializable {
@SerializedName("price_user")
private BigDecimal priceUser;

//@SerializedName("price_old")
//private BigDecimal priceOld;
@SerializedName("price_old")
private BigDecimal price_old;


@SerializedName("no_price")
private boolean no_price;

@SerializedName("no_price_type")
private String no_price_type;


@SerializedName("no_price_discount")
private BigDecimal no_price_discount;



//@SerializedName("expire_at")
//private String expireAt;
Expand All @@ -56,7 +69,8 @@ public class ProductAction implements Serializable {
public ProductAction() {
}

public ProductAction(long id, String name, long organizationId, BigDecimal price, BigDecimal priceUser, Logo photo, Organization organization, ProductCategory productCategory) {
public ProductAction(long id, String name, long organizationId, BigDecimal price, BigDecimal priceUser,BigDecimal priceOld, boolean noPrice,
String noPriceType, BigDecimal noPriceDiscount, Logo photo, Organization organization, ProductCategory productCategory) {
this.id = id;
this.name = name;
this.organizationId = organizationId;
Expand All @@ -65,6 +79,11 @@ public ProductAction(long id, String name, long organizationId, BigDecimal price
this.photo = photo;
this.organization = organization;
this.productCategory = productCategory;

this.price_old = priceOld;
this.no_price = noPrice;
this.no_price_type = noPriceType;
this.no_price_discount = noPriceDiscount;
}

public long getId() {
Expand Down Expand Up @@ -130,4 +149,36 @@ public ProductCategory getProductCategory() {
public void setProductCategory(ProductCategory productCategory) {
this.productCategory = productCategory;
}

public BigDecimal getPrice_old() {
return price_old;
}

public void setPrice_old(BigDecimal price_old) {
this.price_old = price_old;
}

public boolean isNo_price() {
return no_price;
}

public void setNo_price(boolean no_price) {
this.no_price = no_price;
}

public String getNo_price_type() {
return no_price_type;
}

public void setNo_price_type(String no_price_type) {
this.no_price_type = no_price_type;
}

public BigDecimal getNo_price_discount() {
return no_price_discount;
}

public void setNo_price_discount(BigDecimal no_price_discount) {
this.no_price_discount = no_price_discount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public enum Type {
@SerializedName("expired")
private boolean expired;

@SerializedName("used")
boolean used;

@SerializedName("expire_at_locale")
private String expireAtLocale;

Expand Down Expand Up @@ -239,4 +242,12 @@ public boolean isExpired() {
public void setExpired(boolean expired) {
this.expired = expired;
}

public boolean isUsed() {
return used;
}

public void setUsed(boolean used) {
this.used = used;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.forus.me.android.domain.exception.RetrofitException;
import io.forus.me.android.domain.models.common.DetailsApiError;
import io.forus.me.android.domain.models.records.errors.BaseApiError;
import io.forus.me.android.domain.models.records.errors.EmailError;
import io.forus.me.android.domain.models.records.errors.NewRecordCategoryError;
import io.forus.me.android.domain.models.records.errors.NewRecordError;

Expand All @@ -25,6 +26,11 @@ public NewRecordCategoryError mapToNewRecordCategoryError(RetrofitException retr
return new NewRecordCategoryError(apiError.getMessage(), apiError.getErrors().getName());
}

public EmailError mapToApiError(RetrofitException retrofitException) throws IOException {
ApiError apiError = retrofitException.getErrorBodyAs(ApiError.class);
return new EmailError(apiError.getMessage(), apiError.getErrors().getEmail());
}

@Override
public BaseApiError mapToBaseApiError(RetrofitException retrofitException) throws IOException {
BaseError apiError = retrofitException.getErrorBodyAs(BaseError.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.forus.me.android.data.net.sign

import com.gigawatt.android.data.net.sign.models.request.EmailValidateRequest
import com.gigawatt.android.data.net.sign.models.request.SignUp
import io.forus.me.android.data.entity.account.Account
import io.forus.me.android.data.entity.common.Success
Expand Down Expand Up @@ -35,7 +36,9 @@ interface SignService {
@POST("api/v1/identity/proxy/email")
fun restoreByEmail(@Body restore: RestoreByEmail) : Observable<ResponseBody>

// @GET("{{apiUrl}}/identity/validate/email")
@POST("api/v1/identity/validate/email")
fun validateEmail(@Body email: EmailValidateRequest) : Observable<ValidateEmailResult>

@GET("api/v1/identity/proxy/email/exchange/{token}")
fun restoreExchangeToken(@Path("token") token: String) : Observable<AccessToken>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.forus.me.android.data.repository.account

import android.util.Log
import com.gigawatt.android.data.net.sign.models.request.SignUp
import io.forus.me.android.data.entity.sign.request.SignRecords
import io.forus.me.android.data.repository.account.datasource.AccountDataSource
Expand Down Expand Up @@ -45,6 +44,13 @@ class AccountRepository(private val settingsDataSource: SettingsDataSource,
return accountRemoteDataSource.restoreByEmail(email)
}

override fun validateEmail(email: String): Observable<ValidateEmail> {

return accountRemoteDataSource.validateEmail(email).map {
it
}
}

override fun restoreExchangeToken(token: String): Observable<RequestDelegatesEmailModel> {
return accountRemoteDataSource.restoreExchangeToken(token)
.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface AccountDataSource {

fun restoreByEmail(email: String) : Observable<Boolean>

fun validateEmail(email: String) : Observable<io.forus.me.android.domain.models.account.ValidateEmail>


fun restoreExchangeToken(token: String) : Observable<AccessToken>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import io.forus.me.android.data.entity.sign.response.IdentityTokenResult;
import io.forus.me.android.data.entity.sign.response.ShortTokenResult;
import io.forus.me.android.data.entity.sign.response.SignUpResult;
import io.forus.me.android.data.entity.sign.response.ValidateEmailResult;
import io.forus.me.android.data.repository.account.datasource.AccountDataSource;
import io.forus.me.android.data.repository.datasource.LocalDataSource;
import io.forus.me.android.domain.models.account.ValidateEmail;
import io.reactivex.Observable;

public class AccountLocalDataSource implements AccountDataSource, LocalDataSource{
Expand Down Expand Up @@ -166,4 +168,10 @@ public Observable<AccessToken> registerExchangeToken(@NotNull String token) {
public Observable<ShortTokenResult> getShortToken() {
return null;
}

@NotNull
@Override
public Observable<ValidateEmail> validateEmail(@NotNull String email) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package io.forus.me.android.data.repository.account.datasource.remote

import android.util.Log
import com.gigawatt.android.data.net.sign.models.request.EmailValidateRequest
import com.gigawatt.android.data.net.sign.models.request.SignUp
import io.forus.me.android.data.entity.account.Account
import io.forus.me.android.data.entity.sign.request.AuthorizeCode
import io.forus.me.android.data.entity.sign.request.AuthorizeToken
import io.forus.me.android.data.entity.sign.request.RegisterPush
import io.forus.me.android.data.entity.sign.request.RestoreByEmail
import io.forus.me.android.data.entity.sign.response.*
import io.forus.me.android.data.entity.sign.response.AccessToken
import io.forus.me.android.data.entity.sign.response.IdentityPinResult
import io.forus.me.android.data.entity.sign.response.IdentityTokenResult
import io.forus.me.android.data.entity.sign.response.ShortTokenResult
import io.forus.me.android.data.net.sign.SignService
import io.forus.me.android.data.repository.account.datasource.AccountDataSource
import io.forus.me.android.data.repository.datasource.RemoteDataSource
import io.forus.me.android.domain.models.account.ValidateEmail
import io.reactivex.Observable


class AccountRemoteDataSource(f: () -> SignService) : AccountDataSource, RemoteDataSource<SignService>(f) {


Expand Down Expand Up @@ -79,6 +84,22 @@ class AccountRemoteDataSource(f: () -> SignService) : AccountDataSource, RemoteD
}
}

override fun validateEmail(email: String): Observable<ValidateEmail> {
val requestBody = EmailValidateRequest()
requestBody.email = email

/* val observable: Observable<Boolean> = ObservableCreate<Boolean>(object : ObservableOnSubscribe<Boolean?> {
override fun subscribe(emitter: ObservableEmitter<Boolean?>) {
true
}
})*/
return service.validateEmail(requestBody)
.map {
io.forus.me.android.domain.models.account.ValidateEmail(it.email.used, it.email.valid)
}
}

override fun restoreExchangeToken(token: String): Observable<AccessToken> {
return service.restoreExchangeToken(token);
}
Expand Down
Loading

0 comments on commit 63182af

Please sign in to comment.