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;
}
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;
}
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;
}
Aggregations