Package org.springframework.batch.sample.domain.order

Examples of org.springframework.batch.sample.domain.order.BillingInfo


  }

  @Test
  public void testValidPayment() {
    Order order = new Order();
    BillingInfo info = new BillingInfo();
    info.setPaymentId("INVALID");
    info.setPaymentDesc("INVALID");
    order.setBilling(info);

    Errors errors = new BeanPropertyBindingResult(order, "validOrder");
    orderValidator.validatePayment(info, errors);

    assertEquals(2, errors.getAllErrors().size());
    assertEquals("error.billing.type", errors.getFieldError("billing.paymentId").getCode());
    assertEquals("error.billing.desc", errors.getFieldError("billing.paymentDesc").getCode());

    info = new BillingInfo();
    info.setPaymentId("VISA");
    info.setPaymentDesc("ADFI-1234567890");
    order.setBilling(info);

    errors = new BeanPropertyBindingResult(order, "validOrder");
    orderValidator.validatePayment(info, errors);
View Full Code Here


*/
public class BillingInfoFieldExtractor implements FieldExtractor<Order> {

  @Override
  public Object[] extract(Order order) {
    BillingInfo billingInfo = order.getBilling();
    return new Object[] { "BILLING:", billingInfo.getPaymentId(), billingInfo.getPaymentDesc() };
  }
View Full Code Here

  public static final String PAYMENT_TYPE_ID_COLUMN = "PAYMENT_TYPE_ID";
  public static final String PAYMENT_DESC_COLUMN = "PAYMENT_DESC";

  @Override
  public BillingInfo mapFieldSet(FieldSet fieldSet) {
    BillingInfo info = new BillingInfo();

    info.setPaymentId(fieldSet.readString(PAYMENT_TYPE_ID_COLUMN));
    info.setPaymentDesc(fieldSet.readString(PAYMENT_DESC_COLUMN));

    return info;
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.sample.domain.order.BillingInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.