use of org.broadleafcommerce.core.payment.domain.OrderPayment in project BroadleafCommerce by BroadleafCommerce.
the class CartStateServiceImpl method cartHasTemporaryCreditCard.
@Override
public boolean cartHasTemporaryCreditCard() {
Order cart = CartState.getCart();
List<OrderPayment> orderPayments = orderPaymentService.readPaymentsForOrder(cart);
for (OrderPayment payment : CollectionUtils.emptyIfNull(orderPayments)) {
boolean isCreditCartPayment = PaymentType.CREDIT_CARD.equals(payment.getType());
boolean isTemporaryPaymentGateway = PaymentGatewayType.TEMPORARY.equals(payment.getGatewayType());
if (payment.isActive() && isCreditCartPayment && isTemporaryPaymentGateway) {
return true;
}
}
return false;
}
use of org.broadleafcommerce.core.payment.domain.OrderPayment in project BroadleafCommerce by BroadleafCommerce.
the class CartStateServiceImpl method cartHasCreditCardPaymentWithSameToken.
@Override
public boolean cartHasCreditCardPaymentWithSameToken(String paymentToken) {
Order cart = CartState.getCart();
List<OrderPayment> orderPayments = orderPaymentService.readPaymentsForOrder(cart);
for (OrderPayment orderPayment : orderPayments) {
if (orderPayment.isActive() && PaymentType.CREDIT_CARD.equals(orderPayment.getType())) {
List<PaymentTransaction> transactions = orderPayment.getTransactions();
for (PaymentTransaction transaction : transactions) {
String orderPaymentToken = transaction.getAdditionalFields().get(PaymentAdditionalFieldType.TOKEN.getType());
if (ObjectUtils.equals(orderPaymentToken, paymentToken)) {
return true;
}
}
}
}
return false;
}
use of org.broadleafcommerce.core.payment.domain.OrderPayment in project BroadleafCommerce by BroadleafCommerce.
the class PaymentMethodVariableExpression method orderContainsPaymentOfType.
protected boolean orderContainsPaymentOfType(Order order, PaymentType paymentType) {
List<OrderPayment> orderPayments = orderPaymentService.readPaymentsForOrder(order);
for (OrderPayment payment : orderPayments) {
boolean isActive = payment.isActive();
boolean isOfCorrectType = paymentType.equals(payment.getType());
if (isActive && isOfCorrectType) {
return true;
}
}
return false;
}
Aggregations