use of com.eventyay.organizer.data.order.Order in project open-event-orga-app by fossasia.
the class ChartAnalyser method loadData.
public Completable loadData(long eventId) {
clearData();
isCheckinChart = false;
return getAttendeeSource(eventId).doOnNext(attendee -> {
Order order = attendee.getOrder();
if (order == null) {
error = true;
return;
}
String date = order.getCompletedAt();
switch(attendee.getTicket().getType()) {
case TicketAnalyser.TICKET_FREE:
addDataPointForSales(freeMap, date);
break;
case TicketAnalyser.TICKET_DONATION:
addDataPointForSales(donationMap, date);
break;
case TicketAnalyser.TICKET_PAID:
addDataPointForSales(paidMap, date);
break;
default:
}
}).toList().doAfterSuccess(attendees -> this.attendees = attendees).toCompletable().doOnComplete(() -> {
if (error)
throw new IllegalAccessException("No order found");
normalizeDataSet();
freeSet = setDataForSales(freeMap, "Free");
paidSet = setDataForSales(paidMap, "Paid");
donationSet = setDataForSales(donationMap, "Donation");
prepare();
});
}
use of com.eventyay.organizer.data.order.Order 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())));
}
use of com.eventyay.organizer.data.order.Order in project open-event-orga-app by fossasia.
the class CreateOrderViewModel method createOnSiteOrder.
public void createOnSiteOrder(long eventId) {
Order order = new Order();
Event event = new Event();
event.setId(eventId);
order.setEvent(event);
order.setAmount(orderAmount.getValue());
for (Long ticketId : onSiteTicketsMap.keySet()) {
OnSiteTicket onSiteTicket = new OnSiteTicket();
onSiteTicket.setId(ticketId);
onSiteTicket.setQuantity(onSiteTicketsMap.get(ticketId).get());
onSiteTicketsList.add(onSiteTicket);
}
order.setOnSiteTickets(onSiteTicketsList);
compositeDisposable.add(orderRepository.createOrder(order).compose(dispose(compositeDisposable)).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> {
clearSelectedTickets();
progress.setValue(false);
}).subscribe(createdOrder -> success.setValue("Order created successfully"), throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Aggregations