|
|
@@ -33,7 +33,9 @@ import atmob.reactivex.rxjava3.annotations.NonNull;
|
|
|
import atmob.reactivex.rxjava3.core.Observable;
|
|
|
import atmob.reactivex.rxjava3.core.Single;
|
|
|
import atmob.reactivex.rxjava3.core.SingleObserver;
|
|
|
+import atmob.reactivex.rxjava3.core.SingleSource;
|
|
|
import atmob.reactivex.rxjava3.disposables.Disposable;
|
|
|
+import atmob.reactivex.rxjava3.functions.Function;
|
|
|
import atmob.rxjava.utils.RxJavaUtil;
|
|
|
|
|
|
@Singleton
|
|
|
@@ -92,7 +94,20 @@ public class MemberRepository {
|
|
|
.compose(RxJavaUtil.SingleSchedule.io2Main());
|
|
|
}
|
|
|
|
|
|
- public Single<OrderPayResponse> requestPayOrder(int itemId, int payPlatform, int payMethod) {
|
|
|
+ public Single<OrderPayResponse> requestGoodsPayOrder(int itemId, int payPlatform, int payMethod) {
|
|
|
+ return gpBillingClient.queryPurchase(BillingClient.ProductType.SUBS)
|
|
|
+ .map(list -> {
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ throw new RxHttpHandler.ServerErrorException(-1, "Unsuccessful: Subscription already exists");
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ })
|
|
|
+ .flatMap(purchases -> requestPayOrder(itemId, payPlatform, payMethod))
|
|
|
+ .compose(RxJavaUtil.SingleSchedule.io2Main());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private Single<OrderPayResponse> requestPayOrder(int itemId, int payPlatform, int payMethod) {
|
|
|
return atmobApi.orderPay(new OrderPayRequest(itemId, payPlatform, payMethod))
|
|
|
.compose(RxHttpHandler.handle(false))
|
|
|
.compose(RxJavaUtil.SingleSchedule.io2Main());
|