Created
October 15, 2015 20:20
-
-
Save kvofreelance/3160debd4eb49b833efe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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