FoxPro and .NET Interop
wwDotnetBridge + TransbankPosSDK.dll
Gravatar is a globally recognized avatar based on your email address. wwDotnetBridge + TransbankPosSDK.dll
  mariano
  All
  Dec 7, 2022 @ 07:34am

Hi, I can't access any method of this dll (https://github.com/TransbankDevelopers/transbank-sdk-dotnet). Could you help me ?

I just need an example of how to start.

DO wwUtils
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge","V4")
lobridge.loadassembly("TransbankPosSDK.dll")
loPOSIntegrado = loBridge.CreateInstance("Transbank.POSIntegrado.POSIntegrado")
Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  Rick Strahl
  mariano
  Dec 8, 2022 @ 02:58pm

We're not going to do your work for you with your business specific example.

Please: Provide some working code or code that fails with precise examples and/or a reference to what .NET functions you're trying to call and we can try to give you more information on what you can try.

Nobody here is going to go through the steps to clone a repo and install a library locally just to test your code for you unless you want to pay for support so you can have "just an example of how to start".

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  mariano
  Rick Strahl
  Dec 12, 2022 @ 11:55am

Hello, expression "just an example of how to start" was not for them to do my job but it would not be the first time q I do not see a mistake in front of my eyes.

My problem is that following the examples and having the library registered. When I run

lobridge.loadassembly("TransbankPosSDK.dll") 
loCallBack = CREATEOBJECT("MyCallback")
loPOSIntegrado = loBridge.CreateInstance("Transbank.POSIntegrado.POSIntegrado")
DEFINE CLASS MyCallback as custom 

*** Returns the result of the method and the name of the method name
FUNCTION OnCompleted(lvResult,lcMethod)
? "Success: " + lcMethod,lvResult
ENDFUNC


* Returns an error message, a .NET Exception and the method name
FUNCTION OnError(lcMessage,loException,lcMethod)
? "Error: " + lcMethod,lcMessage
ENDFUNC

ENDDEFINE

I don't get any error. loPOSIntegrated is type object but has no visible properties or methods.

I try to access this code. public async Task Sale(int amount, string ticket, bool sendStatus = false)

loBridge.InvokeMethodAsync(loCallback,loPOSIntegrado,"Sale",12345)

namespace Transbank.POSIntegrado
{
    public class POSIntegrado : Serial
    {
        public POSIntegrado()
        {
            
        }

        public static POSIntegrado Instance { get; } = new POSIntegrado();
        
        public async Task<SaleResponse> Sale(int amount, string ticket, bool sendStatus = false)
Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  Rick Strahl
  mariano
  Dec 12, 2022 @ 07:24pm

You have to pass all the parameters to the method. No such thing as optional parameters when calling with Reflection via wwDotnetBridge.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  mariano
  mariano
  Dec 15, 2022 @ 12:00pm

Hi, One step and new error 😦

Cannot load file or assembly 'System.IO.Ports, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the specified file.

I have the dll registered. I tried copy to system32 didn't work, SysWOW64 didn't work either. What can be? I keep investigating.

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  Rick Strahl
  mariano
  Dec 15, 2022 @ 12:18pm

System.IO.Ports is a built-in .NET assembly that lives in the GAC. It should be referenced by the API you're calling unless you are accessing a type in that namespace directly in your code, in which case you have to reference the GAC assembly via its fully qualified assembly name or the path in the GAC folder.

The fully qualified assembly name is the name in the error message.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  mariano
  Rick Strahl
  Dec 28, 2022 @ 12:02pm

Hi, New problem Delete system.io.ports from my project, install same and diferent version but doesnt work.

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge + TransbankPosSDK.dll
  Rick Strahl
  mariano
  Dec 29, 2022 @ 11:04am

What is the full error message? It looks like you're running on a non-supported version of Windows?

+++ Rick ---

© 1996-2023