Browse Source

Domestic remit txn tested in uat

master
Preyea Regmi 5 years ago
parent
commit
77a9fb1d3b
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/gateway/DomesticRemitReceiptGateway.java
  3. 44
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/presenter/DomesticRemitReceiptPresenterImpl.java
  4. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/presenter/DomesticRemitReceiptPresenterInterface.java
  5. 43
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/view/DomesticRemitReceiptActivity.java
  6. 25
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/send/presenter/DomesticRemitPresenterImpl.java
  7. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/send/view/DomesticRemitActivity.java
  8. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/API_URL.java
  9. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

BIN
.idea/caches/build_file_checksums.ser

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/gateway/DomesticRemitReceiptGateway.java

@ -43,7 +43,7 @@ public class DomesticRemitReceiptGateway extends PrivilegedGateway implements Do
@Override
public Observable<ResponseBody> getReceiptData(String auth, String transactionId) {
return null;
return HttpClientV2.getInstance().getDomesticReceipt(auth,transactionId);
}
@Override

44
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/presenter/DomesticRemitReceiptPresenterImpl.java

@ -4,8 +4,12 @@ import com.gmeremit.online.gmeremittance_native.base.BasePresenter;
import com.gmeremit.online.gmeremittance_native.customwidgets.CustomAlertDialog;
import com.gmeremit.online.gmeremittance_native.domesticremit.receipt.model.DomesticRemitTxnReceiptDTO;
import com.gmeremit.online.gmeremittance_native.domesticremit.receipt.view.DomesticRemitReceiptActivity;
import com.gmeremit.online.gmeremittance_native.utils.Constants;
import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponseV2;
import com.gmeremit.online.gmeremittance_native.utils.https.GenericResponseDataModel;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@ -17,28 +21,35 @@ public class DomesticRemitReceiptPresenterImpl extends BasePresenter implements
private final DomesticRemitReceiptGatewayInterface gateway;
private final CompositeDisposable compositeDisposable;
private final String txnId;
private final boolean requestFromDomesticRemitProcess;
public DomesticRemitReceiptPresenterImpl(DomesticRemitReceiptViewContract view, DomesticRemitReceiptGatewayInterface gateway, String txnId) {
public DomesticRemitReceiptPresenterImpl(DomesticRemitReceiptViewContract view, DomesticRemitReceiptGatewayInterface gateway, String txnId, boolean requestFromDomesticremitProcess) {
this.view=view;
this.gateway=gateway;
this.compositeDisposable =new CompositeDisposable();
this.txnId=txnId;
this.requestFromDomesticRemitProcess=requestFromDomesticremitProcess;
}
@Override
public void getReceiptData() {
// compositeDisposable.add(
// this.gateway.getReceiptData(gateway.getAuth(),this.txnId)
// .doOnSubscribe(dis->view.showProgressBar(true,""))
// .doFinally(()->view.showProgressBar(false,""))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribeWith(new DomesticRemitReceiptObserver())
//
// );
compositeDisposable.add(
this.gateway.getReceiptData(gateway.getAuth(),this.txnId)
.doOnSubscribe(dis->view.showProgressBar(true,""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doFinally(()->view.showProgressBar(false,""))
.subscribeWith(new DomesticRemitReceiptObserver())
);
formatDataAndUpdateReceipt(this.gateway.getMockedReciept());
}
@Override
public boolean isRequestFromDomesticRemitProcess() {
return requestFromDomesticRemitProcess;
}
private void formatDataAndUpdateReceipt(DomesticRemitTxnReceiptDTO domesticRemitTxnReceiptDTO)
{
DomesticRemitReceiptActivity.TxnReceiptViewModel txnReceiptViewModel=new DomesticRemitReceiptActivity.TxnReceiptViewModel();
@ -58,10 +69,21 @@ public class DomesticRemitReceiptPresenterImpl extends BasePresenter implements
public class DomesticRemitReceiptObserver extends GenericApiObserverResponseV2<DomesticRemitTxnReceiptDTO>
{
@Override
protected Type getDataType() {
return TypeToken.getParameterized(DomesticRemitTxnReceiptDTO.class).getType();
}
@Override
protected void onSuccess(GenericResponseDataModel<DomesticRemitTxnReceiptDTO> t) {
if(t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2))
{
formatDataAndUpdateReceipt(t.getData());
}
else
{
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView());
}
}
@Override

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/presenter/DomesticRemitReceiptPresenterInterface.java

@ -8,8 +8,12 @@ public interface DomesticRemitReceiptPresenterInterface extends BasePresenterInt
void getReceiptData();
interface DomesticRemitReceiptViewContract extends BaseContractInterface
boolean isRequestFromDomesticRemitProcess();
interface DomesticRemitReceiptViewContract extends BaseContractInterface
{
void showReciept(DomesticRemitReceiptActivity.TxnReceiptViewModel receiptViewModel);
}
}

43
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/receipt/view/DomesticRemitReceiptActivity.java

@ -1,6 +1,6 @@
package com.gmeremit.online.gmeremittance_native.domesticremit.receipt.view;
import android.support.v7.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
@ -10,11 +10,14 @@ import com.gmeremit.online.gmeremittance_native.base.BaseActivity;
import com.gmeremit.online.gmeremittance_native.domesticremit.receipt.gateway.DomesticRemitReceiptGateway;
import com.gmeremit.online.gmeremittance_native.domesticremit.receipt.presenter.DomesticRemitReceiptPresenterImpl;
import com.gmeremit.online.gmeremittance_native.domesticremit.receipt.presenter.DomesticRemitReceiptPresenterInterface;
import com.gmeremit.online.gmeremittance_native.homeV2.view.HomeActivityV2;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static com.gmeremit.online.gmeremittance_native.homeV2.view.HomeActivityV2.BUNDLE_ACTION_FETCH_ALL_DATA;
public class DomesticRemitReceiptActivity extends BaseActivity implements DomesticRemitReceiptPresenterInterface.DomesticRemitReceiptViewContract {
@ -61,11 +64,10 @@ public class DomesticRemitReceiptActivity extends BaseActivity implements Domest
TextView tv_acc_no;
private DomesticRemitReceiptPresenterImpl presenter;
public static final String DOMESTIC_TXN_ID_BUNDLE_KEY="DOMESTIC_TXN_ID_BUNDLE_KEY";
public static final String DOMESTIC_TXN_ID_BUNDLE_KEY = "DOMESTIC_TXN_ID_BUNDLE_KEY";
public static final String REQUEST_FROM_DOMESTIC_REMIT_PROCESS = "REQUEST_FROM_DOMESTIC_REMIT_PROCESS";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -76,20 +78,16 @@ public class DomesticRemitReceiptActivity extends BaseActivity implements Domest
performDefaultAction(savedInstanceState);
}
private void init()
{
this.presenter=new DomesticRemitReceiptPresenterImpl(this,new DomesticRemitReceiptGateway(),getIntent().getStringExtra(DOMESTIC_TXN_ID_BUNDLE_KEY));
private void init() {
this.presenter = new DomesticRemitReceiptPresenterImpl(this, new DomesticRemitReceiptGateway(), getIntent().getStringExtra(DOMESTIC_TXN_ID_BUNDLE_KEY), getIntent().getBooleanExtra(REQUEST_FROM_DOMESTIC_REMIT_PROCESS, false));
}
private void performDefaultAction(Bundle savedInstanceState) {
if(savedInstanceState==null)
{
if (savedInstanceState == null) {
iv_cancel.setVisibility(View.INVISIBLE);
toolbar_title.setText(getString(R.string.receipt_title_text));
presenter.getReceiptData();
}
else
{
} else {
}
}
@ -108,16 +106,23 @@ public class DomesticRemitReceiptActivity extends BaseActivity implements Domest
tv_acc_no.setText(receiptViewModel.getAccNo());
}
@OnClick({R.id.iv_back,R.id.btn_submit})
public void goBack(View iv_back)
{
onBackPressed();
}
@OnClick({R.id.iv_back, R.id.btn_submit})
public void goBack(View iv_back) {
if (!presenter.isRequestFromDomesticRemitProcess())
onBackPressed();
else
{
Intent a = new Intent(this, HomeActivityV2.class);
a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
a.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(a);
finish();
}
}
public static class TxnReceiptViewModel
{
public static class TxnReceiptViewModel {
String pAmount;
String txnNo;

25
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/send/presenter/DomesticRemitPresenterImpl.java

@ -119,7 +119,7 @@ public class DomesticRemitPresenterImpl extends BasePresenter implements Domesti
private void performSendMoneyTransaction(String password, boolean isBioMetricUsed) {
DomesticRemitTxnRequestBody remitTxnRequestBody = new DomesticRemitTxnRequestBody();
remitTxnRequestBody.setCustomerId(gateway.getUserIDNumber());
remitTxnRequestBody.setCustomerId(gateway.getUserID());
remitTxnRequestBody.setUserId(gateway.getUserID());
remitTxnRequestBody.setFintechUseNo(domesticRemitDataValidator.selectedSenderAccount.getFintechUseNo());
remitTxnRequestBody.setSentAmount(domesticRemitDataValidator.sendAmount);
remitTxnRequestBody.setRecipientBankCode(domesticRemitDataValidator.selectedRecipientBank.getBankCode());
@ -131,15 +131,15 @@ public class DomesticRemitPresenterImpl extends BasePresenter implements Domesti
remitTxnRequestBody.setKftcAccountId(domesticRemitDataValidator.selectedSenderAccount.getKftcAccountId());
Log.d(this.getClass().getSimpleName(),remitTxnRequestBody.toString());
//
// compositeDisposable.add(
// this.gateway.doDomesticTransaction(gateway.getAuth(), remitTxnRequestBody)
// .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text)))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doFinally(() -> view.showProgressBar(false, ""))
// .subscribeWith(new DomesticRemitTxnObserverDomesticRemitTxnObserver())
// );
compositeDisposable.add(
this.gateway.doDomesticTransaction(gateway.getAuth(), remitTxnRequestBody)
.doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text)))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doFinally(() -> view.showProgressBar(false, ""))
.subscribeWith(new DomesticRemitTxnObserverDomesticRemitTxnObserver())
);
}
@ -628,6 +628,11 @@ public class DomesticRemitPresenterImpl extends BasePresenter implements Domesti
public class DomesticRemitTxnObserverDomesticRemitTxnObserver extends GenericApiObserverResponseV2<DomesticRemitTxnResponseDTO> {
@Override
protected Type getDataType() {
return TypeToken.getParameterized(DomesticRemitTxnResponseDTO.class).getType();
}
@Override
protected void onSuccess(GenericResponseDataModel<DomesticRemitTxnResponseDTO> t) {
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/domesticremit/send/view/DomesticRemitActivity.java

@ -42,6 +42,7 @@ import butterknife.ButterKnife;
import static android.view.View.GONE;
import static com.gmeremit.online.gmeremittance_native.domesticremit.receipt.view.DomesticRemitReceiptActivity.DOMESTIC_TXN_ID_BUNDLE_KEY;
import static com.gmeremit.online.gmeremittance_native.domesticremit.receipt.view.DomesticRemitReceiptActivity.REQUEST_FROM_DOMESTIC_REMIT_PROCESS;
import static com.gmeremit.online.gmeremittance_native.domesticremit.recenthistory.view.DomesticRemitRecipientHistoryActivity.SELECT_DOMESTIC_TXN_FROM_HISTORY_REQUEST;
import static com.gmeremit.online.gmeremittance_native.transactionpasspromt.view.TransactionPasswordPromptActivity.OTP_COUNTDOWN_VALUE;
import static com.gmeremit.online.gmeremittance_native.transactionpasspromt.view.TransactionPasswordPromptActivity.PAYMENT_TYPE_BUNDLE_KEY;
@ -410,6 +411,7 @@ public class DomesticRemitActivity extends BaseActivity implements DomesticRemit
//Route to receipt view
Intent intent =new Intent(this, DomesticRemitReceiptActivity.class);
intent.putExtra(DOMESTIC_TXN_ID_BUNDLE_KEY,transacitonId);
intent.putExtra(REQUEST_FROM_DOMESTIC_REMIT_PROCESS,true);
startActivity(intent);
}

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/API_URL.java

@ -63,5 +63,6 @@ public class API_URL {
public static final String AUTO_DEBIT_VERIFY_BANK = BuildConfig.API_VERSION + "/kftc/GetRecipientInfo";
public static final String DOMESTIC_REMIT_TXN = BuildConfig.API_VERSION + "/kftc/SendDomeRimit";
public static final String DOMESTIC_TXN_HISTORY = BuildConfig.API_VERSION + "/mobile/DomestricTranhistory/{userId}";
public static final String DOMESTIC_TXN_RECEIPT = BuildConfig.API_VERSION + "/mobile/DomesticReceipt/{tranId}";
}

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

@ -288,6 +288,10 @@ public interface ApiEndpoints {
@Headers("Content-Type: application/json")
Observable<DomesticTransactionHistoryAPIResponse> getDomesticTransactionHistory(@Header("Authorization") String token, @Path("userId") String userId, @Body() JsonObject jsonObject);
@POST(API_URL.DOMESTIC_TXN_RECEIPT)
@Headers("Content-Type: application/json")
Observable<ResponseBody> getDomesticReceipt(@Header("Authorization") String token, @Path("tranId") String tranID);

Loading…
Cancel
Save