Skip to content

Instantly share code, notes, and snippets.

@WirecardMobileServices
Last active May 10, 2019 07:35
EposSDK-Refund
import java.math.BigDecimal;
import de.wirecard.epos.EposSDK;
import de.wirecard.epos.model.sale.builder.RefundRequest;
import de.wirecard.epos.model.sale.builder.payment.CashRefundPayment;
import de.wirecard.epos.model.with.With;
import de.wirecard.epos.model.with.WithBase;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
//initialize your params
String originalSaleId;
CashRefundPayment refundPayment = new CashRefundPayment(new BigDecimal("15"));
RefundRequest refundRequest = new RefundRequest(originalSaleId, refundPayment);
eposSDK.sales().operation()
.refund(refundRequest)
.observeOn(AndroidSchedulers.mainThread()) // in case you want result in main thread
.subscribe(saleNonErrorResponse -> {
// check for response from backend
}, throwable -> {
//handle error
});
//******************** USING WITH PARAMETER ********************//
WithBase withBase = With.base().scheduler(Schedulers.newThread()); // in case you want request to run on specific thread
eposSDK.sales().operation()
.refund(refundRequest, withBase)
.observeOn(AndroidSchedulers.mainThread()) // in case you want result in main thread
.subscribe(saleNonErrorResponse -> {
// check for response from backend
}, throwable -> {
//handle error
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment