Hi is it possible to retrieve a value from a .net assembly via dot net bridge? The following code is to perform this task in .Net
/// <summary>
/// Shows simple use of POS Controlled printing.
/// </summary>
static void PurchaseWithPOSControlledPrinting()
{
// Create a vault session
using (VaultSession session=new VaultSession("CHECKOUT1",OnPrint))
{
// After creating a session always check for uncompleted transactions
// <insert code here>
// Create a transaction object
PurchaseTransaction purchaseTx=new PurchaseTransaction("#1",19.95m);
TransactionResult result=session.ExecuteTransaction(purchaseTx);
// Determine the success of the transaction
if (result==TransactionResult.Success)
{
Console.WriteLine("Transaction succeeded");
Console.WriteLine("Truncated PAN = {0}",purchaseTx.CardInfo.PAN);
Console.WriteLine(
"Duplicate Receipt = \n{0}",
purchaseTx.TxInfo.DuplicateReceiptImage);
}
else
{
Console.WriteLine("Transaction failed - <enter> to continue");
Console.ReadLine();
}
}
}
/// <summary>
/// Receipt Print Handler
/// </summary>
/// <param name="text">The text to be printed.</param>
/// <param name="printType">The type of print job.</param>
/// <returns>Returns true if the receipt was printed OK.</returns>
static bool OnPrint(string text,PrintType printType)
{
bool printedOk=true;
// Send receipt to printer here...
Console.WriteLine("--- Print Job ---\n{0}\n-----------------\n",text);
return printedOk;
}
Looking particularly at getting DuplicateReceiptImage
I have been trying the following
lcRef=Sys(1)+Sys(2)
purchaseTx=loBridge.CreateInstance('Verifone.Vault.POSInterface.PurchaseTransaction',lcRef, Cast(15.22 As Currency))
EftResult=objVaultEft.ExecuteTransaction(purchaseTx)
lcRcpTxt=lobridge.getstaticproperty('purchaseTx.TxInfo','DuplicateReceiptImage')
lcRcpTxt above is set to .null.
Thanks
The value you are trying to retrieve is not a static value. It's a property on an object instance.
lcRef=Sys(1)+Sys(2)
purchaseTx=loBridge.CreateInstance('Verifone.Vault.POSInterface.PurchaseTransaction',lcRef, Cast(15.22 As Currency))
EftResult=objVaultEft.ExecuteTransaction(purchaseTx)
* this might work too although I can't tell what type that is
* purchaseTx.TxInfo.DuplicationReceiptImage
lcRcpTxt=lobridge.GetProperty(purchaseTx,'TxInfo.DuplicateReceiptImage')
Hmm that returns .t. not a string as I thought it would
Check for an error message...
If something fails you should get an exception. However if you have an error handler or try/catch hooked up it might eat the exception. Sounds to me like that's what's happening in your case.
+++ Rick ---
Thanks for the good responses. I am wondering does the bridge support callbacks (delegates), I am wondering if this is my issue
Event support was just added to wwDotnetBridge. It's in the OSS version and will be in the next releases for Web Connection and West Wind Client Tools. This feature was landed by an external contributor (yay!...)
Docs here:
+++ Rick ---