Example #1
0
void MetaBundle::XmlLoader::bundleLoaded()
{
    m_bundle.checkExists();
    emit newBundle( m_bundle, m_attributes );
    if( m_target )
    {
        BundleLoadedEvent e( m_bundle, m_attributes );
        QApplication::sendEvent( m_target, &e );
    }
}
Example #2
0
// send a transaction given the specified parameters
void sendTransaction( int argc, char *argv[] )
{
	// Create a new context/bundle
	// A void pointer is used here as this application only needs to hold a reference, 
	// and does not need to know any of it's specifics.
	void *bundle = newBundle();
	
	//Add the client type and the version to the bundle
	put(bundle, "CLIENTTYPE", THE_CLIENT_TYPE);
	put(bundle, "VERSION", THE_VERSION);

	printf( "Arguments: %d\r\n", argc );

	if ( argc == 9 )
	{
		printf( "Debug set to: [%s]\r\n", argv[8] );
		if ( stricmp( argv[8], "debug" ) == 0 )
		{
			printf( "Debug ON\r\n" );
			put ( bundle, "DEBUG", "ON" );
			put ( bundle, "LOGFILE", "webpay.log" );
		}
		else
		{
			printf( "Debug OFF\r\n" );
			put ( bundle, "DEBUG", "OFF" );
		}
	}
	else
	{
		printf( "Debug OFF\r\n" );
		put ( bundle, "DEBUG", "OFF" );
	}

	put_ClientID( bundle, argv[3]);

	// Set security related parameters
	put_CertificatePath( bundle, argv[4] );
	put_CertificatePassword( bundle, argv[5] );
	put( bundle, "_CAFILE", argv[6] );

	// Set the server address and port number
	setServers ( bundle, argv[1] );
	setPort ( bundle, argv[2] );

	// Set the transaction's parameters.
	// These vary between transaction types and are subject
	// to change with notice, as new types are added.
	put ( bundle, "CARDDATA", "4564456445644564" );
	put ( bundle, "CARDEXPIRYDATE", "0215" );
	put ( bundle, "DATA", "Example Transaction" );

	put ( bundle, "INTERFACE", "CREDITCARD" );
	put ( bundle, "TRANSACTIONTYPE", "PURCHASE" );

	put ( bundle, "TOTALAMOUNT", "10.00" );
	put ( bundle, "TAXAMOUNT", "1.00" );

	// Attempt to execute the transaction request...
	if ( execute ( bundle ) ) {
		// If the execute method returns successfully this indicates 
		// that communication with the Payment Gateway has been successful.
		// A further test of the Response Code and Response Text will be 
		// required to determine if the Payment has been successfully 
		// Authorised. Please see the developers guide for more details.
		
		printf ( "Successfully communicated with the WTS.\r\n" );
			
	} else {
		// There has been a problem during the execute call.

		// Log message.
		printf ( "Unable to communicate with the WTS.\r\n" );

		//Try transaction recovery
		char *transactionRef = get( bundle, "TXNREFERENCE" );
		if (transactionRef)
		{
			//We have a transaction reference so attempt a status transaction.
			printf("Performing status check with Transaction Ref = [%s]\n", transactionRef);
			if(doStatusCheck(bundle))
			{
			   printf ( "Status Check Successful - Details are displayed below.\r\n" );
			} else {
				printf ( "Status check failed: Unknown transaction status.\nPlease wait a short while and try status check again using Transaction Ref [%s].\r\n", transactionRef );
			}
		}
		else
		{
			// There is no transaction reference number so the transaction has failed completely.
			// It can be safely reprocessed.
			printf("The transaction can be safely reprocessed as no Transaction Reference Number exists.\n");
		}
		
	}

	// Get the responses and display them...
	displayResults(bundle);

	cleanup ( bundle );
}