Search in sources :

Example 1 with OrderReceiptRequest

use of com.eventyay.organizer.data.order.model.OrderReceiptRequest in project open-event-orga-app by fossasia.

the class OrderDetailViewModel method sendReceipt.

// send order receipt via email
public void sendReceipt(String orderIdentifier) {
    OrderReceiptRequest orderReceipt = new OrderReceiptRequest();
    orderReceipt.setOrderIdentifier(orderIdentifier);
    compositeDisposable.add(orderRepository.sendReceipt(orderReceipt).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(() -> success.setValue("Email Sent!"), throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Also used : MutableLiveData(androidx.lifecycle.MutableLiveData) LiveData(androidx.lifecycle.LiveData) SingleEventLiveData(com.eventyay.organizer.common.livedata.SingleEventLiveData) ViewTransformers.dispose(com.eventyay.organizer.common.rx.ViewTransformers.dispose) ViewModel(androidx.lifecycle.ViewModel) TicketRepository(com.eventyay.organizer.data.ticket.TicketRepository) OrderRepository(com.eventyay.organizer.data.order.OrderRepository) Inject(javax.inject.Inject) Attendee(com.eventyay.organizer.data.attendee.Attendee) Order(com.eventyay.organizer.data.order.Order) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) AttendeeRepository(com.eventyay.organizer.data.attendee.AttendeeRepository) EventRepository(com.eventyay.organizer.data.event.EventRepository) ErrorUtils(com.eventyay.organizer.utils.ErrorUtils) Ticket(com.eventyay.organizer.data.ticket.Ticket) VisibleForTesting(androidx.annotation.VisibleForTesting) OrderReceiptRequest(com.eventyay.organizer.data.order.model.OrderReceiptRequest) OrderReceiptRequest(com.eventyay.organizer.data.order.model.OrderReceiptRequest)

Aggregations

VisibleForTesting (androidx.annotation.VisibleForTesting)1 LiveData (androidx.lifecycle.LiveData)1 MutableLiveData (androidx.lifecycle.MutableLiveData)1 ViewModel (androidx.lifecycle.ViewModel)1 SingleEventLiveData (com.eventyay.organizer.common.livedata.SingleEventLiveData)1 ViewTransformers.dispose (com.eventyay.organizer.common.rx.ViewTransformers.dispose)1 Attendee (com.eventyay.organizer.data.attendee.Attendee)1 AttendeeRepository (com.eventyay.organizer.data.attendee.AttendeeRepository)1 EventRepository (com.eventyay.organizer.data.event.EventRepository)1 Order (com.eventyay.organizer.data.order.Order)1 OrderRepository (com.eventyay.organizer.data.order.OrderRepository)1 OrderReceiptRequest (com.eventyay.organizer.data.order.model.OrderReceiptRequest)1 Ticket (com.eventyay.organizer.data.ticket.Ticket)1 TicketRepository (com.eventyay.organizer.data.ticket.TicketRepository)1 ErrorUtils (com.eventyay.organizer.utils.ErrorUtils)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 List (java.util.List)1 Inject (javax.inject.Inject)1