Browse Source

Penny test flow fixes

master
Preyea Regmi 6 years ago
parent
commit
677eba3d16
  1. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java
  2. 71
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/presenter/pennytest/PennyTestPresenter.java
  3. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/presenter/pennytest/PennyTestPresenterInterface.java
  4. 16
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/view/pennytest/PennyTestOperationFragment.java
  5. 19
      app/src/main/res/layout/fragment_penny_test_operation.xml
  6. 1
      app/src/main/res/values/strings.xml

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java

@ -190,7 +190,7 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
if (homeFragmentRelatedSubject != null) if (homeFragmentRelatedSubject != null)
homeFragmentRelatedSubject.onNext(new HomeFragmentRelatedData(shouldShowKYCView, kycMessage, kycTitle, homeFragmentRelatedSubject.onNext(new HomeFragmentRelatedData(shouldShowKYCView, kycMessage, kycTitle,
disableKYCViewClick, fullName, userInfoModelV2.getYearlyLimit(), disableKYCViewClick, fullName, userInfoModelV2.getYearlyLimit(),
userInfoModelV2.getRewardPoint(), isPennyTestPending, hasRequestedPennyTest,
userInfoModelV2.getRewardPoint(), isPennyTestPending&&!shouldShowKYCView, hasRequestedPennyTest,
pennyTestTitle, pennyTestMessage)); pennyTestTitle, pennyTestMessage));
view.showWithdrawView(userInfoModelV2.isVerified()); view.showWithdrawView(userInfoModelV2.isVerified());

71
app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/presenter/pennytest/PennyTestPresenter.java

@ -10,6 +10,7 @@ import com.gmeremit.online.gmeremittance_native.utils.https.MessageResponseDataM
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.logging.Handler;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
@ -40,12 +41,15 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
@Override @Override
public void performPennyTest(String cerNumber) { public void performPennyTest(String cerNumber) {
view.hideKeyBoard(); view.hideKeyBoard();
compositeDisposable.add(
this.gateway.postDataForPennyTest(this.gateway.getAuth(), this.gateway.getBankAccountNumber(), cerNumber,this.gateway.getSenderId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new PennyTestResultObserver())
);
new android.os.Handler().postDelayed(()->{
compositeDisposable.add(
this.gateway.postDataForPennyTest(this.gateway.getAuth(), this.gateway.getBankAccountNumber(), cerNumber,this.gateway.getSenderId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new PennyTestResultObserver())
);
},400);
} }
@Override @Override
@ -57,6 +61,16 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
} }
@Override
public void requestPennyTestAgain() {
compositeDisposable.add(
this.gateway.requestForPennyTest(this.gateway.getAuth(), this.gateway.getUserID())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new PennyTestReRequestObserver())
);
}
private void updateFlagOnPennyTestSuccess() { private void updateFlagOnPennyTestSuccess() {
gateway.updatePennyTestStatus("2"); gateway.updatePennyTestStatus("2");
gateway.updateLasKnownPennyTestResultMessage(null); gateway.updateLasKnownPennyTestResultMessage(null);
@ -84,11 +98,10 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
updateFlagOnPennyTestAfterRequest(t.getId(),t.getData().getMsg()); updateFlagOnPennyTestAfterRequest(t.getId(),t.getData().getMsg());
view.navigateToPennyTestConfirmView(t.getData().getMsg()); view.navigateToPennyTestConfirmView(t.getData().getMsg());
}); });
} }
else else
{ {
view.showPopUpMessage(t.getData().getMsg(),CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
view.showPopUpMessage(t.getMsg(),CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
} }
} }
@ -103,8 +116,6 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
} }
} }
public class PennyTestResultObserver extends GenericApiObserverResponseV2<MessageResponseDataModel> { public class PennyTestResultObserver extends GenericApiObserverResponseV2<MessageResponseDataModel> {
@Override @Override
@ -118,7 +129,7 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
{ {
view.morphProgressBarIntoButton(()->{ view.morphProgressBarIntoButton(()->{
updateFlagOnPennyTestSuccess(); updateFlagOnPennyTestSuccess();
view.showPopUpMessage(t.getMsg(),CustomAlertDialog.AlertType.SUCCESS,alertType -> {
view.showPopUpMessage(t.getData().getMsg(),CustomAlertDialog.AlertType.SUCCESS,alertType -> {
view.onPennyTestSuccess(); view.onPennyTestSuccess();
}); });
@ -127,12 +138,8 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
} }
else else
{ {
String message;
if(t.getData()!=null&&t.getData().getMsg()!=null)
message=t.getData().getMsg();
else
message=t.getMsg();
view.showPopUpMessage(message,CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
view.showPopUpMessage(t.getMsg(),CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
} }
} }
@ -149,6 +156,36 @@ public class PennyTestPresenter extends BasePresenter implements PennyTestIntera
} }
} }
public class PennyTestReRequestObserver extends GenericApiObserverResponseV2<MessageResponseDataModel> {
@Override
protected Type setType() {
return TypeToken.getParameterized(GenericResponseDataModel.class, MessageResponseDataModel.class).getType();
}
@Override
protected void onSuccess(GenericResponseDataModel<MessageResponseDataModel> t) {
if(t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
{
view.morphProgressBarIntoButton(()->{ updateFlagOnPennyTestAfterRequest(t.getId(),t.getData().getMsg());
view.showPopUpMessage(t.getData().getMsg(),CustomAlertDialog.AlertType.SUCCESS,null); });
}
else
{
view.showPopUpMessage(t.getMsg(),CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
}
}
@Override
public void onFailed(String message) {
view.showPopUpMessage(message,CustomAlertDialog.AlertType.FAILED,alertType->view.morphProgressBarIntoButton(null));
}
@Override
protected void onConnectionNotEstablished(String message) {
view.showPopUpMessage(message,CustomAlertDialog.AlertType.NO_INTERNET,alertType->view.morphProgressBarIntoButton(null));
}
}
} }

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/presenter/pennytest/PennyTestPresenterInterface.java

@ -11,6 +11,8 @@ public interface PennyTestPresenterInterface extends BasePresenterInterface {
String checkIfUserHasAlreadyIniitatedPennyTest(); String checkIfUserHasAlreadyIniitatedPennyTest();
void requestPennyTestAgain();
interface PennyTestContractInterface extends BaseContractInterface { interface PennyTestContractInterface extends BaseContractInterface {

16
app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV2/view/pennytest/PennyTestOperationFragment.java

@ -10,6 +10,7 @@ import android.widget.TextView;
import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.base.BaseFragment; import com.gmeremit.online.gmeremittance_native.base.BaseFragment;
import com.gmeremit.online.gmeremittance_native.kycV2.presenter.pennytest.PennyTestPresenterInterface;
import com.gmeremit.online.gmeremittance_native.utils.other.Utility; import com.gmeremit.online.gmeremittance_native.utils.other.Utility;
import butterknife.BindView; import butterknife.BindView;
@ -23,6 +24,9 @@ public class PennyTestOperationFragment extends BaseFragment implements View.OnC
@BindView(R.id.titleText) @BindView(R.id.titleText)
TextView titleText; TextView titleText;
@BindView(R.id.resend_request)
TextView resendRequest;
@BindView(R.id.ed_creditNumber) @BindView(R.id.ed_creditNumber)
EditText creditNumber; EditText creditNumber;
private String titleMessage=null; private String titleMessage=null;
@ -49,12 +53,14 @@ public class PennyTestOperationFragment extends BaseFragment implements View.OnC
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
image_example.setOnClickListener(this); image_example.setOnClickListener(this);
resendRequest.setOnClickListener(this);
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
image_example.setOnClickListener(null); image_example.setOnClickListener(null);
resendRequest.setOnClickListener(null);
} }
private void performDefaultAction(Bundle savedInstanceState) { private void performDefaultAction(Bundle savedInstanceState) {
@ -80,9 +86,19 @@ public class PennyTestOperationFragment extends BaseFragment implements View.OnC
case R.id.image_example: case R.id.image_example:
openExample(); openExample();
break; break;
case R.id.resend_request:
requestPennyTestAgain();
break;
} }
} }
private void requestPennyTestAgain() {
PennyTestPresenterInterface presenter= (PennyTestPresenterInterface) getActivity();
if(presenter!=null)
presenter.requestPennyTestAgain();
}
public void setTitle(String msg) { public void setTitle(String msg) {
try { try {
titleText.setText(msg); titleText.setText(msg);

19
app/src/main/res/layout/fragment_penny_test_operation.xml

@ -65,6 +65,25 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/accountWrapper" /> app:layout_constraintTop_toTopOf="@+id/accountWrapper" />
<com.gmeremit.online.gmeremittance_native.customwidgets.GmeTextView
android:id="@+id/resend_request"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:padding="10dp"
android:text="@string/resend_request"
android:textColor="@color/colorPrimary"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/accountWrapper" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

1
app/src/main/res/values/strings.xml

@ -87,6 +87,7 @@ Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
1914 translation by H. Rackham 1914 translation by H. Rackham
"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</string> "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</string>
<string name="remaining_yearly_balance_text">Remaining Yearly Balance</string> <string name="remaining_yearly_balance_text">Remaining Yearly Balance</string>
<string name="resend_request" translatable="false"><u>Resend Request</u></string>
</resources> </resources>
Loading…
Cancel
Save