Search in sources :

Example 1 with CreditCardPayment

use of org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment in project BroadleafCommerce by BroadleafCommerce.

the class CheckoutTest method addPaymentToOrder.

private OrderPayment addPaymentToOrder(Order order, Address address) {
    OrderPayment payment = new OrderPaymentImpl();
    payment.setBillingAddress(address);
    payment.setAmount(new Money(15D + (15D * 0.05D)));
    payment.setReferenceNumber("1234");
    payment.setType(PaymentType.CREDIT_CARD);
    payment.setPaymentGatewayType(NullIntegrationGatewayType.NULL_INTEGRATION_GATEWAY);
    payment.setOrder(order);
    PaymentTransaction tx = new PaymentTransactionImpl();
    tx.setAmount(payment.getAmount());
    tx.setType(PaymentTransactionType.AUTHORIZE_AND_CAPTURE);
    tx.setOrderPayment(payment);
    payment.getTransactions().add(tx);
    CreditCardPayment cc = new CreditCardPayment() {

        private static final long serialVersionUID = 1L;

        private String referenceNumber = "1234";

        @Override
        public String getCvvCode() {
            return "123";
        }

        @Override
        public Integer getExpirationMonth() {
            return 11;
        }

        @Override
        public Integer getExpirationYear() {
            return 2011;
        }

        @Override
        public Long getId() {
            return null;
        }

        @Override
        public String getPan() {
            return "1111111111111111";
        }

        @Override
        public String getNameOnCard() {
            return "Cardholder Name";
        }

        @Override
        public void setCvvCode(String cvvCode) {
        // do nothing
        }

        @Override
        public void setExpirationMonth(Integer expirationMonth) {
        // do nothing
        }

        @Override
        public void setExpirationYear(Integer expirationYear) {
        // do nothing
        }

        @Override
        public void setId(Long id) {
        // do nothing
        }

        @Override
        public void setNameOnCard(String nameOnCard) {
        // do nothing
        }

        @Override
        public void setPan(String pan) {
        // do nothing
        }

        @Override
        public EncryptionModule getEncryptionModule() {
            return encryptionModule;
        }

        @Override
        public String getReferenceNumber() {
            return referenceNumber;
        }

        @Override
        public void setEncryptionModule(EncryptionModule encryptionModule) {
        // do nothing
        }

        @Override
        public void setReferenceNumber(String referenceNumber) {
            this.referenceNumber = referenceNumber;
        }
    };
    order.getPayments().add(payment);
    return payment;
}
Also used : PaymentTransaction(org.broadleafcommerce.core.payment.domain.PaymentTransaction) Money(org.broadleafcommerce.common.money.Money) CreditCardPayment(org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment) OrderPaymentImpl(org.broadleafcommerce.core.payment.domain.OrderPaymentImpl) PaymentTransactionImpl(org.broadleafcommerce.core.payment.domain.PaymentTransactionImpl) EncryptionModule(org.broadleafcommerce.common.encryption.EncryptionModule) OrderPayment(org.broadleafcommerce.core.payment.domain.OrderPayment)

Example 2 with CreditCardPayment

use of org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment in project BroadleafCommerce by BroadleafCommerce.

the class SecureOrderPaymentDaoImpl method findCreditCardPayment.

@SuppressWarnings("unchecked")
public CreditCardPayment findCreditCardPayment(String referenceNumber) {
    Query query = em.createNamedQuery("BC_READ_CREDIT_CARD_BY_REFERENCE_NUMBER");
    query.setParameter("referenceNumber", referenceNumber);
    List<CreditCardPayment> infos = query.getResultList();
    CreditCardPayment response = (infos == null || infos.size() == 0) ? null : infos.get(0);
    if (response != null) {
        response.setEncryptionModule(encryptionModule);
    }
    return response;
}
Also used : CreditCardPayment(org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment) Query(javax.persistence.Query)

Example 3 with CreditCardPayment

use of org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment in project BroadleafCommerce by BroadleafCommerce.

the class SecureOrderPaymentDaoImpl method createCreditCardPayment.

public CreditCardPayment createCreditCardPayment() {
    CreditCardPayment response = entityConfiguration.createEntityInstance(CreditCardPayment.class.getName(), CreditCardPayment.class);
    response.setEncryptionModule(encryptionModule);
    return response;
}
Also used : CreditCardPayment(org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment)

Aggregations

CreditCardPayment (org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment)3 Query (javax.persistence.Query)1 EncryptionModule (org.broadleafcommerce.common.encryption.EncryptionModule)1 Money (org.broadleafcommerce.common.money.Money)1 OrderPayment (org.broadleafcommerce.core.payment.domain.OrderPayment)1 OrderPaymentImpl (org.broadleafcommerce.core.payment.domain.OrderPaymentImpl)1 PaymentTransaction (org.broadleafcommerce.core.payment.domain.PaymentTransaction)1 PaymentTransactionImpl (org.broadleafcommerce.core.payment.domain.PaymentTransactionImpl)1