Created
May 23, 2021 12:37
-
-
Save ClaudeHangui/a0d5aa035d6bc885dd564bf2f2f632b8 to your computer and use it in GitHub Desktop.
Repository which provides the various payment methods used by financial service companies
This file contains hidden or 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
package com.changui.payoneerhomeexercise.data; | |
import com.changui.payoneerhomeexercise.domain.PaymentMethodUIModel; | |
import com.changui.payoneerhomeexercise.domain.PaymentMethodRepository; | |
import com.changui.payoneerhomeexercise.domain.SchedulersFacade; | |
import java.util.List; | |
import javax.inject.Inject; | |
import io.reactivex.Single; | |
public class PaymentMethodRepositoryImpl implements PaymentMethodRepository { | |
private final ApiService apiService; | |
private final GetPaymentMethodsMapper paymentMethodsMapper; | |
private final SchedulersFacade schedulersFacade; | |
@Inject | |
public PaymentMethodRepositoryImpl(ApiService apiService, GetPaymentMethodsMapper mapper, SchedulersFacade facade) { | |
this.apiService = apiService; | |
this.paymentMethodsMapper = mapper; | |
this.schedulersFacade = facade; | |
} | |
@Override | |
public Single<List<PaymentMethodUIModel>> getPaymentMethods() { | |
return apiService.getPaymentMethods() | |
.map(paymentMethodsMapper::mapToUI) | |
.subscribeOn(schedulersFacade.provideIO()) | |
.observeOn(schedulersFacade.provideUIThread()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment