Search in sources :

Example 1 with OrderPaymentImpl

use of org.broadleafcommerce.core.payment.domain.OrderPaymentImpl 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 OrderPaymentImpl

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

the class PaymentInfoDataProvider method provideBasicSalesPaymentInfo.

@DataProvider(name = "basicPaymentInfo")
public static Object[][] provideBasicSalesPaymentInfo() {
    OrderPayment sop = new OrderPaymentImpl();
    sop.setAmount(new Money(BigDecimal.valueOf(10.99)));
    sop.setReferenceNumber("987654321");
    sop.setType(PaymentType.CREDIT_CARD);
    return new Object[][] { { sop } };
}
Also used : Money(org.broadleafcommerce.common.money.Money) OrderPaymentImpl(org.broadleafcommerce.core.payment.domain.OrderPaymentImpl) OrderPayment(org.broadleafcommerce.core.payment.domain.OrderPayment) DataProvider(org.testng.annotations.DataProvider)

Aggregations

Money (org.broadleafcommerce.common.money.Money)2 OrderPayment (org.broadleafcommerce.core.payment.domain.OrderPayment)2 OrderPaymentImpl (org.broadleafcommerce.core.payment.domain.OrderPaymentImpl)2 EncryptionModule (org.broadleafcommerce.common.encryption.EncryptionModule)1 PaymentTransaction (org.broadleafcommerce.core.payment.domain.PaymentTransaction)1 PaymentTransactionImpl (org.broadleafcommerce.core.payment.domain.PaymentTransactionImpl)1 CreditCardPayment (org.broadleafcommerce.core.payment.domain.secure.CreditCardPayment)1 DataProvider (org.testng.annotations.DataProvider)1