use of org.broadleafcommerce.core.payment.domain.PaymentTransactionImpl 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;
}
Aggregations