Search in sources :

Example 1 with ISOAmount

use of org.jpos.iso.ISOAmount in project jPOS by jpos.

the class CheckFieldsTest method testAmounts.

@Test
public void testAmounts() throws ISOException {
    Context ctx = new Context();
    ISOMsg m = new ISOMsg();
    ISOAmount local = new ISOAmount(4, 858, new BigDecimal("290.00"));
    ISOAmount settlement = new ISOAmount(5, 840, new BigDecimal("10.00"));
    m.set(local);
    m.set(settlement);
    ctx.put(ContextConstants.REQUEST.toString(), m);
    cfg.put("mandatory", "AMOUNT");
    int action = cf.prepare(1L, ctx);
    assertEquals(PREPARED | NO_JOIN | READONLY, action);
    Result rc = ctx.getResult();
    assertFalse(rc.hasInfo());
    assertFalse(rc.hasWarnings());
    assertFalse(rc.hasFailures());
    assertEquals(local, ctx.get(ContextConstants.LOCAL_AMOUNT.toString()));
    assertEquals(settlement, ctx.get(ContextConstants.AMOUNT.toString()));
}
Also used : Context(org.jpos.transaction.Context) ISOMsg(org.jpos.iso.ISOMsg) ISOAmount(org.jpos.iso.ISOAmount) BigDecimal(java.math.BigDecimal) Result(org.jpos.rc.Result) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)1 ISOAmount (org.jpos.iso.ISOAmount)1 ISOMsg (org.jpos.iso.ISOMsg)1 Result (org.jpos.rc.Result)1 Context (org.jpos.transaction.Context)1 Test (org.junit.Test)1