package com.braintree.facade.backoffice;

import com.braintree.exceptions.BraintreeErrorException;
import de.hybris.platform.core.model.order.OrderModel;
import de.hybris.platform.ordermanagementfacades.payment.data.PaymentTransactionEntryData;
import de.hybris.platform.payment.model.PaymentTransactionEntryModel;

import java.math.BigDecimal;
import java.util.List;
import java.util.function.Predicate;

public interface BraintreeBackofficeMultiCaptureFacade {

    boolean isMultiCapturePossible(final OrderModel order);

    List<PaymentTransactionEntryModel> getMultiCaptureableTransactions(final OrderModel order);

    PaymentTransactionEntryData partialCapture(OrderModel orderModel, BigDecimal captureAmount,
                                               PaymentTransactionEntryModel entry, boolean isOrderToBeForceCompleted) throws BraintreeErrorException;

    BigDecimal getPossibleAmountForCapture(OrderModel orderModel);

    boolean isPartialCapturePossible(OrderModel orderModel);

    BigDecimal getTransactionAmount(final PaymentTransactionEntryModel currentModel, final OrderModel orderModel);


    PaymentTransactionEntryData submitForSettlement(OrderModel orderModel, BigDecimal amount,
                                                    PaymentTransactionEntryModel entry, boolean isOrderToBeForceCompleted) throws BraintreeErrorException;

    boolean isSubmitForSettlementAvailable(OrderModel orderModel);

    Predicate<PaymentTransactionEntryModel> getCaptureTransactionTypePredicate();

    Predicate<PaymentTransactionEntryModel> getAuthorizeTransactionTypePredicate();

    Predicate<PaymentTransactionEntryModel> getRefundTransactionTypePredicate();

    BigDecimal getAuthorizationAmountByTransactionId(OrderModel orderModel, String transactionId);
}
