1 4 package com.openedit.store.gateway; 5 6 import com.openedit.WebPageRequest; 7 import com.openedit.store.CreditCardType; 8 import com.openedit.store.CreditPaymentMethod; 9 import com.openedit.store.Order; 10 import com.openedit.store.StoreTestCase; 11 12 15 public class EchoOrderArchiveTest extends StoreTestCase { 16 public static final String ECHO_TEST_CARD_NUMBER = "4005550000000019"; 17 18 21 public EchoOrderArchiveTest(String name) { 22 super(name); 23 } 24 25 28 public void testEchoPaymentArchiveWithBadOrder() throws Exception { 29 EchoOrderArchive archiver = new EchoOrderArchive(); 30 WebPageRequest context = getFixture().createPageRequest(); 31 Order order = createOrder(); 32 archiver.exportNewOrder(context, getStore(), order); 33 assertFalse(order.getOrderState().isOk()); 34 } 35 36 39 public void testEchoPaymentArchive() throws Exception { 40 CreditPaymentMethod paymentMethod = new CreditPaymentMethod(); 41 CreditCardType type = new CreditCardType(); 42 type.setName("Visa"); 43 paymentMethod.setCreditCardType(type); 44 paymentMethod.setCardNumber(ECHO_TEST_CARD_NUMBER); 45 paymentMethod.setExpirationMonth(6); 46 paymentMethod.setExpirationYear(2006); 47 EchoOrderArchive archiver = new EchoOrderArchive(); 48 archiver.setAddRandomAmountToTotal(true); WebPageRequest context = getFixture().createPageRequest(); 50 Order order = createOrder(); 51 order.setPaymentMethod(paymentMethod); 52 archiver.exportNewOrder(context, getStore(), order); 53 if (!order.getOrderState().isOk()) { 54 throw new Exception (order.getOrderState().getDescription()); 55 } 56 } 57 } | Popular Tags |