Skip to content

Instantly share code, notes, and snippets.

@kvofreelance
Created October 15, 2015 20:20
Show Gist options
  • Save kvofreelance/3160debd4eb49b833efe to your computer and use it in GitHub Desktop.
Save kvofreelance/3160debd4eb49b833efe to your computer and use it in GitHub Desktop.
NetworkApi api = new NetworkService().getApi();
api.sendVeridyCoupon(merchantID, couponCode)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<JsonServerResponse<VerfiyCouponData>>() {
@Override
public void onCompleted() {
DisplayProcessMessage(false);
}
@Override
public void onError(Throwable e) {
DisplayProcessMessage(false);
}
@Override
public void onNext(JsonServerResponse<VerfiyCouponData> verfiyCouponData) {
if (verfiyCouponData.Content.IsValid) {
Intent result = new Intent();
verfiyCouponData.Content.CouponValue = couponEditText.getText().toString().trim();
verfiyCouponData.Content.MerchantId = mMerchantID;
result.putExtra(Const.COUPON_VALID_NAME, verfiyCouponData.Content);
setResult(RESULT_OK, result);
finish();
} else {
couponEditText.setError(verfiyCouponData.Message);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment