Amadis

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Integrating Agnos - or Developing a payment application (L3) relies on:

  • A previous successful platform integration (DEVICE realization) validated from unit tests vectors execution

  • A first L2 qualification demonstrating that the system is mature enough to start L3 development (i.e. a full L2 TA is not required to start as long as significant use cases can be executed)

Agnos programmation paridigm is systematic:

  1. Set pre-conditions

  2. Trigger a transaction

  3. Get post-conditions

Agnos provides a rich API. The following gives some hints to built from scratch a first application integrating Agnos.

Set pre-conditions

System Initialization

That level of initialization shall be performed only once, usually at system’s start-up time.

  • gpiMain

  • gpiInitializeHSM

  • gpiInitializeDisplay

  • gpiInitPolling

Transaction Initialization

  • pmwInitializePaymentContext

  • pmwInitializeOutComeParameter

  • dtmInitializeFromFile

Trigger Card Processing

Magstripe

//---------------------------------------------------------
//            trigSwipeCardPayment
//---------------------------------------------------------
//  Perform a magnetic stripe transaction
//
//  Visibility: Private
//  Hypothesis: --
//  Reference: --
//
//	Return: as per definitions
//			SUCCESS = 0
//			RETRY_CAPTURE = 4
//
tByte trigSwipeCardPayment(tExecutionContext* exe, tPaymentContext* pay, tOutComeParameter* out)
{
	tByte track1[MAX_LENGTH], track2[MAX_LENGTH], track3[MAX_LENGTH];
	tWord track1Len=0, track2Len=0, track3Len=0;
	tWord retcode = 0;
	tTimerHandler timerHandler=0;
	tTimerState timerState=tsNONE;
	tTimerTime timerElapsedSecond=0, timerElapsedMicrosecond=0;

	gpiMemSet(track1,0,MAX_LENGTH);
	gpiMemSet(track2,0,MAX_LENGTH);
	gpiMemSet(track3,0,MAX_LENGTH);

	gpiGetTimer(&timerHandler); // Request a free timer
	gpiGetTimerState(timerHandler,&timerState);
	if(timerState!=tsRUNNING)
		gpiStartTimer(timerHandler,10,0); // 10 second timeout. Arbitrary

	// Wait for card to be swiped
	do
	{
		retcode = gpiReadMagstripe(0,track1,&track1Len,track2,&track2Len,track3,&track3Len);

		gpiGetTimerTime(timerHandler,&timerElapsedSecond,&timerElapsedMicrosecond);
		gpiGetTimerState(timerHandler,&timerState);

	} while ((retcode != msrNO_ERROR) && (timerState != tsTIMEOUT));

	gpiFreeTimer(timerHandler);
	if(timerState == tsTIMEOUT)
		return TIMEOUT;

	if(!track2Len && !track1Len)
	{
		gpiDisplayMessageByID(gpi_true,pmwGetLanguage(pay),CARD_ERROR);
		return RETRY_CAPTURE;
	}

	gpiDisplayMessageByID(gpi_true,pmwGetLanguage(pay),PROCESSING);

	if((pay->mPOSEntryMode != FALLBACK_MODE) && track2Len) // Not a magstripe fallback case
	{
		retcode = isThereAChip(track2);
		switch (retcode)
		{
			case CHIP:
				gpiDisplayMessageByID(gpi_true,pmwGetLanguage(pay),USE_CHIP_READER);
				return RETRY_CAPTURE;
			case ERROR:
				gpiDisplayMessageByID(gpi_true,pmwGetLanguage(pay),CARD_ERROR);
				return RETRY_CAPTURE;
			default:
				break;
		}
	}

	pay->mDataExchange.mTrack2.mLength = track2Len+3;
	pay->mDataExchange.mTrack2.mStream[0]=0x9F;
	pay->mDataExchange.mTrack2.mStream[1]=0x6B;
	pay->mDataExchange.mTrack2.mStream[2]=track2Len;
	gpiMemCpy(pay->mDataExchange.mTrack2.mStream+3,track2,track2Len);

    // Go online and process issuer response accordingly
    // ..
    return SUCCESS;
}

Contact

Contactless

Get post-conditions

Sessions Management

  • No labels